From f56fc551fe0e877a07b0326527ff465c1c11221b Mon Sep 17 00:00:00 2001
From: martbost
Date: Tue, 17 Nov 2026 07:22:44 -0600
Subject: [PATCH] Network Weekend (Marty 2026-11-17): 8 instant picks per
position Fri 11-27 00:00 CT to Tue 12-01 00:00 CT, ribbon, chatbot facts
weekend.js: date gate by the purchase's chain time (WEEKEND_PICKS=0 switches it off, WEEKEND_NOW test clock); /api/config, quote,
order and the attach hook use it. Tank check 11-17: draft pool 1,339, 2 positions sold. netdeals.js + /assets/netweekend.js ribbon
(/api/network-deals from the hub), loaded by common.js (not draftday/admin), common.js?v=4. chatbot FACTS weekend line and a
chatcore finish hook so stored instant answers say 8 while live. qa/weekend.test.cjs.
Co-Authored-By: Claude Opus 5.5
---
chatbot.js | 8 +++--
chatcore.js | 1 +
netdeals.js | 54 ++++++++++++++++++++++++++++++
public/admin.html | 2 +-
public/assets/common.js | 6 ++++
public/assets/netweekend.js | 67 +++++++++++++++++++++++++++++++++++++
public/builder.html | 2 +-
public/cards.html | 2 +-
public/coach.html | 2 +-
public/contract.html | 2 +-
public/disclaimer.html | 2 +-
public/draftday.html | 2 +-
public/index.html | 2 +-
public/join.html | 2 +-
public/ledger.html | 2 +-
public/privacy.html | 2 +-
public/promote.html | 2 +-
public/team.html | 2 +-
public/terms.html | 2 +-
qa/weekend.test.cjs | 26 ++++++++++++++
server.js | 16 +++++----
weekend.js | 15 +++++++++
22 files changed, 199 insertions(+), 22 deletions(-)
create mode 100644 netdeals.js
create mode 100644 public/assets/netweekend.js
create mode 100644 qa/weekend.test.cjs
create mode 100644 weekend.js
diff --git a/chatbot.js b/chatbot.js
index a5ab5ad..84cedfd 100644
--- a/chatbot.js
+++ b/chatbot.js
@@ -12,7 +12,8 @@
const core = require('./chatcore');
const C = require('./config').get();
-const KNOWLEDGE_DATE = '2026-11-15';
+const KNOWLEDGE_DATE = '2026-11-17';
+const weekend = require('./weekend');
const URL_ = 'https://' + C.site;
const SUPPORT = 'https://instantadpay.com/support';
const PO = C.position, SP = C.split, D = C.draft, PK = C.picks;
@@ -90,12 +91,15 @@ const FACTS = () => [
'- BEST COACH POT: ' + SP.potPct + '% of every position to a prize wallet fixed in the contract; each Central week shared among the coaches whose picks started the most (places ' + POT + ' percent; tie = got there first), announced on the board, every payout on the ledger. Prizes depend on that week\'s pot, never promised. Boards also show Rookie of the Week and last week\'s top 3.',
'- CARDS: Rookie (drafted), Starter (wallet), Pro (payouts on), All-Star (first purchase), Hall of Fame (holds a position of their own). Public cards show milestones, never earnings; scouting earnings show to coaches only.',
'- PAGES: / (pool, tracker, standings), /join (buy), /team (coaching), /cards, /builder (CryptoTeamBuild builder, third-party programs), /promote, /ledger, /contract, /terms, /disclaimer, /privacy. Run by TrustClickz.',
+ (weekend.live() ? '- NETWORK WEEKEND (live now, Black Friday to Cyber Monday, Fri 11-27 to Mon 11-30, midnight to midnight Central): every position bought in the window comes with ' + weekend.weekendPicks() + ' instant picks instead of ' + PO.picksOnBuy + ', same $' + PO.usd + ' price. This overrides the ' + PO.picksOnBuy + ' picks above until Tuesday 12-01 00:00 Central. Every network deal: https://instantadpay.com/weekend' : null),
'- NO REFUNDS: blockchain payments are final. SUPPORT for account or payment problems: network support at ' + SUPPORT + ' (InstantAdPay runs the one desk for every network site). ' + NOT_INCOME
-].join('\n');
+].filter(Boolean).join('\n');
const SITE = {
id: 'fivex', hubSite: 'fivex', netId: 'fivex', name: '5xYourTeam', url: URL_, supportUrl: SUPPORT, knowledgeDate: KNOWLEDGE_DATE,
dataDir: C.dataDir, canned: CANNED, faq: FAQ, facts: FACTS,
+ // Network Weekend: the stored instant answers say the normal picks; while the weekend is live the reply carries the weekend number
+ finish: r => (weekend.live() ? r.replace(new RegExp('\\b' + PO.picksOnBuy + ' (picks right away|instant picks)', 'g'), weekend.weekendPicks() + ' $1 (Network Weekend, through Monday 11-30 midnight Central)') : r),
intro: 'You are the assistant on 5xYourTeam (' + URL_ + '), The Draft: coaches buy a $' + PO.usd + ' one-time position and draft people who joined the network without a sponsor every week, then coach them through site messages.',
quickTopics: ['How does The Draft work?', 'Where does the $10 go?', 'When is the draft?', 'What is Downline Banners?']
};
diff --git a/chatcore.js b/chatcore.js
index df23ff4..eda2fdb 100644
--- a/chatcore.js
+++ b/chatcore.js
@@ -175,6 +175,7 @@ async function handle(req, res, p, u, h) {
const b = await h.readBody(req);
const hist = Array.isArray(b.history) ? b.history.map(x => String(x || '')).join(' ').slice(-800) : String(b.history || '').slice(-800);
const r = await answer(b.message, hist);
+ if (r.reply && typeof S.finish === 'function') { try { r.reply = S.finish(r.reply); } catch (e) {} } // site hook: date-gated wording (Network Weekend 2026-11-17)
if (r.handoff) r.support = supportLink(b.message);
h.json(res, r.error ? 400 : 200, r); return true;
}
diff --git a/netdeals.js b/netdeals.js
new file mode 100644
index 0000000..e708583
--- /dev/null
+++ b/netdeals.js
@@ -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: [] } }; } };
diff --git a/public/admin.html b/public/admin.html
index 92bfcbc..bca0532 100644
--- a/public/admin.html
+++ b/public/admin.html
@@ -28,7 +28,7 @@
Best Coach pot (last week)
-
+


5XYOURTEAM
DRAFT DAY
RESULTS
-