From 31329905e2eef2399bc1b8607a6f7d46029e91ff Mon Sep 17 00:00:00 2001 From: kurihada Date: Sun, 1 Mar 2026 14:17:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20SPA=20fallback=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=8C=B9=E9=85=8D=EF=BC=8C/api-tester=20?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E8=A2=AB=E8=AF=AF=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - startsWith('/api') 改为 startsWith('/api/'),避免前端路由 /api-tester 被跳过 - 修正 webDir 解析路径,指向 dist/web 而非源码 web/ --- src/server/app.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/app.ts b/src/server/app.ts index ab537c5..793d765 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -300,9 +300,9 @@ export class AppServer { private setupWebDashboard(): void { // Resolve the web dashboard dist directory relative to this file. - // In the built output: dist/server/app.js → dist/web/ is at ../web + // tsup bundles to dist/index.js, so dist/web/ is a sibling. const thisDir = path.dirname(fileURLToPath(import.meta.url)); - const webDir = path.resolve(thisDir, '..', 'web'); + const webDir = path.resolve(thisDir, 'web'); if (!fs.existsSync(webDir)) { logger.debug({ webDir }, 'Web dashboard dist not found, skipping static mount'); @@ -319,7 +319,7 @@ export class AppServer { this.app.get('*', (req, res, next) => { // Skip API / MCP / health routes if ( - req.path.startsWith('/api') || + req.path.startsWith('/api/') || req.path.startsWith('/sse') || req.path.startsWith('/messages') || req.path === '/health'