fix(brain): redirect / to /docs/observer/dashboard.html (browser-smoke fix)
Browser smoke (Playwright) revealed that rewriting path internally without
changing the response URL left the browser's base URL as /, breaking
relative <script src="dashboard.js"> and ../automation-graph-data.js
references. 302 redirect makes the browser settle on /docs/observer/,
which resolves the relative paths correctly. All 4 views verified clean
(0 console errors). Screenshots: brain-dashboard-{map,replay,feed,aggregate}-view.png.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,13 @@ export function createServer(root = REPO_ROOT) {
|
||||
return;
|
||||
}
|
||||
let path = url.split('?')[0];
|
||||
if (path === '/') path = '/docs/observer/dashboard.html';
|
||||
if (path === '/') {
|
||||
// Redirect (not rewrite) so the browser's base URL becomes /docs/observer/,
|
||||
// which makes relative <script src="dashboard.js"> and ../automation-graph-data.js resolve correctly.
|
||||
res.writeHead(302, { Location: '/docs/observer/dashboard.html' });
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
const abs = resolveStaticPath(path, root);
|
||||
if (!abs || !existsSync(abs) || !statSync(abs).isFile()) {
|
||||
res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
|
||||
|
||||
Reference in New Issue
Block a user