Michael Camire fixes + hub shells in the tank (Marty 2026-11-14, LinkSpin Support)

1. Top-up across positions: an ad burns from ONE position, and topUpCampaign only looked at the ad's
   own position (or the main one when the list row had no memberId), so credits bought on a linked
   position could never top up the ad. Ported from InstantAdPay 2026-09-27 (Jim Watts): the ad's real
   member id is read from the campaign row; when it cannot cover, the refusal names where the free
   credits are and offers switchOptions; with the member's yes (switchTo, only a position on the
   account) moveFunding settles what the ad already ran up on the OLD position, moves the ad, then
   tops up. Ads screen asks in-page (own dialog) and retries. Create already had the largest-position guard.
2. Toasts: errors stay until closed (close button, role=alert), other notes 3.5 to 9 s by length.
3. Banner Spin per-banner clicks: his 3 clicks were all unmatched (no view on record for that browser),
   so they landed on the fallback row and every banner said 0. Click matching now also tries the same
   connection (daily-salted IP-only hash) when the browser key finds nothing (mail/exchange app view,
   click opened in the phone browser), view notes last 60 min instead of 15, and the stats split
   'Fallback shown' from 'Clicks not tied to a banner' so the rows add up to the total. History is not
   backfilled: views were never stored per visitor, so old clicks cannot be tied reliably.
4. Holding tank: hub-made waiting accounts with no sponsor are in the tank (waiting, rescue, readyTick
   read listAll with { shells: true }; 'hub-shell' no longer holds anyone back). Locked / sponsored /
   unknown, grace, 2-adoption cap unchanged; readyTick still never switches a shell on;
   accounts.listAll default unchanged (mailings skip shells).

