v4.3.18: web-ui 폴더 정리 - html/js/css 분리, server.ts 레거시 리다이렉트 추가

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
kim
2026-07-25 19:39:44 +09:00
co-authored by Claude
parent d1032019de
commit 52b373f2d4
34 changed files with 317 additions and 107 deletions
+17 -4
View File
@@ -2590,7 +2590,7 @@ app.use((req, _res, next) => {
if (!auth.enabled) return next();
// Allow auth endpoints, login page, and static assets without authentication
if (req.path.startsWith('/api/auth/') || req.path === '/login.html') return next();
if (req.path.startsWith('/api/auth/') || req.path === '/login.html' || req.path === '/html/login.html') return next();
// companion.py / install_autostart.py must be fetchable by a standalone script running
// on the user's machine (no session cookie available there), so they're public downloads.
if (req.path === '/companion.py' || req.path === '/install_autostart.py') return next();
@@ -2630,7 +2630,7 @@ app.use((req, _res, next) => {
if (req.path.startsWith('/api/')) {
_res.status(401).json({ error: 'Authentication required' });
} else {
_res.redirect('/login.html');
_res.redirect('/html/login.html');
}
});
@@ -2664,7 +2664,7 @@ app.use('/wavacity', express.static(path.join(webUiPath, 'wavacity'), {
// see /pdf-editor below — so the case id is never sent in that request.)
app.get('/pdf-editor-open', (req: express.Request, res: express.Response) => {
const session = getSessionUser(req);
if (!session) { res.redirect('/login.html'); return; }
if (!session) { res.redirect('/html/login.html'); return; }
const caseId = String(req.query.caseId || '');
if (/^[a-zA-Z0-9_-]+$/.test(caseId)) {
res.setHeader('Set-Cookie', `dt_pdf_case=${caseId}; Path=/pdf-editor; HttpOnly; SameSite=Lax; Max-Age=3600`);
@@ -4335,7 +4335,20 @@ registerUserRoutes(app, {
registerDetectiveRoutes(app, getSessionUser, isPathInsideDir, CONFIG_DIR_PATH);
app.get('/{*path}', (_req, res) => { res.sendFile(path.join(webUiPath, 'index.html')); });
// Redirect legacy top-level HTML routes into /html/ after web-ui reorganization.
const LEGACY_HTML_REDIRECTS = [
'/login.html','/index.html','/claude-app.html','/code.html','/writer-app.html',
'/language-app.html','/nvr-app.html','/weather-app.html','/music-app.html',
'/mind-app.html','/lawyer-app.html','/investor-app.html','/accountant-app.html',
'/detective-app.html','/studio-app.html','/pptx-wizard.html','/traffic-app.html',
'/android-emulator.html','/arduino-emulator.html','/esp32-flasher.html',
'/python-runner.html','/xlsx-viewer.html','/dental-agent.html'
];
for (const p of LEGACY_HTML_REDIRECTS) {
app.get(p, (_req, res) => { res.redirect(`/html${p}`); });
}
app.get('/{*path}', (_req, res) => { res.sendFile(path.join(webUiPath, 'html', 'index.html')); });
const server = http.createServer(app);