From c704b5005c4408b679abb2d8f3255a91ce5965a0 Mon Sep 17 00:00:00 2001 From: Matthias Seidl Date: Tue, 24 Nov 2020 17:50:57 +0100 Subject: [PATCH] fixes #2 --- app.py | 10 ++++++++++ templates/home.html | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index fee3b98..41dce1b 100644 --- a/app.py +++ b/app.py @@ -144,6 +144,16 @@ def upload(): return 'OK' +@app.route('/delete', methods=['POST']) +def delete(): + file_sha = request.form.get('sha') + path = request.form.get('path') + payload = {"sha": file_sha, "message": "WEB API delete file"} + resp = oauth.gitea.request('DELETE', urllib.parse.quote('{}/contents/{}'.format(app.config.get('REPO_URL'), path)), data=json.dumps(payload), headers={'Content-type': 'application/json'}) + + return redirect('/') + + if __name__ == "__main__": gitea = oauth.create_client('gitea') app.run(debug=True) diff --git a/templates/home.html b/templates/home.html index 003c64f..3cf9841 100644 --- a/templates/home.html +++ b/templates/home.html @@ -5,7 +5,12 @@