mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Add user GitHub API Token to settings
This commit is contained in:
parent
3fe6db4d42
commit
498a074222
4 changed files with 31 additions and 1 deletions
|
@ -142,6 +142,18 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</label>
|
</label>
|
||||||
<p class="help-block">If you have Git installed, allow periodic checks for updates.</p>
|
<p class="help-block">If you have Git installed, allow periodic checks for updates.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="git_update_options">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="git_token">GitHub API Token</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" class="form-control" id="git_token" name="git_token" value="${config['git_token']}" data-parsley-trigger="change">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="help-block">Optional: Use your own GitHub API token when checking for updates.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
<h3>Display Settings</h3>
|
<h3>Display Settings</h3>
|
||||||
</div>
|
</div>
|
||||||
|
@ -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() {
|
$( ".http-settings" ).change(function() {
|
||||||
httpChanged = true;
|
httpChanged = true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,6 +111,7 @@ _CONFIG_DEFINITIONS = {
|
||||||
'GET_FILE_SIZES_HOLD': (dict, 'General', {'section_ids': [], 'rating_keys': []}),
|
'GET_FILE_SIZES_HOLD': (dict, 'General', {'section_ids': [], 'rating_keys': []}),
|
||||||
'GIT_BRANCH': (str, 'General', 'master'),
|
'GIT_BRANCH': (str, 'General', 'master'),
|
||||||
'GIT_PATH': (str, 'General', ''),
|
'GIT_PATH': (str, 'General', ''),
|
||||||
|
'GIT_TOKEN': (str, 'General', ''),
|
||||||
'GIT_USER': (str, 'General', 'drzoidberg33'),
|
'GIT_USER': (str, 'General', 'drzoidberg33'),
|
||||||
'GRAPH_TYPE': (str, 'General', 'plays'),
|
'GRAPH_TYPE': (str, 'General', 'plays'),
|
||||||
'GRAPH_DAYS': (int, 'General', 30),
|
'GRAPH_DAYS': (int, 'General', 30),
|
||||||
|
|
|
@ -124,6 +124,7 @@ def checkGithub():
|
||||||
# Get the latest version available from github
|
# Get the latest version available from github
|
||||||
logger.info('Retrieving latest version information 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)
|
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)
|
version = request.request_json(url, timeout=20, validator=lambda x: type(x) == dict)
|
||||||
|
|
||||||
if version is None:
|
if version is None:
|
||||||
|
@ -144,6 +145,7 @@ def checkGithub():
|
||||||
|
|
||||||
logger.info('Comparing currently installed version with latest GitHub version')
|
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)
|
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)
|
commits = request.request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict)
|
||||||
|
|
||||||
if commits is None:
|
if commits is None:
|
||||||
|
|
|
@ -1261,7 +1261,8 @@ class WebInterface(object):
|
||||||
"home_library_cards": json.dumps(plexpy.CONFIG.HOME_LIBRARY_CARDS),
|
"home_library_cards": json.dumps(plexpy.CONFIG.HOME_LIBRARY_CARDS),
|
||||||
"buffer_threshold": plexpy.CONFIG.BUFFER_THRESHOLD,
|
"buffer_threshold": plexpy.CONFIG.BUFFER_THRESHOLD,
|
||||||
"buffer_wait": plexpy.CONFIG.BUFFER_WAIT,
|
"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)
|
return serve_template(templatename="settings.html", title="Settings", config=config)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue