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()