diff --git a/public/assets/home.js b/public/assets/home.js index 4f13375..15b815f 100644 --- a/public/assets/home.js +++ b/public/assets/home.js @@ -1,149 +1,91 @@ -// Landing page: live ladder, buy buttons, sponsor attribution line. -(async function () { - await IAP.renderNav('home'); - const c = await IAP.getConfig(); - IAP.$('contractLink').href = c.explorer + '/address/' + c.contract; +// LinkSpin home (2026-10-07): the working demo (paste pages -> live spin link -> email to keep it), the live +// strip from /api/stats, the package credits from /api/catalog. Plain script, no libraries, CSP-clean. +(function () { + const $ = id => document.getElementById(id); + const fmt = n => Number(n || 0).toLocaleString(); + const q = new URLSearchParams(location.search); + const ref = q.get('ref') || ''; + // ?ref= on the home page rides along to /join so the sponsor cookie is set there (viral-link rule) + if (ref) document.querySelectorAll('[data-join]').forEach(a => { try { const u = new URL(a.getAttribute('href'), location.origin); u.searchParams.set('ref', ref); a.setAttribute('href', u.pathname + u.search); } catch (e) {} }); + // framed (traffic exchanges): open sign-in and the spin link in a new tab + const framed = (() => { try { return window.top !== window.self; } catch (e) { return true; } })(); + if (framed) document.querySelectorAll('a[data-join], a[href^="/contract"], a[href^="/ledger"]').forEach(a => { a.target = '_blank'; a.rel = 'noopener'; }); - const sp = await (await fetch('/api/sponsor')).json(); - if (sp.invited) { - const el = IAP.$('sponsorLine'); - el.hidden = false; - el.textContent = (sp.sponsorId ? 'You were invited by member #' + sp.sponsorId + '.' : 'You arrived through a member’s invite.') - + ' Your purchases pay their team, and your own link will do the same for you.'; - } + let CONFIG = null; + fetch('/api/config').then(r => r.json()).then(c => { CONFIG = c; if (c && c.contract && $('ftContract')) { $('ftContract').textContent = c.contract.slice(0, 6) + '…' + c.contract.slice(-4); } }).catch(() => {}); - async function loadLadder() { - const { products } = await (await fetch('/api/catalog')).json(); - const wrap = document.getElementById('tiles'); - wrap.innerHTML = ''; - const NAMES = { 1: 'Micro', 2: 'Activation', 3: 'Builder', 4: 'Growth', 5: 'Leader' }; - for (const p of products) { - const bonus = p.creditAmount - p.priceCents; // credits above 1cr/cent = bulk bonus - const div = document.createElement('div'); - div.className = 'tile' + (p.priceCents === 5000 ? ' hot' : ''); - div.innerHTML = '
' + (NAMES[p.id] || 'Package ' + p.id) + '
' - + '
$' + Math.round(p.priceCents / 100) + '
' - + '
' + p.creditAmount.toLocaleString() + ' credits
' - + '
' + (bonus > 0 ? '+' + bonus.toLocaleString() + ' bonus credits' : ' ') + '
' - + '
' + (p.costWei ? IAP.fmtPol(p.costWei) + ' POL right now' : 'paused') + '
' - + ''; - wrap.appendChild(div); - } - wrap.querySelectorAll('button[data-id]').forEach(b => b.addEventListener('click', () => buyPack(b))); - } - async function buyPack(btn) { + // live strip + fetch('/api/stats').then(r => r.json()).then(s => { + $('stServed').textContent = fmt(s.servedToday); + $('stMembers').textContent = fmt(s.onchainMembers); + $('stPackages').textContent = fmt(s.purchases); + const pol = Number(BigInt(String(s.paidInWei || '0')) / 10000000000000000n) / 100; // two decimals of POL + $('stPol').textContent = pol.toLocaleString(undefined, { maximumFractionDigits: 2 }); + $('stHealth').textContent = 'healthy'; $('stDot').className = 'dot'; + }).catch(() => { $('stHealth').textContent = 'offline'; $('stDot').className = 'dot off'; }); + + // package credits from the catalog (flat credits = cents, Marty 2026-10-07) and the example POL figure + fetch('/api/catalog').then(r => r.json()).then(c => { + const by = {}; (c.products || []).forEach(p => { by[p.priceCents] = p; }); + document.querySelectorAll('#pkgGrid .cr').forEach(el => { const p = by[Number(el.dataset.cr)]; el.textContent = p ? fmt(p.creditAmount) + ' credits' : fmt(Number(el.dataset.cr)) + ' credits'; }); + const hundred = by[10000]; + if (hundred && hundred.costWei) { const pol = Number(BigInt(String(hundred.costWei)) / 10000000000000000n) / 100; $('exPol').textContent = pol.toFixed(2); } + else $('exPol').textContent = '[live]'; + }).catch(() => {}); + + // the demo + const form = $('demoForm'), err = $('demoErr'), out = $('demoOut'); + const showErr = (el, m) => { el.textContent = m; el.hidden = !m; }; + let demoUrl = ''; + form.addEventListener('submit', async ev => { + ev.preventDefault(); showErr(err, ''); + const urls = ['d1', 'd2', 'd3'].map(id => $(id).value.trim()).filter(Boolean); + const bad = urls.find(u => !/^https?:\/\/[^\s]+\.[^\s]+$/i.test(u)); + if (!urls.length) return showErr(err, 'Paste at least one page address.'); + if (bad) return showErr(err, 'Addresses need to start with https:// (check: ' + bad.slice(0, 40) + ')'); + $('spinBtn').disabled = true; try { - btn.disabled = true; - // email members get their wallet linked to the account at buy time - const me = await (await fetch('/api/me')).json(); - if (me.signedIn && me.email && !me.address) { - IAP.status('First, a free signature links your wallet to your account…'); - await IAPWallet.signIn(); - } - IAP.status('Confirm the purchase in your wallet…'); - // resolve the sponsor at buy time: a code referrer who activated since - // page load still gets locked in - const spNow = await (await fetch('/api/sponsor')).json(); - const r = await IAPWallet.buy(Number(btn.dataset.id), spNow.sponsorId || 0, btn.dataset.cost); - if (r.receipt.status !== '0x1') throw new Error('Transaction reverted. Check the explorer.'); - IAP.status('Purchase settled on-chain. Credits are yours, payouts delivered. Watch it on the ledger.', 'ok'); - IAP.refreshNavWallet(); - } catch (e) { - IAP.status('Purchase failed: ' + (e.message || e), 'bad'); - } finally { btn.disabled = false; } - } - async function loadStats() { - try { - const s = await (await fetch('/api/stats')).json(); - IAP.$('stMembers').textContent = (s.onchainMembers || 0).toLocaleString(); - IAP.$('stPurchases').textContent = (s.purchases || 0).toLocaleString(); - IAP.$('stPaid').textContent = IAP.fmtPol(s.paidInWei || '0'); - IAP.$('stPayouts').textContent = (s.payouts || 0).toLocaleString(); - } catch (e) {} - } - async function loadTicker() { - try { - const { events } = await (await fetch('/api/feed?n=30')).json(); - if (!events.length) return; - const inner = IAP.$('tickerInner'); - inner.innerHTML = events.map(ev => '' + IAP.describeEvent(ev, c) + '').join(''); - IAP.$('ticker').hidden = false; - // readable pace (Marty, 2026-09-12): about 70 px per second no matter how much text is loaded, - // instead of a fixed 42 s for the whole strip; pause while a finger or pointer rests on it - const wrap = IAP.$('ticker'); - const secs = Math.max(30, Math.round((inner.scrollWidth + wrap.clientWidth) / 70)); - inner.style.animationDuration = secs + 's'; - const pause = on => { inner.style.animationPlayState = on ? 'paused' : 'running'; }; - wrap.addEventListener('mouseenter', () => pause(true)); wrap.addEventListener('mouseleave', () => pause(false)); - wrap.addEventListener('touchstart', () => pause(true), { passive: true }); wrap.addEventListener('touchend', () => pause(false), { passive: true }); - } catch (e) {} - } - // level cycler: chips + generation highlighting + auto-advance - const LVL = { - 1: { pct: '50%', desc: 'Activate with the $20 starter package and switch on payouts from your wallet. From then on your direct referrals each pay you 50 percent of every package they ever buy, in POL, straight to your wallet. Until you activate, you earn ad credits, not POL.' }, - 2: { pct: '20%', desc: 'Bring 2 buyers of $20 or more and level 2 unlocks: 20 percent of every package your referrals’ referrals buy, on every purchase, forever.' }, - 3: { pct: '10%', desc: 'At 5 qualifying buyers, level 3 opens the third generation: 10 percent of everything they buy. Eight positions deep in this picture, and it keeps growing.' } - }; - const viz = document.getElementById('genViz'); - if (viz) { - const chips = [...document.querySelectorAll('.chips [data-lvl]')]; - const setLvl = n => { - viz.dataset.lvl = n; - document.getElementById('vizPct').textContent = LVL[n].pct; - document.getElementById('lvlDesc').textContent = LVL[n].desc; - chips.forEach(ch => ch.classList.toggle('on', ch.dataset.lvl === String(n))); - }; - let cur = 1; - let auto = null; - if (!matchMedia('(prefers-reduced-motion: reduce)').matches) { - auto = setInterval(() => { cur = cur % 3 + 1; setLvl(cur); }, 4200); - } - chips.forEach(ch => ch.addEventListener('click', () => { - if (auto) { clearInterval(auto); auto = null; } // a click takes the wheel - cur = Number(ch.dataset.lvl); - setLvl(cur); - })); - } + const r = await (await fetch('/api/demo/spin', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ urls }) })).json(); + if (r.error) throw new Error(r.error); + demoUrl = r.url; $('demoLink').textContent = r.url.replace(/^https:\/\//, ''); $('openBtn').href = r.url; + $('demoMeta').textContent = r.destinations + (r.destinations === 1 ? ' page' : ' pages') + ' · equal shares · live'; + form.hidden = true; out.hidden = false; out.style.display = 'flex'; + $('em').focus(); + } catch (e) { showErr(err, e.message); } + finally { $('spinBtn').disabled = false; } + }); + $('copyBtn').addEventListener('click', () => { + const done = () => { $('copyBtn').textContent = 'Copied'; setTimeout(() => { $('copyBtn').textContent = 'Copy'; }, 1800); }; + try { navigator.clipboard.writeText(demoUrl).then(done, () => { window.prompt('Copy your link', demoUrl); }); } catch (e) { window.prompt('Copy your link', demoUrl); } + }); - // what-if calculator: pure arithmetic on the locked constants - const dc = document.getElementById('dcDirects'); - if (dc) { - const $id = x => document.getElementById(x); - const usd = n => '$' + n.toLocaleString(undefined, { maximumFractionDigits: 2 }); - const recalc = () => { - const d = Number($id('dcDirects').value); - const p = Number($id('dcPkg').value); - const r = Number($id('dcSpread').value); - $id('dcDirectsV').textContent = d; - $id('dcSpreadV').textContent = r; - const qualifies = p >= 20; // sub-$20 packages never count toward qualification - const l2open = qualifies && d >= 2; - const l3open = qualifies && d >= 5; - const g2 = d * r, g3 = g2 * r; - const e1 = d * p * 0.5; - const e2 = l2open ? g2 * p * 0.2 : 0; - const e3 = l3open ? g3 * p * 0.1 : 0; - $id('dcN1').textContent = d; $id('dcN2').textContent = g2; $id('dcN3').textContent = g3; - $id('dcE1').textContent = usd(e1); - $id('dcE2').textContent = l2open ? usd(e2) : 'passes up'; - $id('dcE3').textContent = l3open ? usd(e3) : 'passes up'; - $id('dcTotal').textContent = usd(e1 + e2 + e3); - const setB = (el, open, need) => { el.textContent = open ? 'open' : 'locked: ' + need; el.className = 'badge' + (open ? '' : ' amber'); }; - setB($id('dcB1'), true, ''); - setB($id('dcB2'), l2open, qualifies ? (2 - d) + ' more buyer(s)' : 'needs $20+ buyers'); - setB($id('dcB3'), l3open, qualifies ? (5 - d) + ' more buyer(s)' : 'needs $20+ buyers'); - $id('dcQualNote').textContent = qualifies - ? 'Buyers of $20 or more count toward your qualification. 2 unlock level 2, 5 unlock level 3.' - : 'Heads up: $5 packages pay your level 1 but do not qualify buyers, so levels 2 and 3 stay locked in this scenario.'; - }; - ['dcDirects', 'dcPkg', 'dcSpread'].forEach(x => $id(x).addEventListener('input', recalc)); - recalc(); - } - - IAP.adSlot('banner', 'adSlotHome'); - loadLadder(); - loadStats(); - loadTicker(); - setInterval(loadStats, 60000); + // keep it: the engine's email-code door; the ls.demo cookie set by /api/demo/spin claims the spin on verify + const keep = $('keepForm'), kerr = $('keepErr'); const fts = Date.now(); + keep.addEventListener('submit', async ev => { + ev.preventDefault(); showErr(kerr, ''); + const email = $('em').value.trim(); + if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email)) return showErr(kerr, 'That email address does not look right.'); + $('keepBtn').disabled = true; + try { + const r = await (await fetch('/api/auth/email/start', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, fts, hp_field_x9: $('hp_field_x9').value, pick: null }) })).json(); + if (r.error) throw new Error(r.error); + $('codeRow').hidden = false; $('codeRow').style.display = 'flex'; $('keepBtn').textContent = 'Send again'; + if (r.devCode) $('code').value = r.devCode; + $('code').focus(); + } catch (e) { showErr(kerr, e.message); } + finally { $('keepBtn').disabled = false; } + }); + $('verifyBtn').addEventListener('click', async () => { + showErr(kerr, ''); + const email = $('em').value.trim(), code = $('code').value.trim(); + if (code.length < 6) return showErr(kerr, 'Enter the six digits from the email.'); + $('verifyBtn').disabled = true; + try { + const r = await (await fetch('/api/auth/email/verify', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, code, followups: true }) })).json(); + if (r.error) throw new Error(r.error); + const dest = '/links'; + if (framed) window.open(dest, '_blank', 'noopener'); else location.href = dest; + } catch (e) { showErr(kerr, e.message); } + finally { $('verifyBtn').disabled = false; } + }); })(); diff --git a/public/assets/pub.css b/public/assets/pub.css new file mode 100644 index 0000000..a243cef --- /dev/null +++ b/public/assets/pub.css @@ -0,0 +1,164 @@ +/* LinkSpin public pages (home, join, contract, legal), Instrument scheme (Marty approved the boards 2026-10-07). + Same tokens as cr.css (the Control Room): light workspace on a blueprint dot grid, dark chrome header and + footer, blue does the everyday work, signal orange marks the one action on a screen. Nothing from the + InstantAdPay clone (sapphire glow, mint, circuit texture) is in here. */ +:root{ + --bg:#E9EEF5; --panel:#FFFFFF; --panel-2:#F3F6FB; --line:#CDD7E5; --line-strong:#AEBED4; + --ink:#0F1B2E; --ink-2:#324361; --muted:#66768F; + --accent:#1F6FEB; --accent-hi:#0B4BB3; --accent-dim:#7CB2FF; --accent-soft:#E1ECFC; + --sig:#FF6A1A; --sig-2:#D9530A; --sig-soft:#FFE9DC; + --ok:#0E8A5C; --ok-soft:#DDF4E8; --warn:#C2410C; --warn-soft:#FFE7D8; --bad:#B91C1C; --hi-row:#FFF3EA; + --chrome:#0B1424; --chrome-2:#101D33; --chrome-ink:#EEF3FA; --chrome-sub:#8CA2C4; --chrome-line:#1E2E4A; --inset:#0F1B2E; + --sh:0 10px 24px -18px rgba(15,27,46,.45),0 1px 0 rgba(255,255,255,.9) inset; + --display:"Rajdhani","Segoe UI",system-ui,sans-serif; --body:"Manrope","Segoe UI",system-ui,sans-serif; --mono:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace; + color-scheme:light; +} +*{box-sizing:border-box} +html{scroll-behavior:smooth} +body{margin:0;min-height:100vh;display:flex;flex-direction:column;background:var(--bg);background-image:radial-gradient(circle,rgba(31,111,235,.20) 1px,transparent 1.3px),radial-gradient(120% 60% at 50% 0%,rgba(255,255,255,.6),transparent 60%);background-size:18px 18px,100% 100%;background-attachment:fixed;color:var(--ink);font:15px/1.5 var(--body)} +a{color:var(--accent-hi)} a:hover{color:var(--accent)} +button,input,select,textarea{font:inherit;color:inherit} +:focus-visible{outline:2px solid var(--sig);outline-offset:2px} +[hidden]{display:none!important} +.wrap{max-width:1180px;margin:0 auto;padding:0 20px;width:100%} +.disp{font-family:var(--display);font-weight:700;letter-spacing:.04em;text-transform:uppercase} +.mono{font-family:var(--mono);font-variant-numeric:tabular-nums} +.muted{color:var(--muted)} .ink2{color:var(--ink-2)} +.eyebrow{font:700 11px var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--muted)} + +/* chrome: header + footer */ +.top{position:relative;background:linear-gradient(180deg,var(--chrome-2),var(--chrome));border-bottom:1px solid var(--chrome-line);color:var(--chrome-ink)} +.top::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:1px;background:linear-gradient(90deg,var(--accent) 0,var(--sig) 28%,transparent 60%)} +.top .wrap{min-height:64px;display:flex;align-items:center;gap:22px;flex-wrap:wrap;padding-top:8px;padding-bottom:8px} +.brand{display:inline-flex;align-items:center;gap:10px;text-decoration:none;color:var(--chrome-ink)} +.brand .mark{position:relative;width:26px;height:26px;border-radius:50%;border:3px solid var(--accent);border-right-color:transparent;display:inline-block;flex:none} +.brand .mark::after{content:"";position:absolute;right:-5px;top:-3px;width:8px;height:8px;border-radius:50%;background:var(--sig);box-shadow:0 0 0 3px rgba(255,106,26,.25)} +.brand .word{font-family:var(--display);font-weight:700;font-size:22px;letter-spacing:.12em;text-transform:uppercase} +.brand .word b{color:#8CC8FF;font-weight:700} +.nav{display:flex;gap:18px;flex-wrap:wrap;margin-left:12px} +.nav a{color:var(--chrome-sub);text-decoration:none;font-weight:700;font-size:13px;padding:6px 0} +.nav a:hover{color:var(--chrome-ink)} +.top .grow,.foot .grow{flex:1} +.foot{background:var(--chrome);border-top:1px solid var(--chrome-line);color:var(--chrome-sub);margin-top:auto} +.foot .wrap{padding-top:22px;padding-bottom:22px;display:flex;gap:18px;flex-wrap:wrap;align-items:center;font-size:12px} +.foot a{color:var(--chrome-sub);text-decoration:none} +.foot a:hover{color:var(--chrome-ink)} +.foot .word{font-family:var(--display);font-weight:700;font-size:16px;letter-spacing:.12em;text-transform:uppercase;color:var(--chrome-ink)} +.foot .word b{color:#8CC8FF} + +/* controls */ +.btn{font:700 13px var(--body);letter-spacing:.04em;padding:10px 16px;border-radius:7px;border:1px solid var(--line-strong);background:linear-gradient(180deg,#FFFFFF,#F3F6FB);color:var(--ink);display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;cursor:pointer;min-height:44px;box-shadow:0 1px 0 rgba(255,255,255,.9) inset,0 1px 2px rgba(15,27,46,.08);white-space:nowrap} +.btn:hover{border-color:var(--accent);color:var(--ink)} +.btn.pri{font-family:var(--display);font-size:16px;letter-spacing:.08em;text-transform:uppercase;background:linear-gradient(180deg,#FF7A32,var(--sig));border-color:var(--sig-2);color:#fff;box-shadow:0 8px 18px -10px rgba(255,106,26,.9),0 1px 0 rgba(255,255,255,.35) inset} +.btn.pri:hover{background:linear-gradient(180deg,#FF8A48,var(--sig));color:#fff} +.btn.blue{background:linear-gradient(180deg,#3A83F0,var(--accent));border-color:var(--accent-hi);color:#fff;box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset} +.btn.blue:hover{color:#fff} +.btn.ghost{background:transparent;box-shadow:none;border-color:var(--chrome-line);color:var(--chrome-ink)} +.btn.ghost:hover{color:#fff;border-color:var(--chrome-sub)} +.btn[disabled]{opacity:.55;cursor:default} +.field{border:1px solid var(--line-strong);border-radius:6px;padding:10px 12px;background:#FFF;font:500 13px var(--mono);color:var(--ink);box-shadow:0 1px 2px rgba(15,27,46,.06) inset;width:100%;min-height:44px} +.field:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px rgba(255,106,26,.18)} +.lbl{display:grid;gap:5px;font:700 10.5px var(--body);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)} +.led{display:inline-flex;align-items:baseline;gap:10px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;padding:10px 14px;color:var(--chrome-sub);font:500 12px var(--mono);max-width:100%;overflow-wrap:anywhere} +.led b{font-family:var(--display);font-size:22px;line-height:1;color:var(--sig);letter-spacing:.04em;font-weight:700} +.led .k{font-size:10px;letter-spacing:.1em;text-transform:uppercase} +.tag{display:inline-flex;align-items:center;gap:5px;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:4px;border:1px solid var(--line-strong);color:var(--ink-2);background:var(--panel-2)} +.tag.ok{border-color:rgba(14,138,92,.4);color:var(--ok);background:var(--ok-soft)} +.tag.warn{border-color:rgba(194,65,12,.4);color:var(--warn);background:var(--warn-soft)} +.tag.t{border-color:var(--accent-soft);background:var(--accent-soft);color:var(--accent-hi)} +.note{font-size:12px;color:var(--muted);line-height:1.5} +.err{font-size:13px;color:var(--bad);font-weight:700} + +/* surfaces */ +.tile,.panel{position:relative;background:linear-gradient(180deg,#FFFFFF,#F6F8FC);border:1px solid var(--line);border-radius:8px;box-shadow:var(--sh);min-width:0} +.panel{background:var(--panel)} +.tile::before,.tile::after{content:"";position:absolute;width:11px;height:11px;border:1.5px solid var(--line-strong);pointer-events:none} +.tile::before{top:5px;left:5px;border-right:0;border-bottom:0}.tile::after{bottom:5px;right:5px;border-left:0;border-top:0} +.tile.hi{background:linear-gradient(180deg,#FFFFFF,#EEF4FE)}.tile.hi::before,.tile.hi::after{border-color:var(--sig)} +.ph{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,#EEF2F9 0 6px,#F5F7FC 6px 12px);border-radius:8px 8px 0 0} +.ph h3,.ph h2{font-family:var(--display);font-weight:700;font-size:14px;letter-spacing:.1em;text-transform:uppercase;margin:0;display:flex;align-items:center;gap:8px} +.ph h3::before,.ph h2::before{content:"";width:8px;height:8px;background:var(--sig);transform:rotate(45deg);display:inline-block;flex:none} +.ph .meta{font:500 10.5px var(--mono);color:var(--muted);letter-spacing:.04em} +.pb{padding:16px 18px 18px} +.bar{height:6px;background:var(--line);border-radius:3px;overflow:hidden}.bar i{display:block;height:100%;background:linear-gradient(90deg,var(--accent-hi),var(--accent))} +.split{display:flex;height:14px;border-radius:4px;overflow:hidden;background:var(--line)}.split i{display:block;height:100%} +.ico{width:22px;height:22px;stroke:var(--accent);fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none} +.check{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--ink-2)} +.dot{width:7px;height:7px;border-radius:50%;background:var(--ok);display:inline-block;margin-right:8px;box-shadow:0 0 0 3px rgba(14,138,92,.22);animation:pulse 2.4s ease-in-out infinite} +.dot.off{background:var(--muted);animation:none;box-shadow:none} +@keyframes pulse{0%,100%{box-shadow:0 0 0 3px rgba(14,138,92,.22)}50%{box-shadow:0 0 0 5px rgba(14,138,92,.08)}} +@media (prefers-reduced-motion:reduce){.dot{animation:none}} + +/* page sections */ +.hero{padding:56px 0 28px} +.hero .wrap{display:flex;gap:40px;flex-wrap:wrap;align-items:flex-start} +.hero .copy{flex:1 1 440px;min-width:0;display:flex;flex-direction:column;gap:18px} +.hero h1{margin:0;font-size:54px;line-height:1.02;letter-spacing:.03em} +.hero h1 em{font-style:normal;color:var(--accent-hi)} +.hero .lede{margin:0;font-size:17px;color:var(--ink-2);max-width:52ch} +.hero .demo{flex:1 1 420px;min-width:0;max-width:520px} +.ctas{display:flex;gap:12px;flex-wrap:wrap;align-items:center} +.checks{display:flex;gap:18px;flex-wrap:wrap;margin-top:6px} +.strip{background:var(--chrome);border-top:1px solid var(--chrome-line);border-bottom:1px solid var(--chrome-line);margin-top:24px;color:var(--chrome-sub)} +.strip .wrap{padding-top:12px;padding-bottom:12px;display:flex;gap:26px;align-items:center;flex-wrap:wrap;font:500 11px var(--mono);letter-spacing:.03em} +.strip b{color:var(--chrome-ink);font-weight:700} +.strip a{color:var(--sig);font-weight:700;text-decoration:none} +.sec{padding:52px 0 20px} +.sec .wrap{display:flex;flex-direction:column;gap:18px} +.sec-h{display:flex;align-items:baseline;gap:16px;flex-wrap:wrap} +.sec h2{margin:0;font-size:34px} +.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px} +.grid6{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px} +.card{padding:20px 22px 22px;display:flex;flex-direction:column;gap:10px} +.card h3{margin:0;font-size:22px} +.card p{margin:0;color:var(--ink-2)} +.card .ico{width:28px;height:28px} +.card .foot-row{margin-top:auto;display:flex;gap:6px;flex-wrap:wrap} +.two{display:flex;gap:28px;flex-wrap:wrap;align-items:flex-start} +.two > *{flex:1 1 380px;min-width:0} +.two .text{display:flex;flex-direction:column;gap:14px} +.two .text p{margin:0;color:var(--ink-2);font-size:16px} +.two .text ul{margin:0;padding-left:18px;color:var(--ink-2);display:flex;flex-direction:column;gap:6px} +.pkg{padding:16px 14px;display:flex;flex-direction:column;gap:6px} +.pkg .k{font:700 10px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted)} +.pkg.hi .k{color:var(--sig-2)} +.pkg .price{font-family:var(--display);font-weight:700;font-size:34px;line-height:1;letter-spacing:.02em} +.pkg.hi .price{color:var(--accent-hi)} +.pkg .cr{font-size:12px;color:var(--ink-2)} +.ledger{background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;color:var(--chrome-sub);font:500 11px var(--mono);padding:10px 12px;line-height:1.6;overflow-x:auto} +.ledger .b{color:#8CC8FF}.ledger .s{color:var(--sig)} +.amts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:6px} +.amts div{display:flex;gap:10px;align-items:baseline} +.amts .n{font:700 22px var(--mono)} +.amts span:last-child{font-size:13px;color:var(--ink-2)} +.last{padding:44px 0 64px} +.last .wrap{display:flex;gap:28px;flex-wrap:wrap;align-items:center} +.last > .wrap > *{flex:1 1 380px;min-width:0} +.last h2{margin:0;font-size:30px} +.last p{margin:0;color:var(--ink-2)} + +/* legal / long-form pages */ +.doc{max-width:820px;margin:0 auto;padding:44px 20px 64px;width:100%} +.doc h1{font-size:42px;margin:0 0 10px;line-height:1.04} +.doc h2{font-size:24px;margin:30px 0 8px} +.doc p,.doc li{color:var(--ink-2)} +.doc .panel{margin-top:18px} + +@media (max-width:980px){ + .grid3{grid-template-columns:1fr} + .grid6{grid-template-columns:repeat(3,minmax(0,1fr))} + .hero h1{font-size:42px} + .sec h2{font-size:28px} +} +@media (max-width:640px){ + .wrap{padding:0 16px} + .hero{padding-top:32px} + .hero h1{font-size:34px} + .hero .lede{font-size:16px} + .grid6{grid-template-columns:repeat(2,minmax(0,1fr))} + .nav{display:none} + .btn.pri{font-size:15px} + .strip .wrap{gap:12px 18px} + .amts{grid-template-columns:1fr} + .doc h1{font-size:32px} +} diff --git a/public/banners/linkspin-og-1200x630.png b/public/banners/linkspin-og-1200x630.png new file mode 100644 index 0000000..4c6ed2c Binary files /dev/null and b/public/banners/linkspin-og-1200x630.png differ diff --git a/public/index.html b/public/index.html index ba02beb..c18983c 100644 --- a/public/index.html +++ b/public/index.html @@ -2,488 +2,214 @@ -LinkSpin: advertise and earn, locked in code - +LinkSpin: one link, every page you promote + - - - - - + + + + - - - - - + + + + + + - + -
-
- -
- - - - - - +
-

