1
0

feat: 版本管理,package.json 唯一版本源、/api/meta 返回版本、Dashboard Header 展示版本号

This commit is contained in:
2026-05-20 19:14:37 +08:00
parent f3df3a203b
commit 8eac814cc6
25 changed files with 490 additions and 20 deletions

View File

@@ -16,10 +16,11 @@ export interface StartServerOptions {
mode: RuntimeMode;
staticAssets?: StaticAssets;
store: ProbeStore;
version: string;
}
export function startServer(options: StartServerOptions) {
const { config, mode, staticAssets, store } = options;
const { config, mode, staticAssets, store, version } = options;
const server = Bun.serve({
fetch(req) {
@@ -36,7 +37,7 @@ export function startServer(options: StartServerOptions) {
GET: (req) => handleDashboard(new URL(req.url), store, mode),
},
"/api/meta": {
GET: () => handleMeta(mode),
GET: () => handleMeta(mode, version),
},
"/api/targets/:id/history": {
GET: (req) => handleHistory(req.params.id, new URL(req.url), store, mode),