重构模拟器工作台与日志浮层

This commit is contained in:
2026-03-30 19:19:31 +08:00
parent 24bc60bc7f
commit 1635a11780
10 changed files with 1349 additions and 225 deletions

View File

@@ -57,7 +57,12 @@ function respondJson(response, statusCode, payload) {
}
function serveStatic(requestPath, response) {
const safePath = requestPath === '/' ? '/index.html' : requestPath
let safePath = requestPath === '/' ? '/index.html' : requestPath
if (safePath.endsWith('/')) {
safePath = `${safePath}index.html`
} else if (!path.extname(safePath)) {
safePath = `${safePath}/index.html`
}
const resolvedPath = path.normalize(path.join(PUBLIC_DIR, safePath))
if (!resolvedPath.startsWith(PUBLIC_DIR)) {
response.writeHead(403)