Only register gdrive callback if gdrive is enabled

With enabled gdrive return on change if no watch callback is configured, instead of send request to google drive
This commit is contained in:
Ozzieisaacs
2020-12-11 15:56:42 +01:00
parent 388e46ee81
commit 88ea998f8b
3 changed files with 8 additions and 3 deletions
+3 -1
View File
@@ -123,10 +123,12 @@ def revoke_watch_gdrive():
@gdrive.route("/gdrive/watch/callback", methods=['GET', 'POST'])
def on_received_watch_confirmation():
if not config.config_google_drive_watch_changes_response:
return ''
if request.headers.get('X-Goog-Channel-Token') != gdrive_watch_callback_token \
or request.headers.get('X-Goog-Resource-State') != 'change' \
or not request.data:
return redirect(url_for('admin.configuration'))
return '' # redirect(url_for('admin.configuration'))
log.debug('%r', request.headers)
log.debug('%r', request.data)