From db4b404a88d08b66c0d5601e3a38a5181752fbbf Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Tue, 7 Nov 2017 14:19:27 -0600 Subject: [PATCH] part of #110 --- changelog.txt | 4 ++++ resources/language/English/strings.xml | 3 ++- resources/lib/authorizers.py | 28 ++++++++++++++++++-------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index 794cfd8..30db15f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version 1.1.1 + +fixed error on authorizers (missing secret/key) + Version 1.1.0 added tinyurl for oauth urls diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 0b2c3fa..1ecd886 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -49,7 +49,7 @@ Removing backup Go to this URL to authorize Click OK AFTER completion - Dropbox Developer Code Needed + Developer Code Needed Visit https://www.dropbox.com/developers Enable Scheduler Schedule @@ -99,4 +99,5 @@ Authorize this remote service in the settings first is authorized error authorizing + Visit https://console.developers.google.com/ diff --git a/resources/lib/authorizers.py b/resources/lib/authorizers.py index ab6f61a..7957976 100644 --- a/resources/lib/authorizers.py +++ b/resources/lib/authorizers.py @@ -15,13 +15,16 @@ class DropboxAuthorizer: self.APP_KEY = utils.getSetting('dropbox_key') self.APP_SECRET = utils.getSetting('dropbox_secret') - self.setup() - def setup(self): + result = True + if(self.APP_KEY == '' and self.APP_SECRET == ''): #we can't go any farther, need these for sure - xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30058),utils.getString(30059)) - return + xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30027) + ' ' + utils.getString(30058),utils.getString(30059)) + + result = False + + return result def isAuthorized(self): user_token_key,user_token_secret = self._getToken() @@ -30,6 +33,10 @@ class DropboxAuthorizer: def authorize(self): result = True + + if(not self.setup()): + return False + if(self.isAuthorized()): #delete the token to start over self._deleteToken() @@ -97,13 +104,15 @@ class GoogleDriveAuthorizer: self.CLIENT_ID = utils.getSetting('google_drive_id') self.CLIENT_SECRET = utils.getSetting('google_drive_secret') - self.setup() - def setup(self): + result = True + if(self.CLIENT_ID == '' and self.CLIENT_SECRET == ''): #we can't go any farther, need these for sure - xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30058),utils.getString(30059)) - return + xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30098) + ' ' + utils.getString(30058),utils.getString(30108)) + result = False + + return result def isAuthorized(self): return xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "google_drive.dat")) @@ -111,6 +120,9 @@ class GoogleDriveAuthorizer: def authorize(self): result = True + if(not self.setup()): + return False + #create authorization helper and load default settings gauth = GoogleAuth(xbmc.validatePath(xbmc.translatePath(utils.addon_dir() + '/resources/lib/pydrive/settings.yaml'))) gauth.LoadClientConfigSettings()