Refuel Kit on LinkSpin (Fuel Your Offers stage 3, Marty approved 2026-10-24): kit.js (same file as InstantAdPay) with LinkSpin's own art, entitlement from InstantAdPay's streak record through refuel.status (view.kits: month -> streak month at unlock). Ads screen Refuel Kit panel (fuel.js?v=20261024kit): Make mine, Download, Copy image link, animated at a 3-month streak, and "Load into my Banner Spin" (kitspin.js): each Banner Spin size in the kit goes into one of the member's Banner Spins of that size with room, or a new one while the tier allows (the reason is shown when it does not); the personalized file is copied into uploads like a normal Banner Spin upload, labelled "Refuel Kit <month>", target = the member's own link; loading twice adds nothing twice; files over 150 KB are refused plainly. /kitimg/<hmac> public serving, admin Settings > Refuel Kit (upload, placeholder art, preview, release), raster copies of the LinkSpin placeholder banners (public/banners/linkspin-<size>.png, from the existing SVGs) for the placeholder kit. Behind the refuelStreak switch. Chatbot CANNED + FACTS mention the kit. qa/refuel-kit.test.cjs 5 checks against the real bannerspin.js. Note: qa kb retrieval has 2 pre-existing misses (spin links vs Banner Spin, PropellerAds postback), same before this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,9 @@ const postbacks = require('./postbacks'); // outbound + inbound conversion postb
|
||||
const convtrack = require('./convtrack'); // conversion pixel: goals, ad click ids, landing tag + goal pixel, per-goal reports (2026-10-23)
|
||||
const marks = require('./marks'); // one-time claims shared by both app copies during a deploy (event_marks or exclusive files), 2026-10-24
|
||||
const refill = require('./refill');
|
||||
const refuel = require('./refuel'); // Monthly Refuel streak, LinkSpin side: reports $25+ packages to InstantAdPay (the source of truth), applies its grants (2026-10-24) // refill notices: low / out / idle, one message per owner, conversions tracked (2026-10-24)
|
||||
const refuel = require('./refuel');
|
||||
const kit = require('./kit');
|
||||
const kitspin = require('./kitspin'); // Refuel Kit -> Banner Spin loader // the Refuel Kit: monthly members-only LinkSpin banner sets, personalized per member (2026-10-24) // Monthly Refuel streak, LinkSpin side: reports $25+ packages to InstantAdPay (the source of truth), applies its grants (2026-10-24) // refill notices: low / out / idle, one message per owner, conversions tracked (2026-10-24)
|
||||
const bannerspin = require('./bannerspin'); // Banner Spin: one image URL + one click URL rotating up to 25 banners (2026-10-18)
|
||||
const sources = require('./sources'); // traffic sources: network macros, campaign URLs, per-source postbacks, Reports dimension (2026-10-12)
|
||||
const pages = require('./pages'); // member pages: bridge / review / squeeze, served at /p/<slug> (2026-09-29)
|
||||
@@ -635,6 +637,9 @@ async function boot() {
|
||||
// a week later if credits sit idle; one email + one on-site notice per owner, every send watched for what they did next
|
||||
refuel.init({ dataDir: DATA_DIR, siteConfig, ads, accounts, marks, mailer, drip, siteUrl: SITE_URL, iapBase: IAP_BASE,
|
||||
message: async (to, subject, html) => { await messages.deliver(1, ADMIN_EMAIL || 'house@' + SITE_HOST, [to], subject, html, 'notice'); } });
|
||||
kit.init({ dataDir: DATA_DIR, program: 'linkspin', publicDir: PUBLIC_DIR, siteUrl: SITE_URL,
|
||||
entitled: async email => { const v = await refuel.status(email); return v && v.on && !v.error ? { on: true, months: v.kits || {}, nextRefuel: v.refuelDayLabel || null, today: v.today || null } : { on: false }; },
|
||||
linkFor: async email => { const a = await accounts.byEmail(email); if (!a) return null; const tok = a.username || a.code; return tok ? { username: a.username || null, link: SITE_URL + '/join/' + tok } : null; } });
|
||||
setTimeout(() => refuel.tick().catch(e => console.error('refuel', e.message)), 75000);
|
||||
setInterval(() => refuel.tick().catch(e => console.error('refuel', e.message)), 60 * 1000);
|
||||
refill.init({ dataDir: DATA_DIR, siteConfig, ads, accounts, chain, mailer, drip, marks, siteUrl: SITE_URL, houseOwner: ads.HOUSE_OWNER, streakLine: email => refuel.streakLine(email),
|
||||
@@ -3823,6 +3828,22 @@ const server = http.createServer(async (req, res) => {
|
||||
passedUp: { count: passed.length, unqualified: passed.filter(e => e.reason === 'unqualified').length, sendFailed: passed.filter(e => e.reason === 'send-failed').length },
|
||||
wallets, balances, fixedMonthlyUsd: Number(siteConfig().pnlFixedMonthlyUsd) || 0, burner: burner.status() });
|
||||
}
|
||||
// -- Refuel Kit admin: kits as data (month, theme, five base images), placeholder art from public/banners, personalization preview
|
||||
if (p === '/api/admin/kits' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, { kits: kit.listKits(), sizes: kit.ORDER }); }
|
||||
if (p === '/api/admin/kits' && req.method === 'POST') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); const r = kit.saveKit(await readBody(req)); return json(res, r.error ? 400 : 200, r); }
|
||||
if (p === '/api/admin/kits/placeholder' && req.method === 'POST') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); const b = await readBody(req); return json(res, 200, kit.usePlaceholder(String(b.month || ''))); }
|
||||
if (p === '/api/admin/kits/upload' && req.method === 'POST') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
let buf; try { buf = await readRaw(req, 3 * 1024 * 1024); } catch (e) { return json(res, 413, { error: 'Image too large (3 MB max).' }); }
|
||||
const r = kit.uploadBase(String(u.searchParams.get('month') || ''), String(u.searchParams.get('size') || ''), buf, req.headers['content-type']);
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
if (p === '/api/admin/kits/preview' && req.method === 'GET') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const r = await kit.preview(String(u.searchParams.get('month') || ''), String(u.searchParams.get('size') || ''), String(u.searchParams.get('username') || 'yourname').replace(/[^a-z0-9_]/gi, '').slice(0, 24), u.searchParams.get('variant') === 'gif' ? 'gif' : 'still');
|
||||
if (r.error) return json(res, 400, r);
|
||||
res.writeHead(200, { 'Content-Type': { png: 'image/png', jpg: 'image/jpeg', gif: 'image/gif' }[r.ext], 'Cache-Control': 'no-store' }); return fs.createReadStream(r.file).pipe(res);
|
||||
}
|
||||
if (p === '/api/admin/refuel' && req.method === 'GET') { // Monthly Refuel, LinkSpin side: switch, link to InstantAdPay, reports waiting to go
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
return json(res, 200, refuel.adminView());
|
||||
@@ -3831,6 +3852,30 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
return json(res, 200, await refuel.tick());
|
||||
}
|
||||
// -- the Refuel Kit (2026-10-24): personalized banners are public by URL, rendered only for entitled members
|
||||
if (p.startsWith('/kitimg/') && (req.method === 'GET' || req.method === 'HEAD')) {
|
||||
const f = kit.servePath(p.slice(8)); if (!f) { res.writeHead(404, { 'Content-Type': 'text/plain' }); return res.end('Not found'); }
|
||||
res.writeHead(200, { 'Content-Type': f.mime, 'Cache-Control': 'public, max-age=86400', 'Access-Control-Allow-Origin': '*' });
|
||||
return req.method === 'HEAD' ? res.end() : fs.createReadStream(f.file).pipe(res);
|
||||
}
|
||||
if (p === '/api/my/kits' && req.method === 'GET') {
|
||||
const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
return json(res, 200, await kit.myKits(s.email));
|
||||
}
|
||||
if (p === '/api/my/kits/render' && 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 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 });
|
||||
}
|
||||
// "Load into my Banner Spin": each Banner Spin size in the kit goes into one of the member's Banner Spins of that size with
|
||||
// room, or a new one when the tier allows; the banner is the member's personalized file, the target their own link
|
||||
if (p === '/api/my/kits/bannerspin' && 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 kitspin.load({ kit, bannerspin, content, uploadsDir: UPLOADS_DIR, email: s.email, month: String(b.month || ''), variant: b.variant, sizes: b.sizes });
|
||||
return json(res, r.error ? (r.status || 400) : 200, r);
|
||||
}
|
||||
if (p === '/api/my/refuel' && req.method === 'GET') { // the member's Refuel card, from InstantAdPay's record ({ on:false } while switched off)
|
||||
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