Files
viraladsource/public/assets/adpage.js
T
Marty Bostick edaf98c8f6 ViralAdSource app (Marty approved 2026-11-16): free text ads that spread by reshares, each ad with its own family tree
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>
2026-11-16 09:19:34 -06:00

27 lines
2.1 KiB
JavaScript

// An ad through a reshare link (/s/<code>): the ad, whose branch it came through, "Reshare this ad" (the member's own unique link,
// under this one) and "Join free" for people new to the network. The visit counts as a verified view for that branch once seen.
(async function () {
const $ = VAS.$, esc = VAS.esc;
const code = (location.pathname.match(/^\/s\/([a-z0-9]{8})/) || [])[1];
const d = await VAS.wire('share', code).catch(() => ({}));
if (!d.ad) { $('adBox').innerHTML = '<p class="note err">' + esc(d.error || 'That ad is not running right now.') + ' <a href="/#board">See the board</a></p>'; $('reshareBox').hidden = true; return; }
const sh = d.share || {};
document.title = d.ad.headline + ' | ViralAdSource';
$('chain').textContent = sh.step > 0 ? 'Reshared by @' + (sh.resharer || 'a member') + ' · step ' + sh.step + ' from the source' + (sh.owner ? ' (@' + sh.owner + ')' : '')
: 'At the source' + (sh.owner ? ': @' + sh.owner + '\'s ad' : '');
$('adBox').innerHTML = VAS.adCard(d.ad, { big: true, place: 'share', share: sh.code });
VAS.featured($('featured'), d);
const out = (url, note) => {
$('reshareOut').innerHTML = '<div class="sharebox"><span>' + esc(url) + '</span><button class="btn sm" type="button" id="cp">Copy</button></div>' + (note ? '<p class="muted" style="font-size:14px;margin:8px 0 0">' + esc(note) + '</p>' : '');
$('cp').onclick = () => VAS.copy(url, $('cp'));
};
if (d.mine) out(d.mine.url, d.mine.own ? 'This is your own ad: this is its source link.' : 'Your reshare link for this ad.');
$('reshareBtn').onclick = async () => {
const me = await VAS.getJSON('/api/me'); if (!me.signedIn) { location.href = '/my?back=' + encodeURIComponent(location.pathname); return; }
const r = await VAS.post('/api/my/reshare', { adId: d.ad.id, from: sh.code });
if (r.error) return VAS.status(r.error, 'err');
out(r.url, r.own ? 'This is your own ad: share its source link.' : r.created ? 'Your new branch: step ' + r.step + ' from the source. Share this link anywhere.' : 'You already reshared this ad. Here is your link again.');
VAS.status('');
};
})();