Refill: 7-day idle follow-up (unanswered out notice, >=100 credits, nothing running; once per record, tracked as state idle); ad click relay ignores an advertiser opening their own ad
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -2970,9 +2970,12 @@ const server = http.createServer(async (req, res) => {
|
||||
}
|
||||
m = /^\/api\/ads\/click\/(\d+)$/.exec(p);
|
||||
if (m && req.method === 'GET') {
|
||||
const target = await ads.click(m[1]);
|
||||
// an advertiser opening their own ad's link (from Campaigns, a preview, a test) is not a click: relay it uncounted (Marty, 2026-09-30)
|
||||
let own = false;
|
||||
try { const s = await auth.fromRequest(req); if (s && s.email) { const cm = await ads.campaignById(m[1]); own = !!(cm && cm.owner && String(cm.owner).toLowerCase() === String(s.email).toLowerCase()); } } catch (e) {}
|
||||
const target = own ? await ads.targetOf(m[1]) : await ads.click(m[1]);
|
||||
if (!target) { res.writeHead(404, baseHeaders()); return res.end(); }
|
||||
coach.recordClick(m[1], req.headers.referer); // where the click happened
|
||||
if (!own) coach.recordClick(m[1], req.headers.referer); // where the click happened
|
||||
res.writeHead(302, baseHeaders({ Location: target }));
|
||||
return res.end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user