Advertise and earn instantly.
Locked in code, not promises.

-

Buy real ad packages from 5 to 250 dollars. Every purchase settles through - a smart contract you can read yourself, and your earnings land in - your own wallet before the page even refreshes.

-

One crypto, one network: packages are paid in POL on Polygon and every payout arrives as POL in your wallet. Buy POL with a card inside if you have never held any.

- - -
-
–
On-chain members
-
–
Packages bought
-
–
POL settled
-
–
Instant payouts
-
-

every number above is read from the blockchain, not a marketing database

+ LinkSpin + + + Sign in + Start free
-
+ - - -
+
-
-

Instant payments without compromise

-

Most referral programs run on a database someone can change after you promote. - This one runs on Polygon, split by a contract nobody can touch. Not even us.

+
+ Rotator · pages · ad zones · paid on-chain +

One link.
Every page you promote,
in turn.

+

Paste the pages you are promoting. LinkSpin gives you one short link that rotates between them, counts every real click, drops the bots, and shows you which page converts. Free to use. No wallet needed to start.

+ +
+ Bots filtered on the server + Click ids pass through + Your own short domain +
-
-
-
-

Paid in the same transaction

-

The purchase and every payout are one blockchain event. No balances held, no withdrawal - button, no company touching the money.

-
-
-
-

