Engine Room (Fuel Your Offers stage 4, Marty approved 2026-10-24): a new Members tab (engineNav, pane-engine) on InstantAdPay, shown only while refuelStreak is on, unlocked by the first counted refuel and greyed with one move "Refuel to start your engine" before. engine.js (the same file ships in LinkSpin): facts() gathers one site's member facts (credits free + in campaigns, recent campaigns, clicks this week and last week from click_sources via coach.clicksSince, free login slots; on LinkSpin also goals this month from the conversion pixel counted from the Central-time 1st, and the Banner Spin / spin link / page / testing parts), build() turns both sites' facts + the streak into three plain dials (fuel left vs this cycle's refuel credits incl. bonus with days left at the recent burn; clicks this week against last week with clicks per 1,000 credits; goals this month vs a member-set goal stored with the streak, refuel.setGoal), the streak panel, warning lights (ads at 80%, ads out, refuel day coming, login slot open), six part lights (fuel, banner spin, spin link, page, testing, conversion tracking: green / amber / grey with setup links) and one next move from simple ordered rules (refuel window, relaunch, Pit Stop top-up, top up the winner, tracking, Banner Spin, test A/B, cut the loser, keep running). LinkSpin facts arrive through signed /api/partner/engine (cached a minute; LinkSpin down = unknown, never zero); InstantAdPay answers the same call for LinkSpin's panel with its facts + the streak. Member /api/my/engine, /api/my/engine/goal; partner op refuel/goal. engine-room.js (same file both sites): plain SVG dials with aria labels, works at 390 px, colour only for warnings. Chatbot CANNED + FACTS cover the Engine Room. my.js?v=20261024er (PANES + engine), engine-room.js?v=20261024er. qa/refuel-engine.test.cjs 10 checks (switch, locked, each dial, lights, parts, next-move order, facts on stubbed LinkSpin incl. Central month start, goal storage).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,7 +74,8 @@ const wednesday = require('./wednesday'); // Wired Wednesday: +25% on $10+ packs
|
||||
const fridaybank = require('./fridaybank'); // Friday Bonus Hunts: days banked Sat-Thu by solo + video (2026-09-26)
|
||||
const refill = require('./refill');
|
||||
const refuel = require('./refuel');
|
||||
const kit = require('./kit'); // the Refuel Kit: monthly members-only banner sets, personalized per member (Fuel Your Offers stage 3, 2026-10-24) // the Monthly Refuel streak, one per member across InstantAdPay + LinkSpin (Fuel Your Offers, 2026-10-24); switch refuelStreak, default off
|
||||
const kit = require('./kit');
|
||||
const engine = require('./engine'); // the Engine Room: dials, warning lights, part lights, next move across both sites (Fuel Your Offers stage 4, 2026-10-24) // the Refuel Kit: monthly members-only banner sets, personalized per member (Fuel Your Offers stage 3, 2026-10-24) // the Monthly Refuel streak, one per member across InstantAdPay + LinkSpin (Fuel Your Offers, 2026-10-24); switch refuelStreak, default off
|
||||
const pdsync = require('./pdsync'); // PassiveDrip PTC bridge: our visit campaigns on their paid-to-click page (2026-09-30) // campaign running-low / ran-out notices, and what came of them // Five Dollar Friday: +20% credits on Friday packs, the wave, the badge (Marty, 2026-09-20)
|
||||
const snapshot = require('./snapshot'); // daily growth snapshot -> Telegram payments feed (Marty, 2026-09-15)
|
||||
const override = require('./override'); // level-4 override: weekly dry-run report; the payer ships OFF (overrideMode 'live' + overrideGoLive + OVERRIDE_PAYER_KEY), 2026-10-23
|
||||
@@ -1141,6 +1142,14 @@ function supportGuard(req, b, email) {
|
||||
supportGlobal.n += 1; supportMark('ip:' + ip); supportMark('em:' + email);
|
||||
return null;
|
||||
}
|
||||
// LinkSpin's Engine Room facts for one member (signed /api/partner/engine), cached a minute; null when LinkSpin does not answer
|
||||
const lsEngineCache = new Map();
|
||||
async function engineFromLinkSpin(email, fresh) {
|
||||
const hit = lsEngineCache.get(email); if (!fresh && hit && Date.now() - hit.at < 60000) return hit.v;
|
||||
let v = null; try { const r = await SF.peerPost(LS_BASE(), '/api/partner/engine', { email }, 6000); v = r && r.facts ? r.facts : null; } catch (e) { v = null; }
|
||||
lsEngineCache.set(email, { at: Date.now(), v }); if (lsEngineCache.size > 2000) lsEngineCache.delete(lsEngineCache.keys().next().value);
|
||||
return v;
|
||||
}
|
||||
// LinkSpin partner calls (registry rows, help desk): one secret both ways, LS_SYNC_SECRET, as X-LS-Ts (ms) + X-LS-Sig =
|
||||
// hex HMAC-SHA256(ts + newline + raw body), 10-minute window. Resolves { body } or { status, error }.
|
||||
async function readLsSigned(req, maxBytes) {
|
||||
@@ -3216,8 +3225,16 @@ const server = http.createServer(async (req, res) => {
|
||||
if (op === 'outbox') return json(res, 200, { ok: true, on: refuel.cfg().on, items: refuel.cfg().on ? await refuel.outbox('linkspin') : [] });
|
||||
if (op === 'ack') return json(res, 200, { ok: true, acked: await refuel.ack('linkspin', Array.isArray(b.refs) ? b.refs : []) });
|
||||
if (op === 'status') return json(res, 200, Object.assign({ ok: true }, await refuel.view(b.email)));
|
||||
if (op === 'goal') { const r = await refuel.setGoal(b.email, b.goal); return json(res, r.error ? 400 : 200, r); }
|
||||
return json(res, 404, { error: 'unknown op' });
|
||||
}
|
||||
// -- the Engine Room, partner side: this site's facts for one member + the streak (LinkSpin builds its own panel from them)
|
||||
if (p === '/api/partner/engine' && req.method === 'POST') {
|
||||
const sg = await readLsSigned(req, 64000); if (!sg.body) return json(res, sg.status, { error: sg.error });
|
||||
const email = String(sg.body.email || '').trim().toLowerCase(); if (!email) return json(res, 400, { error: 'Which member?' });
|
||||
const rv = await refuel.view(email);
|
||||
return json(res, 200, { ok: true, refuel: rv, facts: rv.on ? await engine.facts({ site: 'iap', adminMember, ads, coach }, email) : null });
|
||||
}
|
||||
if (p === '/api/partner/registry' && req.method === 'POST') {
|
||||
const sg = await readLsSigned(req, 2e6); if (!sg.body) return json(res, sg.status, { error: sg.error });
|
||||
const b = sg.body;
|
||||
@@ -4748,6 +4765,17 @@ const server = http.createServer(async (req, res) => {
|
||||
const r = await kit.renderFor(s.email, String(b.month || ''), String(b.size || ''), b.variant === 'gif' ? 'gif' : 'still');
|
||||
return json(res, r.error ? 400 : 200, r.error ? r : { ok: true, url: r.url, abs: r.abs, size: r.size, variant: r.variant, bytes: r.bytes });
|
||||
}
|
||||
// -- the Engine Room (2026-10-24): InstantAdPay's facts + LinkSpin's (signed, cached a minute) + the streak, built into one panel
|
||||
if (p === '/api/my/engine' && req.method === 'GET') {
|
||||
const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
const rv = await refuel.view(s.email); if (!rv.on) return json(res, 200, { on: false });
|
||||
const [own, peer] = await Promise.all([engine.facts({ site: 'iap', adminMember, ads, coach }, s.email), engineFromLinkSpin(s.email, u.searchParams.get('fresh') === '1')]);
|
||||
return json(res, 200, engine.build({ refuel: rv, iap: own, ls: peer, goal: rv.goal }));
|
||||
}
|
||||
if (p === '/api/my/engine/goal' && req.method === 'POST') {
|
||||
const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
const b = await readBody(req); const r = await refuel.setGoal(s.email, b.goal); return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
if (p === '/api/my/refuel' && req.method === 'GET') {
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
|
||||
Reference in New Issue
Block a user