Trust pack (Marty 2026-11-14): contract proof, live ledger, proof toasts, Telegram sale cards, legal pages, network footer.

- proof.js: /api/ledger (each VBBShop purchase with its split read from the receipt's Paid/PaymentFailed events, else the contract's fixed 30/10/60 math; weekly prize transfers with their transactions), /api/contract (owner, prize wallet, company, keeper, paused, orders, balance and owed, read live and cached 5 min; Sourcify exact match, Polygonscan pending).
- Telegram (CTB Rewards bot, payments topic, TG_TOKEN/TG_CHAT/TG_PAY_TOPIC same as Downline Banners): one photo card per purchase (prebuilt VBB proof image rotated, buyer, sponsor/prize/company split in POL, this week's purchases + prize pot, Polygonscan + ledger links) and one line per confirmed prize payout. Hooks: shop.setHook (newly credited purchases only) and prize.setHook (confirmed transfers); once per tx via an in-process guard plus docstore.claim; nothing older than 2 hours.
- Pages /contract, /ledger, /terms, /disclaimer (Earnings Disclaimer), /privacy (TrustClickz, real mechanics: advertising not income, same-transaction split, prize wallet holds the 10% until Monday, no refunds on-chain, one-time purchases, crypto risk, data incl. hashed visit checks and the network hub); sitemap.
- Footer: Terms, Earnings Disclaimer, Privacy, Contract, Ledger, Support, company line, 'Part of the network' from the hub (netsites.js, /api/network-sites, fallback list), VBB marked current. Toasts add purchases and prize payouts.
- tools/proof-art.mjs renders public/art/proof/vbb-proof-{pink,blue,yellow}.png. common.js?v=5, vbb.css?v=6.
chain.mjs 49/49 (real contract on anvil + stand-in Telegram: exact split, 2 cards, no repost on rescans, 6 prize lines). smoke 241/241.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-14 10:38:40 -06:00
parent d049c529ac
commit 2fe3d9e4c0
27 changed files with 685 additions and 27 deletions
+40
View File
@@ -0,0 +1,40 @@
// The network sites list for the footer's "Part of the network" line (Marty 2026-11-14 trust pack).
// One source: the hub's public GET /v1/network-sites (HUB_URL). Cached 10 minutes, refreshed in the background, never waits on a
// slow hub (2.5 s timeout), and falls back to the same built-in list. Never RM Circle, never the games.
// The same file lives in every network site (InstantAdPay, LinkSpin, Downline Banners, VBB, Stack POL).
const FALLBACK = [
{ id: 'iap', name: 'InstantAdPay', url: 'https://instantadpay.com' },
{ id: 'linkspin', name: 'LinkSpin', url: 'https://linkspin.app' },
{ id: 'dlb', name: 'Downline Banners', url: 'https://downlinebanners.com' },
{ id: 'vbb', name: 'Viral Banner Blitz', url: 'https://viralbannerblitz.com' },
{ id: 'stackpol', name: 'Stack POL', url: 'https://stackpol.com' },
{ id: 'earnerscorner', name: 'Earners Corner', url: 'https://earnerscorner.com' }
];
const TTL = 10 * 60 * 1000;
let cache = { at: 0, list: FALLBACK, from: 'fallback' };
let inflight = null;
const hubUrl = () => String(process.env.HUB_URL || 'https://hub.saasy.top').trim().replace(/\/+$/, '');
function clean(list) {
if (!Array.isArray(list)) return null;
const ok = list.filter(s => s && typeof s.name === 'string' && /^https:\/\/[a-z0-9.-]+(\/[^\s"'<>]*)?$/i.test(String(s.url || '')))
.slice(0, 30).map(s => ({ id: String(s.id || s.name).toLowerCase().replace(/[^a-z0-9]+/g, '').slice(0, 30), name: String(s.name).slice(0, 60), url: String(s.url).replace(/\/+$/, '') }));
return ok.length ? ok : null;
}
function refresh() {
if (inflight || process.env.NETWORK_SITES_HUB === '0') return inflight;
const ac = new AbortController(); const t = setTimeout(() => ac.abort(), 2500);
inflight = fetch(hubUrl() + '/v1/network-sites', { signal: ac.signal })
.then(r => (r.ok ? r.json() : null))
.then(j => { const l = clean(j); if (l) cache = { at: Date.now(), list: l, from: 'hub' }; else cache.at = Date.now(); })
.catch(() => { cache.at = Date.now() - TTL + 60 * 1000; }) // hub down: try again in a minute, keep the last good list
.finally(() => { clearTimeout(t); inflight = null; });
return inflight;
}
function list() { if (Date.now() - cache.at > TTL) refresh(); return cache.list; }
// GET /api/network-sites: public, cacheable, the same answer on every page
function handle(req, res) {
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'public, max-age=300', 'X-Content-Type-Options': 'nosniff' });
res.end(JSON.stringify(list()));
}
module.exports = { list, handle, refresh, FALLBACK, _state: () => cache };