Rules that cannot move

-

50-20-10 across three levels plus a 20 percent platform fee, written as constants in an - immutable contract. There is no function to change them.

-
-
-
-

Verifiable by anyone

-

Every payment streams to a public ledger with a verify link straight to the block explorer. - If it is not there, it did not happen.

+ +
+

Try it, no account

up to 3 pages · equal shares
+
+ + + +
+ + Your link is live the second you press it. +
+ +
+
-
+
-
-

Why this is not another ad site

-

You have seen traffic exchanges, click-to-earn sites and solo-ad sellers. Here is the honest side by side.

-
-
- - - - - - - - - - -
Typical advertising siteLinkSpin
Referral commission5 to 15 percent, often only after a minimum balance50 percent to the direct sponsor, then 20 and 10 on the next two levels
When you get paidRequest a withdrawal, wait for approval, hopeIn the same transaction the package sells
Who holds the moneyThe site's balance, at the owner's discretionNobody. The contract splits it to real wallets. There is no balance to hold
Can the rules changeWhenever the owner edits a settingNever. 50 / 20 / 10 / 20 are constants in a verified, immutable contract
ProofA number on a dashboardEvery payout is a public transaction you can open yourself
Ad viewsTimers that run while nobody looksA 10-second dwell, a human check, and a server-side clock
CreditsPoints that expire or get devalued1 credit = 1 cent of delivery, recorded on-chain, spent only by your campaigns
JoiningInstall an app, connect a wallet, then maybe readEmail first. The wallet comes when you are ready to be paid
AdvertisingPay to be seen by people who are paid to clickSeven formats delivered to members who buy ads themselves, with verified visits and finished video views
-

