// ViralAdBlitz local smoke test. Boots the app in prototype mode (no DOCSTORE_URL: files in a throwaway data dir under qa/out) // against local stand-ins, then checks: copy rules, pages, the promo kit, sign-in (wallet + network), the one free text ad, member // pages built from the hub line (first 5 with an ad, by place), verified visits / views / clicks, the weekly board, Boost orders // (line voucher signed by the keeper, already-bound line, hub down), Boost recording from the chain (ledger split, passed over, // Telegram card once, hub report), Boost delivery (views counted, starred while active, finished), Network Ad Space finishing, // old-link redirects, admin, a restart, and Playwright renders on desktop + phone. // Nothing leaves this machine: hub, InstantAdPay lookup, chain RPC, Telegram and NAS are local stand-ins. No real wallet, no money. // node qa/smoke.mjs (Playwright renders too, if installed at PLAYWRIGHT) // SKIP_UI=1 node qa/smoke.mjs (HTTP checks only) import { spawn } from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; import crypto from 'node:crypto'; import http from 'node:http'; import { createRequire } from 'node:module'; import { fileURLToPath } from 'node:url'; const require = createRequire(import.meta.url); const { ethers } = require('ethers'); const APP = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const OUT = path.join(APP, 'qa', 'out'); fs.mkdirSync(OUT, { recursive: true }); const DATA = path.join(OUT, 'data-' + Date.now()); fs.mkdirSync(DATA, { recursive: true }); const PW = process.env.PLAYWRIGHT || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright'; const PORT = Number(process.env.SMOKE_APP_PORT || 3317), BASE = 'http://127.0.0.1:' + PORT; const ADMIN = 'smoke-admin-token', SSO_SECRET = crypto.randomBytes(32).toString('hex'), HUB_SECRET = 'h'.repeat(40); const KEEPER_PK = '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d'; // anvil's public test key #1 const KEEPER = new ethers.Wallet(KEEPER_PK).address; const SHOP = '0x00000000000000000000000000000000000Ab0B5'; const sleep = ms => new Promise(r => setTimeout(r, ms)); let pass = 0, fail = 0; let srv = null; const ok = (cond, what, extra) => { if (cond) { pass++; console.log(' ok ' + what); } else { fail++; console.log(' FAIL ' + what + (extra !== undefined ? ' -> ' + JSON.stringify(extra, (k, v) => typeof v === 'bigint' ? v.toString() : v).slice(0, 500) : '')); } }; const listen = (port, fn) => http.createServer(async (q, r) => { let b = ''; for await (const c of q) b += c; try { await fn(q, r, b); } catch (e) { r.statusCode = 500; r.end(String(e.message)); } }).listen(port, '127.0.0.1').unref(); // ---- stand-in network hub: people = wallet|id -> { id, username, wallet|null, sponsorId, blocked }. Signed as viraladblitz. ---- const HUB = { people: new Map(), down: false, badSig: 0, resolves: 0, got: [] }; function person(username, wallet, sponsorId) { const id = 'h_' + crypto.createHash('sha1').update(username).digest('hex').slice(0, 16); HUB.people.set(id, { id, username, wallet: wallet ? wallet.toLowerCase() : null, sponsorId: sponsorId || null }); return id; } const hubView = p => { if (!p) return null; const sp = p.sponsorId && HUB.people.get(p.sponsorId); return { id: p.id, username: p.username, wallet: p.wallet, blocked: false, sponsor: sp ? { id: sp.id, username: sp.username } : null }; }; const HUB_PORT = PORT + 1; listen(HUB_PORT, async (q, r, b) => { r.setHeader('Content-Type', 'application/json'); if (HUB.down) { r.statusCode = 503; return r.end('{"error":"down"}'); } const want = crypto.createHmac('sha256', HUB_SECRET).update(q.headers['x-hub-ts'] + '\n' + b).digest('hex'); if (q.headers['x-hub-sig'] !== want || q.headers['x-hub-site'] !== 'viraladblitz') { HUB.badSig++; r.statusCode = 401; return r.end('{}'); } const j = JSON.parse(b || '{}'); if (q.url === '/v1/resolve') { HUB.resolves++; const all = [...HUB.people.values()]; let p = null; if (j.id) p = HUB.people.get(j.id); else if (j.wallet) p = all.find(x => x.wallet === String(j.wallet).toLowerCase()); else if (j.ref) { const ref = String(j.ref).toLowerCase(); p = all.find(x => x.wallet === ref || x.username.toLowerCase() === ref); } else if (j.email) p = all.find(x => x.email === j.email); return r.end(JSON.stringify({ person: hubView(p) })); } if (String(q.url).startsWith('/v1/adwriter')) return r.end(JSON.stringify({ on: true, daily: 5, left: 5 })); // the ad writer (hubadwriter.js; its own test covers the calls) HUB.got.push({ route: q.url, body: j }); r.end('{"ok":true}'); }); // ---- stand-in InstantAdPay member lookup (only used while the hub is down) ---- const IAP_KNOWS = new Set(); const LOOKUP_PORT = PORT + 2; listen(LOOKUP_PORT, async (q, r) => { const a = (new URL(q.url, 'http://x').searchParams.get('a') || '').toLowerCase(); r.setHeader('Content-Type', 'application/json'); r.end(JSON.stringify(IAP_KNOWS.has(a) ? { address: a, username: 'iap' + a.slice(2, 8) } : {})); }); // ---- stand-in Polygon JSON-RPC: quoteWei at POL $0.25 (1 cent = 0.04 POL), sponsorOf from BOUND, contract facts, logs + receipts ---- const IFACE = new ethers.Interface(['event Purchase(uint256 indexed orderId, address indexed buyer, uint256 indexed sku, uint256 qty, uint256 ref, uint256 views, uint256 usdCents, uint256 weiPaid, uint256 levelsPaid, uint256 companyPaid)', 'event Paid(uint256 indexed orderId, address indexed to, uint256 amount, uint8 level, uint8 depth)', 'event PassedOver(uint256 indexed orderId, address indexed who, uint8 depth)', 'event SponsorBound(address indexed member, address indexed sponsor)', 'function quoteWei(uint256 sku, uint256 qty) view returns (uint256)', 'function sponsorOf(address) view returns (address)', 'function buy(uint256 sku, uint256 qty, uint256 ref, address[] line, uint256 deadline, bytes sig) payable returns (uint256)', 'function owner() view returns (address)', 'function company() view returns (address)', 'function keeper() view returns (address)', 'function paused() view returns (bool)', 'function totalOwed() view returns (uint256)', 'function orderCount() view returns (uint256)']); const CHAIN = { head: 1, logs: [], receipts: {}, bound: new Map(), replayAll: false, down: false, times: {} }; const TANGEM = '0x7627Fc78876948AC9d95C1C9eB061E7D6d647b70'; const CHAIN_PORT = PORT + 3; listen(CHAIN_PORT, async (q, r, b) => { const j = JSON.parse(b || '{}'); let result = null; r.setHeader('Content-Type', 'application/json'); if (CHAIN.down) return r.end(JSON.stringify({ jsonrpc: '2.0', id: j.id, error: { code: -1, message: 'down' } })); if (j.method === 'eth_blockNumber') result = '0x' + CHAIN.head.toString(16); if (j.method === 'eth_call') { const d = j.params[0].data; const tx = IFACE.parseTransaction({ data: d }); const enc = (fn, v) => IFACE.encodeFunctionResult(fn, v); if (tx.name === 'quoteWei') result = enc('quoteWei', [500n * tx.args[1] * 4n * 10n ** 16n]); if (tx.name === 'sponsorOf') result = enc('sponsorOf', [CHAIN.bound.get(tx.args[0].toLowerCase()) || ethers.ZeroAddress]); if (tx.name === 'owner' || tx.name === 'company') result = enc(tx.name, [TANGEM]); if (tx.name === 'keeper') result = enc('keeper', [KEEPER]); if (tx.name === 'paused') result = enc('paused', [false]); if (tx.name === 'totalOwed') result = enc('totalOwed', [0n]); if (tx.name === 'orderCount') result = enc('orderCount', [BigInt(CHAIN.logs.length)]); } if (j.method === 'eth_getBalance') result = '0x0'; if (j.method === 'eth_getTransactionReceipt') result = CHAIN.receipts[j.params[0]] || null; if (j.method === 'eth_maxPriorityFeePerGas') result = '0x' + (40n * 10n ** 9n).toString(16); if (j.method === 'eth_getBlockByNumber') { const n = j.params[0] === 'latest' ? CHAIN.head : parseInt(j.params[0], 16); result = { number: '0x' + n.toString(16), timestamp: '0x' + (CHAIN.times[n] || Math.floor(Date.now() / 1000)).toString(16), baseFeePerGas: '0x' + (30n * 10n ** 9n).toString(16) }; } if (j.method === 'eth_getLogs') { const f = j.params[0], lo = parseInt(f.fromBlock, 16), hi = parseInt(f.toBlock, 16); result = CHAIN.logs.filter(l => CHAIN.replayAll || (parseInt(l.blockNumber, 16) >= lo && parseInt(l.blockNumber, 16) <= hi)); } r.end(JSON.stringify({ jsonrpc: '2.0', id: j.id, result })); }); // a Boost on the stand-in chain: Purchase log + a receipt with SponsorBound / PassedOver / Paid logs, like VABShop emits let orderId = 0; function chainBoost(o) { const id = ++orderId; const block = ++CHAIN.head; const tx = '0x' + crypto.randomBytes(32).toString('hex'); if (o.blockAt) CHAIN.times[block] = o.blockAt; const weiPaid = 500n * BigInt(o.qty || 1) * 4n * 10n ** 16n; const share = weiPaid / 10n; const mk = (name, args, li) => { const e = IFACE.encodeEventLog(name, args); return { address: SHOP.toLowerCase(), topics: e.topics, data: e.data, blockNumber: '0x' + block.toString(16), transactionHash: tx, logIndex: '0x' + li.toString(16), removed: false }; }; const logs = []; let li = 0; for (const [m, s] of o.bound || []) { logs.push(mk('SponsorBound', [m, s], li++)); CHAIN.bound.set(m.toLowerCase(), s.toLowerCase()); } for (const [w, d] of o.over || []) logs.push(mk('PassedOver', [id, w, d], li++)); (o.pays || []).forEach(([w, d], i) => logs.push(mk('Paid', [id, w, share, i + 1, d], li++))); const company = weiPaid - share * BigInt((o.pays || []).length); logs.push(mk('Paid', [id, TANGEM, company, 0, 0], li++)); const purchase = mk('Purchase', [id, o.buyer, 1, o.qty || 1, o.ref || 0, o.views || 500, 500 * (o.qty || 1), weiPaid, (o.pays || []).length, company], li++); logs.push(purchase); CHAIN.logs.push(purchase); CHAIN.receipts[tx] = { status: '0x1', blockNumber: '0x' + block.toString(16), to: SHOP.toLowerCase(), from: o.buyer.toLowerCase(), logs }; return { tx, id, weiPaid, share, company }; } // ---- stand-in Telegram Bot API ---- const TG = []; const TG_PORT = PORT + 4; listen(TG_PORT, async (q, r, b) => { TG.push({ method: q.url.split('/').pop(), token: q.url.split('/')[1], body: JSON.parse(b || '{}') }); r.setHeader('Content-Type', 'application/json'); r.end('{"ok":true,"result":{}}'); }); // ---- stand-in LinkSpin partner endpoint /api/partner/vab/links (net.v1 signature). Starts DOWN (404, as before LinkSpin ships it). ---- const LS = { up: false, calls: [], badSig: 0, links: new Map(), known: new Set(['one', 'owner', 'four', 'five', 'six', 'seven', 'topdog', 'downline']), stats: {}, spins: { one: [{ code: 'onespin1', name: 'My three offers', destinations: 3, paused: false }, { code: 'onepaus1', name: 'Resting', destinations: 1, paused: true }, { code: 'oneempt1', name: 'Empty', destinations: 0, paused: false }], owner: [{ code: 'ownspin1', name: 'Owner rotator', destinations: 2, paused: false }] } }; const LS_PORT = PORT + 5; listen(LS_PORT, async (q, r, b) => { r.setHeader('Content-Type', 'application/json'); if (!LS.up || q.url !== '/api/partner/vab/links') { r.statusCode = 404; return r.end('{"error":"Not found"}'); } const want = crypto.createHmac('sha256', SSO_SECRET).update('net.v1.' + q.headers['x-net-ts'] + '\n' + b).digest('hex'); if (q.headers['x-net-sig'] !== want) { LS.badSig++; r.statusCode = 401; return r.end('{"error":"unauthorized"}'); } const j = JSON.parse(b || '{}'); LS.calls.push(j); const SPIN_HOSTS = ['linkspin.app', 'qa-spin.net', 'qa-spare.net']; if (j.op === 'spins' && !LS.known.has(String(j.username || '').toLowerCase())) return r.end(JSON.stringify({ account: false, hosts: SPIN_HOSTS })); if (!LS.known.has(String(j.username || '').toLowerCase())) return r.end('{"account":false}'); if (j.op === 'spins') return r.end(JSON.stringify({ account: true, username: j.username, host: 'qa-spin.net', hosts: SPIN_HOSTS, spins: (LS.spins[j.username] || []).map(x => Object.assign({ url: 'https://qa-spin.net/r/' + x.code }, x)) })); if (j.op === 'stats') return r.end(JSON.stringify({ account: true, stats: LS.stats[j.username] || {} })); const links = {}; for (const x of j.links || []) { const k = j.username + ':' + x.id; let l = LS.links.get(k); if (!l) { l = { code: crypto.randomBytes(3).toString('hex'), url: x.url }; LS.links.set(k, l); } l.url = x.url; links[x.id] = { code: l.code, link: 'https://spin.test/r/' + l.code + '?s1=' + x.id + '&placement=' + x.id, created: false }; } r.end(JSON.stringify({ account: true, username: j.username, host: 'spin.test', links, errors: {} })); }); const ENV = Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, ADMIN_TOKEN: ADMIN, NODE_ENV: 'development', DOCSTORE_URL: '', VISIT_SECONDS: '2', VISITS_PER_IP_DAY: '2', LINK_PROBE: '0', NETWORK_LOOKUP_URL: 'http://127.0.0.1:' + LOOKUP_PORT + '/api/network/member', NETWORK_SSO_SECRET: SSO_SECRET, IAP_URL: 'https://iap.invalid', LS_URL: 'https://ls.invalid', NETWORK_SITES_HUB: '0', CONTRACT_ADDRESS: SHOP, CHAIN_RPC: 'http://127.0.0.1:' + CHAIN_PORT, KEEPER_KEY: KEEPER_PK, SHOP_START_BLOCK: '1', SHOP_CONFIRMATIONS: '0', SHOP_POLL_MS: '200', EXPLORER: 'https://explorer.invalid', HUB_ENABLED: '1', NETKB: '0', HUB_URL: 'http://127.0.0.1:' + HUB_PORT, HUB_SECRET, HUB_SITE: 'viraladblitz', HUB_TICK_MS: '300', HUB_DOWN_MS: '300', HUB_CACHE_MS: '200', LS_TRACK_URL: 'http://127.0.0.1:' + LS_PORT, LS_SWEEP_FIRST_MS: '300', LS_SWEEP_MS: '300', LS_RETRY_MS: '300', LS_CACHE_MS: '100', TG_TOKEN: 'standin-token', TG_CHAT: '-100123', TG_PAY_TOPIC: '632242', TG_API: 'http://127.0.0.1:' + TG_PORT }); process.on('exit', () => { try { srv && srv.kill(); } catch (e) {} }); let nextIp = 10; function client(opts = {}) { const jar = {}; const ip = opts.ip || ('203.0.113.' + (nextIp++)); const ua = opts.ua || ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) SmokeBrowser/' + ip); return { jar, ip, ua, async req(p, o = {}) { const headers = Object.assign({ 'User-Agent': ua, 'X-Forwarded-For': ip, Cookie: Object.entries(jar).map(([k, v]) => k + '=' + v).join('; ') }, o.headers || {}); const r = await fetch(BASE + p, { method: o.method || 'GET', headers, body: o.body, redirect: 'manual' }); for (const c of r.headers.getSetCookie ? r.headers.getSetCookie() : []) { const [kv] = c.split(';'); const i = kv.indexOf('='); jar[kv.slice(0, i)] = kv.slice(i + 1); } return r; }, async json(p, body, extra) { const r = await this.req(p, body === undefined ? { headers: extra } : { method: 'POST', headers: Object.assign({ 'Content-Type': 'application/json' }, extra), body: JSON.stringify(body) }); return Object.assign({ _status: r.status }, await r.json().catch(() => ({}))); } }; } async function boot() { const log = fs.openSync(path.join(OUT, 'server.log'), 'a'); srv = spawn(process.execPath, ['server.js'], { cwd: APP, env: ENV, stdio: ['ignore', log, log] }); for (let i = 0; i < 80; i++) { try { const r = await fetch(BASE + '/health'); if (r.ok) return; } catch (e) {} await sleep(150); } throw new Error('server did not start; see qa/out/server.log'); } async function stop() { const p = srv; srv = null; if (!p) return; const done = new Promise(r => p.once('exit', r)); p.kill('SIGINT'); await Promise.race([done, sleep(3000)]); } // a member signed in by wallet signature. hub: { username, sponsorId } puts them in the hub; iap: InstantAdPay knows the wallet async function walletMember(o = {}) { const w = o.wallet || ethers.Wallet.createRandom(); const c = client(); const a = w.address.toLowerCase(); if (o.hub) c.hubId = person(o.hub.username, a, o.hub.sponsorId); if (o.iap) IAP_KNOWS.add(a); const ch = await c.json('/api/auth/challenge', { address: w.address }); const v = await c.json('/api/auth/verify', { address: w.address, signature: await w.signMessage(ch.message) }); c.address = a; c.wallet = w; c.ok = v.ok === true && !!c.jar['vab.sid']; return c; } const adBody = (n, extra) => Object.assign({ headline: 'Headline number ' + n, line1: 'First line for ad ' + n + ', plain text', line2: 'Second line ' + n, link: 'https://member-' + n + '.example-shop.com/offer?id=' + n }, extra || {}); // one page load + its verified visit async function view(c, page, u, wait) { const d = await c.json('/api/wire?page=' + page + (u ? '&u=' + encodeURIComponent(u) : '')); if (!d.ticket) return { d, r: { verified: false, why: 'no-ticket' } }; await sleep(wait != null ? wait : 2100); return { d, r: await c.json('/api/visit/seen', { ticket: d.ticket, visibleMs: wait != null ? wait : 2100 }) }; } async function main() { if (await fetch(BASE).then(() => true, () => false)) throw new Error('port ' + PORT + ' is already in use; set SMOKE_APP_PORT'); console.log('data dir', DATA); console.log('1. copy rules'); const pub = path.join(APP, 'public'); const files = fs.readdirSync(pub).filter(f => f.endsWith('.html')).map(f => path.join(pub, f)).concat(fs.readdirSync(path.join(pub, 'assets')).filter(f => /\.(js|css)$/.test(f) && f !== 'wallet.js').map(f => path.join(pub, 'assets', f))); const texts = files.map(f => [path.basename(f), fs.readFileSync(f, 'utf8')]).concat(['promokit.js', 'proof.js', 'server.js', 'tools/pages.mjs', 'tools/art.mjs'].map(f => [f, fs.readFileSync(path.join(APP, f), 'utf8')])); ok(texts.every(([, t]) => !/[\u2014\u2013]/.test(t)), 'no em or en dashes in any page, script or copy source', texts.filter(([, t]) => /[\u2014\u2013]/.test(t)).map(x => x[0])); const html = texts.filter(([n]) => n.endsWith('.html')).map(x => x[1]).join('\n'); ok(!/metamask/i.test(html), 'pages never name MetaMask'); ok(/SafePal or any other crypto wallet/.test(html), 'wallet copy says "SafePal or any other crypto wallet"'); ok(!/passive income|guaranteed (income|returns|profit)|earn (cash|money)|make money|get rich|up to \$?\d+ (a|per)|maximum (you|earn)/i.test(html), 'no income promises and no earnings caps in page copy'); ok(/never a subscription/i.test(html) && /A Boost buys advertising, not income\. Nothing is promised\./.test(html), 'Boost copy: one-time, never a subscription; "advertising, not income. Nothing is promised."'); ok(/TrustClickz/.test(html) && !/Green Valley|Moody|35004/.test(html), 'legal pages name TrustClickz, no street address'); console.log('2. boot (prototype mode, temp data dir)'); await boot(); const cfg = await (await fetch(BASE + '/api/config')).json(); ok(cfg.boost.usd === 5 && cfg.boost.views === 500 && cfg.boost.sku === 1 && cfg.split.levels === 5 && cfg.split.levelPct === 10 && cfg.split.companyPct === 50, 'config: Boost $5 = 500 views, 5 levels x 10% + 50% company', cfg.boost); ok(cfg.shop.live === true && cfg.shop.contract.toLowerCase() === SHOP.toLowerCase(), 'shop live against the stand-in contract'); ok(fs.readFileSync(path.join(OUT, 'server.log'), 'utf8').includes('files (prototype mode)'), 'server says prototype mode (no DOCSTORE_URL)'); console.log('3. pages'); const anon = client(); for (const p of ['/', '/how', '/my', '/boost', '/ledger', '/contract', '/promote', '/terms', '/disclaimer', '/privacy', '/admin', '/robots.txt', '/sitemap.xml', '/art/mark.svg', '/art/og-share.png', '/assets/vab.css', '/assets/common.js']) { const r = await anon.req(p); ok(r.status === 200, 'GET ' + p + ' 200', r.status); } let r = await anon.req('/'); const home = await r.text(); ok(/

