mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-25 02:57:22 +00:00
Merge remote-tracking branch 'sec_fixes/negate' into master
This commit is contained in:
commit
55fcf23d2b
@ -123,18 +123,17 @@ def revoke_watch_gdrive():
|
|||||||
|
|
||||||
@gdrive.route("/gdrive/watch/callback", methods=['GET', 'POST'])
|
@gdrive.route("/gdrive/watch/callback", methods=['GET', 'POST'])
|
||||||
def on_received_watch_confirmation():
|
def on_received_watch_confirmation():
|
||||||
|
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'))
|
||||||
|
|
||||||
log.debug('%r', request.headers)
|
log.debug('%r', request.headers)
|
||||||
if request.headers.get('X-Goog-Channel-Token') == gdrive_watch_callback_token \
|
log.debug('%r', request.data)
|
||||||
and request.headers.get('X-Goog-Resource-State') == 'change' \
|
|
||||||
and request.data:
|
|
||||||
|
|
||||||
data = request.data
|
|
||||||
|
|
||||||
def updateMetaData():
|
|
||||||
log.info('Change received from gdrive')
|
log.info('Change received from gdrive')
|
||||||
log.debug('%r', data)
|
|
||||||
try:
|
try:
|
||||||
j = json.loads(data)
|
j = json.loads(request.data)
|
||||||
log.info('Getting change details')
|
log.info('Getting change details')
|
||||||
response = gdriveutils.getChangeById(gdriveutils.Gdrive.Instance().drive, j['id'])
|
response = gdriveutils.getChangeById(gdriveutils.Gdrive.Instance().drive, j['id'])
|
||||||
log.debug('%r', response)
|
log.debug('%r', response)
|
||||||
@ -156,5 +155,4 @@ def on_received_watch_confirmation():
|
|||||||
calibre_db.reconnect_db(config, ub.app_DB_path)
|
calibre_db.reconnect_db(config, ub.app_DB_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
updateMetaData()
|
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
Reference in New Issue
Block a user