From db4308c5fcf86b7cda3e8f994152a26ac7e934a3 Mon Sep 17 00:00:00 2001 From: martbost Date: Fri, 30 Oct 2026 14:44:15 -0500 Subject: [PATCH] Link domains serve page-builder media: /niches/ and /uploads/. 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 --- server.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.js b/server.js index 0aa6d08..7c6fcfc 100644 --- a/server.js +++ b/server.js @@ -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'); }