diff --git a/server.js b/server.js index 2f0cab1..c830785 100644 --- a/server.js +++ b/server.js @@ -332,7 +332,10 @@ const server = http.createServer(async (req, res) => { // old site links (2026-11-13): referral links were /? (bare query) and pages were *.php. An old username maps to // the same person's network username (oldrefs.json, matched by email); a page address goes home. if (/\.php$/i.test(p) || (p === '/' && /^[A-Za-z0-9_.-]{2,40}$/.test(u.search.slice(1).split('&')[0]))) { // "&fbclid=..." may follow - const old = /\.php$/i.test(p) && p !== '/index.php' ? '' : u.search.slice(1).split('&')[0].toLowerCase(); + // old splash/landing pages carried the referral as ?r= (2026-11-17: /splashpg.php?r= kept the ref like VAS) + const lp = p.toLowerCase(); const rq = String(u.searchParams.get('r') || ''); + const old = (lp === '/splashpg.php' || lp === '/lcp.php') ? (/^[A-Za-z0-9_.-]{2,40}$/.test(rq) ? rq.toLowerCase() : '') + : /\.php$/i.test(p) && lp !== '/index.php' ? '' : u.search.slice(1).split('&')[0].toLowerCase(); let OR = {}; try { OR = JSON.parse(fs.readFileSync(path.join(C.dataDir, 'oldrefs.json'), 'utf8')); } catch (e) {} const net = old && OR[old]; res.writeHead(301, { Location: net ? '/?ref=' + encodeURIComponent(net) : '/', 'Cache-Control': 'no-store' }); return res.end(); }