Network Weekend (Marty 2026-11-17): ribbon, WEEKEND500 start gate, date-gated chatbot fact

- netdeals.js + /api/network-deals (hub /v1/network-deals) and /assets/netweekend.js loaded from common.js and netline.js:
  the ribbon shows only Fri 11-27 00:00 CT to Tue 12-01 00:00 CT by the page's own clock (common/netline ?v=20261117nw)
- promos: optional starts (MySQL promo_codes.starts) so a code can be created dormant and open by itself; setClock for tests
- weekendfact.js: chatbot FACTS for the event (live deal lines from the hub) Fri to Mon, the WEEKEND500 line to Tue 12-08 00:00 CT
- qa/networkweekend.test.cjs: 8 pass (test clocks only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 07:22:52 -06:00
parent e0ece93e9d
commit 5613d10224
34 changed files with 265 additions and 38 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ function head(o) {
+ '</head><body><div class="wrap bl">';
}
function tail() {
return '</div><script src="/assets/common.js?v=20261116ad"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
return '</div><script src="/assets/common.js?v=20261117nw"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
}
const authorBox = () => '<div class="author"><img src="/logo-icon.png" alt="LinkSpin"><div><b>' + AUTHOR + '</b><span>Founder of LinkSpin and the Crypto Team Build Network. Twenty-plus years of internet marketing, and a habit of writing down what actually worked.</span></div></div>';
const cardHtml = p => '<a class="post-card" href="/blog/' + esc(p.slug) + '">' + (p.cover ? '<img src="' + esc(p.cover) + '" alt="" loading="lazy" style="width:100%;border-radius:10px;margin:0 0 12px">' : '') + '<h2>' + esc(p.title) + '</h2><p>' + esc(p.excerpt) + '</p><p class="meta">' + fmtDate(p.publishedAt || p.created) + ' · ' + readMinutes(p.body) + ' min read' + (p.tags.length ? ' · ' + p.tags.map(esc).join(', ') : '') + '</p></a>';
+3 -2
View File
@@ -210,6 +210,7 @@ const REFUEL_OFF_ANSWER = 'The Monthly Refuel streak (bonus ad credits for refue
// launch day 2026-11-15 Central: before it the pre-launch fact, from it the launched fact (date-driven since 2026-11-02)
const ctToday = () => new Date().toLocaleDateString('en-CA', { timeZone: 'America/Chicago' });
function launchFact() { return ctToday() < '2026-11-15' ? '- PRE-LAUNCH (since 2026-10-17): LinkSpin is open to everyone for pre-launch testing until the official launch on November 15, 2026. Everything is live and working (links, sources, zones, ads, credits, payouts), but features and screens may change while it is tested. A notice at the top of every member screen says so. If someone got a reminder email about a member they have not contacted, they can ignore it: nothing changed in their line.' : '- LAUNCHED 2026-11-15: LinkSpin is fully open. The pre-launch period (Oct 17 to Nov 14) is over; everything that was live stays live, and the pre-launch notice is gone.'; }
const { weekendFact } = require('./weekendfact'); // Network Weekend 2026, date-gated (Marty 2026-11-17)
function systemPrompt(kbBlock) {
return `You are the assistant on LinkSpin (${SITE_URL}), a link rotator, page builder and advertising network for marketers, a Crypto Team Build Network property.
@@ -231,7 +232,7 @@ ${refuelFact()}${synFact()}- PRODUCT, all free with an email account: SPIN LINKS
- WHO INVITED YOU (2026-11-07, Marty approved): a member with no sponsor and no member number sees a Who invited you? box at the top of their Control Room screens. They type a username, confirm in an in-page box, and that member becomes their sponsor (it follows to InstantAdPay, lifts the hold, and the sponsor gets a new-referral email and notice); with a wallet already linked the site switches their payouts on under that sponsor right away. Refused: themselves, a username that does not exist, someone in their own line, a member who cannot take new members, a member with no payouts on and nobody above them on the contract, and anyone who already has a sponsor or a member number. Nobody invited me hides the box (a small link under More brings it back while they are in the tank) and changes nothing else. It never blocks the site. It is not an adoption: no 7-day window and it does not count toward the two.
- SIGN-UP GRACE (2026-11-07): for 24 hours from sign-up nobody can adopt a member by hand. The 24-hour auto-assign is unchanged and runs from the wallet link, so a member who links a wallet in their first hour is matched about 24 hours after linking, with at most a short hand-adoption window first. Members back in the tank later have no grace.
- HOLDING TANK ACTIVATION HOLD (2026-10-27): a member with no sponsor is first matched to their network sponsor (the same email or wallet with a sponsor on InstantAdPay). Nobody known: the free Switch on payouts waits for an adopter and the Credits screen says "You're being matched with a sponsor. Payouts switch on as soon as someone picks you up (within 24 hours)." with the time left; they show at the top of every holding tank with a green Ready to activate badge and the hours left, and the shared payments topic on Telegram is told. Nobody adopts in 24 hours: the site assigns them to the next eligible adopter in rotation (own $25+ package, fewer than 10 people held from the tank who have not switched on payouts yet, signed in within 7 days; least recently auto-assigned first), and the pickup is posted marked (auto-assigned). The moment they have a sponsor (adopted, assigned or matched), the site switches their payouts on under that sponsor (engine-paid) and sends them the transaction link. A PURCHASE IS NEVER HELD: a tank member can buy at any time; with no sponsor yet that purchase places them under the platform position for good. Someone who arrived through a sponsor link is never held.
${launchFact()}
${launchFact()}${weekendFact()}
- SUPPORT (LIVE 2026-10-16): members open Help in the Control Room (${SITE_URL}/help) to send Marty a ticket (pick a category, a subject, the message), see each ticket's status (Open, Waiting on you, Closed), and read and answer his replies; a badge on the Help item shows when he has replied, and replies also arrive by email. Anyone signed out or locked out uses the public form at ${SITE_URL}/support, gets a private link to follow the ticket without signing in, and can reply there. The chat can also pass a conversation to support ("Send this to support"). Marty answers every ticket himself; there is no support email address, point people to ${SITE_URL}/support instead. Tickets share one desk with the rest of the Crypto Team Build Network.
- Leaderboard at ${SITE_URL}/leaderboard ranks members by packages sold to direct referrals (weekly, monthly, all time; weekly and monthly prizes are ad credits, never cash).
- FOUNDER BADGE (2026-11-05): cosmetic only (no credits, no POL, no perks, never posted to Telegram). Granted automatically from the launch moment (Sun 2026-11-15 6:00 AM Central) to every account whose earliest signed-in visit is before that moment; carried-over accounts that never signed in do not get it. Shown in the member's badge strip, on their wall, on their sponsor's Team list and on the leaderboard.
@@ -326,4 +327,4 @@ async function answerRaw(message, historyText) {
}
}
module.exports = { init, answer, enabled, KNOWLEDGE_DATE, CANNED, seeds, systemPrompt };
module.exports = { weekendFact, init, answer, enabled, KNOWLEDGE_DATE, CANNED, seeds, systemPrompt };
+1
View File
@@ -81,6 +81,7 @@ async function bootstrap() {
catch (e) { if (!['ER_DUP_FIELDNAME', 'ER_DUP_KEYNAME'].includes(e.code)) throw e; }
};
await alterSafe('ALTER TABLE promo_codes ADD COLUMN funder VARCHAR(190) NULL'); // member-funded partner codes (Nexus), 2026-09-14
await alterSafe('ALTER TABLE promo_codes ADD COLUMN starts BIGINT NOT NULL DEFAULT 0'); // 2026-11-17 Network Weekend: a code can open at a set time (0 = open now)
await alterSafe('ALTER TABLE accounts ADD COLUMN username VARCHAR(30) NULL');
await alterSafe('ALTER TABLE accounts ADD UNIQUE KEY uq_username (username)');
await alterSafe('ALTER TABLE accounts ADD COLUMN member_id INT NULL');
+1 -1
View File
@@ -146,7 +146,7 @@ async function renderPage() {
const w = winners();
if (w.length) h += '<h2 style="font-size:24px;margin:0 0 10px">Past winners</h2>' + w.slice(0, 12).map(x => '<div class="win"><b>' + (x.kind === 'week' ? 'Week of ' : 'Month of ') + fmtD(x.start) + '</b>: ' + (x.top[0] ? esc(x.top[0].name) + ' (' + x.top[0].sales + ' sold, $' + x.top[0].usd + ')' : 'no sales') + (x.granted && x.granted.length ? ' · awarded: ' + x.granted.map(g => esc(g.name) + ' +' + g.credits.toLocaleString()).join(', ') : (x.prize ? ' · prize ' + esc(x.prize) : '')) + '</div>').join('');
h += '<p class="muted small" style="margin-top:30px">Sales are $ of packages bought by members you directly sponsor. Weekly and monthly prizes are advertising credits or packages, never cash. No income is guaranteed.</p>';
h += '</div><script src="/assets/common.js?v=20261116ad"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
h += '</div><script src="/assets/common.js?v=20261117nw"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
return h;
}
function setLaunchPanel(fn) { if (R) R.launchPanel = fn; }
+54
View File
@@ -0,0 +1,54 @@
// Network deals for this site's "Network Weekend" ribbon (Marty 2026-11-17). One source: the hub's public GET /v1/network-deals
// (HUB_URL). Cached 2 minutes, refreshed in the background, never waits on a slow hub (2.5 s timeout); hub down = no ribbon.
// The same file lives in every network site. Never RM Circle, never the games (the hub list never names them).
// The page (/assets/netweekend.js) switches the ribbon on and off by its own clock at startsAt / endsAt, so a cached copy never
// shows early or late. setLocal(fn) lets a site rewrite its own deal line from live data (for example a price read from chain),
// so the ribbon never shows a number the contract does not charge: fn(deal) returns the deal, a changed copy, or null to drop it.
const TTL = 2 * 60 * 1000;
let cache = { at: 0, body: { events: [] } };
let inflight = null;
let local = null;
const hubUrl = () => String(process.env.HUB_URL || 'https://hub.saasy.top').trim().replace(/\/+$/, '');
const safeUrl = u => (/^https:\/\/[a-z0-9.-]+(\/[^\s"'<>]*)?$/i.test(String(u || '')) ? String(u) : '');
const str = (v, n) => String(v == null ? '' : v).slice(0, n || 300);
function clean(j) {
if (!j || !Array.isArray(j.events)) return null;
return { events: j.events.slice(0, 5).filter(e => e && e.id && !Number.isNaN(Date.parse(e.startsAt)) && !Number.isNaN(Date.parse(e.endsAt))).map(e => ({
id: str(e.id, 60), name: str(e.name, 60), tagline: str(e.tagline, 160), url: safeUrl(e.url), startsAt: e.startsAt, endsAt: e.endsAt,
days: e.days && typeof e.days === 'object' ? Object.fromEntries(Object.entries(e.days).slice(0, 20).map(([k, v]) => [str(k, 10), str(v, 40)])) : {},
deals: (Array.isArray(e.deals) ? e.deals : []).slice(0, 40).map(d => {
const x = { site: str(d.site, 30), name: str(d.name, 80), url: safeUrl(d.url), text: str(d.text), endsAt: Number.isNaN(Date.parse(d.endsAt)) ? e.endsAt : d.endsAt };
if (d.note) x.note = str(d.note, 120);
if (d.byDay && typeof d.byDay === 'object') x.byDay = Object.fromEntries(Object.entries(d.byDay).slice(0, 20).map(([k, v]) => [str(k, 10), str(v)]));
return x;
})
})) };
}
function refresh() {
if (inflight || process.env.NETWORK_DEALS_HUB === '0') return inflight;
const ac = new AbortController(); const t = setTimeout(() => ac.abort(), 2500);
inflight = fetch(hubUrl() + '/v1/network-deals', { signal: ac.signal })
.then(r => (r.ok ? r.json() : null))
.then(j => { const b = clean(j); if (b) cache = { at: Date.now(), body: b }; else cache.at = Date.now(); })
.catch(() => { cache.at = Date.now() - TTL + 30 * 1000; }) // hub down: try again in 30 s, keep the last good copy
.finally(() => { clearTimeout(t); inflight = null; });
return inflight;
}
function current() { if (Date.now() - cache.at > TTL) refresh(); return cache.body; }
function setLocal(fn) { local = typeof fn === 'function' ? fn : null; }
function withLocal(body, self) {
if (!local) return body;
return { events: body.events.map(e => Object.assign({}, e, { deals: e.deals.map(d => {
if (d.site !== self) return d;
try { const r = local(Object.assign({}, d)); return r === undefined ? d : r; } catch (err) { return d; }
}).filter(Boolean) })) };
}
// GET /api/network-deals: public, short cache, the same answer on every page. self = this site's network id (NETWORK_SITE_ID).
function handle(req, res, self) {
const me = String(self || process.env.NETWORK_SITE_ID || '').trim().toLowerCase();
const body = Object.assign({ self: me }, withLocal(current(), me));
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'public, max-age=60', 'X-Content-Type-Options': 'nosniff' });
res.end(JSON.stringify(body));
}
module.exports = { current, handle, refresh, setLocal, clean, _set: b => { cache = { at: Date.now(), body: clean(b) || { events: [] } }; } };
+11 -6
View File
@@ -4,10 +4,14 @@
// the dashboard. One redemption per code per account; every redemption is logged; optional
// cap (max uses) and expiry; codes can be switched off. Storage: MySQL promo_codes +
// promo_redemptions, or DATA_DIR/promos.json.
// starts (2026-11-17, Network Weekend WEEKEND500): a code can be created dormant and open by itself at an exact time (ms; 0 = open
// now). Before it opens it answers 'not open yet'. Test clock: setClock(fn) in tests only.
const fs = require('fs');
const path = require('path');
const db = require('./db');
let DATA_DIR = null;
let clock = () => Date.now();
function setClock(fn) { clock = typeof fn === 'function' ? fn : () => Date.now(); }
const norm = c => String(c || '').trim().toUpperCase().replace(/[^A-Z0-9_-]/g, '').slice(0, 24);
const J = {
@@ -27,8 +31,8 @@ const D = {
async get(code) { const r = await db.q('SELECT * FROM promo_codes WHERE code=?', [code]); return r[0] ? row(r[0]) : null; },
async list() { return (await db.q('SELECT * FROM promo_codes ORDER BY created DESC')).map(row); },
async put(c) {
await db.q('INSERT INTO promo_codes (code,credits,partner,note,max_uses,expires,active,created,funder) VALUES (?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE funder=VALUES(funder), credits=VALUES(credits), partner=VALUES(partner), note=VALUES(note), max_uses=VALUES(max_uses), expires=VALUES(expires), active=VALUES(active)',
[c.code, c.credits, c.partner || null, c.note || null, c.maxUses || 0, c.expires || 0, c.active ? 1 : 0, c.created || Date.now(), c.funder || null]);
await db.q('INSERT INTO promo_codes (code,credits,partner,note,max_uses,expires,active,created,funder,starts) VALUES (?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE funder=VALUES(funder), credits=VALUES(credits), partner=VALUES(partner), note=VALUES(note), max_uses=VALUES(max_uses), expires=VALUES(expires), active=VALUES(active), starts=VALUES(starts)',
[c.code, c.credits, c.partner || null, c.note || null, c.maxUses || 0, c.expires || 0, c.active ? 1 : 0, c.created || Date.now(), c.funder || null, c.starts || 0]);
return this.get(c.code);
},
async uses(code) { const r = await db.q('SELECT COUNT(*) n FROM promo_redemptions WHERE code=?', [code]); return Number(r[0].n); },
@@ -36,7 +40,7 @@ const D = {
async addRedemption(r) { await db.q('INSERT IGNORE INTO promo_redemptions (code,email,credits,via,ts) VALUES (?,?,?,?,?)', [r.code, r.email, r.credits, r.via, r.ts]); },
async redemptions(code, n) { const rows = code ? await db.q('SELECT * FROM promo_redemptions WHERE code=? ORDER BY ts DESC LIMIT ?', [code, Number(n) || 200]) : await db.q('SELECT * FROM promo_redemptions ORDER BY ts DESC LIMIT ?', [Number(n) || 200]); return rows.map(r => ({ code: r.code, email: r.email, credits: Number(r.credits), via: r.via, ts: Number(r.ts) })); }
};
const row = r => ({ code: r.code, funder: r.funder || null, credits: Number(r.credits), partner: r.partner || '', note: r.note || '', maxUses: Number(r.max_uses) || 0, expires: Number(r.expires) || 0, active: !!Number(r.active), created: Number(r.created) });
const row = r => ({ code: r.code, funder: r.funder || null, credits: Number(r.credits), partner: r.partner || '', note: r.note || '', maxUses: Number(r.max_uses) || 0, expires: Number(r.expires) || 0, starts: Number(r.starts) || 0, active: !!Number(r.active), created: Number(r.created) });
const impl = () => db.enabled() ? D : J;
function init(opts) { DATA_DIR = opts.dataDir; if (!db.enabled()) J.load(); }
@@ -44,7 +48,7 @@ async function create(c) {
const code = norm(c.code); if (!code || code.length < 3) return { error: 'Code must be 3 to 24 letters or numbers.' };
const credits = Math.floor(Number(c.credits)); if (!(credits > 0) || credits > 100000) return { error: 'Credits must be between 1 and 100,000.' };
const cur = await impl().get(code);
const saved = await impl().put({ code, credits, funder: c.funder ? String(c.funder).toLowerCase() : (cur && cur.funder) || null, partner: String(c.partner || '').slice(0, 80), note: String(c.note || '').slice(0, 200), maxUses: Math.max(0, Math.floor(Number(c.maxUses) || 0)), expires: c.expires ? Number(new Date(c.expires)) || 0 : 0, active: c.active !== false && c.active !== 0 && c.active !== '0', created: cur ? cur.created : Date.now() });
const saved = await impl().put({ code, credits, funder: c.funder ? String(c.funder).toLowerCase() : (cur && cur.funder) || null, partner: String(c.partner || '').slice(0, 80), note: String(c.note || '').slice(0, 200), maxUses: Math.max(0, Math.floor(Number(c.maxUses) || 0)), expires: c.expires ? Number(new Date(c.expires)) || 0 : 0, starts: c.starts !== undefined ? (c.starts ? Number(new Date(c.starts)) || 0 : 0) : (cur && cur.starts) || 0, active: c.active !== false && c.active !== 0 && c.active !== '0', created: cur ? cur.created : Date.now() });
return { ok: true, code: saved };
}
async function setActive(code, active) { const c = await impl().get(norm(code)); if (!c) return { error: 'No such code.' }; await impl().put(Object.assign(c, { active: !!active })); return { ok: true }; }
@@ -52,7 +56,8 @@ async function setActive(code, active) { const c = await impl().get(norm(code));
async function check(code, email) {
const k = norm(code); if (!k) return { error: 'Enter a promo code.' };
const c = await impl().get(k); if (!c || !c.active) return { error: 'That promo code is not valid.' };
if (c.expires && Date.now() > c.expires) return { error: 'That promo code has expired.' };
if (c.starts && clock() < c.starts) return { error: 'That promo code is not open yet.' };
if (c.expires && clock() > c.expires) return { error: 'That promo code has expired.' };
if (email && await impl().redeemed(k, email)) return { error: 'You already used that promo code.' };
if (c.maxUses && (await impl().uses(k)) >= c.maxUses) return { error: 'That promo code has been fully redeemed.' };
return null;
@@ -71,4 +76,4 @@ async function adminView() {
return { codes, recent: await impl().redemptions(null, 100) };
}
async function byFunder(email) { return (await impl().list()).filter(c => c.funder === String(email || '').toLowerCase()); }
module.exports = { init, create, setActive, check, redeem, adminView, norm, byFunder };
module.exports = { setClock, init, create, setActive, check, redeem, adminView, norm, byFunder };
+1 -1
View File
@@ -548,7 +548,7 @@
</div>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/admin-kb.js?v=20261020kb"></script>
<script src="/assets/admin.js?v=20261115la"></script><script src="/assets/admin-sponsorcheck.js?v=20261107tg"></script><script src="/assets/admin-refill.js?v=20261024rf"></script><script src="/assets/admin-kits.js?v=20261024kit"></script><script src="/assets/admin-launchweek.js?v=20261105lw"></script>
</body>
+3
View File
@@ -313,3 +313,6 @@ window.IAP = (function () {
a.href = '/go/iap?to=' + encodeURIComponent(u.pathname + u.search + u.hash);
}, true);
})();
// Network Weekend ribbon (Marty 2026-11-17): netweekend.js paints it only while a network event is live (dates from the hub)
(function () { try { if (window.__nwRibbon || document.querySelector('script[src^="/assets/netweekend.js"]')) return; var s = document.createElement('script'); s.src = '/assets/netweekend.js?v=20261117a'; s.defer = true; s.setAttribute('data-site', 'linkspin'); (document.head || document.documentElement).appendChild(s); } catch (e) {} })();
+3
View File
@@ -36,3 +36,6 @@
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
})();
// Network Weekend ribbon (Marty 2026-11-17): netweekend.js paints it only while a network event is live (dates from the hub)
(function () { try { if (window.__nwRibbon || document.querySelector('script[src^="/assets/netweekend.js"]')) return; var s = document.createElement('script'); s.src = '/assets/netweekend.js?v=20261117a'; s.defer = true; s.setAttribute('data-site', 'linkspin'); (document.head || document.documentElement).appendChild(s); } catch (e) {} })();
+67
View File
@@ -0,0 +1,67 @@
// "Network Weekend" ribbon (Marty 2026-11-17): a thin bar at the top of every network site page while a network event is live.
// Data: /api/network-deals (netdeals.js, from the hub). Switches on and off by this page's own clock at the event's exact
// startsAt / endsAt (US Central midnights), so a cached feed never shows it early or late, and it takes itself down at endsAt on
// a page left open. Shows this site's own deal for today (byDay, Central date) and links to the full deals page.
// The same file lives in every network site. Never RM Circle, never the games. No inline styles (CSP): styles go through CSSOM.
// Test clock: window.__NW_NOW (ms) before this script runs; nothing else.
(function () {
if (window.__nwRibbon) return; window.__nwRibbon = 1;
var tag = document.currentScript;
var meAttr = (tag && tag.getAttribute('data-site')) || '';
function now() { return typeof window.__NW_NOW === 'number' ? window.__NW_NOW : Date.now(); }
// late November is CST (UTC-6) for every date this ribbon covers
function ctDay(ms) { return new Date(ms - 6 * 3600 * 1000).toISOString().slice(0, 10); }
function closedKey(id, day) { return 'nw.closed.' + id + '.' + day; }
function isClosed(id, day) { try { return window.localStorage.getItem(closedKey(id, day)) === '1'; } catch (e) { return false; } }
function setClosed(id, day) { try { window.localStorage.setItem(closedKey(id, day), '1'); } catch (e) {} }
var bar = null;
function remove() { if (bar && bar.parentNode) bar.parentNode.removeChild(bar); bar = null; }
function paint(body) {
var me = meAttr || (body && body.self) || '';
var t = now();
var ev = ((body && body.events) || []).filter(function (e) { return t >= Date.parse(e.startsAt) && t < Date.parse(e.endsAt); })[0];
if (!ev) { remove(); return false; }
var day = ctDay(t);
if (isClosed(ev.id, day)) { remove(); return true; }
var mine = (ev.deals || []).filter(function (d) { return d.site === me && t < Date.parse(d.endsAt || ev.endsAt); })[0];
var line = mine ? ((mine.byDay && mine.byDay[day]) || mine.text) : '';
var label = (ev.days && ev.days[day]) || '';
var onDealsPage = ev.url && (location.origin + location.pathname) === ev.url;
remove();
bar = document.createElement('div');
bar.className = 'nw-ribbon'; bar.setAttribute('role', 'region'); bar.setAttribute('aria-label', ev.name);
bar.style.cssText = 'position:relative;z-index:50;display:flex;flex-wrap:wrap;gap:4px 12px;align-items:center;justify-content:center;padding:8px 40px 8px 16px;'
+ 'background:#14161b;color:#f4f1e8;font:600 13.5px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;text-align:center;border-bottom:2px solid #f2c94c';
// built node by node with CSSOM styles: no style attributes, so a strict CSP (style-src 'self') has nothing to block
function el(tagName, css, text) { var n = document.createElement(tagName); if (css) n.style.cssText = css; if (text) n.textContent = text; return n; }
var head = el('span'); head.appendChild(el('b', 'color:#f2c94c', ev.name)); if (label) head.appendChild(document.createTextNode(' · ' + label));
bar.appendChild(head);
var body2 = el('span', 'font-weight:500', line || ev.tagline);
if (line && mine && mine.note) { body2.appendChild(document.createTextNode(' ')); body2.appendChild(el('span', 'opacity:.75', mine.note)); }
bar.appendChild(body2);
if (ev.url && !onDealsPage) { var a = el('a', 'color:#f2c94c;text-decoration:underline', 'See every deal'); a.href = ev.url; a.target = '_blank'; a.rel = 'noopener'; bar.appendChild(a); }
var x = el('button', 'position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:0;color:#f4f1e8;font-size:18px;line-height:1;cursor:pointer;padding:4px 8px', '×');
x.type = 'button'; x.setAttribute('aria-label', 'Hide for today'); bar.appendChild(x);
bar.querySelector('button').addEventListener('click', function () { setClosed(ev.id, day); remove(); });
document.body.insertBefore(bar, document.body.firstChild);
return true;
}
var feed = null, timer = null;
function schedule() {
clearTimeout(timer); if (!feed) return;
// wake at the next switch moment (start, end, a deal ending, the next Central midnight), at least once a minute
var t = now(), next = t + 60 * 1000;
(feed.events || []).forEach(function (e) {
[e.startsAt, e.endsAt].concat((e.deals || []).map(function (d) { return d.endsAt; })).forEach(function (s) { var x = Date.parse(s); if (x > t && x < next) next = x; });
});
timer = setTimeout(function () { if (typeof window.__NW_NOW === 'number') window.__NW_NOW += next - t; paint(feed); schedule(); }, Math.max(250, next - t));
}
function run() {
fetch('/api/network-deals', { credentials: 'omit' }).then(function (r) { return r.ok ? r.json() : null; }).then(function (b) {
if (!b || !Array.isArray(b.events) || !b.events.length) return;
feed = b; paint(b); schedule();
}).catch(function () {});
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
window.__nwPaint = function (b) { feed = b; return paint(b); }; // tests
})();
+1 -1
View File
@@ -149,6 +149,6 @@
</div>
</footer>
<script src="/assets/contract.js?v=20261023ov"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -284,6 +284,6 @@
</div>
</footer>
<script src="/assets/conversion-guide.js?v=20261024ct"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -81,7 +81,7 @@
</div>
</div>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/wallet.js?v=20261021a"></script>
<script src="/assets/cr-shell.js?v=20261115hub"></script>
<script src="/assets/credits-screen.js?v=20261107tg"></script>
+1 -1
View File
@@ -47,6 +47,6 @@
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
</div>
</footer>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+2 -2
View File
@@ -69,7 +69,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
</footer>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -225,6 +225,6 @@
</footer>
<script src="/assets/home.js?v=20261113me"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+2 -2
View File
@@ -106,8 +106,8 @@ body.squeeze .card{position:sticky;top:16px}
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
</div>
</footer>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/join.js?v=20261111b4h"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -102,7 +102,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
</footer>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/launch.js?v=20261105po"></script>
</body>
</html>
+2 -2
View File
@@ -65,8 +65,8 @@
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
</div>
</footer>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/ledger.js?v=20261007a"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -1015,7 +1015,7 @@
</div>
</div>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/cr-shell.js?v=20261115hub"></script>
<script src="/assets/tools.js?v=20261011a"></script>
<script src="/assets/wallet.js?v=20261021a"></script>
+2 -2
View File
@@ -131,8 +131,8 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford to lose.</div>
</footer>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/partners.js?v=20261010a"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -193,7 +193,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.</div>
</footer>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/plays.js?v=20260910b"></script>
</body>
</html>
+1 -1
View File
@@ -56,6 +56,6 @@
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
</div>
</footer>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -289,6 +289,6 @@
</footer>
<script src="/assets/publishers.js?v=20261010a"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -281,6 +281,6 @@
</div>
</footer>
<script src="/assets/refuel-guide.js?v=20261024rg"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+2 -2
View File
@@ -67,8 +67,8 @@
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
</div>
</footer>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/support.js?v=20261016a"></script>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -62,6 +62,6 @@
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
</div>
</footer>
<script src="/assets/netline.js?v=20261116ad" data-site="linkspin"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
</body>
</html>
+1 -1
View File
@@ -35,7 +35,7 @@
<p><a href="/ledger">← Back to the live ledger</a> · <a href="/contract">Read the contract review</a></p>
</div>
</section>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/tx.js?v=20260906m"></script>
</body>
</html>
+1 -1
View File
@@ -49,7 +49,7 @@
</div>
</div>
</section>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/wall.js?v=20261030pp"></script>
<script src="/assets/wall-founder.js?v=20261105fd"></script>
</body>
+1 -1
View File
@@ -120,7 +120,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never share your recovery phrase.</div>
</footer>
</div>
<script src="/assets/common.js?v=20261116ad"></script>
<script src="/assets/common.js?v=20261117nw"></script>
<script src="/assets/wallets.js?v=20261026a"></script>
</body>
</html>
+65
View File
@@ -0,0 +1,65 @@
// Network Weekend tests (Marty 2026-11-17): WEEKEND500 promo start/end gate, the date-gated chatbot fact, /api/network-deals.
// Throwaway DATA_DIR, JSON promo store, test clocks only (promos.setClock, a fixed `now` for the fact); no MySQL, no real member.
// Run: node qa/networkweekend.test.cjs
'use strict';
const fs = require('fs'), os = require('os'), path = require('path'), assert = require('assert');
process.env.DATABASE_URL = ''; process.env.MYSQL_HOST = '';
const ROOT = path.join(__dirname, '..');
const promos = require(path.join(ROOT, 'promos.js'));
const { weekendFact } = require(path.join(ROOT, 'weekendfact.js'));
const netdeals = require(path.join(ROOT, 'netdeals.js'));
let pass = 0, fail = 0;
async function test(name, fn) { try { await fn(); pass++; console.log(' ok ' + name); } catch (e) { fail++; console.log(' FAIL ' + name + '\n ' + String(e && e.stack || e).split('\n').slice(0, 4).join('\n ')); } }
const T = iso => Date.parse(iso);
const OPEN = '2026-11-27T00:00:00-06:00', CLOSE = '2026-12-08T00:00:00-06:00';
(async () => {
promos.init({ dataDir: fs.mkdtempSync(path.join(os.tmpdir(), 'nwtest-')) });
await test('WEEKEND500 is created dormant with starts/expires, maxUses 250', async () => {
const r = await promos.create({ code: 'weekend500', credits: 500, maxUses: 250, starts: OPEN, expires: CLOSE, partner: 'Network Weekend', note: 'IAP $20+ pack bundle' });
assert.ok(r.ok); assert.strictEqual(r.code.starts, T(OPEN)); assert.strictEqual(r.code.expires, T(CLOSE)); assert.strictEqual(r.code.maxUses, 250); assert.strictEqual(r.code.funder, null);
});
await test('not open one second before Fri 11-27 00:00 CT, open at it', async () => {
promos.setClock(() => T(OPEN) - 1000);
assert.strictEqual((await promos.redeem('WEEKEND500', 'a@x.test', 'dashboard')).error, 'That promo code is not open yet.');
promos.setClock(() => T(OPEN));
const g = await promos.redeem('WEEKEND500', 'a@x.test', 'dashboard'); assert.ok(g.ok); assert.strictEqual(g.credits, 500);
});
await test('one per account', async () => {
promos.setClock(() => T('2026-11-30T23:59:00-06:00'));
assert.strictEqual((await promos.redeem('WEEKEND500', 'a@x.test', 'dashboard')).error, 'You already used that promo code.');
assert.ok((await promos.redeem('WEEKEND500', 'b@x.test', 'link')).ok);
});
await test('expired from Tue 12-08 00:00 CT', async () => {
promos.setClock(() => T(CLOSE) - 1); assert.ok((await promos.redeem('WEEKEND500', 'c@x.test', 'dashboard')).ok);
promos.setClock(() => T(CLOSE) + 1); assert.strictEqual((await promos.redeem('WEEKEND500', 'd@x.test', 'dashboard')).error, 'That promo code has expired.');
});
await test('re-saving a code without starts keeps its start time; codes without starts open now', async () => {
const r = await promos.create({ code: 'WEEKEND500', credits: 500, maxUses: 250, expires: CLOSE }); assert.strictEqual(r.code.starts, T(OPEN));
promos.setClock(() => T('2026-11-20T12:00:00-06:00'));
await promos.create({ code: 'PLAINCODE', credits: 10 }); assert.ok((await promos.redeem('PLAINCODE', 'a@x.test', 'dashboard')).ok);
promos.setClock(null);
});
await test('maxUses caps redemptions', async () => {
promos.setClock(() => T('2026-11-28T12:00:00-06:00'));
await promos.create({ code: 'CAP2', credits: 5, maxUses: 2, starts: OPEN, expires: CLOSE });
assert.ok((await promos.redeem('CAP2', 'p@x.test')).ok); assert.ok((await promos.redeem('CAP2', 'q@x.test')).ok);
assert.strictEqual((await promos.redeem('CAP2', 'r@x.test')).error, 'That promo code has been fully redeemed.');
promos.setClock(null);
});
await test('chatbot fact: absent before Fri 00:00 CT and from Tue 12-08 00:00 CT; deal list only Fri to Mon', async () => {
assert.strictEqual(weekendFact(T(OPEN) - 1), ''); assert.strictEqual(weekendFact(T(CLOSE)), '');
netdeals._set({ events: [{ id: 'nw', name: 'Network Weekend', startsAt: new Date(T(OPEN)).toISOString(), endsAt: new Date(T('2026-12-01T00:00:00-06:00')).toISOString(), days: {},
deals: [{ site: 'iap', name: 'InstantAdPay', text: 'x', byDay: { '2026-11-30': 'Cyber Monday: +30% bonus ad credits on any $20+ pack.' }, note: 'Ad credits buy advertising, not income.' }] }] });
const mon = weekendFact(T('2026-11-30T09:00:00-06:00'));
assert.match(mon, /LIVE NOW/); assert.match(mon, /Cyber Monday: \+30%/); assert.match(mon, /WEEKEND500/); assert.ok(mon.startsWith('\n'));
const tue = weekendFact(T('2026-12-01T00:00:00-06:00')); assert.ok(!/LIVE NOW/.test(tue)); assert.match(tue, /WEEKEND500/);
assert.ok(!/—/.test(mon + tue), 'no em dashes'); assert.ok(!/up to/i.test(mon + tue));
});
await test('GET /api/network-deals answers with self and the cached feed', async () => {
let head = null, body = '';
netdeals.handle({ headers: {} }, { writeHead: (c, h) => { head = [c, h]; }, end: b => { body = b; } }, 'linkspin');
assert.strictEqual(head[0], 200); const j = JSON.parse(body); assert.strictEqual(j.self, 'linkspin'); assert.strictEqual(j.events.length, 1);
});
console.log(`\n${pass} passed, ${fail} failed`); process.exit(fail ? 1 : 0);
})();
+1 -1
View File
@@ -66,7 +66,7 @@ function renderPage() {
h += '<h2 style="font-size:24px;margin:10px 0 16px">Release notes</h2>';
h += v.notes.length ? v.notes.map(n => '<article class="note" id="' + esc(n.id) + '"><h2>' + esc(n.title) + n.tags.map(tagChip).join('') + '</h2><p class="when">' + fmt(n.date) + '</p>' + bodyHtml(n.body) + '</article>').join('') : '<p class="muted">No notes yet.</p>';
h += '<p class="muted small" style="margin-top:30px">Suggestions and bug reports: the chat bubble on any page, or the LinkSpin Telegram group.</p>';
h += '</div><script src="/assets/common.js?v=20261116ad"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
h += '</div><script src="/assets/common.js?v=20261117nw"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
return h;
}
module.exports = { init, notes, roadmap, saveNote, saveRoadmap, remove, publicView, renderPage, bodyHtml, TAGS, STATUSES };
+3 -1
View File
@@ -11,6 +11,7 @@ const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const netsites = require('./netsites'); // footer network list from the hub (2026-11-14 trust pack)
const netdeals = require('./netdeals'); // Network Weekend ribbon feed from the hub (2026-11-17)
const sendy = require('./sendy');
const { URL } = require('url');
const chain = require('./chain');
@@ -1681,6 +1682,7 @@ const server = http.createServer(async (req, res) => {
// -- public API
if (p === '/api/network-sites' && req.method === 'GET') return netsites.handle(req, res);
if (p === '/api/network-deals' && req.method === 'GET') return netdeals.handle(req, res, netsites.selfId(req) || 'linkspin');
if (p === '/api/config' && req.method === 'GET') {
const c = chain.getConfig();
// public copy of the site settings: never anything that looks like a credential
@@ -4589,7 +4591,7 @@ const server = http.createServer(async (req, res) => {
+ '<style>.bp{max-width:560px;text-align:center;padding:40px 16px 60px}.bp img{width:100%;max-width:520px;border-radius:18px;border:1px solid var(--line);box-shadow:0 20px 60px rgba(0,0,0,.45)}.bp h1{font-size:clamp(24px,5vw,34px);margin:22px 0 8px}.bp p{color:var(--muted);max-width:44ch;margin:0 auto 20px}</style></head>'
+ '<body><div class="wrap bp"><img src="' + img + '" alt="' + esc(label) + ' badge for @' + esc(un) + '"><h1>@' + esc(un) + ' unlocked <em>' + label + '</em></h1><p>' + esc(sub.charAt(0).toUpperCase() + sub.slice(1)) + '. On LinkSpin every ad package that sells pays the sponsor in the same transaction, straight to their wallet, on-chain.</p>'
+ '<a class="btn" href="/join/' + esc(un) + '">Join @' + esc(un) + '\u2019s line free</a><p class="small" style="margin-top:26px">Advertising with a performance referral program. Not an investment; no income is guaranteed.</p></div>'
+ '<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/blog-page.js?v=20260912a"></script></body></html>';
+ '<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/blog-page.js?v=20260912a"></script></body></html>';
res.writeHead(200, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'public, max-age=300' }));
return res.end(html);
}
+26
View File
@@ -0,0 +1,26 @@
// NETWORK WEEKEND chatbot fact (Marty 2026-11-17): date-gated, present only while it applies.
// Fri 11-27 00:00 CT to Tue 12-01 00:00 CT: the event is live; deal lines come from the hub feed (netdeals.js) by the Central day.
// Tue 12-01 00:00 CT to Tue 12-08 00:00 CT: only the WEEKEND500 code fact (Monday buyers get a week to redeem).
// CHATBOT_NOW (ISO) = test clock, tests only.
const NW = { start: Date.parse('2026-11-27T00:00:00-06:00'), end: Date.parse('2026-12-01T00:00:00-06:00'), codeEnd: Date.parse('2026-12-08T00:00:00-06:00') };
const NL = String.fromCharCode(10);
function nwNow() { const t = Date.parse(process.env.CHATBOT_NOW || ''); return Number.isNaN(t) ? Date.now() : t; }
function lines(now) {
const t = now === undefined ? nwNow() : now;
if (t < NW.start || t >= NW.codeEnd) return [];
const code = '- PROMO CODE WEEKEND500 (Network Weekend 2026): 500 LinkSpin ad credits (earned-grade), one per account, new and existing accounts. It is handed out on the InstantAdPay purchase notice for any InstantAdPay pack of $20 or more bought Fri 11-27 to Mon 11-30 (midnight to midnight Central). Redeem it in the promo code box on the LinkSpin dashboard until Tue 12-08 midnight Central. It is not a referral reward and pays nobody. Ad credits buy advertising, not income.';
if (t >= NW.end) return [code];
const out = ['- NETWORK WEEKEND (Black Friday to Cyber Monday 2026, LIVE NOW): Fri 11-27 to Mon 11-30, midnight to midnight Central; every deal ends Tue 12-01 00:00 Central (the InstantAdPay Game Pass bonus days run to Thu 12-03 midnight Central). All deals: https://instantadpay.com/weekend. LinkSpin prices and payouts are unchanged this weekend; the LinkSpin part is the WEEKEND500 code. Never quote earnings or income. Today\'s network deals:'];
try {
const ev = (require('./netdeals').current().events || []).find(e => t >= Date.parse(e.startsAt) && t < Date.parse(e.endsAt));
if (ev) {
const day = new Date(t - 6 * 3600 * 1000).toISOString().slice(0, 10);
for (const d of ev.deals) if (t < Date.parse(d.endsAt || ev.endsAt)) out.push(' * ' + d.name + ': ' + ((d.byDay && d.byDay[day]) || d.text) + (d.note ? ' ' + d.note : ''));
}
} catch (e) {}
out.push(code);
return out;
}
// '' outside the dates, else a newline then the fact lines (it follows ${launchFact()} on the same template line)
function weekendFact(now) { const l = lines(now); return l.length ? NL + l.join(NL) : ''; }
module.exports = { weekendFact, NW };