No income is guaranteed. Results depend on your effort. Cryptocurrency involves risk of loss. LinkSpin sells advertising; it is not an investment.

+ rotator checking + links served today · + members on-chain · + packages bought · + POL settled · + + every number is read from Polygon, not a database →
-
+
-
-

Watch the money move

-

This is a live view, not a brochure. Real purchases split into real payouts, - each one a click away from the raw transaction.

+

What you get, free

no package required
+
+ +
+ +

Pages

+

Point us at any offer. We read its headline and points, you add one line of angle, and you get a bridge, review or squeeze page on your link domain. Leads are yours: list, CSV, webhook.

+
bridgereviewsqueezeleads: yours
+
+
+ +

Zones

+

One script tag puts an ad slot on your own site. It shows member ads first, then network ads, and pays you ad credits for every viewable impression. Five sizes.

+
728×90300×250160×600468×60320×50
+
-
-
-
-
-

Buy a package

-

Priced in dollars, settled in POL at the live oracle rate. Overpayment refunds itself in the same transaction.

-
-
-
-

The contract splits it

-

Half to the direct sponsor, then levels 2 and 3, then the platform. Automatically, immediately, every time.

-
-
-
-
{{SITE_HOST}}/ledger
-
-
🧾 member #7 bought package #2 ($20.00)−213 POL
-
💸 level 1 payout → member #3+106.5 POL
-
💸 level 2 payout → member #2+42.6 POL
-
💸 level 3 payout → member #1+21.3 POL
-
🏛 platform fee settled42.6 POL
-
⭐ member #3 now has 2 qualifying buyerslevel 2 ✓
-
-
-
-
-
-

