Friday Bonus Hunts: InstantAdPay counts the banked days

Each day Saturday through Thursday (Central) that a member opens an inbox ad
and watches a video banks one extra PolHunter hunt for the following Friday.
If their inbox had no unread solo ad that day, the video alone counts, so
nobody is blocked by an empty inbox. These are the two slowest-delivering ad
types (about 6-7 views per campaign per day against 40-50 for banners), so
the game sends attention exactly where advertisers are short of it.

fridaybank.js counts from video_seen and solo_inbox.read_ts with DST-safe
Central midnights. /api/my/friday-bank feeds a card on the Earn tab (week
chips, today's two steps with links to the right sub-tab);
/api/hunt/friday-bank answers PolHunter, HMAC-signed with the existing
HUNT_SSO_SECRET, 5-minute window. QA member walk: 0 bugs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-26 15:20:51 -05:00
parent 9116368ffe
commit cf5a9674a2
4 changed files with 125 additions and 1 deletions
+22
View File
@@ -2363,6 +2363,7 @@
const st = await (await fetch('/api/my/earn')).json();
if (st.error) return null;
$('earnProgress').textContent = 'today: ' + st.views + ' / ' + st.target + ' ads viewed';
loadFridayBank();
$('earnBalance').textContent = (st.earnedAvailable != null ? st.earnedAvailable : st.earned) + ' earned credits available' + (st.reserved ? ' · ' + st.reserved + ' in live campaigns' : '');
if ($('earnActLink')) $('earnActLink').onclick = e => { e.preventDefault(); jumpTo('campaigns', 'creditActivity'); };
const done = st.views >= st.target;
@@ -2981,3 +2982,24 @@
};
btn.addEventListener('click', go); inp.addEventListener('keydown', e => { if (e.key === 'Enter') go(); });
})();
// Friday Bonus Hunts card on the Earn tab (2026-09-26). Hoisted so the Earn loader can call it.
async function loadFridayBank() {
const card = document.getElementById('fbankCard'); if (!card) return;
let b; try { const r = await fetch('/api/my/friday-bank', { credentials: 'same-origin' }); if (!r.ok) return; b = await r.json(); } catch (e) { return; }
const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const wd = d => WD[new Date(d + 'T12:00:00Z').getUTCDay()];
document.getElementById('fbankCount').textContent = b.banked + ' banked';
document.getElementById('fbankDays').innerHTML = (b.days || []).map(d => {
const st = d.banked ? ['#43e8c3', '&#10003;'] : d.future ? ['var(--line-strong)', '&middot;'] : d.day === b.today ? ['#ffb238', '&#9675;'] : ['var(--line-strong)', '&times;'];
return '<span title="' + d.day + '" style="display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;border:1px solid ' + st[0] + ';font-size:13px"><b style="color:' + st[0] + '">' + st[1] + '</b>' + wd(d.day) + '</span>';
}).join('') + '<span style="display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;background:rgba(180,140,255,.18);font-size:13px">Fri: +' + b.banked + ' hunts</span>';
const t = (b.days || []).find(d => d.day === b.today);
let msg = '';
if (b.isFriday) msg = b.banked ? '<b>It\'s Friday.</b> Your ' + b.banked + ' banked hunt' + (b.banked === 1 ? '' : 's') + ' are live on <a href="/api/my/polhunter">PolHunter</a> today.' : 'It\'s Friday. Bank hunts Saturday through Thursday for next Friday.';
else if (t && t.banked) msg = '&#10003; <b>Today is banked.</b> Come back tomorrow to bank another.';
else if (t) msg = 'To bank today: ' + (t.video ? '&#10003; video watched' : '<a href="#" data-earn-go="videos">watch one video</a>') + (t.soloNeeded ? ' and ' + (t.solo ? '&#10003; inbox ad opened' : '<a href="#" data-earn-go="inbox">open one inbox ad</a>') : ' (no inbox ad waiting, so the video alone counts)') + '.';
const el = document.getElementById('fbankToday'); el.innerHTML = msg;
el.querySelectorAll('[data-earn-go]').forEach(a => a.addEventListener('click', ev => { ev.preventDefault(); const tab = document.querySelector('[data-earn="' + a.dataset.earnGo + '"]'); if (tab) tab.click(); }));
card.hidden = false;
}