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:
+3
-1
@@ -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)
|
||||
|
||||
@@ -20,6 +20,8 @@ from __future__ import division, print_function, unicode_literals
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
import chardet
|
||||
import ssl
|
||||
|
||||
from flask import Response, stream_with_context
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
Reference in New Issue
Block a user