Straight to their wallets

-

Recipients get POL in their own wallets within seconds. Nothing to claim, nothing to request.

-
-
-
-

Credits mint on-chain

-

One credit is one cent of ad delivery across the network. Only your campaigns can ever spend them.

-
-
-
-

Amounts shown are the $20 worked example at the current oracle rate. Open the real ledger →

-
+
-
-
- - - - - - - - - - - - - - - - - - - 50% - - - - - - - - - - - - - - - - - - - - - -
-
-

Earn deeper as your people buy

-

Levels unlock by performance, never by payment. Refer buyers, and their - shares of every future purchase route to you automatically.

-
- - - -
-

Activate with the $20 starter package and switch on payouts from your wallet. From then on your direct referrals each pay you 50 percent of every package they ever buy, in POL, straight to your wallet. Until you activate, you earn ad credits, not POL.

-
    -
  • No withdrawal requests, ever. Every payment sends straight to your wallet.
  • -
  • Unqualified shares visibly pass up to the next qualified person
  • -
  • Qualification never expires and can never be bought
  • +
    +
    +

    Advertise, and get paid the moment your people do

    +

    Members buy ad packages to run banner, text and login ads across the viewer, every member zone and the partner network. Each purchase is split in the same transaction on Polygon. Nothing is held. Nothing is promised later. The contract is public and cannot be changed.

    +
      +
    • Your direct sponsor gets half of every package you buy, instantly.
    • +
    • Level 2 opens after two of your people buy a $20 or larger package. Level 3 after five.
    • +
    • A share with no qualified member passes up the line, then to the platform. It never waits in a balance.
    • +
    • The $10 door is for trying the ads. It does not count toward opening levels, and we say so.
    +
    -
    -
