001878bdae
- Free text ad for network members (InstantAdPay / LinkSpin sign-in or wallet, membership through the hub), one per member - Member pages viraladblitz.com/<username>: own ad + the first 5 people above in the hub line with a live ad (by place) + 2 Boosted places - Front page: amber ticker (Boosted starred), Top ads this week by verified clicks, today's numbers, ledger, contract proof - Verified visitors / views / clicks (ticket + dwell + per-visitor dedupe + per-connection cap + bot filter, owner excluded) - Boost $5 = 500 guaranteed views through VABShop: keeper-signed EIP-712 line voucher from the hub line, watcher, delivery counted per verified view with an audit row each, Network Ad Space text-ad finishing after 30 days (vabnas.js) - Trust pack: /ledger, /contract, toasts, Telegram card per Boost (once), Terms / Earnings Disclaimer / Privacy (TrustClickz), network footer from the hub with tracked links, promo kit (21 creatives) + /promote, LinkSpin zone placeholders, hub report - Old YFW links via the oldrefs map (admin load route); docstore MySQL documents + row tables - qa/smoke.mjs 162/162 (stand-in hub, chain, Telegram, NAS; Playwright desktop + phone), qa/chain.mjs 20/20 (real VABShop on anvil) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73 lines
9.1 KiB
JavaScript
73 lines
9.1 KiB
JavaScript
// Renders the site art with Playwright (local only): the icon, the OG share image, the Telegram proof cards
|
|
// (public/art/proof/vab-proof-{amber,cream,green}.png) and the promo kit (public/art/kit/vab-<angle>-<shape>.png, 3 angles x 7
|
|
// shapes, ad-blocker-neutral names). Copy facts come from config.js (Boost price + views) and promokit.js (angles, shapes).
|
|
// node tools/art.mjs (PLAYWRIGHT = path to the playwright package)
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { createRequire } from 'node:module';
|
|
import { fileURLToPath } from 'node:url';
|
|
const require = createRequire(import.meta.url);
|
|
const APP = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const PW = process.env.PLAYWRIGHT || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright';
|
|
const { chromium } = require(PW);
|
|
const C = require(path.join(APP, 'config.js')).get();
|
|
const { SHAPES } = require(path.join(APP, 'promokit.js'));
|
|
const ART = path.join(APP, 'public', 'art');
|
|
fs.mkdirSync(path.join(ART, 'kit'), { recursive: true }); fs.mkdirSync(path.join(ART, 'proof'), { recursive: true });
|
|
const FONTS = '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans:wght@400;600&display=swap">';
|
|
const BASE = `*{box-sizing:border-box;margin:0}html,body{width:100%;height:100%;overflow:hidden}body{background:#0a1712;color:#e8efe9;font-family:'IBM Plex Sans',sans-serif}
|
|
.wm{font-family:'Playfair Display',Georgia,serif;font-weight:900;color:#f4efe3;letter-spacing:-.02em}.mono{font-family:'IBM Plex Mono',monospace}.amber{color:#ffb000}
|
|
.tick{background:#000;border-bottom:2px solid #ffb000;color:#ffb000;font-family:'IBM Plex Mono',monospace;white-space:nowrap;overflow:hidden}
|
|
.paper{background:#f4efe3;color:#13201a;border-top:6px solid #ffb000}.cta{background:#ffb000;color:#1a1200;font-weight:600;display:inline-block}`;
|
|
const views = Number(C.boost.views).toLocaleString('en-US');
|
|
const ANG = {
|
|
free: { k: 'FREE FOR NETWORK MEMBERS', h: 'Post your text ad free', s: 'It runs on your page and your team\'s pages.', cta: 'Post my free ad' },
|
|
spread: { k: 'FIVE LEVELS DEEP', h: 'Your ad on your whole team\'s pages', s: 'Everyone you bring in shows your ad, five levels down.', cta: 'Get my page' },
|
|
boost: { k: 'ONE-TIME BOOST', h: '$' + C.boost.usd + ' for ' + views + ' guaranteed views', s: 'Starred on the live ticker. Never a subscription.', cta: 'Boost my ad' }
|
|
};
|
|
const TICK = '▲ FREE TRAFFIC THAT CONVERTS · ★ BOOSTED: ONE LINK FOR EVERY OFFER · ▲ BUILD A LIST WITH ZERO BUDGET · ▲ ';
|
|
function kitHtml(angle, shape, w, h) {
|
|
const a = ANG[angle]; const m = Math.min(w, h);
|
|
if (shape === 'tile') return `<body style="display:flex;flex-direction:column;justify-content:space-between;padding:9px;border:2px solid #ffb000"><div class="wm" style="font-size:15px">ViralAdBlitz</div><div class="wm" style="font-size:${angle === 'boost' ? 20 : 17}px;line-height:1.02">${angle === 'boost' ? '$' + C.boost.usd + ' = ' + views + ' views' : angle === 'free' ? 'Free text ad' : '5 levels deep'}</div><div class="mono amber" style="font-size:10px">viraladblitz.com</div></body>`;
|
|
if (shape === 'strip' || shape === 'leader') {
|
|
const big = shape === 'leader';
|
|
return `<body style="display:flex;align-items:center;gap:${big ? 18 : 10}px;padding:0 ${big ? 18 : 10}px;border-bottom:3px solid #ffb000"><div class="wm" style="font-size:${big ? 30 : 20}px;flex:0 0 auto">ViralAdBlitz</div><div style="flex:1;min-width:0"><div class="mono amber" style="font-size:${big ? 12 : 9}px;letter-spacing:1px">${a.k}</div><div class="wm" style="font-size:${big ? 24 : 15}px;line-height:1.05;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">${a.h}</div></div><div class="cta" style="font-size:${big ? 15 : 11}px;padding:${big ? '10px 14px' : '6px 8px'};flex:0 0 auto">${a.cta}</div></body>`;
|
|
}
|
|
if (shape === 'tower') return `<body style="display:flex;flex-direction:column"><div class="tick" style="font-size:11px;padding:6px 4px">${TICK}</div><div style="padding:14px;display:flex;flex-direction:column;gap:14px;flex:1"><div class="wm" style="font-size:24px">ViralAdBlitz</div><div class="mono amber" style="font-size:11px;letter-spacing:1px">${a.k}</div><div class="wm" style="font-size:28px;line-height:1.05">${a.h}</div><div style="font-size:14px;color:#b9c8bd;line-height:1.4">${a.s}</div><div class="paper" style="padding:10px;font-size:12px"><b style="font-family:'Playfair Display',serif;font-size:15px">Your headline</b><br>Your two lines. Your link.</div><div style="margin-top:auto"><div class="cta" style="font-size:14px;padding:10px 12px;width:100%;text-align:center">${a.cta}</div><div class="mono amber" style="font-size:10px;margin-top:8px;text-align:center">viraladblitz.com</div></div></div></body>`;
|
|
// box, social, square
|
|
const f = m / 250;
|
|
return `<body style="display:flex;flex-direction:column"><div class="tick" style="font-size:${Math.round(11 * f)}px;padding:${Math.round(6 * f)}px ${Math.round(8 * f)}px">${TICK + TICK}</div>
|
|
<div style="flex:1;padding:${Math.round(16 * f)}px;display:flex;flex-direction:column;gap:${Math.round(10 * f)}px;justify-content:center">
|
|
<div style="display:flex;align-items:baseline;gap:${Math.round(8 * f)}px"><span class="wm" style="font-size:${Math.round(20 * f)}px">ViralAdBlitz</span><span class="mono amber" style="font-size:${Math.round(9 * f)}px;border:1px solid #ffb000;padding:1px 4px">LIVE</span></div>
|
|
<div class="mono amber" style="font-size:${Math.round(10 * f)}px;letter-spacing:1px">${a.k}</div>
|
|
<div class="wm" style="font-size:${Math.round((shape === 'social' ? 30 : 26) * f)}px;line-height:1.04">${a.h}</div>
|
|
<div style="font-size:${Math.round(12 * f)}px;color:#b9c8bd;line-height:1.4">${a.s}</div>
|
|
<div style="display:flex;align-items:center;gap:${Math.round(10 * f)}px;margin-top:${Math.round(4 * f)}px"><span class="cta" style="font-size:${Math.round(12 * f)}px;padding:${Math.round(7 * f)}px ${Math.round(10 * f)}px">${a.cta}</span><span class="mono" style="font-size:${Math.round(10 * f)}px;color:#8fa89a">viraladblitz.com</span></div></div></body>`;
|
|
}
|
|
function proofHtml(variant) {
|
|
const bg = { amber: '#0a1712', cream: '#f4efe3', green: '#0b5d3b' }[variant]; const ink = variant === 'cream' ? '#13201a' : '#f4efe3'; const acc = variant === 'green' ? '#ffd166' : '#ffb000';
|
|
return `<body style="background:${bg};color:${ink};display:flex;flex-direction:column"><div class="tick" style="font-size:20px;padding:12px 16px">${TICK + TICK}</div>
|
|
<div style="flex:1;padding:48px 60px;display:flex;flex-direction:column;gap:22px;justify-content:center">
|
|
<div style="display:flex;align-items:baseline;gap:14px"><span style="font-family:'Playfair Display',serif;font-weight:900;font-size:64px;color:${ink}">ViralAdBlitz</span><span class="mono" style="font-size:18px;color:${acc};border:2px solid ${acc};padding:2px 8px">PAID ON-CHAIN</span></div>
|
|
<div style="font-family:'Playfair Display',serif;font-weight:900;font-size:58px;line-height:1.05">A Boost was just paid out on-chain</div>
|
|
<div class="mono" style="font-size:24px;color:${acc}">up to 5 sponsor levels x 10% · same transaction</div>
|
|
<div style="font-size:22px;opacity:.8">Every Boost and every payout: viraladblitz.com/ledger</div></div></body>`;
|
|
}
|
|
const ogHtml = () => `<body style="display:flex;flex-direction:column"><div class="tick" style="font-size:20px;padding:12px 16px">${TICK + TICK}</div><div style="flex:1;padding:56px 64px;display:flex;flex-direction:column;gap:20px;justify-content:center">
|
|
<div class="mono amber" style="font-size:22px;letter-spacing:3px">THE NETWORK'S TEXT AD WIRE</div><div class="wm" style="font-size:74px;line-height:1.02">Your ad runs on your whole team's pages. Five levels deep.</div>
|
|
<div style="display:flex;gap:18px;align-items:center"><span class="cta" style="font-size:26px;padding:14px 22px">Post your free text ad</span><span class="wm" style="font-size:36px">ViralAdBlitz</span></div></div></body>`;
|
|
const iconHtml = () => `<body style="display:flex;align-items:center;justify-content:center;background:#0a1712"><img src="data:image/svg+xml;base64,${Buffer.from(fs.readFileSync(path.join(ART, 'mark.svg'))).toString('base64')}" style="width:192px;height:192px"></body>`;
|
|
|
|
const browser = await chromium.launch(); let made = 0;
|
|
async function shot(html, w, h, out) {
|
|
const pg = await browser.newPage({ viewport: { width: w, height: h } });
|
|
await pg.setContent('<!doctype html><html><head><meta charset="utf-8">' + FONTS + '<style>' + BASE + '</style></head>' + html + '</html>', { waitUntil: 'networkidle' });
|
|
await pg.evaluate(() => document.fonts.ready); await pg.screenshot({ path: out, clip: { x: 0, y: 0, width: w, height: h } }); await pg.close(); made++;
|
|
}
|
|
await shot(iconHtml(), 192, 192, path.join(ART, 'icon-192.png'));
|
|
await shot(ogHtml(), 1200, 630, path.join(ART, 'og-share.png'));
|
|
for (const v of ['amber', 'cream', 'green']) await shot(proofHtml(v), 1200, 630, path.join(ART, 'proof', 'vab-proof-' + v + '.png'));
|
|
for (const angle of Object.keys(ANG)) for (const [shape, [w, h]] of Object.entries(SHAPES)) await shot(kitHtml(angle, shape, w, h), w, h, path.join(ART, 'kit', 'vab-' + angle + '-' + shape + '.png'));
|
|
await browser.close();
|
|
console.log(made + ' images rendered');
|