🚸 swu: Allow configuring GitHub PAT via GUI (#4443)
* Demo Github Token Settings * 🚸 swu: explain where and why to get a GitHub PAT * 🐛 swu: Only set GH PAT if it's been provided Co-authored-by: Gina Häußge <gina@octoprint.org>
This commit is contained in:
1 parent
e6541938db
commit
b4b38133ad
3 files changed
+15
No files matched your search
@@ -64,6 +64,7 @@ $(function () {
|
||||
self.config_releaseChannel = ko.observable();
|
||||
self.config_pipEnableCheck = ko.observable();
|
||||
self.config_minimumFreeStorage = ko.observable();
|
||||
self.config_githubToken = ko.observable();
|
||||
|
||||
self.error_checkoutFolder = ko.pureComputed(function () {
|
||||
return (
|
||||
@@ -243,6 +244,8 @@ $(function () {
|
||||
var target = $(event.target);
|
||||
target.prepend('<i class="fa fa-spinner fa-spin"></i> ');
|
||||
|
||||
var githubToken = self.config_githubToken();
|
||||
|
||||
var data = {
|
||||
plugins: {
|
||||
softwareupdate: {
|
||||
@@ -258,6 +261,9 @@ $(function () {
|
||||
}
|
||||
}
|
||||
};
|
||||
if (githubToken) {
|
||||
data.plugins.softwareupdate.credentials = {github: githubToken};
|
||||
}
|
||||
self.settings.saveData(data, {
|
||||
success: function () {
|
||||
self.configurationDialog.modal("hide");
|
||||
@@ -266,6 +272,7 @@ $(function () {
|
||||
},
|
||||
complete: function () {
|
||||
$("i.fa-spinner", target).remove();
|
||||
self.config_githubToken("");
|
||||
},
|
||||
sending: true
|
||||
});
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('GitHub Access Token') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: config_githubToken" placeholder="{{ _('Enter a new token...')|edq }}">
|
||||
<span class="help-block">{{ _('Set this if you keep running into rate limiting issues. <a href="%(url)s" target="_blank" rel="noopener noreferer">See here for how to obtain a token</a>.', url="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token") }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,6 +171,7 @@
|
||||
{% include "snippets/checkoutFolder.jinja2" %}
|
||||
{% include "snippets/pipTarget.jinja2" %}
|
||||
{% include "snippets/pipEnableCheck.jinja2" %}
|
||||
{% include "snippets/githubToken.jinja2" %}
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Version cache TTL') }}</label>
|
||||
<div class="controls">
|
||||
|
||||
Reference in new issue
Block a user