Files
martbost b2669cfed7 Network hub sign-in, step 3 (Marty 2026-11-15)
networksso.js (the same file on every network site): with HUB_SSO=on /sso/start asks the network hub, /sso/in takes the hub's h1. token (this site's HUB_SECRET, iss hub, aud linkspin, 60 s, single use, state cookie) and falls back once to the pairwise InstantAdPay check when the hub has nobody. networksso.page() on every GET of the main host: a signed-in member's page load tells the hub once (nsso.hp) and pings /v1/activity once a day, only while the hub answers /health.
Sessions: SESSION_TTL_HOURS (168 = 7 days in production), renewed on use at most hourly; cookie 30 days, the server's sliding expiry decides. auth.endSessions.
Sign out everywhere: POST /api/auth/logout-everywhere; the account menu's Sign out asks "Only LinkSpin or every network site"; cr-shell.js?v=20261115hub. hubsync: member.blocked and member.signedout end every session of that member here.
Chatbot: a sign-in lasts 7 days and renews; the silent check is every 2 minutes.
Tests: qa/networksso-hub.e2e.mjs (same file as InstantAdPay, in run.sh). qa sso: ALL PASSED; qa member: ALL PASSED (known warnings).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:36:06 -06:00

136 lines
11 KiB
HTML

<!doctype html>
<html lang="en" data-theme-base="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="robots" content="noindex, nofollow">
<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=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)}
.list .hd{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line)}
.list .hd h2{font-family:var(--display);font-size:20px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;margin:0}
.list .flt{padding:8px 16px;border-bottom:1px solid var(--line)}
.list .items{overflow:auto}
.item{display:grid;grid-template-columns:minmax(0,1fr) 72px;gap:8px;padding:11px 16px;border-bottom:1px solid var(--line);border-left:3px solid transparent;cursor:pointer}
.item:hover{background:var(--row-hover)} .item.on{background:var(--panel);border-left-color:var(--sig)}
.item .nm{font-weight:700;display:flex;gap:8px;align-items:center;flex-wrap:wrap} .item .cd{font-family:var(--mono);font-size:11px;color:var(--muted)}
.item .rt{display:grid;justify-items:end;gap:3px} .item .rt .n{font-family:var(--mono)}
.detail{display:flex;flex-direction:column;min-width:0}
.dhead{display:flex;align-items:center;gap:14px;padding:12px 24px;border-bottom:1px solid var(--line);background:var(--panel);flex-wrap:wrap}
.dhead h2{font-family:var(--display);font-size:24px;font-weight:700;letter-spacing:.02em;margin:0}
.dbody{padding:16px 24px;display:grid;gap:14px}
.dbody .tiles{grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
.empty{padding:40px 24px;color:var(--muted);text-align:center;display:grid;gap:10px;justify-items:center}
.empty .lead{max-width:520px}
.urlbox{display:grid;gap:10px;align-content:start}
.urlbox .code{display:block;font-size:12px;line-height:1.6;padding:10px 12px}
.pick{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:end}
.prm .hd,.prm .rw{grid-template-columns:120px minmax(0,1fr) minmax(0,1fr)}
.pe .hd,.pe .rw{grid-template-columns:150px minmax(0,1.3fr) minmax(0,1fr) 40px}
.pe select.field{width:auto;min-width:130px}
.log .hd,.log .rw{grid-template-columns:150px 90px minmax(0,1fr) 110px 50px}
.chips .chip{user-select:none}
.form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.form .full{grid-column:1 / -1}
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
.catf{margin:4px 0 8px}
.catlist{max-height:46vh;overflow:auto;border:1px solid var(--line);border-radius:8px}
.cat{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px 12px;border-bottom:1px solid var(--line);cursor:pointer}
.cat:last-child{border-bottom:0} .cat:hover{background:var(--row-hover)} .cat b{display:block} .cat .site{font-family:var(--mono);font-size:11px;color:var(--muted)}
.cat .tags{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.prev{background:var(--panel-2);border:1px solid var(--line);border-radius:8px;padding:10px 12px;display:grid;gap:6px;font-size:12px}
.gfor{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:12.5px;color:var(--ink-2);background:var(--panel-2);border:1px solid var(--line);border-radius:8px;padding:8px 12px}
.gfor a{font-weight:700}
.cat .fm{display:flex;gap:4px;flex-wrap:wrap;margin-top:3px}
.prev .mono{font-size:11px;overflow-wrap:anywhere}
.prev dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:3px 10px;margin:0} .prev dt{font-family:var(--mono);font-size:11px;color:var(--ink-2)} .prev dd{margin:0;font-family:var(--mono);font-size:11px;overflow-wrap:anywhere}
@media (max-width:900px){.two{grid-template-columns:1fr}.form{grid-template-columns:1fr}.prm .hd,.log .hd,.pe .hd{display:none}.prm .rw{grid-template-columns:1fr}.log .rw{grid-template-columns:1fr 1fr}.pe .rw{grid-template-columns:1fr 1fr}}
@media (max-width:760px){.ws{grid-template-columns:minmax(0,1fr)}.tabs{flex-wrap:wrap}.list{border-right:0;border-bottom:1px solid var(--line);max-height:44vh}.ws.focus .list{display:none}.ws:not(.focus) .detail{display:none}
.dhead{padding:12px 16px}.dbody{padding:12px 16px}.pick{grid-template-columns:1fr}.tiles{grid-template-columns:repeat(2,minmax(0,1fr))}}
</style>
</head>
<body>
<div id="page">
<div class="ws" id="ws">
<div class="list">
<div class="hd"><h2 id="listCount">Sources</h2><span class="muted mono">30 days</span></div>
<div class="flt"><input class="field" id="filter" type="search" placeholder="Filter sources" aria-label="Filter sources"></div>
<div class="items" id="items"></div>
</div>
<div class="detail" id="detail">
<div class="empty" id="noSel">
<div class="h-disp" style="font-size:18px">No traffic sources yet</div>
<div class="muted lead">A source remembers a network's macros and postback so every link you point at it is tracked and the network learns what converts.</div>
<button class="btn pri" type="button" id="newBtn2">+ New source</button>
</div>
<div id="sel" hidden>
<div class="dhead">
<button class="btn sm" type="button" id="backBtn" hidden>&larr; Sources</button>
<h2 id="dName">Source</h2>
<span class="mono muted" id="dNet"></span>
<span class="mono" id="dOn"></span>
<span class="grow"></span>
<button class="btn sm" type="button" id="togBtn">Disable</button>
<button class="btn sm danger" type="button" id="delBtn">Delete</button>
</div>
<div class="dbody">
<div class="tiles" id="tiles"></div>
<div class="gfor" id="dGuide" hidden></div>
<div class="tabs" id="tabs">
<button type="button" class="on" data-tab="url">Campaign URL</button>
<button type="button" data-tab="pb">Postback</button>
<button type="button" data-tab="settings">Settings</button>
</div>
<div id="tab-url">
<div class="two">
<div class="panel urlbox">
<h2>Campaign URL</h2>
<div class="pick"><label class="lbl">Which of your links<select class="field" id="urlRot"></select></label><button class="btn pri sm" type="button" id="urlCopy">Copy URL</button></div>
<div class="code" id="urlOut">pick a link</div>
<div class="muted" id="urlNote"></div>
</div>
<div class="panel"><h2>Params on the link</h2><div class="tbl prm"><div class="hd"><span>LinkSpin key</span><span>Network macro</span><span>Meaning</span></div><div id="prmRows"></div></div><div class="muted" style="font-size:11.5px">The network replaces each macro when it sends the click. LinkSpin keeps the values with the click and shows them under Reports and the link's Sources tab.</div></div>
</div>
</div>
<div id="tab-pb" hidden>
<div style="display:grid;gap:16px">
<div class="panel urlbox">
<h2>Postback to the network</h2>
<div class="muted">Fires server to server when a click that came from this source converts. LinkSpin fills <span class="mono">{clickid}</span> with the id the network sent and <span class="mono">{payout}</span> with the value.</div>
<div class="code" id="pbUrl">none set</div>
<div><div class="sec" style="margin-bottom:6px">Fires on</div><div class="chips" id="pbEvents"></div></div>
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap"><button class="btn sm" type="button" id="pbTest">Send a test</button><span class="mono muted" id="pbStatus" style="font-size:11px"></span></div>
</div>
<div class="panel"><h2>Recent deliveries</h2><div class="tbl log"><div class="hd"><span>When</span><span>Event</span><span>URL</span><span>Result</span><span class="r">ms</span></div><div id="logRows"></div></div></div>
</div>
</div>
<div id="tab-settings" hidden>
<div class="panel">
<h2>Settings</h2>
<div class="form">
<label class="lbl">Name<input class="field" id="sName" type="text" maxlength="60"></label>
<label class="lbl">Network site<input class="field mono" id="sSite" type="text" maxlength="80" placeholder="network.com"></label>
<label class="lbl">Cost model<input class="field mono" id="sCost" type="text" maxlength="20" placeholder="CPC, CPM, CPV"></label>
<label class="lbl">Postback method<select class="field" id="sMethod"><option value="GET">GET</option><option value="POST">POST</option></select></label>
<label class="lbl full">Postback URL, with {clickid} and {payout} where the network expects them (leave empty for URL tagging and reports only)<input class="field mono" id="sPb" type="text" placeholder="https://network.example/postback?cid={clickid}&payout={payout}"></label>
</div>
<div class="sec">Params</div>
<div class="tbl pe"><div class="hd"><span>LinkSpin key</span><span>Network macro</span><span>Label</span><span></span></div><div id="peRows"></div><div class="ft">clickid is the network's click id; cost is what the click cost; the rest tag the click for reports. Tokens are pasted exactly as the network expands them.</div></div>
<div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center"><button class="btn sm" type="button" id="peAdd">+ Add a param</button><span class="grow"></span><button class="btn pri" type="button" id="sSave">Save settings</button></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261115hub"></script>
<script src="/assets/traffic-guide-data.js?v=20261028a"></script>
<script src="/assets/sources-screen.js?v=20261028a"></script>
</body>
</html>