Assets: cr.css, cr-shell.js, ads-screen.js ?v=20261114tu, banner-spin.js ?v=20261114bc.
QA: walk member 0 bugs (36 ok), netconv 57/57, networksso ALL PASSED, tank-hold all passed (new hub
shell part), profile policy 16/16, new topup-positions 8/8, new bannerspin-attrib 7/7, bannerspin e2e
75/75, hubsync 15 checks, tank-cap 15/15, sponsorfollow 30/30.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-14 11:59:38 -06:00
parent a630979a3a
commit e545343fe0
27 changed files with 282 additions and 47 deletions
BIN
View File
Binary file not shown.
+13 -5
View File
@@ -51,7 +51,7 @@ const TIERS = {
};
const ORDER = ['starter', 'builder', 'leader'];
const MAX_BYTES = 150 * 1024, MAX_BANNERS = 25;
const NOTE_TTL = 15 * 60000, DEDUPE_MS = 60000, FLUSH_MS = 5000, UNIQ_CAP = 500, HOSTS_CAP = 200;
const NOTE_TTL = 60 * 60000, DEDUPE_MS = 60000, FLUSH_MS = 5000, UNIQ_CAP = 500, HOSTS_CAP = 200;
const BOT = /bot|crawl|spider|slurp|facebookexternalhit|preview|telegrambot|whatsapp|curl|wget|python-requests|headless/i;
const norm = e => String(e || '').trim().toLowerCase();
const CT_FMT = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit' });
@@ -92,6 +92,12 @@ const ipOf = req => String(req.headers['x-forwarded-for'] || (req.socket && req.
const vkey = (req, ts) => crypto.createHash('sha256').update(new Date(ts || Date.now()).toISOString().slice(0, 10) + '|' + ipOf(req) + '|' + String(req.headers['user-agent'] || '')).digest('hex').slice(0, 16);
// keys to try for a click: today's, and yesterday's for the first 15 minutes after UTC midnight (a note made at 23:59 still matches)
function vkeys(req) { const now = Date.now(); const k = [vkey(req, now)]; if (now % DAY < NOTE_TTL) k.push(vkey(req, now - DAY)); return k; }
// Second chance for a click (Michael Camire 2026-11-14: 3 clicks on his Banner Spin, every one unmatched, so no banner got
// credit): the same daily-salted hash WITHOUT the browser. A mail app or a traffic-exchange app shows the image in its own
// viewer and opens the click in the phone's or PC's browser: same IP, different user agent, so the full key never matches.
// Only used when the full key finds nothing; the most recent view of this Banner Spin from that IP wins.
const ipkey = (req, ts) => 'i' + crypto.createHash('sha256').update(new Date(ts || Date.now()).toISOString().slice(0, 10) + '|ip|' + ipOf(req)).digest('hex').slice(0, 15);
function ipkeys(req) { if (!ipOf(req)) return []; const now = Date.now(); const k = [ipkey(req, now)]; if (now % DAY < NOTE_TTL) k.push(ipkey(req, now - DAY)); return k; }
const isBot = req => { const ua = String(req.headers['user-agent'] || ''); return !ua || BOT.test(ua); };
const isPrefetch = req => /prefetch|prerender|preview/i.test([req.headers.purpose, req.headers['sec-purpose'], req.headers['x-purpose'], req.headers['x-moz']].filter(Boolean).join(' '));
// a server fetching the image, not a browser (phase 3, 2026-10-20): mail image proxies and plain HTTP libraries. Kept out of
@@ -279,7 +285,7 @@ function choose(s, req, opts) {
const kind = loaderKind(req); rawLoad(String(s.id), hostOf(req), v, kind);
if (!kind) {
const bid = b ? b.id : 0; const host = hostOf(req);
note(v, s.id, host, bid);
note(v, s.id, host, bid); if (ipOf(req)) note(ipkey(req), s.id, host, bid);
const k = v + '|' + s.id + '|' + bid; const last = SEEN.get(k);
if (!last || Date.now() - last >= DEDUPE_MS) { SEEN.set(k, Date.now()); bump(String(s.id), bid, host, v); }
}
@@ -313,7 +319,7 @@ async function click(code, req, reqHost) {
let b = null, m = 'none';
if (!live() || s.adminOff) m = 'off';
else if (xs != null && /^\d{1,4}$/.test(xs)) { b = Number(xs) ? s.banners.find(q => q.id === Number(xs) && !q.adminOff) || null : null; m = 'exact'; }
else { const n = findNote(keys, s.id, h); if (n) { b = n.b ? s.banners.find(q => q.id === n.b && !q.adminOff) || null : null; m = 'note'; } }
else { let n = findNote(keys, s.id, h), how = 'note'; if (!n) { n = findNote(ipkeys(req), s.id, h); how = 'ip'; } if (n) { b = n.b ? s.banners.find(q => q.id === n.b && !q.adminOff) || null : null; m = how; } }
// where to: the banner's target (its spin link, on the same link domain), else the fallback
let url = null;
if (b) { if (b.link) { const r = rotator && rotator.rawRotations ? rotator.rawRotations().find(x => x.id === b.link && x.owner === s.owner) : null; url = r ? 'https://' + (reqHost || 'linkspin.app') + '/r/' + r.code : null; } else url = b.target; }
@@ -383,7 +389,7 @@ function agg(spins, sinceTs) {
if (!ids.has(c.s) || (sinceTs && c.ts < sinceTs)) continue;
const dd = at(days, ctDay(c.ts));
if (c.bot) { T.botClicks++; dd.botClicks++; continue; }
const ok = c.m === 'exact' || c.m === 'note';
const ok = c.m === 'exact' || c.m === 'note' || c.m === 'ip';
for (const o of [at(per, c.s + ':' + c.b), at(hosts, c.h || '(none)'), dd, T]) { o.clicks++; if (ok) o.matched++; else if (c.m === 'none') o.unmatched++; }
const k = c.c || '(none)'; country[k] = (country[k] || 0) + 1; const dv = c.dv || '(none)'; device[dv] = (device[dv] || 0) + 1;
}
@@ -419,7 +425,9 @@ async function stats(owner, id) {
const win = winnerOf(banners.filter(b => b.active)); for (const b of banners) b.winner = b.id === win;
const fb = A.per[s.id + ':0'] || z;
return { spin: pub(s), totals: { imps: A.T.imps, clicks: A.T.clicks, ctr: ctrOf(A.T), matchRate: mrOf(A.T), matched: A.T.matched, unmatched: A.T.unmatched, uniquesSampled: A.T.uniq, conversions: A.T.conv, bots: A.T.botClicks, botLoads: A.T.bots, serverLoads: A.T.srv },
banners, winner: win, winMin: WIN_MIN, fallback: { imps: fb.imps, clicks: fb.clicks, ctr: ctrOf(fb) },
// fallback = the fallback was SHOWN (views + the clicks matched to those views); unmatched = clicks we could not tie to any view,
// listed on their own row so the banner rows + these two add up to the Banner Spin's totals
banners, winner: win, winMin: WIN_MIN, fallback: { imps: fb.imps, clicks: fb.clicks - fb.unmatched, ctr: ctrOf({ imps: fb.imps, clicks: fb.clicks - fb.unmatched }) }, unmatched: { clicks: fb.unmatched },
placements: placementRows(A.hosts), days: dayRows(A.days, ctDay(Date.now() - 30 * DAY)), country: listOf(A.country), device: listOf(A.device),
conversions: Object.entries(A.convBy).sort((a, b) => b[1] - a[1]).map(([k, n]) => ({ k, n })) };
}
+1 -1
View File
@@ -7,7 +7,7 @@
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>@import url("/assets/site.css?v=ls20261101t") layer(legacy);</style>
<link rel="stylesheet" href="/assets/tools.css?v=20261101t">
<link rel="stylesheet" href="/assets/admin.css?v=20261101t">
+3 -3
View File
@@ -7,7 +7,7 @@
<title>Ads · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
/* layout by the space the screen really has (rail expanded or collapsed), not the viewport: the campaign table squeezed
its first column to a word, then a letter, per line once the rail and the side cards took the width (tester, 2026-10-18) */
@@ -75,8 +75,8 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/ads-screen.js?v=20261113sso"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/ads-screen.js?v=20261114tu"></script>
<script src="/assets/fuel.js?v=20261113sso"></script>
<script src="/assets/engine-room.js?v=20261113sso"></script>
</body>
+20 -1
View File
@@ -54,7 +54,26 @@
$('foot').textContent = 'views = views here on LinkSpin; network = the partner ad network; partner zones = other members\u2019 zones on their own sites' + (synN0 > 1 ? ' (network and partner-zone views cost 1/' + synN0 + ' of the rate here, so ' + synN0 + ' of them cost what 1 view here does' + (synT !== synN0 ? '; text ads 1/' + synT : '') + ')' : '') + ' · a paused ad keeps its credits · unspent credits return when an ad ends';
$('rows').querySelectorAll('[data-pause]').forEach(b => b.addEventListener('click', () => act('/api/my/campaigns/' + b.dataset.pause + '/pause')));
$('rows').querySelectorAll('[data-resume]').forEach(b => b.addEventListener('click', () => act('/api/my/campaigns/' + b.dataset.resume + '/resume')));
$('rows').querySelectorAll('[data-top]').forEach(b => b.addEventListener('click', async () => { const v = await dialog({ title: 'Top up #' + b.dataset.top, text: 'Add credits to this ad. You have ' + fmt(D.availableCredits) + ' available.', fields: [{ k: 'credits', label: 'Credits to add', value: '25', mono: true }], ok: 'Add' }); if (!v) return; try { await api('/api/my/campaigns/' + b.dataset.top + '/topup', { credits: Number(v.credits) }); toast('Topped up.'); load(); } catch (e) { toast(e.message, true); } }));
// An ad pays from ONE position (the contract burns from that member id). When the ad's own position cannot
// cover a top-up but another of the member's positions can, the server says so (switchOptions) and the member
// can move the ad to that position and pay from there (Michael Camire 2026-11-14, ported from InstantAdPay).
const topUpReq = async (id, credits, switchTo) => (await fetch('/api/my/campaigns/' + id + '/topup', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(switchTo ? { credits, switchTo } : { credits }) })).json();
$('rows').querySelectorAll('[data-top]').forEach(b => b.addEventListener('click', async () => {
const multi = (D.positionCount || 0) > 1;
const v = await dialog({ title: 'Top up #' + b.dataset.top, text: 'Add credits to this ad. You have ' + fmt(D.availableCredits) + ' available' + (multi ? ' across your positions; an ad pays from one position' : '') + '.', fields: [{ k: 'credits', label: 'Credits to add', value: '25', mono: true }], ok: 'Add' }); if (!v) return;
const credits = Number(v.credits);
try {
let r = await topUpReq(b.dataset.top, credits);
if (r.error && r.switchOptions && r.switchOptions.length) {
const o = r.switchOptions[0];
const ok = await dialog({ title: 'Pay from position #' + o.memberId + '?', text: r.error + ' Move this ad to position #' + o.memberId + ' (' + fmt(o.free) + ' free) and add the ' + fmt(credits) + ' credits from there? Views from now on are paid from #' + o.memberId + '; what the ad already ran up stays on its old position.', ok: 'Pay from #' + o.memberId });
if (!ok) return;
r = await topUpReq(b.dataset.top, credits, o.memberId);
}
if (r.error) throw new Error(r.error);
toast('Topped up: ' + fmt(r.added) + ' credits added' + (r.paidFrom ? ', paid from position #' + r.paidFrom : '') + (r.reactivated ? '. The ad is live again.' : '.')); load();
} catch (e) { toast(e.message, true); }
}));
$('rows').querySelectorAll('[data-qcancel]').forEach(b => b.addEventListener('click', () => cancelReservation(Number(b.dataset.qcancel))));
$('rows').querySelectorAll('[data-edit]').forEach(b => b.addEventListener('click', () => openEdit(Number(b.dataset.edit))));
{ const w = $('loginWhere'); if (w) w.textContent = 'full screen to every member right after they sign in: ' + fmt(slotInfo().credits) + ' purchased credits for a ' + slotInfo().days + '-day slot, ' + slotInfo().max + ' slots at a time. When all are taken, reserve the next one: pay now, it starts when a slot frees, and a cancel before then refunds in full'; }
+4 -3
View File
@@ -226,10 +226,11 @@
if (SEL !== id) return; const s = cur(); if (s) renderTiles(s, st);
// seven columns: name, views, second number (uniques for a banner, every image load for a placement), clicks, CTR, matched, last
const cell = (label, v) => '<span class="r num"><span class="ml">' + label + ' </span>' + v + '</span>';
const row = (name, o, second, secondLabel, last, lastLabel) => '<div class="rw"><span style="overflow-wrap:anywhere">' + name + '</span>' + cell('Views', fmt(o.imps)) + cell(secondLabel, second == null ? '-' : fmt(second)) + cell('Clicks', fmt(o.clicks))
const row = (name, o, second, secondLabel, last, lastLabel) => '<div class="rw"><span style="overflow-wrap:anywhere">' + name + '</span>' + cell('Views', o.imps == null ? '-' : fmt(o.imps)) + cell(secondLabel, second == null ? '-' : fmt(second)) + cell('Clicks', fmt(o.clicks))
+ cell('CTR', o.ctr == null ? '-' : o.ctr + '%') + cell('Matched', o.matchRate == null ? '-' : o.matchRate + '%') + '<span class="r num">' + (last == null ? '' : (lastLabel ? '<span class="ml">' + lastLabel + ' </span>' : '') + last) + '</span></div>';
$('bsStB').innerHTML = st.banners.length ? st.banners.map(b => row('<img src="' + esc(b.image) + '" alt="" style="max-height:28px;max-width:120px;vertical-align:middle;margin-right:6px" referrerpolicy="no-referrer">' + esc(b.label || 'Banner ' + b.id) + (b.winner ? '<span class="bswin" data-winner="' + b.id + '">WINNER</span>' : ''), b, b.uniques, 'Unique', fmt(b.conversions), 'Conv')).join('')
+ (st.fallback.imps || st.fallback.clicks ? row('<span class="muted">Fallback</span>', Object.assign({ matchRate: null }, st.fallback), null, 'Unique', null) : '') : '<div class="rw"><span class="muted">No banners yet.</span></div>';
+ (st.fallback.imps || st.fallback.clicks ? row('<span class="muted">Fallback shown</span>', Object.assign({ matchRate: null }, st.fallback), null, 'Unique', null) : '')
+ (st.unmatched && st.unmatched.clicks ? row('<span class="muted" title="The click came in, but no view of this Banner Spin from that visitor was on record, so we cannot say which banner they saw. These clicks went to your fallback link.">Clicks not tied to a banner</span>', { imps: null, clicks: st.unmatched.clicks, ctr: null, matchRate: null }, null, 'Unique', null) : '') : '<div class="rw"><span class="muted">No banners yet.</span></div>';
const wm = st.winMin || 1000;
$('bsWinNote').textContent = st.winner ? 'WINNER = the best click rate among banners with at least ' + fmt(wm) + ' views each. LinkSpin never changes the weights for you: raise the winner or pause the rest when you are ready.' : 'A WINNER badge appears once two or more live banners have ' + fmt(wm) + ' views each and one leads on click rate. Unique viewers are counted per day from a sample.';
$('bsStP').innerHTML = st.placements.length ? st.placements.map(p => row(esc(p.host === '(none)' ? 'No referrer (email, apps, privacy settings)' : p.host) + (p.caches ? '<span class="bscache" data-caches="' + esc(p.host) + '"><b>Caches banners:</b> ' + esc(p.caches) + '</span>' : ''), p, p.loads, 'Loads', p.caches ? '<span class="tag warn" title="' + esc(p.caches) + '">CACHED</span>' : '', '')).join('') : '<div class="rw"><span class="muted">No views yet. Put the code on a page and load it.</span></div>';
@@ -240,7 +241,7 @@
$('bsDayBars').style.gridTemplateColumns = 'repeat(' + Math.max(1, days.length) + ',minmax(0,1fr))';
$('bsDayBars').innerHTML = days.map(d => '<i style="height:' + Math.round(d.imps / dmax * 100) + '%" title="' + d.day + ' · ' + d.imps + ' views, ' + d.clicks + ' clicks, ' + ((d.bots || 0) + (d.servers || 0)) + ' bot or server loads"></i>').join('');
$('bsDayAxis').innerHTML = days.length ? '<span>' + days[0].day + '</span><span>' + days[days.length - 1].day + '</span>' : '<span class="muted">no views recorded yet</span>';
const t = st.totals; $('bsStNote').textContent = 'Views are counted on the server: bots and link previews are left out and one visitor reloading counts once a minute per banner. Matched = clicks we could tie to the banner that visitor saw (' + fmt(t.matched) + ' matched, ' + fmt(t.unmatched) + ' went to the fallback). About ' + fmt(t.uniquesSampled) + ' unique visitors (sampled).';
const t = st.totals; $('bsStNote').textContent = 'Views are counted on the server: bots and link previews are left out and one visitor reloading counts once a minute per banner. Matched = clicks we could tie to the banner that visitor saw (' + fmt(t.matched) + ' matched, ' + fmt(t.unmatched) + ' could not be tied to a banner and went to the fallback; they are the "Clicks not tied to a banner" row). A click is tied to a banner when a view of it by that visitor is on record from the last hour, from the same browser or the same internet connection; the script embed always ties it. About ' + fmt(t.uniquesSampled) + ' unique visitors (sampled).';
}
// ── header actions ──
+12 -1
View File
@@ -77,7 +77,18 @@ window.CR = (function () {
function sessionLost() { if (lostOpen) return; lostOpen = true; ME = null; toast('Your session ended. Sign in again to keep going.', true); signInFlow(() => location.reload()); }
(function () { const f0 = window.fetch.bind(window); window.fetch = async function (input, init) { const r = await f0(input, init); try { const u = new URL(typeof input === 'string' ? input : input.url, location.href); if (r.status === 401 && u.origin === location.origin && /^\/api\//.test(u.pathname) && !/^\/api\/(auth|me$)/.test(u.pathname) && !/^\/api\/admin\//.test(u.pathname)) sessionLost(); } catch (e) {} return r; }; })();
document.addEventListener('visibilitychange', async () => { if (document.visibilityState !== 'visible' || lostOpen || !ME || !ME.signedIn || Date.now() - lastCheck < 60000) return; lastCheck = Date.now(); const m = await me(true); if (!m || !m.signedIn) sessionLost(); });
function toast(msg, bad) { let t = $('crToast'); if (!t) { t = document.createElement('div'); t.id = 'crToast'; t.className = 'toast'; t.setAttribute('role', 'status'); document.body.appendChild(t); } t.textContent = msg; t.classList.toggle('bad', !!bad); t.classList.add('on'); clearTimeout(toastT); toastT = setTimeout(() => t.classList.remove('on'), 2000); }
// Errors stay until the member closes them (Michael Camire 2026-11-14: a failed top-up's reason vanished after 2 s,
// before he could read it); other notes stay long enough to read, a little longer for long ones.
function toast(msg, bad) {
let t = $('crToast'); if (!t) { t = document.createElement('div'); t.id = 'crToast'; t.className = 'toast'; document.body.appendChild(t); }
const text = String(msg == null ? '' : msg);
t.textContent = ''; const sp = document.createElement('span'); sp.className = 'toast-msg'; sp.textContent = text; t.appendChild(sp);
const hide = () => { clearTimeout(toastT); t.classList.remove('on'); };
if (bad) { const x = document.createElement('button'); x.type = 'button'; x.className = 'toast-x'; x.setAttribute('aria-label', 'Close this message'); x.textContent = '\u00d7'; x.addEventListener('click', hide); t.appendChild(x); }
t.setAttribute('role', bad ? 'alert' : 'status');
t.classList.toggle('bad', !!bad); t.classList.add('on'); clearTimeout(toastT);
if (!bad) toastT = setTimeout(hide, Math.min(9000, Math.max(3500, 1500 + text.length * 45)));
}
async function api(path, body) { const r = await (await fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) })).json(); if (r.error) throw new Error(r.error); return r; }
async function get(path) { const r = await (await fetch(path, { headers: { Accept: 'application/json' } })).json(); if (r.error) throw new Error(r.error); return r; }
function copy(text) { try { navigator.clipboard.writeText(text).then(() => toast('Copied'), () => toast('Select and copy: ' + text)); } catch (e) { toast('Select and copy: ' + text); } }
+4
View File
@@ -193,6 +193,10 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
.toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);background:var(--chrome);color:var(--chrome-ink);border:1px solid var(--chrome-line);border-left:3px solid var(--ok);padding:9px 14px;border-radius:6px;font-size:12px;font-weight:600;opacity:0;transition:opacity .2s;pointer-events:none;z-index:50;box-shadow:0 12px 30px -12px rgba(15,27,46,.6)}
.toast.bad{border-left-color:var(--sig)}
.toast.on{opacity:1}
.toast{max-width:min(92vw,620px);line-height:1.45;display:flex;align-items:flex-start;gap:10px}
.toast.on.bad{pointer-events:auto}
.toast-x{flex:none;background:none;border:0;color:inherit;font:inherit;font-size:16px;line-height:1;padding:0 2px;margin:-1px -4px 0 0;cursor:pointer;opacity:.75}
.toast-x:hover,.toast-x:focus-visible{opacity:1}
.modal-back{position:fixed;inset:0;background:rgba(11,20,36,.55);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;padding:16px;z-index:40}
.modal{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:18px;width:min(520px,100%);display:grid;gap:12px;box-shadow:var(--sh-lg)}
.modal h2{font-family:var(--display);font-size:20px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;margin:0;display:flex;align-items:center;gap:8px}
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Conversions · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start}
@@ -70,7 +70,7 @@
<div id="goalReports"></div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/conversions.js?v=20261026a"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Credits · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
@@ -83,7 +83,7 @@
</div>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/wallet.js?v=20261021a"></script>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/credits-screen.js?v=20261107tg"></script>
<script src="/assets/fuel.js?v=20261112sso"></script>
</body>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Help · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px;max-width:980px}
.hl .hd,.hl .rw{grid-template-columns:minmax(0,1fr) 150px 130px}.hl .rw{cursor:pointer}
@@ -30,7 +30,7 @@
<div id="page">
<div class="body" id="helpBody"><div class="panel"><span class="muted">loading</span></div></div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/help-screen.js?v=20261016a"></script>
</body>
</html>
+3 -3
View File
@@ -7,7 +7,7 @@
<title>Links · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.ws{display:grid;grid-template-columns:320px minmax(0,1fr);min-height:calc(100vh - 94px)}
.dbody .tiles{grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
@@ -270,8 +270,8 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/links.js?v=20261111big"></script>
<script src="/assets/banner-spin.js?v=20261105sz"></script>
<script src="/assets/banner-spin.js?v=20261114bc"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>@import url("/assets/site.css?v=ls20261101t") layer(legacy);</style>
<link rel="stylesheet" href="/assets/tools.css?v=20261101t">
</head>
@@ -1016,7 +1016,7 @@
</div>
</div>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/tools.js?v=20261011a"></script>
<script src="/assets/wallet.js?v=20261021a"></script>
<script src="/assets/promo.js?v=20261020bs3"></script>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Pages · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.look{display:grid;gap:10px;margin:6px 0 10px}.lk-row{display:flex;gap:10px;align-items:flex-start}.lk-k{flex:none;width:64px;font:700 11px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);padding-top:9px}
.lk-opts{display:flex;gap:6px;flex-wrap:wrap}.lk-opts button{font:600 12px var(--body);padding:7px 10px;border-radius:7px;border:1px solid var(--line);background:transparent;color:var(--fg);cursor:pointer}.lk-opts button.on{border-color:var(--accent);background:var(--accent-soft)}
@@ -73,7 +73,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/pages-screen.js?v=20261021t"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Reports · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
@@ -90,7 +90,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/reports.js?v=20261107nc"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Traffic sources · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.ws{display:grid;grid-template-columns:320px minmax(0,1fr);min-height:calc(100vh - 94px)}
.list{border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0;background:var(--panel-glass)}
@@ -128,7 +128,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/traffic-guide-data.js?v=20261028a"></script>
<script src="/assets/sources-screen.js?v=20261028a"></script>
</body>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Team · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
@@ -38,7 +38,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/team.js?v=20261113org"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Traffic guide · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.tg{padding:16px 24px 32px;display:grid;gap:18px;max-width:1180px}
.tg .lead{max-width:760px;color:var(--ink-2);line-height:1.55}
@@ -64,7 +64,7 @@
<div class="rules" id="rules"></div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/traffic-guide-data.js?v=20261028a"></script>
<script src="/assets/traffic-guide.js?v=20261029b"></script>
</body>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Wallet · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
@@ -36,7 +36,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/wallet-screen.js?v=20261023ov"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<title>Zones · LinkSpin</title>
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
<link rel="stylesheet" href="/assets/cr.css?v=20261114tu">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
@@ -42,7 +42,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261113nl"></script>
<script src="/assets/cr-shell.js?v=20261114tu"></script>
<script src="/assets/zones-screen.js?v=20261010a"></script>
</body>
</html>
+72
View File
@@ -0,0 +1,72 @@
// Banner Spin click attribution (Michael Camire 2026-11-14: his "Login Ad Explosion" showed Clicks 3 overall while every
// banner's own Clicks said 0. All three clicks came in with no view on record for that visitor, so they were counted on
// the fallback and no banner got them). Checks, on bannerspin.js directly (throwaway DATA_DIR, fake rotator, no server):
// impression -> click from the same browser credits that banner (note), the script embed's ?x= credits exactly,
// a click from the same connection in ANOTHER browser (mail app / exchange app view, click opens in the phone browser)
// credits the banner it was shown (ip), a click with no view anywhere stays "not tied to a banner",
// and banner rows + fallback shown + not tied add up to the Banner Spin totals.
// node qa/bannerspin-attrib.test.cjs
'use strict';
const assert = require('assert');
const fs = require('fs');
const os = require('os');
const path = require('path');
const SITE = path.join(__dirname, '..');
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'bs-attrib-'));
const bs = require(path.join(SITE, 'bannerspin.js'));
const rotator = { cellAt: () => 0, zoneFor: () => 'UTC', isOn: () => true, rawRotations: () => [], cleanHours: () => ({}), cleanTz: () => ({ tz: 'visitor' }) };
const OWNER = 'owner@bs.test';
let passed = 0, failed = 0; const results = [];
async function t(name, fn) { try { await fn(); passed++; results.push('ok ' + name); } catch (e) { failed++; results.push('FAIL ' + name + '\n ' + String(e && e.stack || e).split('\n').slice(0, 4).join('\n ')); } }
const req = (url, ip, ua, referer) => ({ url, headers: Object.assign({ 'x-forwarded-for': ip, 'user-agent': ua }, referer ? { referer } : {}), socket: {} });
const TG = n => 'https://offer.example/b' + n;
(async () => {
bs.init({ dataDir: DATA, rotator, adminEmail: OWNER, schedule: false });
let S, code;
await t('a Banner Spin with 3 banners (one target each) and a fallback', async () => {
const c = await bs.create(OWNER, { name: 'Attrib', size: '468x60', fallback: 'https://fallback.example/' }); assert.ok(!c.error, c.error);
S = c.spin; code = S.code;
for (const n of [1, 2, 3]) { const r = await bs.addBanner(OWNER, S.id, { image: 'https://img.example/' + n + '.png', target: TG(n), weight: 10 }); assert.ok(!r.error, r.error); }
});
const shown = async (ip, ua, ref) => { const im = await bs.image(code, req('/i/' + code + '.gif', ip, ua, ref), null); const n = Number(/\/(\d)\.png$/.exec(im.url)[1]); return n; };
const clickAs = (ip, ua, ref, q) => bs.click(code, req('/c/' + code + (q || ''), ip, ua, ref), 'linkspin.app');
const want = { 1: 0, 2: 0, 3: 0 };
await t('impression -> click, same browser, with a referrer: that banner, matched by note', async () => {
for (let i = 0; i < 6; i++) {
const ip = '10.9.0.' + i, ua = 'Mozilla/5.0 Desktop' + i; const n = await shown(ip, ua, 'https://exchange-a.example/surf');
const c = await clickAs(ip, ua, 'https://exchange-a.example/surf');
assert.strictEqual(c.url, TG(n)); assert.strictEqual(c.matched, 'note'); assert.strictEqual(c.banner.id, n); want[n]++;
}
});
await t('impression -> click, same browser, no referrer on either (mailer, privacy settings): that banner', async () => {
const n = await shown('10.9.1.1', 'Mozilla/5.0 Quiet', ''); const c = await clickAs('10.9.1.1', 'Mozilla/5.0 Quiet', '');
assert.strictEqual(c.banner && c.banner.id, n); assert.strictEqual(c.matched, 'note'); want[n]++;
});
await t('viewed in a mail or exchange app, clicked in the phone browser (same IP, other UA): that banner, matched by ip', async () => {
const n = await shown('10.9.2.2', 'MailApp/3.1 (Android) WebView', ''); const c = await clickAs('10.9.2.2', 'Mozilla/5.0 (Linux; Android 14) Chrome/130 Mobile', '');
assert.strictEqual(c.banner && c.banner.id, n); assert.strictEqual(c.matched, 'ip'); assert.strictEqual(c.url, TG(n)); want[n]++;
});
await t('script embed click (?x=2) credits banner 2 exactly', async () => {
const c = await clickAs('10.9.3.3', 'Mozilla/5.0 Script', 'https://blog.example/', '?x=2'); assert.strictEqual(c.banner.id, 2); assert.strictEqual(c.matched, 'exact'); want[2]++;
});
await t('a click with no view anywhere: fallback link, not tied to a banner', async () => {
const c = await clickAs('10.9.4.4', 'Mozilla/5.0 NeverSaw', ''); assert.strictEqual(c.banner, null); assert.strictEqual(c.matched, 'none'); assert.strictEqual(c.url, 'https://fallback.example/');
});
await t('stats: per-banner clicks match what was shown, and banners + fallback shown + not tied = the total', async () => {
bs.flush();
const st = await bs.stats(OWNER, S.id);
for (const b of st.banners) assert.strictEqual(b.clicks, want[b.id], 'banner ' + b.id + ' clicks ' + b.clicks + ' want ' + want[b.id]);
assert.strictEqual(st.unmatched.clicks, 1); assert.strictEqual(st.fallback.clicks, 0);
const sum = st.banners.reduce((n, b) => n + b.clicks, 0) + st.fallback.clicks + st.unmatched.clicks;
assert.strictEqual(sum, st.totals.clicks); assert.strictEqual(st.totals.clicks, 10);
assert.strictEqual(st.totals.matched, 9); assert.strictEqual(st.totals.unmatched, 1);
const views = st.banners.reduce((n, b) => n + b.imps, 0) + st.fallback.imps; assert.strictEqual(views, st.totals.imps); assert.strictEqual(st.totals.imps, 8);
});
console.log(results.join('\n'));
console.log('\nbannerspin-attrib: ' + passed + ' passed, ' + failed + ' failed');
try { fs.rmSync(DATA, { recursive: true, force: true }); } catch (e) {}
process.exit(failed ? 1 : 0);
})();
+2 -1
View File
@@ -192,7 +192,8 @@ const W = n => '0x' + String(n).padStart(40, '0');
assert.deepStrictEqual([...held.entries()].sort(), [[E('hs'), 'hub-shell'], [E('tk1'), 'sponsored'], [E('tk2'), 'locked']]);
let w = (await tank.waiting()).map(x => x.email);
assert.ok(w.includes(E('tk3')), 'a free member is offered');
for (const n of ['tk1', 'tk2', 'hs']) assert.ok(!w.includes(E(n)), n + ' is not offered: ' + w.join(','));
for (const n of ['tk1', 'tk2']) assert.ok(!w.includes(E(n)), n + ' is not offered: ' + w.join(','));
assert.ok(w.includes(E('hs')), 'a hub waiting copy with no sponsor IS offered (Marty 2026-11-14: unsponsored old members go in the tank)');
await accounts.setSponsorRef(E('tk2'), 'zed');
const rel = await tank.release(E('zed'), E('tk2'));
assert.ok(rel.error && /locked/.test(rel.error), JSON.stringify(rel)); assert.strictEqual((await accounts.sponsorOf(E('tk2'))).email, E('zed'));
+2
View File
@@ -76,6 +76,8 @@ elif [ "$MODE" = "member" ]; then
node qa/tank-hold.test.mjs || status=1
node qa/profile-policy.test.cjs || status=1
node qa/netconv.test.mjs || status=1
node qa/topup-positions.test.cjs || status=1 # a top-up the ad's position cannot cover offers the position that can, then moves the ad there (Michael Camire 2026-11-14)
node qa/bannerspin-attrib.test.cjs || status=1 # Banner Spin: impression -> click -> the banner shown gets the click (same browser, same connection, script ?x=), rows add up (Michael Camire 2026-11-14)
elif [ "$MODE" = "policy" ]; then
node qa/profile-policy.test.cjs || status=1
elif [ "$MODE" = "sponsorfollow" ]; then
+23
View File
@@ -479,8 +479,31 @@ async function partB() {
}
}
// hub-made waiting accounts (Marty 2026-11-14: "Yes to the unsponsored old members going in the holding tank"): a hub shell
// with no sponsor is in the waiting list even though accounts.listAll leaves shells out by default (mailings); the hub's
// locked / sponsored answers still hold people back, and readyTick still never switches a shell on.
async function partShells() {
console.log('-- Part S: hub shells in the tank');
const B = bench(); const { tank, accounts } = B;
const shell = o => Object.assign({ joinedVia: 'carried', joinedRef: 'hub', lastSeen: 0 }, o || {});
accounts.add('shell@x.co', shell()); accounts.add('shellsp@x.co', shell()); accounts.add('shellkid@x.co', shell({ sponsorRef: 'someone' })); accounts.add('plain@x.co');
const isShell = a => a.joinedVia === 'carried' && a.joinedRef === 'hub' && !a.lastSeen && !a.memberId;
const all0 = accounts.listAll; accounts.listAll = async (limit, opts) => (await all0.call(accounts)).filter(a => (opts && opts.shells) || !isShell(a));
tank.init({ dataDir: B.dir, accounts, chain: { recentEvents: () => [], getConfig: () => ({}) }, messages: { sendChat: async () => {}, lastFrom: async () => 0 }, mailer: { hasKey: () => false, send: async () => {} }, site: 'https://linkspin.test',
hooks: { networkHeld: async list => new Map(list.filter(a => isShell(a)).map(a => [a.email, a.email === 'shellsp@x.co' ? 'sponsored' : 'hub-shell'])), companyId: () => 1 } });
const w = (await tank.waiting()).map(x => x.email);
ok(w.includes('shell@x.co'), 'a hub shell with no sponsor is in the waiting list', JSON.stringify(w));
ok(w.includes('plain@x.co'), 'a normal tank member still is');
ok(!w.includes('shellsp@x.co'), 'a shell the hub says is sponsored elsewhere stays out (rule 3)');
ok(!w.includes('shellkid@x.co'), 'a shell with a sponsor here is not in the tank');
ok((await accounts.listAll(100)).every(a => !isShell(a)), 'accounts.listAll default still leaves shells out (mailings)');
await tank.readyTick();
ok(!tank.readyRec('shell@x.co'), 'readyTick never marks a shell ready (quiet)');
}
await partA();
await partGrace();
await partShells();
if (process.argv[2] !== 'unit') await partB();
console.log(fails ? '\n' + fails + ' FAILED' : '\nall passed');
process.exit(fails ? 1 : 0);
+85
View File
@@ -0,0 +1,85 @@
// Top-up across positions (Michael Camire 2026-11-14, LinkSpin Support): he bought credits on his linked position,
// the dashboard showed them, but adding 1000 credits to his text ad failed. An ad burns from ONE member id, and the
// top-up only ever looked at that one (or, with no memberId on the list row, the main position). Same fix as
// InstantAdPay 2026-09-27 (Jim Watts): say where the free credits are, offer the position that can pay, and on the
// member's yes move the ad's funding there (old charges settle on the old position first) and top up.
// Unit test on ads.js directly: throwaway DATA_DIR, JSON store, a fake chain. No server, no mail, no network.
// node qa/topup-positions.test.cjs
'use strict';
const assert = require('assert');
const fs = require('fs');
const os = require('os');
const path = require('path');
for (const k of ['DATABASE_URL', 'NAS_DB_HOST', 'NAS_DB_USER', 'NAS_DB_PASSWORD', 'NAS_DB_NAME', 'OUTBOUND', 'ENGINE_KEY']) delete process.env[k];
const SITE = path.join(__dirname, '..');
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'topup-pos-'));
const ads = require(path.join(SITE, 'ads.js'));
const ONCHAIN = { 101: 300, 202: 6000, 303: 40 }; // main position, the linked one he bought on, a small third
const chain = { creditBalance: async id => ONCHAIN[id] || 0 };
const OWNER = 'mc@topup.test', OTHER = 'someone@topup.test';
let passed = 0, failed = 0; const results = [];
async function t(name, fn) { try { await fn(); passed++; results.push('ok ' + name); } catch (e) { failed++; results.push('FAIL ' + name + '\n ' + String(e && e.stack || e).split('\n').slice(0, 4).join('\n ')); } }
const text = extra => Object.assign({ type: 'text', name: 'My text ad', targetUrl: 'https://example.com/offer', title: 'A good offer', body: 'Read about it here.', budget: 200 }, extra || {});
const rowOf = id => JSON.parse(fs.readFileSync(path.join(DATA, 'campaigns.json'), 'utf8')).campaigns.find(c => c.id === id);
(async () => {
ads.init({ dataDir: DATA, chain });
let C;
await t('a text ad created on the main position pays from it', async () => {
const r = await ads.createCampaign(OWNER, 101, text(), [101, 202, 303]);
assert.ok(!r.error, r.error); C = r.campaign || r; assert.ok(C.id, 'campaign id');
assert.strictEqual(rowOf(C.id).memberId, 101);
});
await t('1000 credits from a position that has 100 free: refused with where the credits are, nothing moved', async () => {
const r = await ads.topUpCampaign(OWNER, 101, C.id, 1000, { positions: [101, 202, 303] });
assert.ok(r.error, 'refused');
assert.match(r.error, /position #101, which has 100 credits free/);
assert.match(r.error, /#202 has 6,000 free/);
assert.match(r.error, /from #202 instead/);
assert.deepStrictEqual(r.switchOptions, [{ memberId: 202, free: 6000 }]); // #303 (40) cannot cover 1000
assert.strictEqual(rowOf(C.id).memberId, 101); assert.strictEqual(rowOf(C.id).budget, 200);
});
await t('switchTo a position not on the account is ignored (no move, same refusal)', async () => {
const r = await ads.topUpCampaign(OWNER, 101, C.id, 1000, { positions: [101, 303], switchTo: 202 });
assert.ok(r.error); assert.ok(!r.switchOptions.length);
assert.strictEqual(rowOf(C.id).memberId, 101); assert.strictEqual(rowOf(C.id).budget, 200);
});
await t('another member cannot top up or move the ad', async () => {
const r = await ads.topUpCampaign(OTHER, 202, C.id, 1000, { positions: [202], switchTo: 202 });
assert.ok(r.error); assert.strictEqual(rowOf(C.id).memberId, 101);
});
await t('with the member\'s yes (switchTo 202): the ad moves to #202, old charges settle on #101, 1000 added', async () => {
// 30 credits of views the ad already ran up on #101, not yet burned: they must burn from #101, never #202
const F = path.join(DATA, 'campaigns.json'); const db = JSON.parse(fs.readFileSync(F, 'utf8'));
db.campaigns.find(c => c.id === C.id).accrued = 30; fs.writeFileSync(F, JSON.stringify(db)); ads.init({ dataDir: DATA, chain });
const r = await ads.topUpCampaign(OWNER, 101, C.id, 1000, { positions: [101, 202, 303], switchTo: 202 });
assert.ok(!r.error, r.error);
assert.strictEqual(r.added, 1000); assert.strictEqual(r.paidFrom, 202); assert.strictEqual(r.budget, 1200);
const row = rowOf(C.id); assert.strictEqual(row.memberId, 202); assert.strictEqual(row.budget, 1200); assert.strictEqual(row.status, 'active');
assert.strictEqual(row.accrued, 0); assert.strictEqual(row.spent, 30);
const burns = JSON.parse(fs.readFileSync(F, 'utf8')).burnsPending.filter(b => b.ref === 'campaign-' + C.id);
assert.deepStrictEqual(burns.map(b => [b.memberId, b.amount]), [[101, 30]]);
});
await t('balances follow the move: #101 keeps only its own 30 to burn, #202 holds the rest of the ad', async () => {
const b = await ads.balances([101, 202, 303], OWNER);
const per = Object.fromEntries(b.per.map(p => [p.memberId, p.avail]));
assert.strictEqual(per[101], 300 - 30);
assert.strictEqual(per[202], 6000 - (1200 - 30));
assert.strictEqual(per[303], 40);
});
await t('a top-up the ad\'s own position covers needs no switch and stays put', async () => {
const r = await ads.topUpCampaign(OWNER, 101, C.id, 500, { positions: [101, 202, 303] });
assert.ok(!r.error, r.error); assert.strictEqual(r.paidFrom, 202); assert.strictEqual(rowOf(C.id).memberId, 202);
});
await t('no single position can cover: says the most one go can add', async () => {
const r = await ads.topUpCampaign(OWNER, 101, C.id, 5000, { positions: [101, 202, 303] });
assert.ok(r.error); assert.match(r.error, /No single position has 5,000 free; the most you can add in one go is 4,330/);
assert.deepStrictEqual(r.switchOptions, []);
});
console.log(results.join('\n'));
console.log('\ntopup-positions: ' + passed + ' passed, ' + failed + ' failed');
try { fs.rmSync(DATA, { recursive: true, force: true }); } catch (e) {}
process.exit(failed ? 1 : 0);
})();
+4 -1
View File
@@ -3981,7 +3981,10 @@ const server = http.createServer(async (req, res) => {
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
const memberId = await auth.refreshMemberId(s);
const b = await readBody(req);
const r = await ads.topUpCampaign(s.email, memberId, m[1], b.credits);
// every position on the account (Michael Camire 2026-11-14): the ad pays from one, and a top-up the
// ad's own position cannot cover offers to move the ad to a position that can (b.switchTo, member-confirmed)
const posIds = (await myMemberIds(s)).ids;
const r = await ads.topUpCampaign(s.email, memberId, m[1], b.credits, { positions: [memberId, ...posIds], switchTo: Number(b.switchTo) || 0 });
return json(res, r.error ? 400 : 200, r);
}
m = /^\/api\/my\/campaigns\/(\d+)\/cancel-reservation$/.exec(p); // a queued login slot: cancel before start = full refund
+12 -6
View File
@@ -91,9 +91,15 @@ const inTank = a => !a.sponsorRef && !a.memberId; // arrived with no sponsor (or
// hooks.networkHeld = hubsync.heldAmong, wired only with HUB_ENABLED. A hook that throws holds everyone it was asked about:
// the conservative side. No hook (flag off, tests) = nothing held, the tank as before.
const lc = v => String(v || '').trim().toLowerCase();
async function heldSet(accts) {
// Hub-made waiting accounts with no sponsor ARE in the tank (Marty 2026-11-14: "Yes to the unsponsored old members going in the
// holding tank"): 'hub-shell' no longer holds anyone back from waiting / adoption / expiry; locked, sponsored and unknown still do.
// readyTick passes keepShells: a shell is still never aligned or switched on there (quiet: no wallet, never signed in here).
async function heldSet(accts, keepShells) {
if (!hooks.networkHeld || !accts.length) return new Map();
try { return (await hooks.networkHeld(accts)) || new Map(); } catch (e) { console.error('tank networkHeld', e.message); return new Map(accts.map(a => [lc(a.email), 'unknown'])); }
let m;
try { m = (await hooks.networkHeld(accts)) || new Map(); } catch (e) { console.error('tank networkHeld', e.message); return new Map(accts.map(a => [lc(a.email), 'unknown'])); }
if (!keepShells) for (const [k, w] of [...m]) if (w === 'hub-shell') m.delete(k);
return m;
}
const HELD_WHY = { locked: 'they are locked on a network contract', sponsored: 'it already knows a sponsor for them', unknown: 'nothing (it is not answering)', 'hub-shell': 'they are a waiting copy from another door and never signed in here' };
// release / rescue / expiry: 'locked' | 'unknown' | null (hooks.networkLocked = hubsync.lockedAnywhere)
@@ -104,7 +110,7 @@ async function lockedWhy(email) {
// waiting list: newest sign-in first so a live one is easy to spot
async function waiting() {
const all = await accounts.listAll(1e6); // was 2000: newest-first, so once the site passed 2000 accounts (BTC4Hits import 2026-11-11) older tank members fell off the list
const all = await accounts.listAll(1e6, { shells: true }); // hub-made waiting accounts included (Marty 2026-11-14); was 2000: newest-first, so once the site passed 2000 accounts (BTC4Hits import 2026-11-11) older tank members fell off the list
const cand = all.filter(a => inTank(a) && !remoteOpen(a.email));
const held = await heldSet(cand); // rule 3: locked or sponsored elsewhere
return cand.filter(a => !held.has(lc(a.email))).map(a => ({ email: a.email, name: nameOf(a), username: a.username || null, joined: a.created, lastSeen: a.lastSeen || 0, wallet: !!a.address,
@@ -303,7 +309,7 @@ async function rescueSweep() {
if (String(process.env.TANK_RESCUE || '').trim() !== 'on') return { warned: 0, rescued: 0, dead: 0, off: true };
const now = Date.now();
let warned = 0, rescued = 0, dead = 0;
const all = await accounts.listAll(5000);
const all = await accounts.listAll(5000, { shells: true });
await heldSet(all.filter(a => !a.memberId && !a.address && a.sponsorRef)); // one batched hub call warms the cache for lockedWhy below
for (const a of all) {
if (a.memberId || a.address || !a.sponsorRef) continue; // bound, wallet, or already in the tank
@@ -551,9 +557,9 @@ async function autoAssignRun() {
// InstantAdPay owns are announced there, not twice in the shared topic).
async function readyTick() {
const st = RS.load(); const fresh = []; let aligned = 0;
const tankers = (await accounts.listAll(5000)).filter(inTank);
const tankers = (await accounts.listAll(5000, { shells: true })).filter(inTank);
if (hooks.prefetch) { try { await hooks.prefetch(tankers.map(a => a.email)); } catch (e) {} } // one signed batch call to InstantAdPay, not one per member
const netHeld = await heldSet(tankers); // one batched hub call; alignToNetwork below reads the same cache
const netHeld = await heldSet(tankers, true); // one batched hub call; alignToNetwork below reads the same cache
for (const a of tankers) {
if (netHeld.get(lc(a.email)) === 'hub-shell') continue; // a waiting copy from another door: no alignment, no payouts switch-on here (quiet)
if (await alignToNetwork(a).catch(() => null)) { aligned++; continue; }