PolHunter door: a signed-out visitor keeps the share link's ?ref through to /my sign-in (framed traffic-exchange visits lost the sponsor)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2753,7 +2753,8 @@ const server = http.createServer(async (req, res) => {
|
||||
// -- PolHunter hand-off (2026-09-19): sign the member across; polhunter.com verifies with the shared secret
|
||||
if (p === '/api/my/polhunter' && req.method === 'GET') {
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) { res.writeHead(302, { Location: '/my' }); return res.end(); }
|
||||
// not signed in: to sign-in, keeping a PolHunter share link's ?ref so the newcomer's sponsor holds (the viral-link rule on /my sets it)
|
||||
if (!s || !s.email) { const ref = String(u.searchParams.get('ref') || '').trim().toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 20); res.writeHead(302, { Location: '/my' + (ref ? '?ref=' + ref : '') }); return res.end(); }
|
||||
const secret = String(process.env.HUNT_SSO_SECRET || '').trim(); const huntUrl = String(process.env.HUNT_URL || 'https://polhunter.com').replace(/\/+$/, '');
|
||||
if (secret.length < 32) return json(res, 503, { error: 'PolHunter is not connected yet.' });
|
||||
const acct = await accounts.byEmail(s.email);
|
||||
|
||||
Reference in New Issue
Block a user