From 294140d93820fa1d448cf39db97283f54b978946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 13 Jun 2022 12:00:49 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Get=20rid=20of=20global=20API=20?= =?UTF-8?q?key=20leftovers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also get rid of static apps key configuration. That has long been replaced by the bundled appkeys plugin. --- src/octoprint/schema/config/api.py | 4 --- .../static/js/app/viewmodels/settings.js | 21 ------------ .../templates/dialogs/settings/api.jinja2 | 33 ------------------- 3 files changed, 58 deletions(-) diff --git a/src/octoprint/schema/config/api.py b/src/octoprint/schema/config/api.py index 0b6116c73..77ee8d097 100644 --- a/src/octoprint/schema/config/api.py +++ b/src/octoprint/schema/config/api.py @@ -1,15 +1,11 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License" -from typing import Dict - from pydantic import BaseModel from pydantic_settings import with_attrs_docs @with_attrs_docs class ApiConfig(BaseModel): - apps: Dict[str, str] = {} - allowCrossOrigin: bool = False """Whether to allow cross origin access to the API or not.""" diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index bf56727c3..6e79bfeab 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -133,7 +133,6 @@ $(function () { ); self.locale_languages = _.keys(AVAILABLE_LOCALES); - self.api_key = ko.observable(undefined); self.api_allowCrossOrigin = ko.observable(undefined); self.appearance_name = ko.observable(undefined); @@ -867,26 +866,6 @@ $(function () { self.settingsDialog.modal("hide"); }; - self.generateApiKey = function () { - if (!CONFIG_ACCESS_CONTROL) return; - - showConfirmationDialog( - gettext( - "This will generate a new API Key. The old API Key will cease to function immediately." - ), - function () { - OctoPrint.settings.generateApiKey().done(function (response) { - self.api_key(response.apikey); - self.requestData(); - }); - } - ); - }; - - self.copyApiKey = function () { - copyToClipboard(self.api_key()); - }; - self.showTranslationManager = function () { self.translationManagerDialog.modal(); return false; diff --git a/src/octoprint/templates/dialogs/settings/api.jinja2 b/src/octoprint/templates/dialogs/settings/api.jinja2 index a3ec12fab..85e43fcb1 100644 --- a/src/octoprint/templates/dialogs/settings/api.jinja2 +++ b/src/octoprint/templates/dialogs/settings/api.jinja2 @@ -9,37 +9,4 @@ -
-

{{ _('Global API Key') }}

-
-

{% trans %} - It is recommended to no longer use the global API key as it's one single key that gives full admin access - to your whole OctoPrint instance. It will be removed in OctoPrint 2.0. - Instead of using the global key you should create individual Application Keys for - your third party clients. That way they get permissions matching the user account used for key - creation and you can also revoke access to one app without having to change the keys for all other apps. - It's also recommended to create a user account without admin access and use that for third - party clients where possible. - {% endtrans %}

-

{{ _('Access Application Keys') }}

-
-
- -
-
- - - -
- {{ _('Please note that changes to the API key are applied immediately, without having to "Save" first.') }} -
-
-
- -
-
-
-
-
-