Network Weekend (Marty 2026-11-17): 2 free post credits a day Fri 11-27 00:00 CT to Tue 12-01 00:00 CT, live VBBShop SKU values on every page and in the chatbot, the network ribbon

weekend.js: the date gate (WEEKEND_NOW test clock), FREE_CREDITS_PER_DAY stays 1. chainskus.js: skus() read every 60 s, so the
$10 pack shows what the contract credits (50 once the owner signs setSku, 40 before or after). netdeals.js + /assets/netweekend.js:
/api/network-deals and the ribbon; the VBB line is built from live values and drops itself if there is nothing true to say.
chatcore render hook, chatbot FACTS/CANNED from live values with a dated weekend fact. qa/weekend.test.mjs 33 pass, chatbot 182, smoke 268.
common.js?v=10, my.js?v=6, packages.js?v=2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 07:26:05 -06:00
parent 7b973edcf8
commit 3e0dee517d
23 changed files with 314 additions and 32 deletions
+15 -5
View File
@@ -26,6 +26,9 @@ const hubreport = require('./hubreport'); // network hub report by wallet (off u
const prize = require('./prize');
const proof = require('./proof'); // trust pack: /ledger, /contract, Telegram card per purchase + line per prize payout (2026-11-14)
const netsites = require('./netsites'); // footer network list from the hub (2026-11-14)
const netdeals = require('./netdeals'); // Network Weekend ribbon feed from the hub (2026-11-17)
const weekend = require('./weekend'); // Network Weekend date gate: 2 free credits a day, Fri 11-27 00:00 CT to Tue 12-01 00:00 CT
const chainskus = require('./chainskus'); // live VBBShop SKU credits and prices for every page and the chatbot (2026-11-17)
const lsspins = require('./lsspins'); // LinkSpin Banner Spins: post one as a banner, and fill the splash's open places (2026-11-14)
const PUB = path.join(__dirname, 'public');
@@ -161,7 +164,7 @@ function grantDaily(m) {
if (!netVerified(m)) return false;
const day = store.ctDay(); if (m.freeDay === day) return false;
m.freeDay = day; let granted = false;
const add = Math.min(C.freeCreditsPerDay, Math.max(0, C.freeCreditCap - m.credits));
const add = Math.min(weekend.freePerDay(C.freeCreditsPerDay), Math.max(0, C.freeCreditCap - m.credits));
if (add > 0) { m.credits += add; granted = true; }
store.save(); return granted;
}
@@ -172,7 +175,7 @@ function myData(addr) {
swapUsed: swapUsed(b), swappedAt: swapUsed(b) ? b.swaps[b.swaps.length - 1].at : null, canSwap: canSwap(b) }, loop.memberPlace(b)));
const rewards = store.ledger().filter(e => e.owner === m.address);
const shareName = m.username || m.address;
return { address: m.address, username: m.username, credits: m.credits, freeCreditCap: C.freeCreditCap, freeToday: m.freeDay === store.ctDay(), netVerified: netVerified(m),
return { address: m.address, username: m.username, credits: m.credits, freeCreditCap: C.freeCreditCap, freePerDay: weekend.freePerDay(C.freeCreditsPerDay), freeToday: m.freeDay === store.ctDay(), netVerified: netVerified(m),
maxQueued: C.maxQueuedPerMember, banners, rewards: rewards.slice(-50).reverse(), rewardViews: rewards.reduce((t, e) => t + e.views, 0),
week: loop.memberWeek(m.address), share: 'https://' + C.site + '/?ref=' + encodeURIComponent(shareName) };
}
@@ -286,7 +289,7 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/config' && req.method === 'GET') {
return json(res, 200, { site: C.site, siteName: C.siteName, chainId: C.chainId, chainName: C.chainName, rpc: C.publicRpc, walletConnectProjectId: C.walletConnectProjectId,
loopSize: C.loopSize, perShift: C.perShift, viewsPerCycle: C.viewsPerCycle, visitSeconds: C.visitSeconds, freeCreditCap: C.freeCreditCap, maxQueued: C.maxQueuedPerMember,
freeCreditsPerDay: C.freeCreditsPerDay, packs: C.packs, lookUsd: C.lookUsd, lookSku: C.lookSku, prizes: prizes(), sso: networksso.enabled(),
freeCreditsPerDay: weekend.freePerDay(C.freeCreditsPerDay), packs: livePacks(), lookUsd: liveLookUsd(), weekend: weekend.on(), lookSku: C.lookSku, prizes: prizes(), sso: networksso.enabled(),
shop: { live: shop.watching(), contract: shop.watching() ? C.contractAddress : null }, explorer: C.explorer });
}
// buying: the live price, gas fees for the wallet, and the confirmation wait (the Downline Banners endpoints)
@@ -307,6 +310,7 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/ledger' && req.method === 'GET') return json(res, 200, proof.ledger(u.searchParams.get('n')), { 'Cache-Control': 'public, max-age=10' });
if (p === '/api/contract' && req.method === 'GET') { if (limited(req, 'contract', 600, 3600000)) return json(res, 429, { error: 'Too many requests' }); return json(res, 200, await proof.contract(), { 'Cache-Control': 'public, max-age=60' }); }
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, 'vbb');
if (p === '/api/prizes' && req.method === 'GET') return json(res, 200, { current: prizes(), week: store.ctWeek(), past: prize.history(12), explorer: C.explorer }, { 'Cache-Control': 'public, max-age=30' });
if (p === '/api/splash' && req.method === 'GET') { const v = loop.view(24); v.fill = splashFill(); return json(res, 200, v, { 'Cache-Control': 'no-store' }); }
if (p === '/api/leaders' && req.method === 'GET') {
@@ -524,7 +528,7 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/admin/status' && req.method === 'GET') {
const S = store.state(); const L = store.ledger(); const t = store.today();
const byStatus = {}; for (const e of L) byStatus[e.status] = (byStatus[e.status] || 0) + e.views;
return json(res, 200, { day: store.ctDay(), week: store.ctWeek(), config: { split: C.split, packs: C.packs, lookUsd: C.lookUsd, prizePot: C.prizePot, prizes: prizes(), freeCreditsPerDay: C.freeCreditsPerDay, loopSize: C.loopSize, perShift: C.perShift, viewsPerCycle: C.viewsPerCycle, visitSeconds: C.visitSeconds, perIpDay: C.perIpDay, freeCreditCap: C.freeCreditCap, maxQueued: C.maxQueuedPerMember },
return json(res, 200, { day: store.ctDay(), week: store.ctWeek(), config: { split: C.split, packs: livePacks(), lookUsd: liveLookUsd(), prizePot: C.prizePot, prizes: prizes(), freeCreditsPerDay: weekend.freePerDay(C.freeCreditsPerDay), loopSize: C.loopSize, perShift: C.perShift, viewsPerCycle: C.viewsPerCycle, visitSeconds: C.visitSeconds, perIpDay: C.perIpDay, freeCreditCap: C.freeCreditCap, maxQueued: C.maxQueuedPerMember },
loop: { filled: S.loop.length, size: C.loopSize, ids: S.loop, nextOut: S.loop.length ? S.loop[S.loop.length - 1] : null },
queue: { length: S.queue.length, next: S.queue.slice(0, 20) }, progress: S.progress, held: S.progress >= C.perShift && !S.queue.length,
today: { visits: t.visits || 0, shifts: t.shifts || 0, cycles: t.cycles || 0, posts: t.posts || 0, clicks: t.clicks || 0 },
@@ -664,7 +668,12 @@ function splashFill() {
fillCache = { key, at: Date.now(), out }; return out;
}
const validSku = sku => sku === C.lookSku || C.packs.some(x => x.sku === sku);
const skuUsd = sku => sku === C.lookSku ? C.lookUsd : (C.packs.find(x => x.sku === sku) || {}).usd || 0;
const skuUsd = sku => sku === C.lookSku ? liveLookUsd() : (livePacks().find(x => x.sku === sku) || {}).usd || 0;
// the packs as the contract holds them right now (chainskus.js, read every 60 s); the env values until the first read answers
const livePacks = () => chainskus.packs(C);
const liveLookUsd = () => chainskus.lookUsd(C);
// the ribbon's VBB line from live values (weekend.js dealLine): no line while the chain still holds the normal pack (a late signature)
netdeals.setLocal(d => weekend.dealLine(C, d));
function saveUpload(owner, buf, ext) {
const name = owner.slice(2, 10) + '-' + crypto.randomBytes(6).toString('hex') + ext;
fs.writeFileSync(path.join(UPL, name), buf); // uploads stay files on the volume (docstore keeps the uploads folder on disk)
@@ -681,6 +690,7 @@ function saveUpload(owner, buf, ext) {
proof.init(C, { shop, prize, nameOf: async a => { const m = await netMember({ a }).catch(() => null); return m && m.address === a ? m.username : null; } });
shop.setHook(proof.onPurchase); prize.setHook(proof.onPrize); // before the watcher's first scan
shop.init(C); // inert without CONTRACT_ADDRESS + CHAIN_RPC (watcher) / KEEPER_KEY (vouchers)
chainskus.init(C, C.packs.map(p => p.sku).concat([C.lookSku])); // live pack values for pages + chatbot (2026-11-17)
prize.init(C); // prepares last week's payout plan; pays only on an admin's approval (PRIZE_KEY)
// fill spins: members seen in the last 60 days (most recent 400), one LinkSpin call each every 10 minutes
lsspins.init({ base: () => C.lsPartnerBase, members: () => store.members().filter(m => Date.now() - (m.lastSeen || m.joinedAt || 0) < 60 * 86400000)