Spread your ad<\/span> 5 levels deep<\/span><\/h1>/.test(home) && /id="boardCards"/.test(home) && /og:image" content="https:\/\/viraladblitz\.com\/art\/og-share\.png/.test(home), 'front page: "Spread your ad 5 levels deep" headline, board, Open Graph'); r = await anon.req('/how'); const how = await r.text(); ok((how.match(//g) || []).length >= 5 && /PASSED OVER/.test(how) && /A Boost buys advertising, not income\. Nothing is promised\./.test(how) && /SafePal or any other crypto wallet/.test(how) && !/[—–]/.test(how) && /"@type":"FAQPage"/.test(how), 'How it works page: 3 accessible diagrams, 4 sections, FAQ, pass-up shown, copy rules', how.length); ok(/href="\/how#boost">How a Boost worksHow it works<\/a>/.test(fs.readFileSync(path.join(APP, 'public/assets/common.js'), 'utf8')), 'How it works linked from the nav, the footer and the front page ("How a Boost works")'); ok((await (await anon.req('/sitemap.xml')).text()).includes('/how'), 'sitemap lists /how'); { // Guides (Marty 2026-11-17): index + 4 evergreen pages, canonical/OG, linked from nav + footer, in the sitemap, no dashes, the house lines const sm = await (await anon.req('/sitemap.xml')).text(); const cjs = fs.readFileSync(path.join(APP, 'public/assets/common.js'), 'utf8'); for (const g of ['/guides', '/guides/how-it-works', '/guides/is-it-legit', '/guides/free-account', '/guides/faq']) { const gr = await anon.req(g); const t = await gr.text(); ok(gr.status === 200 && t.includes('') && t.includes('og:url" content="https://viraladblitz.com' + g + '"') && //.test(t) && !/[\u2014\u2013]|[^-!]--[^>]/.test(t) && !/RM Circle/i.test(t) && /A Boost buys advertising, not income\./.test(t) && t.includes('/assets/guides.js') && sm.includes(g + ''), 'guide ' + g + ': 200, canonical, OG, description, house lines, in the sitemap'); } const legit = await (await anon.req('/guides/is-it-legit')).text(); ok(legit.includes('0xb58447b0CE9a38Ad0e7d41a074FEbee696452905') && legit.includes('polygonscan.com/address/0xb58447b0CE9a38Ad0e7d41a074FEbee696452905#code') && /LEVEL 5<\/span>10%/.test(legit) && /COMPANY<\/span>50%/.test(legit) && legit.includes('href="/ledger"'), 'Is it legit guide: contract address, Polygonscan code link, 10% x 5 + 50% split, ledger link'); ok(/"@type":"FAQPage"/.test(await (await anon.req('/guides/faq')).text()), 'FAQ guide carries FAQPage data'); ok(/\['\/guides', 'Guides'\]/.test(cjs) && /Guides<\/a>/.test(cjs), 'Guides in the nav and the footer'); const fq = await anon.req('/faq', { redirect: 'manual' }); ok(fq.status === 301 && fq.headers.get('location') === '/guides/faq', '/faq redirects to /guides/faq', fq.status); } ok(!r.headers.get('x-frame-options'), 'front page stays frameable (traffic exchanges)'); r = await anon.req('/my'); ok(r.headers.get('x-frame-options') === 'DENY', '/my is never framed'); ok(/script-src[^;]*https:\/\/linkspin\.app/.test(r.headers.get('content-security-policy') || ''), 'CSP admits linkspin.app (network zones)'); r = await anon.req('/nobody-at-all'); ok(r.status === 404 && /Back to the wire/.test(await r.text()), 'a username the hub does not know: 404'); r = await anon.req('/api/my'); ok(r.status === 401, '/api/my needs sign-in'); // the site assistant (2026-11-15): widget on every page, canned answers without AI, admin KB behind the token ok(/