From fb6f16addecc3ee4012aeabdec253a35b454926a Mon Sep 17 00:00:00 2001 From: Tink bot Date: Mon, 1 Jun 2026 09:26:09 +0000 Subject: [PATCH] fix: respect allow_icon_changes config on web and desktop The `service.allowiconchanges` config option was ignored. On the web ui the value injected into index.html by the api was immediately overwritten by a hardcoded `window.ALLOW_ICON_CHANGES = true` in a later inline script, so the configured value never took effect. The desktop app never received the injected value at all, since it serves the bundled frontend from its own local server and only talks to the api for data. Expose the option via the /info endpoint and read it from the config store, which is the only channel that reaches both the web ui and the desktop app. The brittle window injection and its hardcoded default are removed in favor of this single source of truth. https://claude.ai/code/session_01HAXTJNsDcfsB4hwDNKTECb --- frontend/index.html | 1 - frontend/src/components/home/Logo.vue | 4 +++- frontend/src/main.ts | 1 - frontend/src/stores/config.ts | 2 ++ pkg/routes/api/v1/info.go | 2 ++ pkg/routes/static.go | 5 ----- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index bf4670943..9ad084d61 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -23,7 +23,6 @@ // It has to be the full url, including the last /api/v1 part and port. // You can change this if your api is not reachable on the same port as the frontend. window.API_URL = '/api/v1' - window.ALLOW_ICON_CHANGES = true diff --git a/frontend/src/components/home/Logo.vue b/frontend/src/components/home/Logo.vue index f49bced86..aef4921ae 100644 --- a/frontend/src/components/home/Logo.vue +++ b/frontend/src/components/home/Logo.vue @@ -2,6 +2,7 @@ import { computed } from 'vue' import { useNow } from '@vueuse/core' import { useAuthStore } from '@/stores/auth' +import { useConfigStore } from '@/stores/config' import { useColorScheme } from '@/composables/useColorScheme' import LogoFull from '@/assets/logo-full.svg?component' @@ -13,9 +14,10 @@ const now = useNow({ }) const authStore = useAuthStore() +const configStore = useConfigStore() const { isDark } = useColorScheme() -const Logo = computed(() => window.ALLOW_ICON_CHANGES +const Logo = computed(() => configStore.allowIconChanges && authStore.settings.frontendSettings.allowIconChanges && now.value.getMonth() === 5 ? LogoFullPride diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 6f64e8d8c..63a895a4d 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -19,7 +19,6 @@ declare global { API_URL: string; SENTRY_ENABLED?: boolean; SENTRY_DSN?: string; - ALLOW_ICON_CHANGES: boolean; CUSTOM_LOGO_URL?: string; CUSTOM_LOGO_URL_DARK?: string; } diff --git a/frontend/src/stores/config.ts b/frontend/src/stores/config.ts index 6ca087ff4..73160acd5 100644 --- a/frontend/src/stores/config.ts +++ b/frontend/src/stores/config.ts @@ -44,6 +44,7 @@ export interface ConfigState { }, }, publicTeamsEnabled: boolean, + allowIconChanges: boolean, enabledProFeatures: string[], } @@ -84,6 +85,7 @@ export const useConfigStore = defineStore('config', () => { }, }, publicTeamsEnabled: false, + allowIconChanges: true, enabledProFeatures: [], }) diff --git a/pkg/routes/api/v1/info.go b/pkg/routes/api/v1/info.go index 0f8ded367..0e0a64ff2 100644 --- a/pkg/routes/api/v1/info.go +++ b/pkg/routes/api/v1/info.go @@ -55,6 +55,7 @@ type vikunjaInfos struct { DemoModeEnabled bool `json:"demo_mode_enabled"` WebhooksEnabled bool `json:"webhooks_enabled"` PublicTeamsEnabled bool `json:"public_teams_enabled"` + AllowIconChanges bool `json:"allow_icon_changes"` EnabledProFeatures []license.Feature `json:"enabled_pro_features"` } @@ -107,6 +108,7 @@ func Info(c *echo.Context) error { DemoModeEnabled: config.ServiceDemoMode.GetBool(), WebhooksEnabled: config.WebhooksEnabled.GetBool(), PublicTeamsEnabled: config.ServiceEnablePublicTeams.GetBool(), + AllowIconChanges: config.ServiceAllowIconChanges.GetBool(), EnabledProFeatures: license.EnabledProFeatures(), AvailableMigrators: []string{ (&vikunja_file.FileMigrator{}).Name(), diff --git a/pkg/routes/static.go b/pkg/routes/static.go index c16b275ae..5d9164cc5 100644 --- a/pkg/routes/static.go +++ b/pkg/routes/static.go @@ -48,7 +48,6 @@ const ( ` @@ -92,10 +91,6 @@ func serveIndexFile(c *echo.Context, assetFs http.FileSystem) (err error) { data["SENTRY_ENABLED"] = "true" } data["SENTRY_DSN"] = config.SentryFrontendDsn.GetString() - data["ALLOW_ICON_CHANGES"] = "false" - if config.ServiceAllowIconChanges.GetBool() { - data["ALLOW_ICON_CHANGES"] = "true" - } data["CUSTOM_LOGO_URL"] = config.ServiceCustomLogoURL.GetString() data["CUSTOM_LOGO_URL_DARK"] = config.ServiceCustomLogoURLDark.GetString()