From f5af9fbf0716f7ff711fc2826e07ca69cf393266 Mon Sep 17 00:00:00 2001 From: qian Date: Sat, 13 Jun 2026 21:09:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(setting):=E4=BF=AE=E5=A4=8D=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E9=85=8D=E7=BD=AE=E9=A1=B9=E6=9C=AA=E5=87=86=E7=A1=AE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/common/settings_registry.go | 2 +- ..._options_is_public.sql => 000009_v0_1_11_version.sql} | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) rename migrations/{000009_sync_options_is_public.sql => 000009_v0_1_11_version.sql} (60%) diff --git a/internal/logic/common/settings_registry.go b/internal/logic/common/settings_registry.go index 8aa471e..45eec16 100644 --- a/internal/logic/common/settings_registry.go +++ b/internal/logic/common/settings_registry.go @@ -66,7 +66,7 @@ var Registry = []SettingDef{ {Key: "register_global_limit_per_minute", Type: SettingTypeInt, Default: "10", Category: "general", Label: "全局每分钟注册限制", Description: "全系统每分钟最多注册次数(0表示不限制)", Validation: "min:0,max:100"}, {Key: "maintenance_mode", Type: SettingTypeBool, Default: "false", Category: "general", - Label: "维护模式", Description: "开启后控制台显示维护提示"}, + Label: "维护模式", Description: "开启后控制台显示维护提示", IsPublic: true}, {Key: "maintenance_message", Type: SettingTypeString, Default: "", Category: "general", Label: "维护提示信息", Description: "维护模式下显示的提示文字", IsPublic: true}, {Key: "maintenance_duration", Type: SettingTypeString, Default: "", Category: "general", diff --git a/migrations/000009_sync_options_is_public.sql b/migrations/000009_v0_1_11_version.sql similarity index 60% rename from migrations/000009_sync_options_is_public.sql rename to migrations/000009_v0_1_11_version.sql index 5d93dcb..ccaad86 100644 --- a/migrations/000009_sync_options_is_public.sql +++ b/migrations/000009_v0_1_11_version.sql @@ -3,6 +3,14 @@ -- Settings like turnstile_enabled/turnstile_site_key were marked IsPublic in the -- registry but the DB rows still had is_public=false, causing GetPublicOptions -- (WHERE is_public=true) to skip them and return stale defaults to the tenant frontend. +-- +-- 变更记录: +-- 2026-06-13 追加 'maintenance_mode'。租户前端 MaintenanceBanner.vue 的 +-- `v-if="settings.maintenance_mode"` 依赖公开配置返回维护模式开关,但 +-- registry 此前未标 IsPublic、DB 行也未置 public,导致维护横幅即使管理员 +-- 开启维护模式也永不显示。已在 settings_registry.go 同步标记 IsPublic=true。 +-- 若该行在 DB 中尚不存在(管理员从未保存过维护配置),公开接口会通过 +-- registry 默认值(false)兜底返回,不影响功能。 UPDATE sys_options SET is_public = true, updated_at = NOW() WHERE key IN ( @@ -10,6 +18,7 @@ WHERE key IN ( 'site_description', 'register_enabled', 'register_email_verification', + 'maintenance_mode', 'maintenance_message', 'maintenance_duration', 'api_maintenance_enabled',