Ads viewer: "View an ad" no longer says "no member ads" on every second press
The viewer alternates banner/text requests; with only one type live, every other press came back empty. /api/my/earnview now treats the type as a preference and falls back to the other type before answering none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2355,7 +2355,10 @@ const server = http.createServer(async (req, res) => {
|
||||
if (status.views >= status.target || status.claimed) return json(res, 200, { ad: null, status });
|
||||
const type = String(u.searchParams.get('type') || 'banner');
|
||||
// members never see (or earn from) their own campaigns in the viewer
|
||||
const ad = await ads.serve(type === 'text' ? 'text' : 'banner', Object.assign({ excludeEmail: s.email }, viewerGeo(req), audiences.matcher(req)));
|
||||
const want = type === 'text' ? 'text' : 'banner', vopts = Object.assign({ excludeEmail: s.email }, viewerGeo(req), audiences.matcher(req));
|
||||
// the type is a preference, not a filter: the viewer alternates banner/text, so with only one type live every
|
||||
// second press said "no member ads" (tester, 2026-10-18). Fall back to the other type before saying none.
|
||||
const ad = (await ads.serve(want, vopts)) || (await ads.serve(want === 'text' ? 'banner' : 'text', vopts));
|
||||
if (!ad) return json(res, 200, { ad: null, status });
|
||||
const token = crypto.randomBytes(16).toString('hex');
|
||||
// the viewer tab frames the advertiser's REAL url (no click counted for a paid view)
|
||||
|
||||
Reference in New Issue
Block a user