-
- -
-
-
-

Real ad inventory. Real eyeballs.

-

This is not phantom traffic or empty impressions. Seven ad formats run right now, - reaching members who are themselves marketers buying traffic — and members earn credits back - for the attention they give.

-
-
-
-
-

Display banners live

-

All standard sizes, live across our network, priced per impression. You pay for views, not guesses.

-
-
-
-

Text ads live

-

A headline plus a support line, placed where members actually look. Also per impression, also live right now.

-
-
-
-

Login ads live

-

The moment a member signs in, your ad is the toll gate: they open your page in a fresh tab - while a countdown holds their dashboard. Just a link is enough — add a banner if you have - one. Priced per day.

-
-
-
-

Video ads live

-

Upload a video or drop a link, and pick how long members must watch — 10, 30 or 60 seconds. - They watch in a player that can't be skipped, the clock runs on our server, and you pay only - for completed views. There's a full-screen Shorts feed too.

-
-
-
-

Solo ads live

-

Your full message — rich text, an image or video, and a call-to-action button — delivered - straight into member inboxes on-site and by email. Priced per guaranteed delivery, and readers - earn credits for a real read, so your message gets opened, not skimmed past.

-
-
-
-

Featured rotation live

-

Book your link into the featured rotation by the day — 1, 2 or 7 days — with a hard cap on how - many links share a day and the occupancy shown before you buy. The only rotator that tells you - the dilution up front, because hiding it is a sucker move.

-
-
-
-

Verified visits live

-

Buy a pack of guaranteed unique human visits. Each one is a different member who stayed the - full dwell and passed a human check — no bots, no recycled clicks, no repeats, just real visits - you can count on.

-
-
-
-
- -
-
-
-

What you get as a member

-

Free membership gets you in the door with a working account and the ability to earn - from day one. Buy any package and the real firepower unlocks.

-
-
-
-

Credits: everyone earns these

-

Ad credits are the currency of the ad platform. One credit is one cent of ad delivery. They are not money and are never withdrawn.

-
    -
  • Earned free by viewing ads, watching videos, verified visits, inbox ads and the daily sign-in
  • -
  • Welcome credits on day one, badge bonuses as your team grows
  • -
  • Spent on your own banner, text, video and solo campaigns
  • -
-
-
-

POL: activated members earn this

-

POL is real crypto, paid to your own wallet by the contract in the same transaction someone in your line buys a package. Nobody holds it for you.

-
    -
  • Activate: the $20 starter package (2,000 credits to advertise with) and payouts switched on from your wallet
  • -
  • Level 1 pays 50 percent of every package your direct referrals buy, from the day you are activated
  • -
  • Levels 2 and 3 open when 2, then 5, of your referrals buy a $20 or larger package
  • -
  • If you are not activated when someone in your line buys, that share passes up to the next member above you who is
  • -
-
-
-
-
-

Free membership includes

-
    -
  • A member account and the live ledger
  • -
  • Welcome credits to taste real ad delivery
  • -
  • Earn more credits by viewing ads, watching videos, making verified visits and reading solo ads
  • -
  • Your line banner, shown to your next three levels as they join
  • -
  • Your own shareable profile page with a scannable join QR code
  • -
  • Achievement badges and credit bonuses as your team grows
  • -
  • Your personal referral link, working from day one
  • -
  • Your invite link and line from day one; activate with the $20 starter package to earn POL on your referrals' purchases
  • -
-
-
-

Any package adds

