fix: move shell.peercortex.org routing before generic / handler
This commit is contained in:
parent
58bf76fa82
commit
e302c425c7
30
server.js
30
server.js
@ -892,13 +892,23 @@ const server = http.createServer(async (req, res) => {
|
|||||||
return res.end('Bad Request');
|
return res.end('Bad Request');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve static files
|
// Serve static files — host-based routing
|
||||||
// v2.peercortex.org → editorial design
|
|
||||||
const host = (req.headers.host || '').split(':')[0];
|
const host = (req.headers.host || '').split(':')[0];
|
||||||
const isV2 = host === 'v2.peercortex.org';
|
|
||||||
|
|
||||||
if (reqPath === "/" || reqPath === "/index.html") {
|
if (reqPath === "/" || reqPath === "/index.html") {
|
||||||
const htmlFile = isV2 ? "index-editorial.html" : "index.html";
|
// shell.peercortex.org → admin feedback terminal (check first)
|
||||||
|
if (host === 'shell.peercortex.org') {
|
||||||
|
try {
|
||||||
|
const html = fs.readFileSync('/opt/peercortex-app/public/shell.html', 'utf8');
|
||||||
|
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
||||||
|
return res.end(html);
|
||||||
|
} catch (_e) {
|
||||||
|
res.writeHead(500);
|
||||||
|
return res.end('shell.html not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// v2.peercortex.org → editorial design
|
||||||
|
const htmlFile = (host === 'v2.peercortex.org') ? "index-editorial.html" : "index.html";
|
||||||
try {
|
try {
|
||||||
const html = fs.readFileSync("/opt/peercortex-app/public/" + htmlFile, "utf8");
|
const html = fs.readFileSync("/opt/peercortex-app/public/" + htmlFile, "utf8");
|
||||||
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
||||||
@ -921,18 +931,6 @@ const server = http.createServer(async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shell.peercortex.org → admin feedback terminal
|
|
||||||
if (host === 'shell.peercortex.org' && (reqPath === '/' || reqPath === '/index.html')) {
|
|
||||||
try {
|
|
||||||
const html = fs.readFileSync('/opt/peercortex-app/public/shell.html', 'utf8');
|
|
||||||
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
||||||
return res.end(html);
|
|
||||||
} catch (_e) {
|
|
||||||
res.writeHead(500);
|
|
||||||
return res.end('shell.html not found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Feedback API
|
// Feedback API
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user