From 1b0a1e938e7c6bdca3f9ed93f2beabfc79cc50e7 Mon Sep 17 00:00:00 2001 From: EthanHealy01 <80844253+EthanHealy01@users.noreply.github.com> Date: Wed, 24 Dec 2025 20:56:22 +0000 Subject: [PATCH] added a flag to hide settings (#5263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added an optional flag in settings.yml to hide the settings button in no login servers. When hidden, users can no longer: - Open the Settings modal at all (gear button is hidden) - Change General preferences (tool picker mode, hide unavailable tools/conversions, auto‑unzip and file limit) - Configure keyboard shortcuts (Hotkeys / Keyboard Shortcuts section) - Use the in‑app update checker UI (see current/latest version, check for updates, view update details) - Note: When enableLogin === true, the flag is ignored and the Settings button remains visible. --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Co-authored-by: Reece Browne <74901996+reecebrowne@users.noreply.github.com> --- .../common/model/ApplicationProperties.java | 1 + .../SPDF/controller/api/misc/ConfigController.java | 3 +++ app/core/src/main/resources/settings.yml.template | 1 + build.gradle | 2 +- .../src/core/components/shared/QuickAccessBar.tsx | 14 ++++++++++---- frontend/src/core/contexts/AppConfigContext.tsx | 1 + 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java b/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java index 2453b2b8b..b8cd4e778 100644 --- a/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java +++ b/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java @@ -393,6 +393,7 @@ public class ApplicationProperties { private boolean googlevisibility; private boolean showUpdate; private boolean showUpdateOnlyAdmin; + private boolean showSettingsWhenNoLogin = true; private boolean customHTMLFiles; private String tessdataDir; private boolean enableAlphaFunctionality; diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java index 60286bc00..61ce9fb6c 100644 --- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java +++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java @@ -84,6 +84,9 @@ public class ConfigController { boolean enableLogin = applicationProperties.getSecurity().isEnableLogin() && userService != null; configData.put("enableLogin", enableLogin); + configData.put( + "showSettingsWhenNoLogin", + applicationProperties.getSystem().isShowSettingsWhenNoLogin()); // Mail settings - check both SMTP enabled AND invites enabled boolean smtpEnabled = applicationProperties.getMail().isEnabled(); diff --git a/app/core/src/main/resources/settings.yml.template b/app/core/src/main/resources/settings.yml.template index 96f11f256..6201a52c9 100644 --- a/app/core/src/main/resources/settings.yml.template +++ b/app/core/src/main/resources/settings.yml.template @@ -132,6 +132,7 @@ system: enableAlphaFunctionality: false # set to enable functionality which might need more testing before it fully goes live (this feature might make no changes) showUpdate: false # see when a new update is available showUpdateOnlyAdmin: false # only admins can see when a new update is available, depending on showUpdate it must be set to 'true' + showSettingsWhenNoLogin: true # set to 'false' to hide settings button when login is disabled (enableLogin: false). Only applies when login is disabled. customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template HTML files tessdataDir: "" # path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored. enableAnalytics: null # Master toggle for analytics: set to 'true' to enable all analytics, 'false' to disable all analytics, or leave as 'null' to prompt admin on first launch diff --git a/build.gradle b/build.gradle index 8e60b8566..a4dd1be91 100644 --- a/build.gradle +++ b/build.gradle @@ -60,7 +60,7 @@ repositories { allprojects { group = 'stirling.software' - version = '2.1.5' + version = '2.2.0' configurations.configureEach { exclude group: 'commons-logging', module: 'commons-logging' diff --git a/frontend/src/core/components/shared/QuickAccessBar.tsx b/frontend/src/core/components/shared/QuickAccessBar.tsx index 3aba740a8..ee125d4d4 100644 --- a/frontend/src/core/components/shared/QuickAccessBar.tsx +++ b/frontend/src/core/components/shared/QuickAccessBar.tsx @@ -173,6 +173,12 @@ const QuickAccessBar = forwardRef((_, ref) => { // onClick: () => setActiveButton('activity') //}, + // Determine if settings button should be hidden + // Hide when login is disabled AND showSettingsWhenNoLogin is false + const shouldHideSettingsButton = + config?.enableLogin === false && + config?.showSettingsWhenNoLogin === false; + const bottomButtons: ButtonConfig[] = [ { id: 'help', @@ -185,17 +191,17 @@ const QuickAccessBar = forwardRef((_, ref) => { // This will be overridden by the wrapper logic }, }, - { + ...(shouldHideSettingsButton ? [] : [{ id: 'config', name: t("quickAccess.settings", "Settings"), icon: , - size: 'md', - type: 'modal', + size: 'md' as const, + type: 'modal' as const, onClick: () => { navigate('/settings/overview'); setConfigModalOpen(true); } - } + } as ButtonConfig]) ]; return ( diff --git a/frontend/src/core/contexts/AppConfigContext.tsx b/frontend/src/core/contexts/AppConfigContext.tsx index c8fcdf64c..be230a14f 100644 --- a/frontend/src/core/contexts/AppConfigContext.tsx +++ b/frontend/src/core/contexts/AppConfigContext.tsx @@ -23,6 +23,7 @@ export interface AppConfig { defaultLocale?: string; logoStyle?: 'modern' | 'classic'; enableLogin?: boolean; + showSettingsWhenNoLogin?: boolean; enableEmailInvites?: boolean; isAdmin?: boolean; enableAlphaFunctionality?: boolean;