ViralAdBlitz v1 (viraladblitz.com rebuild, Marty approved 2026-11-14): the network's text-ad home, local build, not deployed
- 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>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
// My page: sign in (network or wallet), post or edit the one free text ad, the member's page link, their line, Boost delivery,
|
||||
// and what the contract has paid them.
|
||||
(async function () {
|
||||
VAB.renderNav('/my'); VAB.renderFooter(); VAB.wire('other').catch(() => {});
|
||||
const $ = VAB.$, esc = VAB.esc;
|
||||
const c = await VAB.getConfig().catch(() => ({}));
|
||||
const me = await VAB.getJSON('/api/me');
|
||||
if (!me.signedIn) {
|
||||
// signed in on InstantAdPay already? one quick hop there and back signs you in here too
|
||||
try { const ss = await VAB.getJSON('/api/sso/status'); if (ss && ss.check) { location.replace('/sso/start?mode=check&via=iap&to=' + encodeURIComponent('/my')); return; } } catch (e) {}
|
||||
$('signin').hidden = false;
|
||||
if (!c.sso) { $('viaIap').hidden = true; $('viaLs').hidden = true; }
|
||||
if (c.joinUrl) $('joinLink').href = c.joinUrl;
|
||||
$('viaWallet').onclick = async () => {
|
||||
try { VAB.status('Check your wallet for the sign-in message.'); await VABWallet.signIn(); location.reload(); }
|
||||
catch (e) { VAB.status(String(e && e.message || e).slice(0, 300), 'err'); }
|
||||
};
|
||||
return;
|
||||
}
|
||||
$('signout').onclick = async () => { await VAB.post('/api/auth/logout'); location.reload(); };
|
||||
const counter = (inp, out, max) => { const f = () => { out.textContent = inp.value.length + ' / ' + max; }; inp.addEventListener('input', f); f(); };
|
||||
const copyText = (t, b) => { try { navigator.clipboard.writeText(t); b.textContent = 'Copied'; setTimeout(() => { b.textContent = 'Copy my link'; }, 1400); } catch (e) {} };
|
||||
async function load() {
|
||||
const d = await VAB.getJSON('/api/my'); if (d.error) { VAB.status(d.error, 'err'); return; }
|
||||
$('dash').hidden = false;
|
||||
const a = d.ad; const lim = c.ad || { headline: 60, line: 90 };
|
||||
$('stats').innerHTML = '<div class="stat"><b>' + (d.username ? '@' + esc(d.username) : esc(VAB.short(d.address))) + '</b><span>' + (d.netVerified ? 'network member' : 'not in the network yet') + '</span></div>'
|
||||
+ '<div class="stat"><b>' + VAB.n(a ? a.views : 0) + '</b><span>verified views of your ad</span></div>'
|
||||
+ '<div class="stat"><b>' + VAB.n(a ? a.vclicks : 0) + '</b><span>verified clicks</span></div>'
|
||||
+ '<div class="stat"><b>' + VAB.polOf(d.earned && d.earned.wei) + '</b><span>POL paid to you by the contract</span></div>';
|
||||
$('pageCard').innerHTML = d.page
|
||||
? '<h2>Your page</h2><p>Share it anywhere. It shows your ad and the five people above you, and everyone who joins through it shows your ad on their page.</p><p class="mono" style="overflow-wrap:anywhere"><a id="pageLink" href="' + esc(d.page) + '" target="_blank" rel="noopener">' + esc(d.page) + '</a></p><div class="row"><button class="btn-line" type="button" id="copyPage">Copy my link</button><a class="btn-quiet" href="/promote">Promo kit</a></div>'
|
||||
: '<h2>Your page</h2><p>Your page address uses your network username. Sign in through InstantAdPay or LinkSpin once and it is set.</p>';
|
||||
if ($('copyPage')) $('copyPage').onclick = () => copyText(d.page, $('copyPage'));
|
||||
if (!d.netVerified) {
|
||||
$('adNote').innerHTML = 'Text ads are free for network members. This wallet is not in the network yet: <a href="' + esc(d.joinUrl) + '" target="_blank" rel="noopener">join InstantAdPay free</a>, link this wallet there, then sign in here through InstantAdPay.';
|
||||
$('adForm').hidden = true;
|
||||
} else {
|
||||
$('adForm').hidden = false;
|
||||
if (a) { $('adHead').textContent = 'Your text ad' + (a.status !== 'live' ? ' (' + a.status + ')' : ''); $('fHead').value = a.headline; $('fL1').value = a.line1; $('fL2').value = a.line2 || ''; $('fLink').value = a.link; $('adSave').textContent = 'Save changes'; }
|
||||
counter($('fHead'), $('cHead'), lim.headline); counter($('fL1'), $('cL1'), lim.line); counter($('fL2'), $('cL2'), lim.line);
|
||||
}
|
||||
$('line').innerHTML = (d.line || []).length ? '<p class="small">The people above you in the network, nearest first. Your page shows the first five who have an ad here.</p>'
|
||||
+ d.line.map(x => '<div class="kit-row"><span class="mono" style="color:var(--amber);width:84px">PLACE ' + x.depth + '</span><span style="flex:1">' + (x.username ? '@' + esc(x.username) : 'a member') + '</span><span class="pill' + (x.hasAd ? ' on' : '') + '">' + (x.hasAd ? 'ad live' : 'no ad yet') + '</span></div>').join('')
|
||||
: '<p class="small">' + (d.lineOk === false ? 'The network line could not be read just now. Try again in a minute.' : 'No sponsor line is known for you in the network yet.') + '</p>';
|
||||
$('boosts').innerHTML = (d.boosts || []).length ? d.boosts.map(b => '<div class="kit-row" style="flex-direction:column;align-items:stretch"><div style="display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap"><span>' + VAB.when(b.at) + ' · ' + VAB.n(b.views) + ' guaranteed views</span><span class="pill' + (b.status === 'delivered' ? ' done' : ' on') + '">' + esc(b.status.replace(/-/g, ' ')) + '</span></div>'
|
||||
+ '<div class="meter"><i style="width:' + Math.min(100, Math.round(b.delivered / b.views * 100)) + '%"></i></div><span class="small muted">' + VAB.n(b.delivered) + ' of ' + VAB.n(b.views) + ' delivered' + (b.nas ? ' (' + VAB.n(b.nas) + ' through Network Ad Space)' : '') + (b.dueAt && b.status === 'delivering' ? ' · on-site until ' + VAB.when(b.dueAt) : '') + '</span></div>').join('')
|
||||
: '<p class="small">No Boosts yet. A Boost is $' + (c.boost ? c.boost.usd : 5) + ' once and buys ' + VAB.n(c.boost ? c.boost.views : 500) + ' guaranteed network views for your ad.</p>';
|
||||
const ex = c.explorer || 'https://polygonscan.com';
|
||||
$('earned').innerHTML = (d.earned && d.earned.items.length) ? d.earned.items.map(x => '<div class="kit-row"><span class="small">' + VAB.when(x.at) + '</span><span style="flex:1">Level ' + x.level + ' share from ' + (x.buyerName ? '@' + esc(x.buyerName) : 'a Boost') + (x.failed ? ' (waiting in the contract for you to claim)' : '') + '</span><b class="mono">' + VAB.polOf(x.wei) + ' POL</b><a class="small" href="' + esc(ex) + '/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">verify</a></div>').join('')
|
||||
: '<p class="small">Nothing yet. The contract pays a level share in the same transaction when someone in your team buys a Boost, if you have bought one yourself. Advertising, not income. Nothing is promised.</p>';
|
||||
}
|
||||
$('adForm').addEventListener('submit', async e => {
|
||||
e.preventDefault(); $('adSave').disabled = true; VAB.status('Checking your link...');
|
||||
const r = await VAB.post('/api/my/ad', { headline: $('fHead').value, line1: $('fL1').value, line2: $('fL2').value, link: $('fLink').value });
|
||||
$('adSave').disabled = false;
|
||||
if (r.error) return VAB.status(r.error, 'err');
|
||||
VAB.status(r.created ? 'Posted. Your ad is live on your page and on your team\'s pages.' : 'Saved. Your ad shows the new text everywhere.', 'ok');
|
||||
load();
|
||||
});
|
||||
await load();
|
||||
})();
|
||||
Reference in New Issue
Block a user