Fix for gdrive not working #1081

pull/1099/head
Ozzieisaacs 5 years ago
parent 78f9ee86b1
commit 8af178c19c

@ -272,6 +272,8 @@ def _configuration_update_helper():
gdrive_secrets = {} gdrive_secrets = {}
gdriveError = gdriveutils.get_error_text(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: 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: if not gdrive_secrets:
return _configuration_result('client_secrets.json is not configured for web application') return _configuration_result('client_secrets.json is not configured for web application')
gdriveutils.update_settings( gdriveutils.update_settings(
@ -413,7 +415,8 @@ def _configuration_result(error_flash=None, gdriveError=None):
if gdriveError: if gdriveError:
gdriveError = _(gdriveError) gdriveError = _(gdriveError)
else: 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_back_button = current_user.is_authenticated
show_login_button = config.db_configured and not current_user.is_authenticated show_login_button = config.db_configured and not current_user.is_authenticated

@ -584,5 +584,7 @@ def get_error_text(client_secrets=None):
filedata = json.load(settings) filedata = json.load(settings)
if 'web' not in filedata: if 'web' not in filedata:
return 'client_secrets.json is not configured for web application' 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: if client_secrets:
client_secrets.update(filedata['web']) client_secrets.update(filedata['web'])

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

Loading…
Cancel
Save