Spot edits: unlimited, full link check on every one, every one logged; admin takedown and restore (Marty 2026-11-16)

Edits (POST /api/my/spot/<id>, /api/my/default, uploads): still any number of times. Every change now gets the full check:
checkLink, then (LINK_PROBE on) the link must answer (safety.probeLink, up to 3 redirects each checked) and an image address must
download as a real 468x60 image of 150 KB or less (safety.probeImage; the address is kept, a Banner Spin image rotates). The
Banner Spin image + click link LinkSpin just handed the member are not fetched (that would count a LinkSpin click). safety.js gains
privateIp + safeLookup with the Node 20 fix VBB/ViralAdBlitz needed (honors opts.all, answers an array). Every real change is
logged on the spot (or the default): old and new link and image, time, via edit/upload; the owner sees the newest 10. 120 changes
an hour per connection (each one fetches the link).

Admin takedown (the Viral Banner Blitz way, 8e6d2f9): /admin (new page) finds a spot by #number, wallet or network username;
POST /api/admin/spots/<id>/takedown {reason (required, the owner sees it), credit}. Hidden everywhere at once: the board shows a
house tile in its place (nobody else moves), the gate gives its step to a house site, /go/<id> goes home, its Network Ad Space
banner is paused (approved = 0) and no new one is placed. No views or clicks count while down. My Spots shows "Taken down" with
the reason and no edit controls. Restore (POST .../restore) reverses it (NAS resumed). Admin ledger: GET /api/admin/actions (who,
when, reason, credit decision). The contract is never touched.
CREDIT BACK IS NOT BUILT: a spot is a $5 on-chain purchase and this site has no free replacement spot or post credit, so
credit: "back" is refused with a note until Marty decides what it means here; takedowns are "no credit".
Chatbot: CANNED takedown + banner answer (unlimited checked, logged edits) + FACTS EDITS/TAKEDOWN lines, KNOWLEDGE_DATE 2026-11-16.
line.css?v=9, my.js?v=z3.
Tests: smoke section 10 (the lookup shape, edit log, unlimited edits, refusals: unreachable, 404, private address, http redirect,
shortener, bad image size/404/unreachable; redirect followed; same link logs nothing; upload logged; default checked + logged;
takedown: token, reason, credit choice, credit back refused, held house tile, image nowhere, /go home, gate, no views, owner view,
no edits while down, ledger, restore, /admin) against a stand-in internet preloaded into the app (qa/out/probe-stub.cjs, nothing
leaves the machine), plus phone renders of My Spots taken down and /admin: 193/193 with UI. chatbot.test 181/181.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-16 05:23:54 -06:00
parent 197aa39fca
commit a428075330
24 changed files with 499 additions and 37 deletions
+30
View File
@@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Admin | Downline Banners</title>
<meta name="description" content="Downline Banners admin.">
<meta name="robots" content="noindex">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
<section class="hero"><h1>Admin</h1><p class="lead">Take a spot down or restore it. The contract is never touched: only what this site shows and counts changes.</p></section>
<div class="card" id="tokCard"><div class="field"><label for="tok">Admin token</label><input id="tok" type="password" autocomplete="off"></div><button class="btn small" id="tokBtn">Open</button></div>
<div id="adm" hidden>
<div class="card" id="spCard"><h3>Spots: take down or restore</h3>
<p class="muted small">Find a spot by #number, wallet or network username. A takedown hides it everywhere at once (board, gate, links, Network Ad Space). Its place stays, held by a house banner, so nobody else moves. No views or clicks count while it is down. The owner sees "Taken down" with your reason. Payments already happened on-chain at purchase and are never touched.</p>
<p class="muted small">Credit back: not available yet. A spot is a $5 on-chain purchase and this site has no free replacement spot or post credit, so a takedown is "no credit" until Marty decides what credit back means here.</p>
<div class="row"><input id="spQ" placeholder="#12, 0x... or username" autocomplete="off" aria-label="Find a spot" style="flex:1;min-width:200px"><button class="btn sec small" id="spFind">Find</button></div>
<div id="spList"></div></div>
<div class="card"><h3>Admin ledger (takedowns and restores)</h3><div class="adm-scroll" id="aActions"></div></div>
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=20261115nr"></script>
<script src="/assets/admin.js?v=1"></script>
</body>
</html>
+65
View File
@@ -0,0 +1,65 @@
// Admin (2026-11-16): spot takedown and restore with a required reason, and the admin ledger. Read with the ADMIN_TOKEN (kept in this tab only).
(function () {
BL.renderNav('');
const $ = BL.$, esc = BL.esc;
let tok = ''; try { tok = sessionStorage.getItem('bl.admin') || ''; } catch (e) {}
const get = u => BL.getJSON(u, { headers: { 'x-admin-token': tok } });
const send = (u, body) => BL.getJSON(u, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-admin-token': tok }, body: JSON.stringify(body) });
const ct = t => t ? new Date(t).toLocaleString('en-US', { timeZone: 'America/Chicago' }) + ' CT' : '';
const who = x => x.username ? '@' + x.username : BL.short(x.owner || '');
async function open() {
const s = await get('/api/admin/actions?n=1');
if (s.error) { BL.status('That token was not accepted.', 'err'); return; }
try { sessionStorage.setItem('bl.admin', tok); } catch (e) {}
$('tokCard').hidden = true; $('adm').hidden = false; BL.status('');
actions();
}
async function actions() {
const a = await get('/api/admin/actions?n=200'); if (a.error) return;
$('aActions').innerHTML = a.actions.length ? '<table class="tbl"><tr><th>When</th><th>Action</th><th>Spot</th><th>Owner</th><th>By</th><th>Reason</th><th>Credit</th></tr>'
+ a.actions.map(e => '<tr><td>' + esc(ct(e.at)) + '</td><td>' + esc(e.action) + '</td><td>#' + e.spotId + '</td><td>' + esc(who(e)) + '</td><td>' + esc(e.by) + '</td><td>' + esc(e.reason || '') + '</td><td>' + esc(e.credit) + '</td></tr>').join('') + '</table>'
: '<p class="muted">No takedowns yet.</p>';
}
async function find() {
const q = $('spQ').value.trim(); if (!q) return;
const d = await get('/api/admin/spots?q=' + encodeURIComponent(q));
if (d.error) { $('spList').innerHTML = '<p class="note err small">' + esc(d.error) + '</p>'; return; }
$('spList').innerHTML = '';
for (const s of d.spots) {
const el = document.createElement('div'); el.className = 'spot-ed adm-spot';
const st = s.down ? 'TAKEN DOWN ' + ct(s.down.at) + ' by ' + s.down.by + ': ' + s.down.reason + ' (no credit)' : 'Showing (' + s.showing.from + ')';
const edits = s.edits.length ? '<details><summary class="small">' + s.edits.length + ' edit' + (s.edits.length === 1 ? '' : 's') + ' (newest first)</summary><table class="tbl"><tr><th>When</th><th>What</th><th>Old</th><th>New</th></tr>'
+ s.edits.map(e => '<tr><td>' + esc(ct(e.at)) + '</td><td>' + esc(e.what) + ' (' + esc(e.via) + ')</td><td class="mono small">' + esc(e.old.link) + '<br>' + esc(e.old.img) + '</td><td class="mono small">' + esc(e.new.link) + '<br>' + esc(e.new.img) + '</td></tr>').join('') + '</table></details>' : '<p class="muted small">No edits yet.</p>';
el.innerHTML = '<div class="row" style="justify-content:space-between"><b>Spot #' + s.id + '</b><span class="small">' + esc(who(s)) + ' <span class="mono">' + esc(s.owner) + '</span></span></div>'
+ '<div class="lots"></div><p class="small">' + esc(st) + '<br>Link: <span class="mono">' + esc(s.link || '(default or none)') + '</span><br><span class="muted">' + s.views + ' of ' + s.owed + ' views, '
+ (s.clicks.organic + s.clicks.gate) + ' clicks. Bought ' + esc(ct(s.boughtAt)) + '.' + (s.downs.length ? ' Restored before: ' + s.downs.length + 'x.' : '') + '</span></p>' + edits + '<div class="act"></div>';
el.querySelector('.lots').appendChild(BL.tile({ t: 'x', img: s.img || s.showing.img, href: '#' }));
const act = el.querySelector('.act');
if (s.down) {
act.innerHTML = '<div class="field"><label class="small muted">Why restore (optional)</label><input class="rs"></div><button class="btn small">Restore this spot</button>';
act.querySelector('button').onclick = async () => {
const r = await send('/api/admin/spots/' + s.id + '/restore', { reason: act.querySelector('.rs').value });
BL.status(r.error || ('Spot #' + s.id + ' restored.'), r.error ? 'err' : 'ok'); find(); actions();
};
} else if (s.kind !== 3) {
act.innerHTML = '<div class="field"><label class="small muted">Reason (the owner sees it)</label><textarea class="why" maxlength="300" rows="2"></textarea></div>'
+ '<div class="row"><label class="small"><input type="radio" name="cr' + s.id + '" value="none" checked> No credit</label><label class="small muted"><input type="radio" name="cr' + s.id + '" value="back" disabled> Credit back (not available yet)</label>'
+ '<button class="btn small">Take down</button></div>';
const bt = act.querySelector('button');
bt.onclick = async () => {
const reason = act.querySelector('.why').value.trim();
if (reason.length < 3) return BL.status('Write the reason first.', 'err');
if (!bt.dataset.armed) { bt.dataset.armed = '1'; bt.textContent = 'Click again to take down #' + s.id; setTimeout(() => { if (bt.isConnected) { delete bt.dataset.armed; bt.textContent = 'Take down'; } }, 8000); return; }
const r = await send('/api/admin/spots/' + s.id + '/takedown', { reason, credit: 'none' });
BL.status(r.error || ('Spot #' + s.id + ' taken down, no credit.'), r.error ? 'err' : 'ok'); find(); actions();
};
}
$('spList').appendChild(el);
}
}
$('spFind').onclick = find;
$('spQ').addEventListener('keydown', e => { if (e.key === 'Enter') find(); });
$('tokBtn').onclick = () => { tok = $('tok').value.trim(); open(); };
$('tok').addEventListener('keydown', e => { if (e.key === 'Enter') $('tokBtn').click(); });
if (tok) open();
})();
+6
View File
@@ -68,3 +68,9 @@ nav .links a.active{color:var(--mint-ink);background:var(--mint)}
.bl-foot .netline{margin-top:12px;padding-top:12px;border-top:1px solid var(--line);line-height:1.9}
.bl-foot .netline .here{color:var(--mint-ink);background:var(--mint);font-weight:700;border-radius:999px;padding:1px 9px}
.legal .card h2{font-size:21px} .legal .card p,.legal .card li{max-width:760px;color:var(--ink)} .legal .card ul{padding-left:20px} .legal .card li{margin:6px 0}
/* spot takedown + edit history (2026-11-16) */
.spot-down{border:1px solid var(--line-strong);border-left:4px solid #ff5d6c;border-radius:10px;padding:10px 12px;margin:8px 0}
.spot-down b{color:#ff5d6c}
.adm-scroll{overflow-x:auto}
.adm-spot details{margin:6px 0}
.adm-spot .tbl td{word-break:break-all}
+8 -1
View File
@@ -40,7 +40,14 @@
const el = document.createElement('div'); el.className = 'spot-ed';
const head = kind === 'spot' ? '<div class="row" style="justify-content:space-between"><b>Spot #' + s.id + '</b><span class="muted small">' + esc(KIND[s.kind] || '') + ' &middot; ' + s.views + ' of ' + s.owed + ' views'
+ (s.kind === 3 ? '' : s.delivering ? ' &middot; ' + s.daysLeft + ' days left' : ' &middot; delivery finished') + ' &middot; clicks ' + (s.clicks.organic + s.clicks.gate) + '</span></div>' : '';
el.innerHTML = head + '<div class="lots" style="align-items:flex-start"></div>'
// taken down by the admin (2026-11-16): the reason, and no edit controls (the spot keeps its place; a house banner shows there)
if (kind === 'spot' && s.down) {
el.innerHTML = head + '<div class="spot-down"><b>Taken down</b> ' + esc(new Date(s.down.at).toLocaleDateString()) + '. Reason: ' + esc(s.down.reason)
+ '<br><span class="small muted">It is hidden everywhere and counts no views while it is down; its place is kept. Questions: use the chat on this page.</span></div>';
return el;
}
const hist = kind === 'spot' && s.edits && s.edits.length ? '<p class="small muted">Last change ' + esc(new Date(s.edits[0].at).toLocaleString()) + ' (' + s.edits.length + (s.edits.length >= 10 ? '+' : '') + ' logged). Every change gets the full link check.</p>' : '';
el.innerHTML = head + hist + '<div class="lots" style="align-items:flex-start"></div>'
+ '<div class="field"><label class="small muted">Target link (https)</label><input data-k="link" placeholder="https://your-site.com/page" value="' + esc(s.link || '') + '"><span class="small muted">Tracking: {clickid}, {spot} and {type} in your link are filled on every click (LinkSpin has a Downline Banners source ready for this).</span></div>'
+ '<div class="field"><label class="small muted">Image address (https), or upload below</label><input data-k="img" placeholder="https://your-site.com/image.png" value="' + esc(String(s.img || '').startsWith('/art/u/') ? '' : s.img || '') + '"></div>'
+ '<div class="row"><button class="btn small" data-a="save">Save</button><label class="btn sec small">Upload image<input type="file" accept="image/png,image/jpeg,image/gif" hidden></label>'
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap legal">
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
+1 -1
View File
@@ -22,7 +22,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
+3 -3
View File
@@ -22,7 +22,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap">
@@ -33,7 +33,7 @@
<div class="grid2" style="margin-top:12px" id="stats"></div></div><div id="zMySpots"></div>
<div class="card"><h3>Your share link</h3><p class="muted small">People who join through this link have you as their sponsor. It is set once, on their first spot.</p>
<div class="field"><input id="share" readonly></div><button class="btn sec small" id="copyBtn">Copy link</button></div>
<div class="card"><h3>Spots</h3><p class="muted small">Image: 468x60 PNG, JPG or GIF up to 150 KB, or an https image address. Link: https only. Change them any time. A spot with no image shows your default, or a network image until you add one.</p>
<div class="card"><h3>Spots</h3><p class="muted small">Image: 468x60 PNG, JPG or GIF up to 150 KB, or an https image address. Link: https only. Change them any time, as often as you like: every change is checked (the link must open, an image address must load) and logged. A spot with no image shows your default, or a network image until you add one.</p>
<div id="spots"></div></div>
<div class="card"><h3>Default image and link</h3><p class="muted small">Used by any spot you have not set up.</p><div id="defaults"></div></div>
<div class="card"><h3>Payments to you</h3><div id="payouts"></div></div>
@@ -43,7 +43,7 @@
</main>
<script src="/assets/common.js?v=20261115nr"></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/my.js?v=z2"></script>
<script src="/assets/my.js?v=z3"></script>
<script src="/assets/chat.js?v=1" defer></script>
</body>
</html>
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap legal">
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
<link rel="stylesheet" href="/assets/kit.css?v=1">
</head>
<body>
+1 -1
View File
@@ -21,7 +21,7 @@
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=2">
<link rel="stylesheet" href="/assets/line.css?v=8">
<link rel="stylesheet" href="/assets/line.css?v=9">
</head>
<body>
<main class="wrap legal">