diff --git a/server/bootstrap.mjs b/server/bootstrap.mjs index 00aa47b..d427f69 100644 --- a/server/bootstrap.mjs +++ b/server/bootstrap.mjs @@ -1,4 +1,4 @@ -import { db, getSetting, migrate, setSetting } from "./db.mjs"; +import { db, migrate, setSetting } from "./db.mjs"; import { hashPassword } from "./security.mjs"; const defaultAdminEmail = process.env.CMS_ADMIN_EMAIL || "admin@example.com"; @@ -33,7 +33,9 @@ function seedSettings() { }; Object.entries(seeds).forEach(([key, value]) => { - if (getSetting(key, undefined) === undefined) { + const existing = db.prepare("SELECT key FROM system_settings WHERE key = ?").get(key); + + if (!existing) { setSetting(key, value, key.includes("secret") || key.includes("password")); } }); diff --git a/src/App.vue b/src/App.vue index af942bd..ff1f20d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,7 @@ + + + + + + 系统设置已保存 + 保存失败,请查看日志 + 正在保存系统设置 + 系统设置保存到 SQLite 数据库 + + + {{ saveState === "saving" ? "保存中" : "保存设置" }} + + + + + + {{ group.eyebrow }} + {{ group.title }} + + {{ labels[key] || key }} + + + + + + + diff --git a/src/types.ts b/src/types.ts index a2eb1fd..06da7b2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -export type PanelKey = "account" | "connect" | "content" | "structure" | "config" | "publish"; +export type PanelKey = "account" | "admin" | "connect" | "content" | "structure" | "config" | "publish"; export type EditorMode = "write" | "preview"; export type DataSource = "local" | "github"; @@ -69,3 +69,10 @@ export interface GitHubRepository { defaultBranch: string; updatedAt: string; } + +export interface SystemSetting { + key: string; + value: string; + encrypted: boolean; + updatedAt: string; +}
+ 系统设置已保存 + 保存失败,请查看日志 + 正在保存系统设置 + 系统设置保存到 SQLite 数据库 +
{{ group.eyebrow }}