Link domains serve page-builder media: /niches/<file> and /uploads/<id>.<ext> on the short link domains (Neville 2026-10-30: images showed in Preview on linkspin.app but 404ed on the live lookfirst.page link because the mini-site answered gone for every path but its own five)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-30 14:44:15 -05:00
parent f69453648b
commit db4308c5fc
+7
View File
@@ -1500,6 +1500,13 @@ const server = http.createServer(async (req, res) => {
if (p === '/assets/pt.js' && isLinkHost(req)) return sendFile(res, path.join(PUBLIC_DIR, 'assets', 'pt.js'));
// -- short link domains: a real small site (home, disclosure, terms, privacy, abuse) so the domain never looks parked
if (isLinkHost(req)) {
// page-builder media (2026-10-30, Neville: images showed in Preview on linkspin.app but not on the live lookfirst.page link):
// a builder page is served on the link domain with relative image paths, so the niche library and member uploads must be
// reachable here too; same strict patterns as the main host, nothing else from public/ or the volume
let im = /^\/niches\/([a-z0-9-]{1,80}\.(?:jpg|jpeg|png|webp|gif))$/.exec(p);
if (im && (req.method === 'GET' || req.method === 'HEAD')) return sendFile(res, path.join(PUBLIC_DIR, 'niches', im[1]));
im = /^\/uploads\/([a-z0-9]{24}\.(?:png|jpg|webp|gif|mp4|webm))$/.exec(p);
if (im && (req.method === 'GET' || req.method === 'HEAD')) return sendFile(res, path.join(UPLOADS_DIR, im[1]));
const page = { '/': 'home', '/disclosure': 'disclosure', '/terms': 'terms', '/privacy': 'privacy', '/abuse': 'abuse', '/robots.txt': 'robots' }[p];
if (!page) { res.writeHead(404, { 'Content-Type': 'text/html; charset=utf-8' }); return res.end(linkSitePage(reqHost(req), 'gone')); }
if (page === 'robots') { res.writeHead(200, { 'Content-Type': 'text/plain' }); return res.end('User-agent: *\nDisallow: /r/\nDisallow: /c/\nDisallow: /s/\n'); }