refactor(设置): 站点配置去掉从来没人读的网址、简称、页脚三项和 AI 小助手开关

库里 options 表那几行旧值留着,没有代码再读。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-13 14:37:35 +08:00
1 parent ee649b81b1
commit 20a6f667d8
6 files changed
+4 -107

No files matched your search

-8
View File
@@ -52,27 +52,19 @@ function isAlive(lastHeartbeat: string) {
/** camelCase 契约 ←→ options 表里的 snake_case key */
const OPTION_KEYS = {
websiteBaseUrl: "website_base_url",
websiteName: "website_name",
websiteNameShortcut: "website_name_shortcut",
websiteFooter: "website_footer",
allowRegister: "allow_register",
submissionListShowAll: "submission_list_show_all",
classList: "class_list",
enableMaxkb: "enable_maxkb",
} as const
adminConfRoutes.get("/website", requireSuperAdmin, async (c) => {
const options = await getWebsiteOptions()
return success(c, {
websiteBaseUrl: options.website_base_url,
websiteName: options.website_name,
websiteNameShortcut: options.website_name_shortcut,
websiteFooter: options.website_footer,
allowRegister: options.allow_register,
submissionListShowAll: options.submission_list_show_all,
classList: options.class_list,
enableMaxkb: options.enable_maxkb,
} satisfies WebsiteConfig)
})
-4
View File
@@ -14,14 +14,10 @@ export const siteRoutes = new Hono()
siteRoutes.get("/site", async (c) => {
const options = await getWebsiteOptions()
return success(c, {
websiteBaseUrl: options.website_base_url,
websiteName: options.website_name,
websiteNameShortcut: options.website_name_shortcut,
websiteFooter: options.website_footer,
allowRegister: options.allow_register,
submissionListShowAll: options.submission_list_show_all,
classList: options.class_list,
enableMaxkb: options.enable_maxkb,
} satisfies WebsiteConfig)
})
-4
View File
@@ -3,14 +3,10 @@ import { inArray } from "drizzle-orm"
import { db, schema } from "../db"
export const websiteOptionDefaults = {
website_base_url: "http://127.0.0.1",
website_name: "Online Judge",
website_name_shortcut: "oj",
website_footer: "Online Judge Footer",
allow_register: true,
submission_list_show_all: true,
class_list: [] as string[],
enable_maxkb: true,
}
export async function getOptions<const T extends readonly string[]>(keys: T) {