Files
OJ2/packages/contract/src/site.ts
T
xuyue d25b5dbe6d
Deploy / deploy (push) Canceled after 0s
update
2026-09-27 19:36:28 +08:00

24 lines
787 B
TypeScript

import { z } from "zod"
export const websiteConfigSchema = z.object({
websiteBaseUrl: z.string(),
websiteName: z.string(),
websiteNameShortcut: z.string(),
websiteFooter: z.string(),
allowRegister: z.boolean(),
submissionListShowAll: z.boolean(),
classList: z.array(z.string()),
enableMaxkb: z.boolean(),
})
/** 当前在线人数。只有聚合值 —— 「某某在不在线」是个人状态,不往匿名接口放 */
export const onlineCountSchema = z.object({
count: z.number().int().nonnegative(),
})
export const quoteSchema = z.union([z.string(), z.record(z.string(), z.unknown())])
export type WebsiteConfig = z.infer<typeof websiteConfigSchema>
export type Quote = z.infer<typeof quoteSchema>
export type OnlineCount = z.infer<typeof onlineCountSchema>