-
    -
  • On-chain ad credits minted the moment you buy
  • -
  • All seven ad formats, with live stats and a dashboard of charts per campaign
  • -
  • Top up any campaign anytime, and message your whole downline
  • -
  • A full arsenal of promotional tools and a ready-made banner kit, personalized with your link
  • -
  • Packages of $20 or more count toward qualification
  • -
-
-
-
-
- -
-
-
-

The ad packages

-

Priced in dollars, settled in POL at the moment you buy. Packages of $20 or more - count toward your sponsor's qualification.

-
-
Loading live prices from the contract…
-
-
50%
direct sponsor
-
20%
level 2
-
10%
level 3
-
20%
platform
-
-
-
- -
-
-
-

Run your what-if

-

Play with a scenario and see how the contract would split it. This is arithmetic on the - locked percentages, not a prediction and not a promise. Nobody earns a cent unless real - people really buy advertising.

-
-
-
-
-

Direct referrals who each buy a package

-

- 2

-

The package they buy

-

-

Referrals each of them brings who also buy

-

- 2

-

-
-
-
- - - - - - - -
LevelPeople buyingYour shareYou receive
Level 1 open–50%–
Level 2 locked–20%–
Level 3 locked–10%–
If every one of those purchases happens–
-

And that is one round of purchases. The same - split runs again on every future package the same people buy.

-
-
-

- The pass-up rule: a locked level's share does not disappear. - The contract climbs the sponsor line, checking up to 25 positions, and pays the first qualified - person it finds; only if nobody in those 25 qualifies does the share go to the platform. It cuts - both ways: stay qualified and you catch the shares that under-qualified positions below you let - slip. Every pass-up is a visible event on the ledger, so you can see - exactly where money climbed past someone and why.

-
-
-
- -
-
- -
-
- -
-
-
-

Questions people actually ask

-
-
Is this a pyramid or ponzi scheme? -

No, and here is the plain version of why. A pyramid scheme pays you just for recruiting, with no - real product behind it. Here every payment is for ad delivery, and the payouts only come from real - buyers who buy real ad packages. You earn from people actually advertising, not from building a chain - of signups. The whole thing runs on a public ledger you can verify yourself, so nothing stays hidden.

-
What happens if the company disappears? -

The important part is that there is no company holding the money. Every sale is split by the smart - contract itself, on the blockchain, in the same transaction. Nobody can pause it, change it, or run - off with the funds, because the code does the paying automatically. If the site vanished tomorrow, - the contract would keep paying exactly what it is set to pay.

-
Do I need crypto experience or a wallet to join? -

No. You can start with a free email signup and use the platform the same way you would use any ad - site. If you want payouts to a wallet, setting one up takes a few minutes and the platform walks you - through it. But you do not need to know anything about crypto to get in and get moving.

-
How fast do I really get paid? -

Payouts happen inside the very transaction that pays for the package. There is no approval step - and nobody holding funds. Your share lands in your own wallet the moment your referral's purchase - confirms. The public ledger lets you watch each one go through.

-
What am I actually buying? -

You are buying ad delivery. Credits are one cent of delivery each, recorded on-chain when you buy. - The 5 dollar package mints 500 credits, and the bigger packages mint bonus credits on top, up to - 32,500 on the 250 dollar package. That is the product, plain and simple. Your earnings come from - referring people who also buy real ad delivery, and the contract splits every purchase automatically.

- -
-
-

See a payment land before you decide.

-

The ledger is open to everyone. Watch real purchases - split and settle, then join free when you have seen enough.

- Join free - Open the live ledger -
-
-
live · polygon
-
-
💸 payout → member #3instant
-
💸 payout → member #2instant
-
🔍 verify on explorer↗
+
+

Where $100 goes

one transaction · same block
+
+
+
+
$50your sponsor
+
$20level 2, open at 2 buyers
+
$10level 3, open at 5 buyers
+
$20platform, two wallets
+
+
+
Purchase #4821 $100.00 · POL
+
→ 0x7a3…e91c $50.00 level 1
+
→ 0x19f…0b44 $20.00 level 2
+
→ passed up $10.00 level 3 (unqualified)
+
→ platform $20.00
+
- -
-
LinkSpin · every payment verifiable on-chain · live ledger · view the contract ↗
-
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.
- -
- - - - +
+
+

The ad packages

priced in dollars · settled in POL at the live rate
+
+
Door$10·try the ads
+
Most chosen$25·qualifies
+
Builder$50·qualifies
+
Growth$100·qualifies
+
Leader$250·qualifies
+
Network$500·qualifies
+
+

Credits buy timed views of your banner, text and login ads. You can also earn credits by viewing ads and by running a zone on your own site. Credits are not money and do not pay out; the split above is what pays.

+
+
+ +
+
+
+ For Crypto Team Build Network members +

Your team is already here

+

Sign in with the email you use on InstantAdPay and your sponsor is placed for you before you buy anything. Same people above you, same people below you, a second property to build on.

+ +
+
+

New here?

+

Make a spin link above, promote it anywhere, and watch the clicks in your Control Room. Buy a package when you want your own ads in front of the network. Email first, wallet only when you are ready to be paid.

