6385e753d0
New kit shapes rendered from HTML in the site's own look by tools/art.mjs (a shape list now renders only those shapes and leaves the other art alone). Listed in promokit.js SHAPES, so /promote, /api/promo-kit and InstantAdPay's Network sites tab show them. Smoke test counts updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
6.4 KiB
JavaScript
101 lines
6.4 KiB
JavaScript
// Promo kit (the VBB pattern, 2026-11-14): the ONE place the ViralAdBlitz 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 + guaranteed views, 5 levels). 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/vab-<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', spread: 'Your ad on your team\'s pages, 5 levels deep', boost: 'Boost: guaranteed network views' };
|
|
|
|
function copy() {
|
|
const n = x => Number(x || 0).toLocaleString('en-US');
|
|
const boost = '$' + C.boost.usd + ' one-time Boost buys ' + n(C.boost.views) + ' guaranteed network views';
|
|
return {
|
|
lines: [
|
|
'InstantAdPay or LinkSpin member? Post a free text ad on ViralAdBlitz. It shows on your page and on your team\'s pages, 5 levels deep. {{LINK}}',
|
|
'One text ad: a headline, two lines and your link. Every person you bring in shows it on their page. {{LINK}}',
|
|
'ViralAdBlitz: the network\'s text ad wire. Free to join, sign in with your network account. {{LINK}}',
|
|
'Want more eyes on your ad? A ' + boost + ', a starred spot on the live ticker and extra places on member pages. No subscription. {{LINK}}',
|
|
'Real visitors only: views and clicks count after the page has been seen, bots and repeats do not count. {{LINK}}'
|
|
],
|
|
headlines: ['Post Your Text Ad Free', 'Your Ad, Five Levels Deep', 'Boost Your Ad Across the Network'],
|
|
email: {
|
|
subject: 'Your text ad on your whole team\'s pages',
|
|
body: [
|
|
'Hi,',
|
|
'',
|
|
'ViralAdBlitz is the network\'s home for text ads: a headline, two lines and your link.',
|
|
'',
|
|
'If you are an InstantAdPay or LinkSpin member, you can post one text ad free. It shows on your own page, and on the page of everyone you bring in, and everyone they bring in, five levels down.',
|
|
'',
|
|
'There is a live ticker of the newest ads and a board of the top ads each week, ranked by verified clicks.',
|
|
'',
|
|
'If you want more people to see it, a ' + boost + '. It is paid in POL with SafePal or any other crypto wallet, once, never a subscription.',
|
|
'',
|
|
'It is advertising, not income. Nothing is promised.',
|
|
'',
|
|
'Here is my page:',
|
|
'{{LINK}}'
|
|
].join('\n')
|
|
},
|
|
posts: [
|
|
'I put my text ad on ViralAdBlitz. It shows on my page and on the pages of everyone I bring in, five levels deep. Free to join for InstantAdPay and LinkSpin members.\n\n{{LINK}}',
|
|
'ViralAdBlitz has a live ticker of the newest ads and a weekly board ranked by verified clicks. A ' + boost + '.\n\n{{LINK}}'
|
|
]
|
|
};
|
|
}
|
|
const NOTE = 'A Boost buys 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 => /^vab-[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 = 'vab-' + 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 (viraladblitz.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: 'Your text ad on your whole team\'s pages, five levels deep.',
|
|
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="ViralAdBlitz"></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 };
|