1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 01:20:32 +00:00

Fix for gdrive not working #1081

This commit is contained in:
Ozzieisaacs 2019-11-26 10:46:06 +01:00
parent 78f9ee86b1
commit 8af178c19c
3 changed files with 7 additions and 2 deletions

View File

@ -272,6 +272,8 @@ def _configuration_update_helper():
gdrive_secrets = {}
gdriveError = gdriveutils.get_error_text(gdrive_secrets)
if "config_use_google_drive" in to_save and not config.config_use_google_drive and not gdriveError:
with open(gdriveutils.CLIENT_SECRETS, 'r') as settings:
gdrive_secrets = json.load(settings)['web']
if not gdrive_secrets:
return _configuration_result('client_secrets.json is not configured for web application')
gdriveutils.update_settings(
@ -413,7 +415,8 @@ def _configuration_result(error_flash=None, gdriveError=None):
if gdriveError:
gdriveError = _(gdriveError)
else:
gdrivefolders = gdriveutils.listRootFolders()
if config.config_use_google_drive and not gdrive_authenticate:
gdrivefolders = gdriveutils.listRootFolders()
show_back_button = current_user.is_authenticated
show_login_button = config.db_configured and not current_user.is_authenticated

View File

@ -584,5 +584,7 @@ def get_error_text(client_secrets=None):
filedata = json.load(settings)
if 'web' not in filedata:
return 'client_secrets.json is not configured for web application'
if 'redirect_uris' not in filedata['web']:
return 'Callback url (redirect url) is missing in client_secrets.json'
if client_secrets:
client_secrets.update(filedata['web'])

View File

@ -213,7 +213,7 @@ class WorkerThread(threading.Thread):
else:
self.doLock.release()
except Exception as e:
log.exception(e)
log.exception(e)
self.doLock.release()
if main_thread.is_alive():
time.sleep(1)