diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index e2a3f895..d4b92359 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -142,6 +142,18 @@ available_notification_agents = sorted(notifiers.available_notification_agents()

If you have Git installed, allow periodic checks for updates.

+
+
+ +
+
+ +
+
+

Optional: Use your own GitHub API token when checking for updates. +

+
+

Display Settings

@@ -1990,6 +2002,20 @@ $(document).ready(function() { } }); + if ($("#check_github").is(":checked")) { + $("#git_update_options").show(); + } else { + $("#git_update_options").hide(); + } + + $("#check_github").click(function(){ + if ($("#check_github").is(":checked")) { + $("#git_update_options").slideDown(); + } else { + $("#git_update_options").slideUp(); + } + }); + $( ".http-settings" ).change(function() { httpChanged = true; }); diff --git a/plexpy/config.py b/plexpy/config.py index ccb05c6d..a687de68 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -111,6 +111,7 @@ _CONFIG_DEFINITIONS = { 'GET_FILE_SIZES_HOLD': (dict, 'General', {'section_ids': [], 'rating_keys': []}), 'GIT_BRANCH': (str, 'General', 'master'), 'GIT_PATH': (str, 'General', ''), + 'GIT_TOKEN': (str, 'General', ''), 'GIT_USER': (str, 'General', 'drzoidberg33'), 'GRAPH_TYPE': (str, 'General', 'plays'), 'GRAPH_DAYS': (int, 'General', 30), diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py index 1c37c9de..23bc9566 100644 --- a/plexpy/versioncheck.py +++ b/plexpy/versioncheck.py @@ -124,6 +124,7 @@ def checkGithub(): # Get the latest version available from github logger.info('Retrieving latest version information from GitHub') url = 'https://api.github.com/repos/%s/plexpy/commits/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_BRANCH) + if plexpy.CONFIG.GIT_TOKEN: url = url + '?access_token=%s' % plexpy.CONFIG.GIT_TOKEN version = request.request_json(url, timeout=20, validator=lambda x: type(x) == dict) if version is None: @@ -144,6 +145,7 @@ def checkGithub(): logger.info('Comparing currently installed version with latest GitHub version') url = 'https://api.github.com/repos/%s/plexpy/compare/%s...%s' % (plexpy.CONFIG.GIT_USER, plexpy.LATEST_VERSION, plexpy.CURRENT_VERSION) + if plexpy.CONFIG.GIT_TOKEN: url = url + '?access_token=%s' % plexpy.CONFIG.GIT_TOKEN commits = request.request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict) if commits is None: diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 89fb862e..aa1d1427 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -1261,7 +1261,8 @@ class WebInterface(object): "home_library_cards": json.dumps(plexpy.CONFIG.HOME_LIBRARY_CARDS), "buffer_threshold": plexpy.CONFIG.BUFFER_THRESHOLD, "buffer_wait": plexpy.CONFIG.BUFFER_WAIT, - "group_history_tables": checked(plexpy.CONFIG.GROUP_HISTORY_TABLES) + "group_history_tables": checked(plexpy.CONFIG.GROUP_HISTORY_TABLES), + "git_token": plexpy.CONFIG.GIT_TOKEN } return serve_template(templatename="settings.html", title="Settings", config=config)