+ Create your free account → +
+
+
+ + + + diff --git a/rotator.js b/rotator.js index 8e8c6b3..f2b91d2 100644 --- a/rotator.js +++ b/rotator.js @@ -138,4 +138,38 @@ async function stats(owner, id) { } function totals() { return { rotations: J.db.rotations.length, hits: J.db.hits.length }; } -module.exports = { init, list, get, create, update, remove, addDest, updateDest, resolve, stats, totals, convert, summary }; +// ── demo spins (home page, 2026-10-07) ───────────────────────────────────────────────────────────────────── +// A visitor with no account pastes up to three pages and gets a working link at once. The rotation is owned by +// 'demo:' (token in the ls.demo cookie) and expires after 24 h unless the visitor signs in, at which point +// claim() hands it to their email and the expiry is lifted. Demo owners never count against a member's quota. +const DEMO_TTL = 24 * DAY; +async function createDemo(token, urls) { + const t = String(token || '').replace(/[^a-f0-9]/g, '').slice(0, 32); if (t.length < 16) return { error: 'Bad demo token.' }; + const owner = 'demo:' + t; + if (J.db.rotations.some(r => r.owner === owner)) return { error: 'This browser already made a demo spin. Sign in to make more.' }; + const clean = (urls || []).map(cleanUrl).filter(Boolean).slice(0, 3); + if (clean.length < 1) return { error: 'Paste at least one page address that starts with https://' }; + const r = await create(owner, { name: 'My first spin' }); if (r.error) return r; + const rec = J.db.rotations.find(x => x.id === r.rotation.id); rec.demo = true; rec.expires = Date.now() + DEMO_TTL; + for (const u of clean) await addDest(owner, rec.id, { url: u, weight: 1, label: '' }); + J.save(); return { ok: true, rotation: pub(rec) }; +} +async function claim(demoOwner, newOwner) { + const o = norm(newOwner); if (!o || !demoOwner) return { ok: false }; + const mine = J.db.rotations.filter(r => r.owner === demoOwner); + for (const r of mine) { r.owner = o; delete r.demo; delete r.expires; r.name = r.name === 'My first spin' ? 'My first spin' : r.name; } + if (mine.length) J.save(); return { ok: true, claimed: mine.length }; +} +function sweepDemos() { + const now = Date.now(); const gone = new Set(); + J.db.rotations = J.db.rotations.filter(r => { if (r.demo && r.expires && r.expires < now) { gone.add(r.id); return false; } return true; }); + if (gone.size) { J.db.hits = J.db.hits.filter(h => !gone.has(h.r)); J.db.conv = J.db.conv.filter(c => !gone.has(c.r)); J.save(); } + return gone.size; +} +function servedToday() { + // Central-time day, like Reports + const now = new Date(); const ct = new Date(now.toLocaleString('en-US', { timeZone: 'America/Chicago' })); + const startCt = new Date(ct.getFullYear(), ct.getMonth(), ct.getDate()).getTime(); const start = now.getTime() - (ct.getTime() - startCt); + return J.db.hits.filter(h => h.ts >= start && !h.bot).length; +} +module.exports = { init, list, get, create, update, remove, addDest, updateDest, resolve, stats, totals, convert, summary, createDemo, claim, sweepDemos, servedToday }; diff --git a/server.js b/server.js index 3c14b3b..1c85b8f 100644 --- a/server.js +++ b/server.js @@ -177,6 +177,7 @@ function getAdminWallAds() { return [{ name: 'LinkSpin', targetUrl: SITE_URL + '/', bannerUrl: null }]; } const chatHits = new Map(); +const demoLimits = new Map(); // ip -> timestamps of home-page demo spins (5 per hour) function chatLimited(ip) { const now = Date.now(), rec = chatHits.get(ip); if (!rec || now > rec.reset) { chatHits.set(ip, { count: 1, reset: now + 60000 }); return false; } @@ -397,6 +398,7 @@ async function boot() { carry.init({ dataDir: DATA_DIR, accounts, registry, chain, mailer, messages, siteConfig, adminEmail: ADMIN_EMAIL, host: SITE_HOST }); const ownHosts = () => [SITE_HOST].concat(String(siteConfig().linkDomains || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean)); rotator.init({ dataDir: DATA_DIR, geo, ownHosts }); + setInterval(() => { try { rotator.sweepDemos(); } catch (e) {} }, 60 * 60 * 1000); // unclaimed home-page demo spins expire after 24 h postbacks.init({ dataDir: DATA_DIR, ownHosts, rotator }); zones.init({ dataDir: DATA_DIR, ads, siteHost: SITE_HOST }); pages.init({ dataDir: DATA_DIR, ownHosts, openrouterKey: () => { if (process.env.OPENROUTER_API_KEY) return process.env.OPENROUTER_API_KEY.trim(); try { return fs.readFileSync(path.join(DATA_DIR, 'openrouter.key'), 'utf8').trim(); } catch (e) { return ''; } } }); @@ -1113,7 +1115,25 @@ const server = http.createServer(async (req, res) => { } if (p === '/api/stats' && req.method === 'GET') { let members = 0; try { members = await chain.memberCount(); } catch (e) {} - return json(res, 200, Object.assign({ onchainMembers: members, siteAccounts: await accounts.count() }, chain.totals())); + return json(res, 200, Object.assign({ onchainMembers: members, siteAccounts: await accounts.count(), servedToday: rotator.servedToday(), rotations: rotator.totals().rotations }, chain.totals())); + } + // -- home-page demo: a working spin link with no account (2026-10-07). One per browser (ls.demo cookie), + // five per IP per hour, 24 h unless the visitor signs in (the email door then claims it). + if (p === '/api/demo/spin' && req.method === 'POST') { + const ip = clientIp(req); const now = Date.now(); + const dl = demoLimits.get(ip) || []; const recent = dl.filter(t => now - t < 3600000); + if (recent.length >= 5) return json(res, 429, { error: 'That is plenty of demo links for one hour. Sign in to make more.' }); + const b = await readBody(req); + const urls = Array.isArray(b.urls) ? b.urls.map(x => String(x || '').trim()).filter(Boolean) : []; + let token = String(parseCookies(req)['ls.demo'] || '').replace(/[^a-f0-9]/g, '').slice(0, 32); + if (token.length < 16) token = crypto.randomBytes(12).toString('hex'); + const r = await rotator.createDemo(token, urls); + if (r.error) return json(res, 400, r); + recent.push(now); demoLimits.set(ip, recent); + const hosts = String(siteConfig().linkDomains || '').split(',').map(x => x.trim()).filter(x => x && !x.startsWith('www.')); + const host = hosts[0] || SITE_HOST; + return json(res, 200, { ok: true, code: r.rotation.code, url: 'https://' + host + '/r/' + r.rotation.code, destinations: r.rotation.destinations.length, expiresIn: 24 * 3600 }, + { 'Set-Cookie': 'ls.demo=' + token + '; Path=/; Max-Age=2592000; HttpOnly; SameSite=Lax' + (IS_PROD ? '; Secure' : '') }); } // -- 24/7 assistant @@ -1190,6 +1210,7 @@ const server = http.createServer(async (req, res) => { if (r.error) return json(res, 400, r); if (r.created) carry.onJoin(r.account, !!ref).catch(() => {}); // network sponsor carries over when no link was used (LinkSpin) if (r.created) { const lc = parseCookies(req)['ls.click']; if (lc) { postbacks.bindClick(e, lc); postbacks.convertFor(e, 'join', {}).catch(() => {}); } } + { const dm = String(parseCookies(req)['ls.demo'] || '').replace(/[^a-f0-9]/g, ''); if (dm.length >= 16) rotator.claim('demo:' + dm, e).catch(() => {}); } // the home-page demo spin becomes theirs // the lead is in the door: queue the getting-started sequence (opt-in box is pre-checked on both forms) if (r.created && (b.followups || b.newsletter)) drip.enqueue(e, ref, via).catch(() => {}); // a wallet-only session (signed with a wallet, no account) finishing setup: