edaf98c8f6
Watershed look from the approved mockup (hero, topo pattern, icons). Network sign-in through the hub, hub membership, activity ping. Reshare links per member per ad with branch/step tracking; family-tree dashboard (branch, step, reshares, views, clicks, sign-ups, Boosts). Verified views earn ad credits for the branch's resharer (L3). L2 sign-up pipeline (hub-new, confirmed email, not self device/IP, throwaway block, daily cap, fraud score) with keeper-signed reward vouchers and a pending-rewards ledger; payouts OFF (REWARD_PAYOUTS). L1 Boosts through VASShop with signed orders naming the sponsor line and the resharer. Trust pack, chatbot, promo kit, PolHunter embed. All numbers are PROPOSALS until Marty sets them. qa/e2e.mjs 59/59 on a local anvil chain, chatbot test 108/108. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
5.7 KiB
JavaScript
82 lines
5.7 KiB
JavaScript
// Promo kit (the VBB pattern, 2026-11-14): the ONE place the ViralAdSource creatives and swipe copy live. Published as a public
|
|
// JSON feed, GET /api/promo-kit?u=<network username or wallet>, read by /promote and by InstantAdPay's promo center ("Network
|
|
// sites"). Facts come from config.js (Boost price + days on top). Copy rules: advertising, not income; nothing is
|
|
// promised; no em dashes; no earnings caps; wallets = "SafePal or any other crypto wallet".
|
|
// Creatives: public/art/kit/vas-<angle>-<shape>.png, rendered by tools/kit-art.mjs (neutral names: no size tokens, no ad words).
|
|
'use strict';
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const C = require('./config').get();
|
|
const netsites = require('./netsites');
|
|
|
|
const KIT_DIR = path.join(__dirname, 'public', 'art', 'kit');
|
|
const SHAPES = { tile: [125, 125, 'Square button'], strip: [468, 60, 'Strip'], leader: [728, 90, 'Leaderboard'], box: [300, 250, 'Box'], panel: [336, 280, 'Large box'],
|
|
tower: [160, 600, 'Skyscraper'], social: [1200, 630, 'Social share'], square: [1080, 1080, 'Square post'] };
|
|
const ANGLES = { free: 'Post a free text ad', tree: 'Watch your ad travel', boost: 'Boost the source' };
|
|
|
|
function copy() {
|
|
const boost = '$' + C.boost.usd + ' one-time Boost puts your ad on top of the reshare board for ' + C.boost.days + ' days';
|
|
return {
|
|
lines: [
|
|
'Every ad has a source. Post a free text ad on ViralAdSource and watch who passes it on. {{LINK}}',
|
|
'Post one free text ad, let people reshare it, and see its whole family tree: every branch, every step. {{LINK}}',
|
|
'ViralAdSource: free text ads that travel by reshares. One network account, sign in with InstantAdPay or LinkSpin. {{LINK}}'
|
|
],
|
|
headlines: ['Every ad has a source', 'Watch your ad travel', 'See who passed your ad on', 'Your ad, branch by branch'],
|
|
email: { subject: 'Watch your ad travel',
|
|
body: ['Hi,', '', 'ViralAdSource lets you post a free text ad that anyone can reshare with their own link. Every reshare is a new branch, and you see the whole family tree of your ad: who passed it on, how far it went and what each branch brought in.', '',
|
|
'Resharers are rewarded for results only, never for a bare share. Ad credits buy advertising, not income.', '', '{{LINK}}'].join('\n') },
|
|
posts: [
|
|
'Most ad sites give you a view count. ViralAdSource shows you the route: which reshare carried your ad furthest and which branch went quiet. Free to post.' + '\n\n{{LINK}}',
|
|
'Post a free text ad, reshare the ones you like with your own link. ' + boost + '. Paid in POL with SafePal or any other crypto wallet.' + '\n\n{{LINK}}'
|
|
]
|
|
};
|
|
}
|
|
const NOTE = 'Ad credits buy advertising, not income. Nothing is promised.';
|
|
const REF_RE = /^(?:[A-Za-z0-9_.-]{2,40}|0x[0-9a-fA-F]{40})$/;
|
|
const base = () => 'https://' + C.site;
|
|
let files = null;
|
|
function creatives() {
|
|
if (files) return files;
|
|
let names = []; try { names = fs.readdirSync(KIT_DIR).filter(f => /^vas-[a-z]+-[a-z]+\.png$/.test(f)); } catch (e) {}
|
|
const out = [];
|
|
for (const angle of Object.keys(ANGLES)) for (const shape of Object.keys(SHAPES)) {
|
|
const f = 'vas-' + angle + '-' + shape + '.png'; if (!names.includes(f)) continue;
|
|
const [w, h, label] = SHAPES[shape];
|
|
out.push({ key: angle + '-' + shape, angle, angleLabel: ANGLES[angle], shape, label, w, h, url: base() + '/art/kit/' + f });
|
|
}
|
|
return (files = out);
|
|
}
|
|
function kit(u) {
|
|
const ref = REF_RE.test(String(u || '')) ? String(u) : '';
|
|
// the member's own page is their link (viraladsource.com/<username>); a wallet falls back to ?ref=
|
|
const link = ref && !/^0x/i.test(ref) ? base() + '/' + encodeURIComponent(ref) : base() + '/' + (ref ? '?ref=' + encodeURIComponent(ref) : '');
|
|
const q = ref ? '?ref=' + encodeURIComponent(ref) : '';
|
|
const fill = s => s.split('{{LINK}}').join(link);
|
|
const track = seg => netsites.tracked(C.siteId, C.siteId, { s1: ref, s2: seg });
|
|
const t = copy();
|
|
return {
|
|
v: 1, site: C.site, name: C.siteName, updated: '2026-11-16', username: ref || null,
|
|
tagline: 'Every ad has a source. Watch yours travel.',
|
|
links: [
|
|
{ key: 'page', label: 'Your page', url: link, tracked: track('') },
|
|
{ key: 'boost', label: 'Boost', url: base() + '/boost' + q, tracked: track('boost') },
|
|
{ key: 'ledger', label: 'Live ledger', url: base() + '/ledger' + q, tracked: track('ledger') }
|
|
],
|
|
linkTemplate: base() + '/{username}', trackedTemplate: netsites.tracked(C.siteId, C.siteId) + '&s1={username}',
|
|
creatives: creatives().map(c => Object.assign({}, c, { html: '<a href="' + link + '" target="_blank" rel="noopener"><img src="' + c.url + '" width="' + c.w + '" height="' + c.h + '" alt="ViralAdSource"></a>' })),
|
|
lines: t.lines.map(fill), headlines: t.headlines, email: { subject: t.email.subject, body: fill(t.email.body) }, posts: t.posts.map(fill),
|
|
note: NOTE, promotePage: base() + '/promote'
|
|
};
|
|
}
|
|
function handle(req, res, u, sendFile) {
|
|
if (u.pathname === '/promote' && (req.method === 'GET' || req.method === 'HEAD') && sendFile) { sendFile(res, path.join(__dirname, 'public', 'promote.html')); return true; }
|
|
if (u.pathname !== '/api/promo-kit') return false;
|
|
const cors = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type' };
|
|
if (req.method === 'OPTIONS') { res.writeHead(204, cors); res.end(); return true; }
|
|
if (req.method !== 'GET' && req.method !== 'HEAD') return false;
|
|
res.writeHead(200, Object.assign({ 'Content-Type': 'application/json', 'Cache-Control': 'public, max-age=300', 'X-Content-Type-Options': 'nosniff' }, cors));
|
|
res.end(JSON.stringify(kit(u.searchParams.get('u')))); return true;
|
|
}
|
|
module.exports = { kit, handle, creatives, SHAPES, ANGLES, copy };
|