Earn credits: ad view dwell defaults to 10 seconds (was 5)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -822,7 +822,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!t || t.token !== String(u.searchParams.get('token') || ''))
|
||||
return json(res, 400, { error: 'That view is no longer open. Head back to the dashboard and load the next ad.' });
|
||||
return json(res, 200, { targetUrl: t.targetUrl, adName: t.adName || null,
|
||||
dwell: ads.rates().viewDwellSeconds || 5 });
|
||||
dwell: ads.rates().viewDwellSeconds || 10 });
|
||||
}
|
||||
// human check: handed out only once the dwell has elapsed on the SERVER clock
|
||||
if (p === '/api/my/viewchallenge' && req.method === 'GET') {
|
||||
@@ -831,7 +831,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const t = earnTokens.get(s.email);
|
||||
if (!t || t.token !== String(u.searchParams.get('token') || ''))
|
||||
return json(res, 400, { error: 'That view is no longer open.' });
|
||||
const dwellMs = (ads.rates().viewDwellSeconds || 5) * 1000;
|
||||
const dwellMs = (ads.rates().viewDwellSeconds || 10) * 1000;
|
||||
const age = Date.now() - t.ts;
|
||||
if (age < dwellMs - 400) return json(res, 200, { early: true, wait: Math.ceil((dwellMs - age) / 1000) });
|
||||
if (age > 5 * 60 * 1000) { earnTokens.delete(s.email); return json(res, 400, { error: 'That ad went stale. Load a fresh one.' }); }
|
||||
@@ -845,7 +845,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
const b = await readBody(req);
|
||||
const t = earnTokens.get(s.email);
|
||||
const dwellMs = (ads.rates().viewDwellSeconds || 5) * 1000;
|
||||
const dwellMs = (ads.rates().viewDwellSeconds || 10) * 1000;
|
||||
if (!t || t.token !== String(b.token || '')) return json(res, 400, { error: 'That view did not check out. Load the next ad and let it finish.' });
|
||||
const age = Date.now() - t.ts;
|
||||
if (age < dwellMs - 400) return json(res, 400, { error: 'Watch the full ad first.' });
|
||||
|
||||
Reference in New Issue
Block a user