From d03ba9b364e971b5f610c806c847acc4804290a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 3 Nov 2022 16:41:16 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Get=20rid=20of=20CONFIG=5F?= =?UTF-8?q?ACCESS=5FCONTROL=5FACTIVE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deprecate it, as with ACL now being obligatory we can use other data to figure out whether first run setup has been completed yet or not. --- src/octoprint/static/js/app/viewmodels/wizard.js | 7 +++---- src/octoprint/templates/initscript.jinja2 | 11 +++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/wizard.js b/src/octoprint/static/js/app/viewmodels/wizard.js index 30c37caf1..64830b051 100644 --- a/src/octoprint/static/js/app/viewmodels/wizard.js +++ b/src/octoprint/static/js/app/viewmodels/wizard.js @@ -18,10 +18,9 @@ $(function () { }; self.showDialog = function () { - if ( - !CONFIG_WIZARD || - !(!CONFIG_ACCESS_CONTROL_ACTIVE || self.loginState.isAdmin()) - ) + // only open a wizard if we have one and either are in first run OR logged in + // as admin + if (!CONFIG_WIZARD || (!CONFIG_FIRST_RUN && !self.loginState.isAdmin())) return; self.getWizardDetails().done(function (response) { diff --git a/src/octoprint/templates/initscript.jinja2 b/src/octoprint/templates/initscript.jinja2 index ab899f4ed..e968d9192 100644 --- a/src/octoprint/templates/initscript.jinja2 +++ b/src/octoprint/templates/initscript.jinja2 @@ -11,9 +11,6 @@ var CONFIG_LOGFILESPERPAGE = 10; var CONFIG_USERSPERPAGE = 10; var CONFIG_GROUPSPERPAGE = 10; - var CONFIG_WEBCAM_STREAM = "{{ webcamStream|e }}"; // deprecated, only left for compatibility reasons - var CONFIG_ACCESS_CONTROL = true; // deprecated, only left for compatibility reasons - var CONFIG_ACCESS_CONTROL_ACTIVE = {% if accessControlActive -%} true; {% else %} false; {%- endif %} var CONFIG_SD_SUPPORT = {% if enableSdSupport -%} true; {% else %} false; {%- endif %} var CONFIG_FIRST_RUN = {% if firstRun -%} true; {% else %} false; {%- endif %} var CONFIG_TEMPERATURE_GRAPH = {% if enableTemperatureGraph -%} true; {% else %} false; {%- endif %} @@ -25,7 +22,6 @@ // sockjs should define CLOSE_NORMAL for us, but they don't (from ws spec) var SOCKJS_CLOSE_NORMAL = 1000; - var UI_API_KEY = ""; // deprecated, only left for compatibility reasons var VERSION = "{{ version.number|e }}"; var DISPLAY_VERSION = "{{ version.display|e }}"; var BRANCH = "{{ version.branch|e }}"; @@ -42,6 +38,13 @@ var ADDITIONAL_VIEWMODELS = []; var OCTOPRINT_ADDITIONAL_BINDINGS = []; + // deprecated stuff only kept for backwards compatibility goes here + var CONFIG_WEBCAM_STREAM = "{{ webcamStream|e }}"; // deprecated, only left for compatibility reasons + var CONFIG_ACCESS_CONTROL = true; // deprecated, only left for compatibility reasons + var CONFIG_ACCESS_CONTROL_ACTIVE = {% if accessControlActive -%} true; {% else %} false; {%- endif %}; // deprecated, only left for compatibility reasons + var UI_API_KEY = ""; // deprecated, only left for compatibility reasons + // end of deprecated stuff + {% if templates.tab.order %} {% set first_tab = templates.tab.order[0] %} {% set entry, data = templates.tab.entries[first_tab] %}