Pages host (lookfirst.page) serves page-builder media too: /niches/<file> and /uploads/<id>.<ext>; the builder pages live on the pages host, not the link domains (Neville 2026-10-30)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-30 14:46:50 -05:00
parent db4308c5fc
commit a24e90b590
+6
View File
@@ -1468,6 +1468,12 @@ const server = http.createServer(async (req, res) => {
if (p === '/') { res.writeHead(302, { Location: 'https://' + SITE_HOST + '/', 'Cache-Control': 'no-store' }); return res.end(); }
if (p === '/robots.txt') { res.writeHead(200, { 'Content-Type': 'text/plain' }); return res.end('User-agent: *\nAllow: /\n'); }
if (p === '/assets/pt.js') return sendFile(res, path.join(PUBLIC_DIR, 'assets', 'pt.js'));
// page-builder media on the pages host (2026-10-30, Neville's lookfirst.page link): builder pages reference the niche
// library and member uploads by relative path, so both are served here with the main host's strict patterns and nothing else
let pim = /^\/niches\/([a-z0-9-]{1,80}\.(?:jpg|jpeg|png|webp|gif))$/.exec(p);
if (pim && (req.method === 'GET' || req.method === 'HEAD')) return sendFile(res, path.join(PUBLIC_DIR, 'niches', pim[1]));
pim = /^\/uploads\/([a-z0-9]{24}\.(?:png|jpg|webp|gif|mp4|webm))$/.exec(p);
if (pim && (req.method === 'GET' || req.method === 'HEAD')) return sendFile(res, path.join(UPLOADS_DIR, pim[1]));
if (!/^\/p\/[a-z0-9-]{3,60}(\/lead)?$/i.test(p) && !/^\/api\/p\//.test(p) && !/^\/[a-z0-9-]{3,60}$/i.test(p)) { res.writeHead(404, { 'Content-Type': 'text/plain' }); return res.end('Not found'); }
}
let pm = /^\/p\/([a-z0-9-]{3,60})$/i.exec(p) || (isPagesHost(req) ? /^\/([a-z0-9-]{3,60})$/i.exec(p) : null);