Network Weekend 2026, built dormant (Marty 2026-11-17): Black Friday to Cyber Monday, midnight to midnight Central
- promodays.js: reusable date-to-percent bonus map (setting promoDays, kill switch promoDaysOn), once per tx via marks (MySQL): Fri 11-27 +40% $5+, Sat/Sun +20% $5+, Mon 11-30 +30% $20+. A mapped Friday is paid by friday.js at max(fridayBonusPct, day pct), one bonus per tx, Game Pass Friday perk intact; Five Dollar Friday +20% resumes 12-04 with no hand edits. - friday.js: Thanksgiving Thursday 18:00 CT notice + email carry the Black Friday copy (one message); Black Friday kickoff and wrap-up copy; /api/friday reports the day's real pct and name; IAP_TEST_NOW test clock (ignored in production). - Weekend Starter Bundle ($20+ in the window: LinkSpin code WEEKEND500 on a purchase notice) and Builder Bundle ($100+: notice + GET /api/network/weekend-builders for DownlineHydra, X-Weekend-Key = env WEEKEND_BUNDLE_KEY, constant-time compare). - promos.js: promo_codes.starts (dormant-until gate) for code NETWORKWEEKEND. - gamepass.js: tier passes paid by a package Fri 11-27 00:00 CT to Fri 12-04 00:00 CT get Explorer/Champion +15 days, Legend +60. - /weekend deals page (assets/weekend.js), Home strip + Overview card (assets/weekend-card.js), network ribbon (netdeals.js + assets/netweekend.js via common.js and netline.js), chatbot fact + answer date-gated. - Share hosts: /weekend, /friday and other page names are pages, not usernames (email links use instantadpay.link: instantadpay.com is still on the Spamhaus DBL, checked 11-17). - welcome.js says the day's real pct; common.js/netline.js/welcome.js ?v=20261117nw. - Tests: qa/promodays.test.cjs (12) + qa/weekend.e2e.mjs (18) at test clocks; bash qa/run.sh weekend; member walk clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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=20261101th"></script></body></html>';
|
||||
return '</div><script src="/assets/common.js?v=20261117nw"></script><script src="/assets/blog-page.js?v=20261101th"></script></body></html>';
|
||||
}
|
||||
const authorBox = () => '<div class="author"><img src="/logo-icon.png" alt="InstantAdPay"><div><b>' + AUTHOR + '</b><span>Founder of InstantAdPay 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>';
|
||||
|
||||
+6
-1
@@ -24,7 +24,10 @@ let HERO_SALE = null; // () => gamepass.cfg().heroes + names (server.js): the bo
|
||||
let PASS_TIERS = null; // () => the live pass tiers (server.js, from gamepass.cfg): the tier fact follows the sovTiers switch
|
||||
const MODEL = process.env.OPENROUTER_MODEL || 'deepseek/deepseek-v4-flash:nitro';
|
||||
|
||||
// Network Weekend (2026-11-17, promodays.js): a date-gated fact and answer; empty outside the window, so nothing to undo after it
|
||||
let WEEKEND = null;
|
||||
function init(opts) {
|
||||
WEEKEND = opts && opts.weekend && typeof opts.weekend.fact === 'function' ? opts.weekend : null;
|
||||
if (opts && typeof opts.gameLive === 'function') GAME_LIVE = opts.gameLive;
|
||||
if (opts && typeof opts.refuelOn === 'function') REFUEL_ON = opts.refuelOn;
|
||||
if (opts && typeof opts.bixLive === 'function') BIX_LIVE = opts.bixLive; DATA_DIR = opts.dataDir; chain = opts.chain; PASS_TIERS = typeof opts.passTiers === 'function' ? opts.passTiers : null; HERO_SALE = typeof opts.heroSale === 'function' ? opts.heroSale : null; const ready = kb.init({ dataDir: DATA_DIR, seeds: seeds() });
|
||||
@@ -375,7 +378,7 @@ FACTS:
|
||||
- NETWORK SIGN-IN (built 2026-11-12): one sign-in for InstantAdPay and LinkSpin, same email on both. A member signed in on one site who follows a link from inside their account to the other (Engine Room, Refuel, Back to InstantAdPay) arrives signed in with no email code; opening the other site's sign-in screen while signed in here also signs them in by itself (one quiet try per browser every 2 minutes). Exception: when the account on the receiving site does not exist yet or is still a waiting account (never signed in), they get the normal email code once, email prefilled. Sign-out is per site and switches the automatic sign-in off on that site for 12 hours (a deliberate link from the other site still works). Sessions are ordinary member sessions (7 days, renewed while active), the admin portal is never shared, and the sign-in grants nothing extra: purchases, payouts and wallet actions still need the wallet. If it fails, the email code always works.
|
||||
- EARNERS CORNER (LIVE 2026-11-10, https://earnerscorner.com): the network's own forum (Discourse) for people who earn online: business opportunities, PTC, traffic exchanges and mailers, crypto earning and wallets, affiliate marketing, tools, plus an Our Network section. Read is open to everyone; posting needs signing in with the InstantAdPay account (no separate forum password). New accounts' first posts are reviewed; links unlock with trust and are open from day one for members with an on-chain position; referral links only in Promote Your Program; AI spam detection; a forum assistant answers network questions from the same official knowledge and links threads.
|
||||
- STACK POL (LIVE 2026-11-09, https://stackpol.com): one site that adds up every POL payout in the network (InstantAdPay and LinkSpin TierPaid referral payments plus every game's payouts), refreshed every 5 minutes, with per-program pages (/earn/<program>), a public ledger showing each payout's username and Polygonscan link, and a blog. Members get a public page at stackpol.com/<username> by switching on 'Show my Stack POL page' in Promo tools > Stack POL; it is ON by default for every paid member (since 2026-11-09) and off only when they switch it off. It never holds money. STACK POL PRO (2026-11-09): one-time unlock, NEW MONEY only: ANY package of $10 or more bought by the member's own position unlocks it automatically (since 2026-11-09 evening, no order step); credits never count; it never uses up a package that also fulfils a Game Pass or hero order. Pro pages show the member's own LinkSpin Banner Spins in the ad spots (network zones otherwise), their spin links, a purple QR code to the page, a 'Want a personalized page like this?' button, and articles opened from the page (?ref=<username>) use the member's referral on every call to action. Pro owners get the Stack POL Pro badge. Totals are past payouts, never a promise of earnings.
|
||||
${passTiersFact()}${heroesFact()}${refuelFact()}${synFact()}${polminerFact()}${warpwaresFact()}${bixFact()}${turkeydropFact()}${sovTestFact()}- ROAD AGENT (LIVE 2026-10-15, https://roadagent.app): a night-highway shooter open to every member. Open the Games tab and tap Play on the Road Agent card, or go to roadagent.app and sign in with the InstantAdPay email. Drive the four-lane highway, shoot the hostiles (thug sedans, switchblades, gunner vans), spare the civilians, pull into the weapons truck for oil slicks, smoke and missiles. Clearing a sector for the first time pays POL to the wallet on the member's InstantAdPay account, plus a daily patrol reward; scrap buys garage upgrades. Fuel = a sponsor visit: before a run the player visits an advertiser's page (a FUEL STOP), which is a normal verified visit with the dwell timer and human check, charged to the advertiser like any visit; advertisers' existing visits campaigns are already in the rotation, nothing to set up; to get more traffic from the game, top up the visits campaign. Clickable Pause, Sound and Music buttons sit under the game (P / M / N keys also work), and the Run tab has an Invite a friend card with the member's roadagent.app/?ref=<username> link.
|
||||
${WEEKEND ? (() => { try { return WEEKEND.fact() || ''; } catch (e) { return ''; } })() : ''}${passTiersFact()}${heroesFact()}${refuelFact()}${synFact()}${polminerFact()}${warpwaresFact()}${bixFact()}${turkeydropFact()}${sovTestFact()}- ROAD AGENT (LIVE 2026-10-15, https://roadagent.app): a night-highway shooter open to every member. Open the Games tab and tap Play on the Road Agent card, or go to roadagent.app and sign in with the InstantAdPay email. Drive the four-lane highway, shoot the hostiles (thug sedans, switchblades, gunner vans), spare the civilians, pull into the weapons truck for oil slicks, smoke and missiles. Clearing a sector for the first time pays POL to the wallet on the member's InstantAdPay account, plus a daily patrol reward; scrap buys garage upgrades. Fuel = a sponsor visit: before a run the player visits an advertiser's page (a FUEL STOP), which is a normal verified visit with the dwell timer and human check, charged to the advertiser like any visit; advertisers' existing visits campaigns are already in the rotation, nothing to set up; to get more traffic from the game, top up the visits campaign. Clickable Pause, Sound and Music buttons sit under the game (P / M / N keys also work), and the Run tab has an Invite a friend card with the member's roadagent.app/?ref=<username> link.
|
||||
- HELP DESK (LIVE 2026-10-16): members open Help in the dashboard (/my#help) to send Marty a support ticket (pick a category, a subject, the message, up to 2 screenshots), see each ticket's status (Open, Waiting on you, Closed) and read and answer his replies; a badge shows when he has replied, and replies also arrive by email. Anyone signed out or locked out uses the public form at https://instantadpay.com/support (name, email, category, subject, message) and gets an email with the ticket number (like IAP-1042) and a private link to view and reply, no sign-in needed. support@instantadpay.com also reaches Marty. Replying to a closed ticket opens it again. In this chat, "Send this to support" turns the conversation into a ticket. Only Marty answers, so replies are not instant; never promise a response time.
|
||||
- PRESENTATION (2026-10-15): instantadpay.com/presentation is a public page (no sign-in) with the narrated InstantAdPay presentation, about six minutes, Marty's voice, captions in 6 languages (English, Italiano, Français, Español, Deutsch, Português) chosen with pills under the player. Sixteen parts: the platform, ad reach, the nine games that pay POL, the $20 split ($10 / $4 / $2 / $4 platform, same transaction), three rules, packages, the 2-then-5 unlock, pass-up, wide versus narrow ($800 vs $36, an illustration), Qualified Start, the Pipeline, LinkSpin (pre-launch Nov 1), one wallet across the network, the first week, and 'the target is five'. Share link: Members > Promo tools > 'Share the presentation' copies instantadpay.com/presentation?ref=<username>; ?ref sets the same 30-day sponsor cookie as the invite link, the page shows 'Shared with you by @name' with avatar and a Join button to /join/<username>. It is in the site menu as 'Presentation'. BUILD WIDE VIDEO: first card in Promo tools > Videos ('Build wide: watch the payments flow'), matched link ?v=wide.
|
||||
- WIRED WEDNESDAY: every Wednesday, Central time (midnight to midnight), any ad package of $20 or more (Activation and up; no $10 pack exists) earns +25% bonus credits wired into the buyer's balance the moment the purchase settles, purchased-grade (usable on every format incl. login ads), credit log label "Wired Wednesday". First one: Wednesday 2026-09-30. Page: instantadpay.com/wednesday. Credits buy ad delivery, never money.
|
||||
@@ -527,6 +530,8 @@ async function answer(message, historyText) { const r = await answerRaw(message,
|
||||
async function answerRaw(message, historyText) {
|
||||
const msg = String(message || '').trim();
|
||||
if (!msg) return { error: 'Say something first.' };
|
||||
// Network Weekend: inside the window a weekend or Friday question gets the live answer (the Five Dollar Friday entry says +20%)
|
||||
if (WEEKEND) { try { const w = WEEKEND.answer(msg); if (w) return { reply: w, canned: true, kb: 'network-weekend' }; } catch (e) {} }
|
||||
// fast path: the knowledge base's instant answers (seeded from CANNED); the in-code list only if the KB store is down
|
||||
let hit = null, kbOk = true, other = [];
|
||||
try {
|
||||
|
||||
@@ -82,6 +82,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'); // a code dormant until this time (Network Weekend, 2026-11-17)
|
||||
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');
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//
|
||||
// Settings (siteConfig): fridayPromo '1'|'0', fridayBonusPct (20), fridayStart 'YYYY-MM-DD' (first
|
||||
// Friday, 2026-09-25). Everything reads the chain index, never a marketing counter.
|
||||
// Promo days (promodays.js, 2026-11-17): a Friday in the promo map (Black Friday 11-27) pays max(fridayBonusPct, the day's pct),
|
||||
// ONE bonus per tx, under the day's name; the Thursday notice and email, the kickoff and the wrap-up carry that day's copy.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -16,7 +18,12 @@ const TZ = 'America/Chicago';
|
||||
const dayOf = ts => new Date(ts).toLocaleDateString('en-CA', { timeZone: TZ });
|
||||
const weekdayOf = ts => new Date(ts).toLocaleDateString('en-US', { timeZone: TZ, weekday: 'short' });
|
||||
const hourOf = ts => Number(new Date(ts).toLocaleString('en-US', { timeZone: TZ, hour: 'numeric', hour12: false }));
|
||||
const isFriday = ts => weekdayOf(ts) === 'Fri';
|
||||
const isFriday = ts => weekdayOf(ts) === 'Fri';
|
||||
// test clock (2026-11-17): env IAP_TEST_NOW (ISO) for the view and the scheduled moments; ignored when NODE_ENV=production
|
||||
const clock = () => { const o = process.env.NODE_ENV !== 'production' && process.env.IAP_TEST_NOW; const t = o ? Date.parse(o) : NaN; return Number.isNaN(t) ? Date.now() : t; };
|
||||
// the promo-day overlay (X.promodays): the effective percent and name for a Friday purchase or moment
|
||||
const pctAt = (ts, cents) => Math.max(cfg().pct, (X.promodays && X.promodays.fridayPct(ts, cents)) || 0);
|
||||
const nameAt = ts => (X.promodays && X.promodays.fridayName(ts)) || 'Five Dollar Friday';
|
||||
|
||||
function init(opts) { X = opts; FILE = path.join(opts.dataDir, 'friday.json'); S = load(); }
|
||||
function load() { try { return JSON.parse(fs.readFileSync(FILE, 'utf8')); } catch (e) { return { granted: {}, posts: {}, badges: {}, sent: {} }; } }
|
||||
@@ -65,26 +72,29 @@ function stats(dayKey) {
|
||||
}
|
||||
// public view
|
||||
function view() {
|
||||
const c = cfg(); const now = Date.now(); const live = liveNow(now); const next = nextFriday(now);
|
||||
return { on: c.on, pct: c.pct, live, today: live ? stats(dayOf(now)) : null, nextFriday: next, nextLabel: next ? labelOf(next) : null, start: c.start };
|
||||
const c = cfg(); const now = clock(); const live = liveNow(now); const next = nextFriday(now);
|
||||
const nextTs = next ? Date.parse(next + 'T12:00:00Z') : 0; // midday UTC = morning Central of that Friday
|
||||
return { on: c.on, pct: live ? pctAt(now) : (next ? pctAt(nextTs) : c.pct), name: live ? nameAt(now) : (next ? nameAt(nextTs) : 'Five Dollar Friday'), live, today: live ? stats(dayOf(now)) : null, nextFriday: next, nextLabel: next ? labelOf(next) : null, start: c.start };
|
||||
}
|
||||
|
||||
// the bonus: once per purchase tx, on a Friday on or after the start
|
||||
async function onEvent(ev) {
|
||||
if (!ev || ev.type !== 'Purchase' || !liveNow(ev.ts) || ev.priceCents < 500) return null;
|
||||
if (S.granted[ev.tx]) return null;
|
||||
const c = cfg(); const bonus = Math.round((Number(ev.creditAmount) || 0) * c.pct / 100);
|
||||
const c = Object.assign({}, cfg(), { pct: pctAt(ev.ts, ev.priceCents) }); const nm = nameAt(ev.ts); const bonus = Math.round((Number(ev.creditAmount) || 0) * c.pct / 100);
|
||||
if (bonus <= 0) return null;
|
||||
const a = await X.accounts.byMemberId(ev.buyerId); if (!a || !a.email) return null;
|
||||
const usd = ('$' + (ev.priceCents / 100).toFixed(2)).replace(/\.00$/, '');
|
||||
await X.ads.addEarned(a.email, bonus, { purchased: true, log: { kind: 'bonus', note: 'Five Dollar Friday: +' + c.pct + '% on your ' + usd + ' package', ref: 'fdf:' + String(ev.tx).slice(0, 30) } });
|
||||
await X.ads.addEarned(a.email, bonus, { purchased: true, log: { kind: 'bonus', note: nm + ': +' + c.pct + '% on your ' + usd + ' package', ref: 'fdf:' + String(ev.tx).slice(0, 30) } });
|
||||
S.granted[ev.tx] = { day: dayOf(ev.ts), memberId: ev.buyerId, bonus, at: Date.now() }; save();
|
||||
try { await X.notify(ev.buyerId, 'Five Dollar Friday: +' + bonus + ' bonus credits', 'Your ' + usd + ' package landed on a Five Dollar Friday, so ' + bonus + ' bonus credits (+' + c.pct + '%) were added to your balance. Every pack bought on a Friday gets this. See your balance: https://instantadpay.com/my#campaigns', 'notice'); } catch (e) {}
|
||||
try { await X.notify(ev.buyerId, nm + ': +' + bonus + ' bonus credits', nm !== 'Five Dollar Friday'
|
||||
? 'Your ' + usd + ' package landed on ' + nm + ', so ' + bonus + ' bonus ad credits (+' + c.pct + '%) were added to your balance, in place of the usual Five Dollar Friday +20%. Ad credits buy advertising, not income. See your balance: https://instantadpay.com/my#campaigns\n\nEvery Network Weekend deal across the network: https://instantadpay.com/weekend'
|
||||
: 'Your ' + usd + ' package landed on a Five Dollar Friday, so ' + bonus + ' bonus credits (+' + c.pct + '%) were added to your balance. Every pack bought on a Friday gets this. See your balance: https://instantadpay.com/my#campaigns', 'notice'); } catch (e) {}
|
||||
// the wave, every ten packs
|
||||
const st = stats(dayOf(ev.ts));
|
||||
if (st.packs > 0 && st.packs % 10 === 0 && !S.posts[st.day + ':' + st.packs]) {
|
||||
S.posts[st.day + ':' + st.packs] = Date.now(); save();
|
||||
X.telegram('\u{1F4B5} <b>Five Dollar Friday</b> · <b>' + st.packs + ' packs</b> so far today from ' + st.buyers + ' buyers, <b>' + st.polPaid.toFixed(2) + ' POL</b> paid to members in the same transactions.\nEvery $5+ pack today earns +' + c.pct + '% credits: https://instantadpay.com/my#buy').catch(() => {});
|
||||
X.telegram('\u{1F4B5} <b>' + nm + '</b> · <b>' + st.packs + ' packs</b> so far today from ' + st.buyers + ' buyers, <b>' + st.polPaid.toFixed(2) + ' POL</b> paid to members in the same transactions.\nEvery $5+ pack today earns +' + c.pct + '% credits: https://instantadpay.com/my#buy').catch(() => {});
|
||||
}
|
||||
return bonus;
|
||||
}
|
||||
@@ -107,25 +117,28 @@ function earnedBadge(memberId) {
|
||||
// Saturday 00:xx CT wrap-up of the Friday that just ended
|
||||
async function tick() {
|
||||
const c = cfg(); if (!c.on) return;
|
||||
const now = Date.now(); const day = dayOf(now); const wd = weekdayOf(now); const h = hourOf(now);
|
||||
const now = clock(); const day = dayOf(now); const wd = weekdayOf(now); const h = hourOf(now);
|
||||
const next = nextFriday(now);
|
||||
if (wd === 'Thu' && h >= 18 && next && !S.sent['thu:' + next] && await claimOnce('fri:thu:' + next)) {
|
||||
S.sent['thu:' + next] = now; save();
|
||||
const subject = 'Tomorrow is Five Dollar Friday';
|
||||
const text = 'Tomorrow is Five Dollar Friday on InstantAdPay.\n\nAny ad package of $5 or more bought on Friday (Central time) earns +' + c.pct + '% bonus credits, added the moment the purchase settles. Your $5 pays your sponsor line the second it clears, and your line’s $5s pay you. Friday is when we all push at once.\n\nGame Pass too: the same Friday purchase gives you a free 7-day Game Pass for every game in the network (once per Friday, added automatically), and the $5 pack lands as 600 credits that you keep for your ads.\n\nLine up your pack: https://instantadpay.com/my#buy\nWatch the wave on the live ledger: https://instantadpay.com/ledger';
|
||||
const promo = X.promodays && X.promodays.thursdayCopy(next); // Thanksgiving 11-26: the Black Friday copy instead, one message
|
||||
const subject = promo ? promo.subject : 'Tomorrow is Five Dollar Friday';
|
||||
const text = promo ? promo.text : 'Tomorrow is Five Dollar Friday on InstantAdPay.\n\nAny ad package of $5 or more bought on Friday (Central time) earns +' + c.pct + '% bonus credits, added the moment the purchase settles. Your $5 pays your sponsor line the second it clears, and your line’s $5s pay you. Friday is when we all push at once.\n\nGame Pass too: the same Friday purchase gives you a free 7-day Game Pass for every game in the network (once per Friday, added automatically), and the $5 pack lands as 600 credits that you keep for your ads.\n\nLine up your pack: https://instantadpay.com/my#buy\nWatch the wave on the live ledger: https://instantadpay.com/ledger';
|
||||
await broadcast(subject, text);
|
||||
}
|
||||
if (wd === 'Fri' && h >= c.kickHour && day >= c.start && !S.sent['kick:' + day] && await claimOnce('fri:kick:' + day)) {
|
||||
S.sent['kick:' + day] = now; save();
|
||||
X.telegram('\u{1F4B5} <b>It’s Five Dollar Friday.</b> Any ad package from $5 up earns <b>+' + c.pct + '% credits</b> today, and every pack pays its sponsor line in the same transaction. Game Pass day too: the same purchase gives you a free 7-day Game Pass for every game (once per Friday, automatic), and the $5 pack lands as 600 credits you keep for ads. Buy yours, then watch the ledger fill up: https://instantadpay.com/my#buy').catch(() => {});
|
||||
if (nameAt(now) !== 'Five Dollar Friday') X.telegram('\u{1F4B5} <b>It’s ' + nameAt(now) + '. Network Weekend is live</b>, midnight to midnight Central through Cyber Monday. Any ad package from $5 up earns <b>+' + pctAt(now) + '% bonus ad credits</b> today, and every pack pays its sponsor line in the same transaction. The same purchase gives you a free 7-day Game Pass. Ad credits buy advertising, not income. Every deal on the network: https://instantadpay.com/weekend').catch(() => {});
|
||||
else X.telegram('\u{1F4B5} <b>It’s Five Dollar Friday.</b> Any ad package from $5 up earns <b>+' + c.pct + '% credits</b> today, and every pack pays its sponsor line in the same transaction. Game Pass day too: the same purchase gives you a free 7-day Game Pass for every game (once per Friday, automatic), and the $5 pack lands as 600 credits you keep for ads. Buy yours, then watch the ledger fill up: https://instantadpay.com/my#buy').catch(() => {});
|
||||
}
|
||||
if (wd === 'Sat' && h < 3) {
|
||||
const fri = dayOf(now - 86400000);
|
||||
if (isFriday(now - 86400000) && fri >= c.start && !S.sent['wrap:' + fri] && await claimOnce('fri:wrap:' + fri)) {
|
||||
S.sent['wrap:' + fri] = now; save();
|
||||
const st = stats(fri); const top = await topLines(fri);
|
||||
X.telegram('\u{1F3C1} <b>Five Dollar Friday wrap-up</b> (' + labelOf(fri) + ')\n<b>' + st.packs + ' packs</b> from ' + st.buyers + ' buyers · $' + st.usd.toFixed(0) + ' in ad packages · <b>' + st.polPaid.toFixed(2) + ' POL</b> paid to members · ' + st.bonusCredits.toLocaleString() + ' bonus credits handed out'
|
||||
+ (top.length ? '\nBiggest lines today: ' + top.map(t => t.who + ' (' + t.packs + ')').join(', ') : '') + '\nNext one is a week away. Line it up: https://instantadpay.com/my#buy').catch(() => {});
|
||||
const wn = nameAt(now - 86400000); const promoFri = wn !== 'Five Dollar Friday';
|
||||
X.telegram('\u{1F3C1} <b>' + wn + ' wrap-up</b> (' + labelOf(fri) + ')\n<b>' + st.packs + ' packs</b> from ' + st.buyers + ' buyers · $' + st.usd.toFixed(0) + ' in ad packages · <b>' + st.polPaid.toFixed(2) + ' POL</b> paid to members · ' + st.bonusCredits.toLocaleString() + ' bonus credits handed out'
|
||||
+ (top.length ? '\nBiggest lines today: ' + top.map(t => t.who + ' (' + t.packs + ')').join(', ') : '') + (promoFri ? '\nNetwork Weekend carries on: +20% on $5+ packs Saturday and Sunday, +30% on $20+ on Cyber Monday. Every deal: https://instantadpay.com/weekend' : '\nNext one is a week away. Line it up: https://instantadpay.com/my#buy')).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,7 +153,7 @@ async function topLines(dayKey) {
|
||||
// on-site notice + email to every active member (quiet 45+ days skipped, drip unsubscribes honoured)
|
||||
async function broadcast(subject, text) {
|
||||
let all = []; try { all = await X.accounts.listAll(5000); } catch (e) { return; }
|
||||
const now = Date.now(); let n = 0;
|
||||
const now = clock(); let n = 0;
|
||||
for (const a of all) {
|
||||
if (!a.email) continue;
|
||||
if (now - (a.lastSeen || a.created || 0) > 45 * 86400000) continue;
|
||||
|
||||
+9
-4
@@ -192,10 +192,14 @@ function extend(e, via, extra, now, tier) {
|
||||
tier = tierOk(tier) ? tier : 'weekly';
|
||||
const c = cfg(); const tc = c.tiers[tier]; const t = now || Date.now(); const cur = passes.get(e) || { until: 0, bought: [] };
|
||||
const T = tiersOf(cur);
|
||||
const until = Math.max(t, T[tier]) + tc.days * 86400000; T[tier] = until; // renewing early loses nothing: from max(now, until)
|
||||
const bought = [Object.assign({ ts: t, via, tier, usd: tc.price / 100, days: tc.days }, extra || {})].concat(cur.bought || []).slice(0, 200);
|
||||
// Network Weekend (2026-11-17, promodays.js passBonusDays): a tier pass PAID by a package fulfilled Fri 11-27 00:00 CT to Fri 12-04
|
||||
// 00:00 CT gets bonus days (Explorer/Champion +15 = 45, Legend +60 = 425); comps and the weekly pass never do
|
||||
const bonus = via === 'package' && R && typeof R.bonusDays === 'function' ? Math.max(0, Number(R.bonusDays(tier, t)) || 0) : 0;
|
||||
const days = tc.days + bonus;
|
||||
const until = Math.max(t, T[tier]) + days * 86400000; T[tier] = until; // renewing early loses nothing: from max(now, until)
|
||||
const bought = [Object.assign({ ts: t, via, tier, usd: tc.price / 100, days }, bonus ? { bonusDays: bonus } : {}, extra || {})].concat(cur.bought || []).slice(0, 200);
|
||||
passes.set(e, writeTiers(cur, T, { bought, ts: t }));
|
||||
return { until, days: tc.days, tier };
|
||||
return { until, days, tier, bonusDays: bonus };
|
||||
}
|
||||
function waitingOrders(e) { const out = []; for (const [k, o] of orders) if (o.status === 'waiting' && o.email === e && o.kind !== 'hero' && o.kind !== 'stackpro') out.push(Object.assign({ order: k }, o, { tier: tierOk(o.tier) ? o.tier : 'weekly' })); return out; }
|
||||
function waitingOrder(e, tier) { return waitingOrders(e).find(o => o.tier === (tier || 'weekly')) || null; }
|
||||
@@ -232,7 +236,8 @@ function view(email, now, opts) {
|
||||
// the tier rows this member sees: weekly always; a higher tier while on sale, in the admin preview, or to a current holder (holders
|
||||
// keep their pass when a sale is switched off, they just cannot buy more)
|
||||
const passRows = TIERS.filter(k => k === 'weekly' || c.tiers[k].sale || admin || T[k] > t).map(k => {
|
||||
const tc = c.tiers[k]; return { tier: k, name: TIER_NAMES[k], perks: TIER_DEF[k].perks, price: tc.price, usd: tc.price / 100, days: tc.days, package: packageFor(tc.price / 100),
|
||||
const tc = c.tiers[k]; const bd = k !== 'weekly' && R && typeof R.bonusDays === 'function' ? Math.max(0, Number(R.bonusDays(k, t)) || 0) : 0;
|
||||
return { tier: k, name: TIER_NAMES[k], perks: TIER_DEF[k].perks, price: tc.price, usd: tc.price / 100, days: tc.days + bd, bonusDays: bd, package: packageFor(tc.price / 100),
|
||||
active: T[k] > t, until: T[k] > t ? T[k] : null, waiting: !!waitingOrder(e, k), sale: !!tc.sale, open: k === 'weekly' ? c.enabled : tierOpen(c, k, admin) };
|
||||
});
|
||||
const tiered = passRows.some(r => r.tier !== 'weekly');
|
||||
|
||||
+1
-1
@@ -142,7 +142,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. 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;
|
||||
}
|
||||
module.exports = { init, view, compute, renderPage, rolloverTick, winners, periodBounds };
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// 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).
|
||||
async function handle(req, res, self) {
|
||||
if (!cache.at) { try { await refresh(); } catch (e) {} } // first ask after a boot waits for the hub once (2.5 s cap)
|
||||
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: [] } }; } };
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
// Promo days (Marty 2026-11-17, "Network Weekend", Black Friday to Cyber Monday 2026): a reusable date-to-percent bonus map, cloned
|
||||
// from Five Dollar Friday (friday.js). Any package bought on a mapped Central day, at or above that day's minimum, earns that day's
|
||||
// bonus percent of its on-chain credits (purchased-grade, labelled in the credit log), once per purchase tx across app copies
|
||||
// (marks.js, MySQL), with a purchase notice that names the day. Future holidays = a new map in the promoDays setting, no code.
|
||||
//
|
||||
// The 2026 map (DEFAULT_DAYS): Fri 11-27 Black Friday +40% $5+, Sat 11-28 and Sun 11-29 +20% $5+, Mon 11-30 Cyber Monday +30% $20+.
|
||||
// Each day is midnight to midnight Central. A mapped day that is a Friday is paid by friday.js at max(fridayBonusPct, the day's pct)
|
||||
// (fridayPct below), so Black Friday is ONE bonus per tx at 40%, the free 7-day Game Pass perk still fires, and nobody flips
|
||||
// fridayBonusPct by hand; normal Five Dollar Friday (+20%) resumes on 12-04 by itself.
|
||||
//
|
||||
// Also here, all date-gated to the weekend window (weekendStart..weekendEnd, Fri 11-27 00:00 CT to Tue 12-01 00:00 CT):
|
||||
// - Weekend Starter Bundle: a $20+ pack also gets the LinkSpin code (setting weekendLinkspinCode, default WEEKEND500) in its notice
|
||||
// - Builder Bundle: a $100+ pack is listed for DownlineHydra (GET /api/network/weekend-builders); DH grants Pro, 25 comps
|
||||
// - Game Pass bonus days for tier passes fulfilled Fri 11-27 00:00 CT to Fri 12-04 00:00 CT (passBonusDays, read by gamepass.js)
|
||||
// - the chatbot fact and answer, the /api/promodays view for the strip, Overview card and /weekend page
|
||||
//
|
||||
// Settings (siteConfig): promoDaysOn '1'|'0' (kill switch), promoDays (JSON {"YYYY-MM-DD": {pct, minCents, name}}), weekendStart /
|
||||
// weekendEnd / weekendPassEnd (ISO), weekendLinkspinCode, weekendBuilderCap (25), promoMailBase (link base for emails, default the share domain instantadpay.link).
|
||||
// Test clock: env IAP_TEST_NOW (ISO), ignored when NODE_ENV=production. Copy rules: no em dashes, Central times, no income promises.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
let X = {}, FILE = null, S = null;
|
||||
const TZ = 'America/Chicago';
|
||||
const dayOf = ts => new Date(ts).toLocaleDateString('en-CA', { timeZone: TZ });
|
||||
const weekdayOf = ts => new Date(ts).toLocaleDateString('en-US', { timeZone: TZ, weekday: 'short' });
|
||||
const CREDITS_LINE = 'Ad credits buy advertising, not income.';
|
||||
|
||||
const DEFAULT_DAYS = {
|
||||
'2026-11-27': { pct: 40, minCents: 500, name: 'Black Friday' },
|
||||
'2026-11-28': { pct: 20, minCents: 500, name: 'Network Weekend Saturday' },
|
||||
'2026-11-29': { pct: 20, minCents: 500, name: 'Network Weekend Sunday' },
|
||||
'2026-11-30': { pct: 30, minCents: 2000, name: 'Cyber Monday' }
|
||||
};
|
||||
const DEFAULTS = {
|
||||
weekendStart: '2026-11-27T00:00:00-06:00', weekendEnd: '2026-12-01T00:00:00-06:00', weekendPassEnd: '2026-12-04T00:00:00-06:00',
|
||||
weekendLinkspinCode: 'WEEKEND500', weekendStarterMinCents: 2000, weekendBuilderMinCents: 10000, weekendBuilderCap: 25,
|
||||
passBonus: { explorer: 15, champion: 15, legend: 60 } // days on top of the tier's own (30, 30, 365)
|
||||
};
|
||||
|
||||
function now() {
|
||||
const o = process.env.NODE_ENV !== 'production' && process.env.IAP_TEST_NOW; const t = o ? Date.parse(o) : NaN;
|
||||
return Number.isNaN(t) ? Date.now() : t;
|
||||
}
|
||||
function init(opts) { X = opts || {}; FILE = path.join(opts.dataDir, 'promodays.json'); S = load(); }
|
||||
function load() { try { return Object.assign({ granted: {}, bundles: {} }, JSON.parse(fs.readFileSync(FILE, 'utf8'))); } catch (e) { return { granted: {}, bundles: {} }; } }
|
||||
function save() { try { fs.writeFileSync(FILE, JSON.stringify(S)); } catch (e) {} }
|
||||
async function claimOnce(key) { try { return X.marks ? await X.marks.claim(key) : true; } catch (e) { return true; } }
|
||||
|
||||
function cfg() {
|
||||
const c = (X.siteConfig && X.siteConfig()) || {};
|
||||
let days = DEFAULT_DAYS;
|
||||
if (c.promoDays) { try { const j = typeof c.promoDays === 'string' ? JSON.parse(c.promoDays) : c.promoDays; if (j && typeof j === 'object') days = j; } catch (e) { console.error('promoDays setting is not valid JSON, using the built-in map'); } }
|
||||
const ms = (k) => { const t = Date.parse(c[k] || DEFAULTS[k]); return Number.isNaN(t) ? Date.parse(DEFAULTS[k]) : t; };
|
||||
return {
|
||||
on: String(c.promoDaysOn == null ? '1' : c.promoDaysOn) === '1',
|
||||
days, start: ms('weekendStart'), end: ms('weekendEnd'), passEnd: ms('weekendPassEnd'),
|
||||
lsCode: String(c.weekendLinkspinCode || DEFAULTS.weekendLinkspinCode).toUpperCase().replace(/[^A-Z0-9_-]/g, '').slice(0, 24),
|
||||
starterMin: Number(c.weekendStarterMinCents) || DEFAULTS.weekendStarterMinCents,
|
||||
builderMin: Number(c.weekendBuilderMinCents) || DEFAULTS.weekendBuilderMinCents,
|
||||
builderCap: Math.max(0, Number(c.weekendBuilderCap == null ? DEFAULTS.weekendBuilderCap : c.weekendBuilderCap) || 0),
|
||||
mailBase: String(c.promoMailBase || 'https://instantadpay.link').replace(/\/+$/, ''), // instantadpay.com is on the Spamhaus DBL (still listed 2026-11-17): email links use the share domain
|
||||
passBonus: DEFAULTS.passBonus
|
||||
};
|
||||
}
|
||||
// the mapped day at ts, or null: { day, pct, minCents, name }
|
||||
function dayAt(ts) {
|
||||
const c = cfg(); if (!c.on) return null;
|
||||
const d = dayOf(ts); const e = c.days[d];
|
||||
if (!e || !(Number(e.pct) > 0)) return null;
|
||||
return { day: d, pct: Number(e.pct), minCents: Math.max(0, Number(e.minCents) || 0), name: String(e.name || 'Promo day').slice(0, 60) };
|
||||
}
|
||||
// friday.js asks: the promo percent for a Friday purchase (0 = none), so Black Friday is paid there, once, at the higher rate
|
||||
function fridayPct(ts, cents) { const d = dayAt(ts); return d && weekdayOf(ts) === 'Fri' && (cents == null || cents >= d.minCents) ? d.pct : 0; }
|
||||
function fridayName(ts) { const d = dayAt(ts); return d && weekdayOf(ts) === 'Fri' ? d.name : ''; }
|
||||
function inWeekend(ts) { const c = cfg(); return c.on && ts >= c.start && ts < c.end; }
|
||||
function weekendLive(t) { return inWeekend(t == null ? now() : t); }
|
||||
// Game Pass bonus days for a tier pass fulfilled at ts (gamepass.js extend, via 'package' only; comps never get them)
|
||||
function passBonusDays(tier, ts) {
|
||||
const c = cfg(); if (!c.on || !(ts >= c.start && ts < c.passEnd)) return 0;
|
||||
return Number(c.passBonus[tier]) || 0;
|
||||
}
|
||||
const usdOf = cents => ('$' + (cents / 100).toFixed(2)).replace(/\.00$/, '');
|
||||
const tsOf = ev => (Number(ev.ts) > 1e12 ? Number(ev.ts) : (Number(ev.ts) > 0 ? Number(ev.ts) * 1000 : Date.now()));
|
||||
|
||||
// the bonus on a mapped non-Friday day (Fridays are paid by friday.js), and the bundle notices on any weekend day
|
||||
async function onEvent(ev) {
|
||||
if (!ev || ev.type !== 'Purchase') return null;
|
||||
const ts = tsOf(ev); const cents = Number(ev.priceCents) || 0;
|
||||
const out = { bonus: 0, starter: false, builder: false };
|
||||
const d = dayAt(ts);
|
||||
if (d && weekdayOf(ts) !== 'Fri' && cents >= d.minCents && !S.granted[ev.tx] && await claimOnce('pd:' + ev.tx)) {
|
||||
const bonus = Math.round((Number(ev.creditAmount) || 0) * d.pct / 100);
|
||||
const a = bonus > 0 && X.accounts ? await X.accounts.byMemberId(ev.buyerId) : null;
|
||||
if (a && a.email) {
|
||||
await X.ads.addEarned(a.email, bonus, { purchased: true, log: { kind: 'bonus', note: d.name + ': +' + d.pct + '% on your ' + usdOf(cents) + ' package', ref: 'pd:' + String(ev.tx).slice(0, 30) } });
|
||||
S.granted[ev.tx] = { day: d.day, memberId: ev.buyerId, bonus, pct: d.pct, at: Date.now() }; save();
|
||||
out.bonus = bonus;
|
||||
try { await X.notify(ev.buyerId, d.name + ': +' + bonus + ' bonus credits', 'Your ' + usdOf(cents) + ' package landed on ' + d.name + ', so ' + bonus + ' bonus ad credits (+' + d.pct + '%) were added to your balance. ' + CREDITS_LINE + ' See your balance: https://instantadpay.com/my#campaigns\n\nEvery Network Weekend deal across the network: https://instantadpay.com/weekend', 'notice'); } catch (e) {}
|
||||
}
|
||||
}
|
||||
if (inWeekend(ts) && cents >= cfg().starterMin && !S.bundles[ev.tx] && await claimOnce('pdb:' + ev.tx)) {
|
||||
const c = cfg(); const builder = cents >= c.builderMin;
|
||||
const wallet = builder ? await walletOf(ev) : '';
|
||||
S.bundles[ev.tx] = { memberId: ev.buyerId, cents, at: ts, builder, wallet }; save();
|
||||
out.starter = true; out.builder = builder;
|
||||
const lines = ['Your ' + usdOf(cents) + ' package came in during Network Weekend, so it carries the Weekend Starter Bundle: a ' + '500-credit LinkSpin code, ' + c.lsCode + '. Enter it at https://linkspin.app (same email as here, one per account).'];
|
||||
if (builder) lines.push('It is also a Builder Bundle: DownlineHydra Pro is on its way to the wallet that paid' + (wallet ? ' (' + wallet.slice(0, 6) + '...' + wallet.slice(-4) + ')' : '') + ', free, while the first ' + c.builderCap + ' comps last. If that wallet already holds Pro, nothing changes. It lands within the hour; check https://downlinehydra.com.');
|
||||
lines.push(CREDITS_LINE);
|
||||
try { await X.notify(ev.buyerId, 'Network Weekend: your bundle extras', lines.join('\n\n'), 'notice'); } catch (e) {}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// the buying position's wallet: the chain index first (MemberActivated), then a contract read
|
||||
async function walletOf(ev) {
|
||||
const id = Number(ev.buyerId) || 0; if (!id || !X.chain) return '';
|
||||
try { for (const e of X.chain.recentEvents(1e9)) if (e.type === 'MemberActivated' && Number(e.id) === id && e.account) return String(e.account).toLowerCase(); } catch (e) {}
|
||||
try { const m = await X.chain.member(id); return m && m.account ? String(m.account).toLowerCase() : ''; } catch (e) { return ''; }
|
||||
}
|
||||
// GET /api/network/weekend-builders (DownlineHydra pulls it): every $100+ package in the window, from the chain index, never a counter
|
||||
async function builders() {
|
||||
const c = cfg(); const out = [];
|
||||
let evs = []; try { evs = X.chain.recentEvents(1e9); } catch (e) {}
|
||||
for (const ev of evs) {
|
||||
if (ev.type !== 'Purchase' || (Number(ev.priceCents) || 0) < c.builderMin) continue;
|
||||
const ts = tsOf(ev); if (!(ts >= c.start && ts < c.end)) continue;
|
||||
const wallet = (S.bundles[ev.tx] && S.bundles[ev.tx].wallet) || await walletOf(ev);
|
||||
if (wallet) out.push({ wallet, txHash: ev.tx, usdCents: Number(ev.priceCents), at: new Date(ts).toISOString() });
|
||||
}
|
||||
return { start: new Date(c.start).toISOString(), end: new Date(c.end).toISOString(), cap: c.builderCap, builders: out.sort((a, b) => a.at < b.at ? -1 : 1) };
|
||||
}
|
||||
|
||||
// the public view for the strip, Overview card and /weekend page
|
||||
function view(t) {
|
||||
const c = cfg(); t = t == null ? now() : t;
|
||||
const d = dayAt(t); const live = inWeekend(t);
|
||||
// nothing about the deals is published before Thanksgiving Thursday 00:00 CT (24 h before the start)
|
||||
if (t < c.start - 86400000) return { on: c.on, live: false, today: null, days: [], startsAt: new Date(c.start).toISOString(), endsAt: new Date(c.end).toISOString(), published: false };
|
||||
const list = Object.entries(c.days).sort().map(([k, v]) => ({ day: k, name: v.name, pct: Number(v.pct), minUsd: (Number(v.minCents) || 0) / 100 }));
|
||||
let st = null;
|
||||
if (d) { let packs = 0, usd = 0; try { for (const ev of X.chain.recentEvents(1e9)) if (ev.type === 'Purchase' && ev.priceCents >= d.minCents && dayOf(tsOf(ev)) === d.day) { packs++; usd += ev.priceCents / 100; } } catch (e) {}
|
||||
st = { packs, usd, bonusCredits: Object.values(S.granted).filter(g => g.day === d.day).reduce((s, g) => s + g.bonus, 0) }; }
|
||||
return { on: c.on, live, today: d ? { day: d.day, name: d.name, pct: d.pct, minUsd: d.minCents / 100, stats: st } : null, days: list,
|
||||
startsAt: new Date(c.start).toISOString(), endsAt: new Date(c.end).toISOString(), passEndsAt: new Date(c.passEnd).toISOString(),
|
||||
published: true, passBonusLive: c.on && t >= c.start && t < c.passEnd, passBonus: c.passBonus, lsCode: live ? c.lsCode : null, builderCap: c.builderCap, note: CREDITS_LINE };
|
||||
}
|
||||
|
||||
// Thanksgiving: friday.js sends this instead of the normal Thursday copy when tomorrow is a mapped Friday (one message)
|
||||
function thursdayCopy(nextFridayKey) {
|
||||
const c = cfg(); const d = c.on && c.days[nextFridayKey]; if (!d) return null;
|
||||
const B = c.mailBase;
|
||||
return { subject: d.name + ' starts at midnight: Network Weekend',
|
||||
text: 'Network Weekend starts tonight at midnight Central and runs Black Friday to Cyber Monday, midnight to midnight.\n\n'
|
||||
+ 'On InstantAdPay:\n'
|
||||
+ 'Black Friday (Fri 11-27): +40% bonus ad credits on any $5+ pack, and the same pack gives you a free 7-day Game Pass.\n'
|
||||
+ 'Saturday and Sunday: +20% bonus ad credits on any $5+ pack.\n'
|
||||
+ 'Cyber Monday (Mon 11-30): +30% bonus ad credits on any $20+ pack.\n'
|
||||
+ 'Any $20+ pack also gets a 500-credit LinkSpin code. Any $100+ pack also gets DownlineHydra Pro free, while the first ' + c.builderCap + ' comps last.\n'
|
||||
+ 'Code NETWORKWEEKEND: 300 bonus ad credits, one per account, from midnight.\n\n'
|
||||
+ 'Every pack still pays its sponsor line in the same transaction, at the full price. ' + CREDITS_LINE + '\n\n'
|
||||
+ 'Every network site has its own weekend deal: ' + B + '/weekend\n'
|
||||
+ 'Line up your pack: ' + B + '/my#buy' };
|
||||
}
|
||||
// the chatbot (chatbot.js): a fact for the system prompt and one answer, only while the weekend (or the Game Pass days) is on
|
||||
function chatFact(t) {
|
||||
const c = cfg(); t = t == null ? now() : t;
|
||||
if (!c.on || t < c.start - 86400000 || t >= c.passEnd) return '';
|
||||
if (t < c.start) return '- NETWORK WEEKEND (starts Fri 2026-11-27 00:00 Central, tomorrow): Black Friday to Cyber Monday, midnight to midnight Central. Not live yet: say it starts at midnight; deals at https://instantadpay.com/weekend.\n';
|
||||
if (t >= c.end) return '- NETWORK WEEKEND is over (it ended Mon 11-30 at midnight Central). Still on until Thu 12-03 23:59 Central: tier Game Pass bonus days (Explorer and Champion 45 days, Legend 365 + 60). Five Dollar Friday is back to +20% on $5+ from Fri 12-04.\n';
|
||||
return '- NETWORK WEEKEND (LIVE now, Fri 11-27 00:00 to Mon 11-30 23:59 Central, midnight to midnight): Black Friday +40% bonus ad credits on any $5+ pack (instead of the usual Five Dollar Friday +20%, never both) plus the free 7-day Game Pass; Saturday and Sunday +20% on $5+; Cyber Monday +30% on $20+. Weekend Starter Bundle: any $20+ pack gets the LinkSpin code ' + c.lsCode + ' (500 LinkSpin credits, shown on the purchase notice). Builder Bundle: any $100+ pack gets DownlineHydra Pro free for the paying wallet, first ' + c.builderCap + ' comps, nobody is paid on a comp. Code NETWORKWEEKEND: 300 bonus ad credits, paid in 5 daily installments as the member finishes the daily ad set, one per account, new and existing accounts, valid until Mon 11-30 23:59 Central. Tier Game Pass bonus days through Thu 12-03 23:59 Central (Explorer and Champion 45 days, Legend 365 + 60) when the tier passes are on sale. Every pack pays its sponsor line in full. No price is cut on InstantAdPay. All deals: https://instantadpay.com/weekend. Ad credits buy advertising, not income; never promise income.\n';
|
||||
}
|
||||
const CHAT_RE = /(black friday|cyber monday|network weekend|weekend (deal|sale|bonus|promo|special)s?|thanksgiving|bundle|networkweekend|friday (bonus|promo|deal|special)|five dollar friday)/i;
|
||||
function chatAnswer(msg, t) {
|
||||
const c = cfg(); t = t == null ? now() : t;
|
||||
if (!c.on || !CHAT_RE.test(String(msg || '')) || t < c.start - 86400000 || t >= c.end) return null;
|
||||
if (t < c.start) return 'Network Weekend starts tonight at midnight Central and runs Black Friday to Cyber Monday, midnight to midnight. Black Friday: +40% bonus ad credits on any $5+ pack plus a free 7-day Game Pass. Saturday and Sunday: +20% on $5+. Cyber Monday: +30% on $20+. Any $20+ pack adds a 500-credit LinkSpin code, any $100+ pack adds DownlineHydra Pro while the first ' + c.builderCap + ' comps last, and code NETWORKWEEKEND gives 300 bonus ad credits from midnight. Every deal: https://instantadpay.com/weekend. ' + CREDITS_LINE;
|
||||
const d = dayAt(t);
|
||||
return 'Network Weekend is on now, midnight to midnight Central through Cyber Monday. ' + (d ? 'Today is ' + d.name + ': +' + d.pct + '% bonus ad credits on any ' + usdOf(d.minCents) + '+ pack' + (weekdayOf(t) === 'Fri' ? ' (this replaces the usual Five Dollar Friday +20%), plus a free 7-day Game Pass' : '') + '. ' : '')
|
||||
+ 'Saturday and Sunday are +20% on $5+, Cyber Monday is +30% on $20+. Any $20+ pack also gets the LinkSpin code ' + c.lsCode + ' (500 LinkSpin credits) on your purchase notice, and any $100+ pack gets DownlineHydra Pro free for the paying wallet while the first ' + c.builderCap + ' comps last. Code NETWORKWEEKEND gives 300 bonus ad credits over 5 days of your daily ad set, one per account. Buy under My account > Buy packages: https://instantadpay.com/my#buy. Every deal on the network: https://instantadpay.com/weekend. ' + CREDITS_LINE;
|
||||
}
|
||||
|
||||
module.exports = { init, cfg, dayAt, fridayPct, fridayName, inWeekend, weekendLive, passBonusDays, onEvent, builders, view, thursdayCopy, chatFact, chatAnswer, now, DEFAULT_DAYS, CREDITS_LINE };
|
||||
@@ -4,6 +4,8 @@
|
||||
// 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.
|
||||
// Start time (2026-11-17, Network Weekend code NETWORKWEEKEND): `starts` (ms, 0 = at once) keeps a code dormant until then, so a
|
||||
// weekend code can be created ahead and opens by itself. Test clock: env IAP_TEST_NOW, ignored when NODE_ENV=production.
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const db = require('./db');
|
||||
@@ -15,6 +17,7 @@ const norm = c => String(c || '').trim().toUpperCase().replace(/[^A-Z0-9_-]/g, '
|
||||
const STEPS = 5;
|
||||
const WINDOW_DAYS = 30;
|
||||
const stepOf = credits => Math.ceil(Number(credits) / STEPS);
|
||||
const nowMs = () => { const o = process.env.NODE_ENV !== 'production' && process.env.IAP_TEST_NOW; const t = o ? Date.parse(o) : NaN; return Number.isNaN(t) ? Date.now() : t; };
|
||||
|
||||
const J = {
|
||||
db: { v: 1, codes: {}, redemptions: [] },
|
||||
@@ -35,8 +38,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); },
|
||||
@@ -46,7 +49,7 @@ const D = {
|
||||
async markPaid(code, email, paid, lastDay) { await db.q('UPDATE promo_redemptions SET paid=?, last_day=? WHERE code=? AND email=?', [paid, lastDay, code, email]); },
|
||||
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, active: !!Number(r.active), created: Number(r.created), starts: Number(r.starts) || 0 });
|
||||
const impl = () => db.enabled() ? D : J;
|
||||
|
||||
function init(opts) { DATA_DIR = opts.dataDir; if (!db.enabled()) J.load(); }
|
||||
@@ -54,7 +57,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 ? Number(new Date(c.starts)) || 0 : (c.starts === undefined && cur ? cur.starts || 0 : 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 }; }
|
||||
@@ -62,7 +65,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 && nowMs() < c.starts) return { error: 'That promo code opens ' + new Date(c.starts).toLocaleString('en-US', { timeZone: 'America/Chicago', weekday: 'long', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' Central.' };
|
||||
if (c.expires && nowMs() > 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;
|
||||
|
||||
+1
-1
@@ -652,7 +652,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.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-kits.js?v=20261101th"></script>
|
||||
</body>
|
||||
|
||||
@@ -104,6 +104,12 @@ window.IAP = (function () {
|
||||
// pages with their own footer (the members area) get the network line too
|
||||
function decorateFooters() { document.querySelectorAll('footer.bo-pagefoot').forEach(f => { const w = document.createElement('div'); w.style.width = '100%'; f.appendChild(w); renderNetworkLine(w); }); }
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', decorateFooters); else decorateFooters();
|
||||
// Network Weekend (2026-11-17): the network ribbon (netweekend.js, every page) and the weekend strip / Overview card (weekend-card.js,
|
||||
// Home and /my). Both switch on and off by date inside the scripts themselves, so outside the window they show nothing.
|
||||
[['/assets/netweekend.js?v=20261117nw', 'iap'], ['/assets/weekend-card.js?v=20261117nw', '']].forEach(([src, site]) => {
|
||||
if (document.querySelector('script[src^="' + src.split('?')[0] + '"]')) return;
|
||||
const t = document.createElement('script'); t.src = src; t.defer = true; if (site) t.setAttribute('data-site', site); document.head.appendChild(t);
|
||||
});
|
||||
async function refreshNavWallet() {
|
||||
try {
|
||||
const me = await (await fetch('/api/me')).json();
|
||||
|
||||
@@ -31,4 +31,6 @@
|
||||
fetch('/api/me', { credentials: 'same-origin' }).then(function (r) { return r.json(); }).then(function (m) { if (m && m.signedIn && m.username && okRef(m.username)) { ref = m.username; paint(); } }).catch(function () {});
|
||||
}
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
|
||||
// Network Weekend ribbon (2026-11-17): date-gated inside netweekend.js; loaded once even when common.js loads it too
|
||||
if (!document.querySelector('script[src^="/assets/netweekend.js"]')) { var t = document.createElement('script'); t.src = '/assets/netweekend.js?v=20261117nw'; t.defer = true; t.setAttribute('data-site', me); document.head.appendChild(t); }
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// "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]) || '';
|
||||
if (label && line.indexOf(label + ': ') === 0) line = line.slice(label.length + 2); // "Black Friday, Black Friday: ..." reads once
|
||||
var onDealsPage = !!ev.url && (function () { try { var u = new URL(ev.url); return location.pathname === u.pathname && (location.hostname === u.hostname || me === 'iap'); } catch (e) { return false; } })();
|
||||
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
|
||||
})();
|
||||
@@ -0,0 +1,60 @@
|
||||
// Network Weekend strip (Home, above the Five Dollar Friday strip) and Overview card (/my, above the Friday card), Marty 2026-11-17.
|
||||
// Data: /api/promodays (promodays.js). Shown only while the weekend is live (Fri 11-27 00:00 CT to Tue 12-01 00:00 CT) and, as a
|
||||
// heads-up, on Thanksgiving Thursday 11-26 Central; the page's own clock decides at the exact midnights, the server's `live` too.
|
||||
// No inline styles (CSP), no native dialogs. Test clock: window.__NW_NOW (ms).
|
||||
(function () {
|
||||
if (window.__nwCard) return; window.__nwCard = 1;
|
||||
var now = function () { return typeof window.__NW_NOW === 'number' ? window.__NW_NOW : Date.now(); };
|
||||
var ctDay = function (ms) { return new Date(ms - 6 * 3600 * 1000).toISOString().slice(0, 10); };
|
||||
var esc = function (s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); };
|
||||
var usd = function (n) { return '$' + (Number(n) % 1 ? Number(n).toFixed(2) : Number(n)); };
|
||||
var hidden = function (k) { try { return localStorage.getItem('iap-hide-nw-' + k) === '1'; } catch (e) { return false; } };
|
||||
var hide = function (k) { try { localStorage.setItem('iap-hide-nw-' + k, '1'); } catch (e) {} };
|
||||
function dayLine(v) {
|
||||
return (v.days || []).map(function (d) { return '<b>' + esc(d.name.replace(/^Network Weekend /, '')) + '</b> +' + d.pct + '% on ' + usd(d.minUsd) + '+'; }).join(' · ');
|
||||
}
|
||||
function state(v) {
|
||||
var t = now(), s = Date.parse(v.startsAt), e = Date.parse(v.endsAt);
|
||||
if (!v.on) return '';
|
||||
if (t >= s && t < e) return 'live';
|
||||
if (t >= s - 86400000 && t < s) return 'soon';
|
||||
return '';
|
||||
}
|
||||
function extras(v) {
|
||||
return 'Any $20+ pack also gets a 500-credit LinkSpin code' + (v.lsCode ? ' (<b>' + esc(v.lsCode) + '</b>)' : '') + ' on your purchase notice. Any $100+ pack also gets DownlineHydra Pro free, while the first ' + esc(v.builderCap) + ' comps last. Code <b>NETWORKWEEKEND</b>: 300 bonus ad credits, one per account.';
|
||||
}
|
||||
function paintStrip(v, st) {
|
||||
var anchor = document.getElementById('fdfStrip'); if (!anchor) return;
|
||||
var el = document.getElementById('nwStrip');
|
||||
if (!st) { if (el) el.hidden = true; return; }
|
||||
if (!el) { el = document.createElement('div'); el.className = 'fdf'; el.id = 'nwStrip'; anchor.parentNode.insertBefore(el, anchor); }
|
||||
el.hidden = false;
|
||||
el.innerHTML = st === 'live' && v.today
|
||||
? '<b>\u{1F6CD}️ Network Weekend: it’s ' + esc(v.today.name.replace(/^Network Weekend /, '')) + '.</b> +' + v.today.pct + '% bonus ad credits on any ' + usd(v.today.minUsd) + '+ pack until midnight Central. ' + extras(v) + ' ' + esc(v.note) + ' <a href="/weekend">Every deal</a>'
|
||||
: '<b>\u{1F6CD}️ Network Weekend starts at midnight Central.</b> ' + dayLine(v) + ', midnight to midnight through Cyber Monday. ' + esc(v.note) + ' <a href="/weekend">Every deal</a>';
|
||||
}
|
||||
function paintCard(v, st) {
|
||||
var anchor = document.getElementById('fdfCard'); if (!anchor) return;
|
||||
var card = document.getElementById('nwCard'); var key = st + '-' + ctDay(now());
|
||||
if (!st || hidden(key)) { if (card) card.hidden = true; return; }
|
||||
if (!card) { card = document.createElement('div'); card.className = 'card'; card.id = 'nwCard'; anchor.parentNode.insertBefore(card, anchor); }
|
||||
card.hidden = false;
|
||||
var live = st === 'live' && v.today;
|
||||
card.innerHTML = '<div class="card-head"><h3>\u{1F6CD}️ ' + (live ? 'Network Weekend: ' + esc(v.today.name.replace(/^Network Weekend /, '')) : 'Network Weekend starts at midnight') + '</h3><span class="sub">'
|
||||
+ (live ? '+' + v.today.pct + '% bonus ad credits on any ' + usd(v.today.minUsd) + '+ pack today' : 'Black Friday to Cyber Monday, Central') + '</span></div>'
|
||||
+ '<p>' + (live && v.today.stats ? '<b>' + v.today.stats.packs + '</b> pack' + (v.today.stats.packs === 1 ? '' : 's') + ' so far today. ' : '') + dayLine(v) + ', each day midnight to midnight Central. ' + extras(v) + '</p>'
|
||||
+ '<p class="muted small">' + esc(v.note) + ' Every pack pays its sponsor line in full, at the normal price.</p>'
|
||||
+ '<button class="btn" type="button" id="nwBuy">' + (live ? 'Buy my weekend pack' : 'See the packages') + '</button> <a class="btn sec" href="/weekend" target="_blank" rel="noopener">Every network deal</a>';
|
||||
var b = document.getElementById('nwBuy'); if (b) b.addEventListener('click', function () { var m = document.querySelector('.bo-menu [data-pane="buy"]'); if (m) m.click(); else location.href = '/my#buy'; });
|
||||
var head = card.querySelector('.card-head'); var x = document.createElement('button');
|
||||
x.type = 'button'; x.className = 'card-x'; x.setAttribute('aria-label', 'Hide for today'); x.textContent = '×';
|
||||
x.addEventListener('click', function () { hide(key); card.hidden = true; }); head.appendChild(x);
|
||||
}
|
||||
var last = null;
|
||||
function load() {
|
||||
fetch('/api/promodays').then(function (r) { return r.ok ? r.json() : null; }).then(function (v) { if (!v) return; last = v; var st = state(v); paintStrip(v, st); paintCard(v, st); }).catch(function () {});
|
||||
}
|
||||
function run() { if (!document.getElementById('fdfStrip') && !document.getElementById('fdfCard')) return; load(); setInterval(load, 120000); }
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
|
||||
window.__nwCardPaint = function (v) { last = v; var st = state(v); paintStrip(v, st); paintCard(v, st); return st; }; // tests
|
||||
})();
|
||||
@@ -0,0 +1,53 @@
|
||||
/* /weekend, the Network Weekend deals page (Marty 2026-11-17). External file on purpose: the site's CSP blocks inline scripts.
|
||||
Data: /api/promodays (InstantAdPay's own days, promodays.js) and /api/network-deals (every site's deal, from the hub).
|
||||
Switches by the page's own clock at the exact Central midnights; before Thanksgiving Thursday both feeds are empty, so the page
|
||||
says only that the weekend is coming. Test clock: window.__NW_NOW (ms). */
|
||||
(function () {
|
||||
var now = function () { return typeof window.__NW_NOW === 'number' ? window.__NW_NOW : Date.now(); };
|
||||
var ctDay = function (ms) { return new Date(ms - 6 * 3600 * 1000).toISOString().slice(0, 10); };
|
||||
var esc = function (s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); };
|
||||
var usd = function (n) { return '$' + (Number(n) % 1 ? Number(n).toFixed(2) : Number(n)); };
|
||||
var label = function (k) { var p = k.split('-').map(Number); return new Date(Date.UTC(p[0], p[1] - 1, p[2], 12)).toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }); };
|
||||
var stateEl = document.getElementById('nwState'), daysEl = document.getElementById('nwDays'), dealsEl = document.getElementById('nwDeals');
|
||||
if (!stateEl) return;
|
||||
// carry ?ref= onto the join button (the page is a member promo tool, like /friday)
|
||||
try { var ref = new URLSearchParams(location.search).get('ref'); if (ref && /^[A-Za-z0-9_.-]{1,40}$/.test(ref)) document.getElementById('nwJoin').href = '/join?v=weekend&ref=' + encodeURIComponent(ref); } catch (e) {}
|
||||
function renderIap(v) {
|
||||
var t = now(), s = Date.parse(v.startsAt), e = Date.parse(v.endsAt), today = ctDay(t);
|
||||
if (!v.on || !v.published) {
|
||||
stateEl.className = 'nw-state'; stateEl.innerHTML = '<span class="nw-tag">Coming</span><span><b>Network Weekend: Black Friday to Cyber Monday.</b> The deals open here on Thanksgiving.</span>';
|
||||
daysEl.innerHTML = ''; return;
|
||||
}
|
||||
if (t >= s && t < e) {
|
||||
var d = v.today || {};
|
||||
stateEl.className = 'nw-state live';
|
||||
stateEl.innerHTML = '<span class="nw-tag">Live now</span><span><b>It is ' + esc((d.name || 'Network Weekend').replace(/^Network Weekend /, '')) + '.</b> +' + esc(d.pct) + '% bonus ad credits on any ' + usd(d.minUsd) + '+ InstantAdPay pack until midnight Central.</span>'
|
||||
+ (d.stats ? '<span><b>' + Number(d.stats.packs || 0).toLocaleString('en-US') + '</b> pack' + (d.stats.packs === 1 ? '' : 's') + ' so far today</span>' : '');
|
||||
} else if (t < s) {
|
||||
var left = s - t, h = Math.floor(left / 3600000), m = Math.floor((left % 3600000) / 60000);
|
||||
stateEl.className = 'nw-state'; stateEl.innerHTML = '<span class="nw-tag">Tonight</span><span><b>Network Weekend starts at midnight Central</b>, in ' + h + 'h ' + m + 'm.</span><span>Join now so your account is ready.</span>';
|
||||
} else {
|
||||
stateEl.className = 'nw-state'; stateEl.innerHTML = '<span class="nw-tag">Ended</span><span><b>Network Weekend is over.</b> Thank you for building with us. Five Dollar Friday is back every Friday.</span>';
|
||||
}
|
||||
daysEl.innerHTML = (v.days || []).map(function (x) {
|
||||
return '<div class="nw-day' + (x.day === today && t >= s && t < e ? ' today' : '') + '"><div class="n">' + esc(label(x.day)) + '</div><h3>+' + esc(x.pct) + '% on ' + usd(x.minUsd) + '+</h3><p>' + esc(x.name) + ': bonus ad credits on any InstantAdPay pack of ' + usd(x.minUsd) + ' or more, midnight to midnight Central.</p></div>';
|
||||
}).join('');
|
||||
}
|
||||
function renderDeals(b) {
|
||||
var t = now(), today = ctDay(t);
|
||||
var ev = ((b && b.events) || []).filter(function (e) { return t >= Date.parse(e.startsAt) - 86400000 && t < Date.parse(e.endsAt); })[0];
|
||||
if (!ev) { if (!((b && b.events) || []).length) return; dealsEl.innerHTML = '<p class="muted">Network Weekend has ended.</p>'; return; }
|
||||
var deals = (ev.deals || []).filter(function (d) { return t < Date.parse(d.endsAt || ev.endsAt); });
|
||||
dealsEl.innerHTML = deals.map(function (d) {
|
||||
var text = (d.byDay && d.byDay[today]) || d.text;
|
||||
return '<div class="nw-deal"><h3>' + esc(d.name) + '</h3><p>' + esc(text) + '</p>' + (d.note ? '<p class="note">' + esc(d.note) + '</p>' : '')
|
||||
+ (d.url ? '<a class="go" href="' + esc(d.url) + '"' + (/instantadpay\.com/.test(d.url) ? '' : ' target="_blank" rel="noopener"') + '>' + (/instantadpay\.com\/weekend/.test(d.url) ? 'Buy on InstantAdPay' : 'Open ' + esc(d.name)) + '</a>' : '') + '</div>';
|
||||
}).join('');
|
||||
dealsEl.querySelectorAll('a.go').forEach(function (a) { if (/instantadpay\.com\/weekend/.test(a.href)) a.href = '/my#buy'; });
|
||||
}
|
||||
function load() {
|
||||
fetch('/api/promodays').then(function (r) { return r.ok ? r.json() : null; }).then(function (v) { if (v) renderIap(v); }).catch(function () {});
|
||||
fetch('/api/network-deals').then(function (r) { return r.ok ? r.json() : null; }).then(renderDeals).catch(function () {});
|
||||
}
|
||||
load(); setInterval(load, 60000);
|
||||
})();
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
function fridayLine(f) {
|
||||
if (!f || !f.on) return null;
|
||||
if (f.live) return { tag: 'TODAY', text: 'It is Five Dollar Friday right now. Every package of $5 or more gets <b>20% bonus credits</b>, automatically, until midnight Central.' };
|
||||
if (f.nextLabel) return { tag: f.nextLabel, text: 'Five Dollar Friday: any package of $5 or more gets <b>' + (f.pct || 20) + '% bonus credits</b>, automatically. No code, nothing to claim.' };
|
||||
if (f.live) return { tag: 'TODAY', text: 'It is ' + (f.name || 'Five Dollar Friday') + ' right now. Every package of $5 or more gets <b>' + (f.pct || 20) + '% bonus credits</b>, automatically, until midnight Central.' }; // Black Friday 2026: +40% (promodays.js)
|
||||
if (f.nextLabel) return { tag: f.nextLabel, text: (f.name || 'Five Dollar Friday') + ': any package of $5 or more gets <b>' + (f.pct || 20) + '% bonus credits</b>, automatically. No code, nothing to claim.' };
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -165,7 +165,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/bixpay-guide.js?v=20261029bz"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -143,7 +143,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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/contract.js?v=20260908p"></script>
|
||||
<script src="/assets/chat.js?v=20261016n"></script>
|
||||
</body>
|
||||
|
||||
@@ -265,8 +265,8 @@
|
||||
<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/conversion-guide.js?v=20261024ct"></script>
|
||||
<script src="/assets/netline.js?v=20261116ad" data-site="iap"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<p class="muted small">You decide whether, and how much, to spend. Never spend more than you can afford to lose.</p>
|
||||
</div>
|
||||
</div></section>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/legal.js?v=20260908a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -97,7 +97,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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/netline.js?v=20261116ad" data-site="iap"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div></section>
|
||||
<script src="/assets/common.js?v=20261116ad"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script>
|
||||
<script src="/assets/legal.js?v=20260908a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/friday.js?v=20260925a"></script>
|
||||
<script src="/assets/common.js?v=20261116ad"></script>
|
||||
<script src="/assets/netline.js?v=20261116ad" data-site="iap"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -79,7 +79,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/games-page.js?v=20261012b"></script>
|
||||
<script src="/assets/netline.js?v=20261116ad" data-site="iap"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/games-page.js?v=20261012b"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -506,7 +506,7 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/wallet.js?v=20260909c"></script>
|
||||
<script src="/assets/home.js?v=20261027tb"></script>
|
||||
<script src="/assets/chat.js?v=20261016n"></script>
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@
|
||||
InstantAdPay · <a href="/contract">Contract</a> · <a href="/terms">Terms</a> · <a href="/privacy">Privacy</a> · <a href="/disclaimer">Disclaimer</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/join.js?v=20261107nc"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -106,7 +106,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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/launch.js?v=20260915b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
<div class="small">InstantAdPay is the Polygon hub of the <a href="https://cryptoteambuild.com" target="_blank" rel="noopener">Crypto Team Build Network</a>.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/ledger.js?v=20260906m"></script>
|
||||
<script src="https://polhunter.com/embed.js" data-slots="1" async></script>
|
||||
<script src="/assets/chat.js?v=20261016n"></script>
|
||||
|
||||
+1
-1
@@ -1307,7 +1307,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/wallet.js?v=20260911a"></script>
|
||||
<script src="/assets/promo.js?v=20261103gp"></script>
|
||||
<script src="/assets/support.js?v=20261116sg"></script>
|
||||
|
||||
@@ -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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/partners.js?v=20260914a"></script>
|
||||
<script src="/assets/netline.js?v=20261116ad" data-site="iap"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -194,7 +194,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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/plays.js?v=20260910b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -87,6 +87,6 @@
|
||||
<div class="small">InstantAdPay is the Polygon hub of the <a href="https://cryptoteambuild.com" target="_blank" rel="noopener">Crypto Team Build Network</a>.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/presentation.js?v=20261015b"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/presentation.js?v=20261015b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
<p class="muted small">We use reasonable safeguards, but no system is perfectly secure. Protect your email and your wallet.</p>
|
||||
</div>
|
||||
</div></section>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/legal.js?v=20260908a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -261,6 +261,6 @@
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
<div id="supMain"><div class="card"><p class="muted small">Loading…</p></div></div>
|
||||
<p class="small muted">We will never ask for your recovery phrase or private key, and nobody from InstantAdPay will message you first asking for money or wallet access.</p>
|
||||
</div></section>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/legal.js?v=20260908a"></script>
|
||||
<script src="/assets/support.js?v=20261116sg"></script>
|
||||
<script src="/assets/chat.js?v=20261016n"></script>
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
<p class="muted small" style="margin-top:18px">See also the <a href="/disclaimer">Disclaimer</a> and <a href="/privacy">Privacy Policy</a>. Questions: the <a href="/support">support page</a> or <a href="mailto:support@instantadpay.com">support@instantadpay.com</a>.</p>
|
||||
</div>
|
||||
</div></section>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/legal.js?v=20260908a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/tx.js?v=20260906m"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script src="/assets/common.js?v=20261116ad"></script><script src="/assets/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/wall.js?v=20261030pp"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -123,7 +123,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/welcome.js?v=20261115la"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/welcome.js?v=20261117nw"></script>
|
||||
<script src="/assets/wallets.js?v=20260911b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/wednesday.js?v=20260929c"></script>
|
||||
<script src="/assets/common.js?v=20261116ad"></script>
|
||||
<script src="/assets/netline.js?v=20261116ad" data-site="iap"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-theme-base="dark">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Network Weekend: Black Friday to Cyber Monday deals across the network | InstantAdPay</title>
|
||||
<meta name="description" content="Network Weekend, Black Friday to Cyber Monday, midnight to midnight US Central: bonus ad credits on InstantAdPay and a deal on every site in the network, one account across them all.">
|
||||
<meta name="theme-color" content="#043b2f">
|
||||
<meta property="og:type" content="website"><meta property="og:site_name" content="InstantAdPay">
|
||||
<meta property="og:title" content="Network Weekend: Black Friday to Cyber Monday across the network">
|
||||
<meta property="og:description" content="Fri 11-27 to Mon 11-30, midnight to midnight US Central. Bonus ad credits on InstantAdPay and a deal on every network site. Ad credits buy advertising, not income.">
|
||||
<meta property="og:url" content="https://instantadpay.com/weekend">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"dark",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("iap.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.IAPTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("iap.theme",c);else localStorage.removeItem("iap.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("iap-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20261112ln">
|
||||
<style>
|
||||
.nw{max-width:900px}
|
||||
.nw .hero{padding:44px 0 10px}
|
||||
.nw-state{display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px;padding:14px 18px;border-radius:14px;border:1px solid var(--line);background:var(--mint-faint);margin:6px 0 22px;font-size:15px}
|
||||
.nw-state.live{border-color:var(--amber-line);background:var(--amber-soft)}
|
||||
.nw-tag{font-family:var(--mono);font-size:11px;letter-spacing:.14em;text-transform:uppercase;font-weight:700;padding:4px 9px;border-radius:999px;background:var(--mint);color:var(--mint-ink)}
|
||||
.nw-state.live .nw-tag{background:var(--amber)}
|
||||
.nw-days{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px;margin:0 0 24px}
|
||||
.nw-day{border:1px solid var(--line);border-radius:14px;padding:14px 16px;background:var(--ink-faint)}
|
||||
.nw-day.today{border-color:var(--amber-line);background:var(--amber-soft)}
|
||||
.nw-day .n{font-family:var(--mono);font-size:11px;letter-spacing:.12em;color:var(--mint);text-transform:uppercase}
|
||||
.nw-day h3{font-family:var(--disp);font-size:20px;margin:6px 0 4px}
|
||||
.nw-day p{margin:0;font-size:14px;color:var(--muted)}
|
||||
.nw-h2{font-family:var(--disp);font-size:22px;margin:26px 0 10px}
|
||||
.nw-deals{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:0 0 26px}
|
||||
.nw-deal{border:1px solid var(--line);border-radius:14px;padding:14px 16px;background:var(--ink-faint);display:flex;flex-direction:column;gap:6px}
|
||||
.nw-deal h3{font-family:var(--disp);font-size:17px;margin:0}
|
||||
.nw-deal p{margin:0;font-size:14.5px}
|
||||
.nw-deal .note{font-size:12.5px;color:var(--muted)}
|
||||
.nw-deal a.go{margin-top:auto;font-weight:700}
|
||||
.nw-cta{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:6px 0 26px}
|
||||
.nw-rule{border-left:4px solid var(--mint);background:var(--mint-soft);padding:14px 18px;border-radius:0 12px 12px 0;margin:0 0 22px;font-size:14.5px}
|
||||
.nw-foot{margin-top:10px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap nw">
|
||||
<section class="hero">
|
||||
<p class="eyebrow">Black Friday to Cyber Monday · US Central time · midnight to midnight</p>
|
||||
<h1>Network Weekend: <em>one account, four days, every site.</em></h1>
|
||||
<p class="lead">Friday 11-27 to Monday 11-30. Bonus ad credits on InstantAdPay every day, and a deal on every site in the network. Same price, more inside: every pack still pays its sponsor line in full.</p>
|
||||
</section>
|
||||
|
||||
<div class="nw-state" id="nwState"><span class="nw-tag">Checking</span><span>Loading today’s status…</span></div>
|
||||
|
||||
<div class="nw-days" id="nwDays"></div>
|
||||
|
||||
<div class="nw-cta">
|
||||
<a class="btn big" id="nwJoin" href="/join?v=weekend">Join free by email</a>
|
||||
<a class="btn sec" href="/my#buy">Already a member? Get your pack</a>
|
||||
</div>
|
||||
|
||||
<h2 class="nw-h2">Every deal in the network</h2>
|
||||
<div class="nw-deals" id="nwDeals"><p class="muted">The deals appear here when Network Weekend opens.</p></div>
|
||||
|
||||
<div class="nw-rule"><b>What a credit is.</b> One credit is one cent of ad delivery across the network: banners, text ads, video, verified visits, solo ads and more. Credits are not money and cannot be withdrawn. They buy advertising for your own offers. <b>Ad credits buy advertising, not income.</b> Pay with SafePal or any other crypto wallet.</div>
|
||||
|
||||
<p class="muted small nw-foot">No income is guaranteed. Results depend on your effort. Cryptocurrency involves risk of loss. InstantAdPay sells advertising; it is not an investment product.</p>
|
||||
<footer>
|
||||
<div>InstantAdPay · <a href="/">Home</a> · <a href="/ledger">Live ledger</a> · <a href="/friday">Five Dollar Friday</a> · <a href="/earning">How earning works</a></div>
|
||||
<div class="small">InstantAdPay is the Polygon hub of the <a href="https://cryptoteambuild.com" target="_blank" rel="noopener">Crypto Team Build Network</a>.</div>
|
||||
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/weekend.js?v=20261117nw"></script>
|
||||
<script src="/assets/common.js?v=20261117nw"></script>
|
||||
<script src="/assets/netline.js?v=20261117nw" data-site="iap"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,195 @@
|
||||
// Network Weekend 2026 (promodays.js + its friday.js, promos.js, gamepass.js and chatbot hooks). Every date gate is driven by the
|
||||
// event time or the IAP_TEST_NOW test clock, never the machine clock. Fakes only: no chain, no DB, no mail, no network.
|
||||
// node --test qa/promodays.test.cjs
|
||||
'use strict';
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const fs = require('fs'); const os = require('os'); const path = require('path');
|
||||
process.env.NODE_ENV = 'test';
|
||||
const DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'pd-'));
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const T = s => Date.parse(s);
|
||||
|
||||
function fresh(mod) { delete require.cache[require.resolve(path.join(ROOT, mod))]; return require(path.join(ROOT, mod)); }
|
||||
function rig(events, site) {
|
||||
const granted = [], notices = [], mails = [], posts = [], claimed = new Set();
|
||||
const deps = {
|
||||
dataDir: fs.mkdtempSync(path.join(DIR, 'd-')), siteConfig: () => Object.assign({}, site || {}),
|
||||
chain: { recentEvents: () => events.slice(), member: async id => ({ account: '0x' + String(id).padStart(40, 'a') }) },
|
||||
ads: { addEarned: async (email, n, o) => granted.push({ email, n, note: o.log.note, purchased: o.purchased }) },
|
||||
accounts: { byMemberId: async id => ({ email: 'm' + id + '@x.test', memberId: id }), listAll: async () => [{ email: 'a@x.test', memberId: 7, lastSeen: T('2026-11-20T00:00:00Z') }] },
|
||||
marks: { claim: async k => { if (claimed.has(k)) return false; claimed.add(k); return true; } },
|
||||
notify: async (id, subject, text) => notices.push({ id, subject, text }),
|
||||
telegram: async t => { posts.push(t); return true; },
|
||||
mailer: { hasKey: () => true, send: async (to, subject, text) => mails.push({ to, subject, text }) }, drip: { isUnsubscribed: async () => false }
|
||||
};
|
||||
const pd = fresh('promodays.js'); pd.init(deps);
|
||||
const fr = fresh('friday.js'); fr.init(Object.assign({}, deps, { promodays: pd }));
|
||||
return { pd, fr, granted, notices, mails, posts, deps };
|
||||
}
|
||||
let n = 0;
|
||||
const buy = (iso, cents, credits, id) => ({ type: 'Purchase', tx: '0xtx' + (++n), li: 0, ts: T(iso), buyerId: id || 11, priceCents: cents, creditAmount: credits });
|
||||
|
||||
test('the map: each day is midnight to midnight Central (CST, UTC-6)', () => {
|
||||
const { pd } = rig([]);
|
||||
assert.strictEqual(pd.dayAt(T('2026-11-27T05:59:59Z')), null); // Thu 23:59:59 CT
|
||||
assert.strictEqual(pd.dayAt(T('2026-11-27T06:00:00Z')).pct, 40); // Fri 00:00 CT
|
||||
assert.strictEqual(pd.dayAt(T('2026-11-28T05:59:59Z')).name, 'Black Friday');
|
||||
assert.strictEqual(pd.dayAt(T('2026-11-28T06:00:00Z')).pct, 20);
|
||||
assert.strictEqual(pd.dayAt(T('2026-11-29T12:00:00Z')).pct, 20);
|
||||
const m = pd.dayAt(T('2026-11-30T06:00:00Z')); assert.strictEqual(m.pct, 30); assert.strictEqual(m.minCents, 2000);
|
||||
assert.strictEqual(pd.dayAt(T('2026-12-01T05:59:59Z')).name, 'Cyber Monday');
|
||||
assert.strictEqual(pd.dayAt(T('2026-12-01T06:00:00Z')), null); // Tue 00:00 CT: off
|
||||
assert.strictEqual(pd.inWeekend(T('2026-11-27T06:00:00Z')), true);
|
||||
assert.strictEqual(pd.inWeekend(T('2026-12-01T06:00:00Z')), false);
|
||||
});
|
||||
|
||||
test('Black Friday: ONE bonus per tx at 40% through friday.js, not 20 + 40, and nobody flips fridayBonusPct', async () => {
|
||||
const ev = buy('2026-11-27T15:00:00Z', 500, 500);
|
||||
const r = rig([ev], { fridayBonusPct: '20' });
|
||||
assert.strictEqual(await r.fr.onEvent(ev), 200); // 40% of 500
|
||||
assert.strictEqual(await r.fr.onEvent(ev), null); // same tx again: nothing
|
||||
const p = await r.pd.onEvent(ev); assert.strictEqual(p.bonus, 0); // promodays never pays a Friday
|
||||
assert.deepStrictEqual(r.granted.map(g => g.n), [200]);
|
||||
assert.match(r.granted[0].note, /^Black Friday: \+40% on your \$5 package/);
|
||||
assert.ok(r.notices.some(x => /^Black Friday: \+200 bonus credits/.test(x.subject) && /Ad credits buy advertising, not income\./.test(x.text)));
|
||||
});
|
||||
|
||||
test('a normal Friday after the weekend is Five Dollar Friday +20% again (12-04)', async () => {
|
||||
const ev = buy('2026-12-04T15:00:00Z', 500, 500);
|
||||
const r = rig([ev], { fridayBonusPct: '20' });
|
||||
assert.strictEqual(await r.fr.onEvent(ev), 100);
|
||||
assert.match(r.granted[0].note, /^Five Dollar Friday: \+20%/);
|
||||
assert.strictEqual((await r.pd.onEvent(ev)).bonus, 0);
|
||||
});
|
||||
|
||||
test('Saturday and Sunday +20% on $5+, Cyber Monday +30% on $20+ only, Tuesday nothing; once per tx', async () => {
|
||||
const sat = buy('2026-11-28T06:00:00Z', 500, 500), sun = buy('2026-11-30T05:59:00Z', 1000, 1000);
|
||||
const mon10 = buy('2026-11-30T18:00:00Z', 1000, 1000), mon20 = buy('2026-11-30T18:00:00Z', 2000, 2000), tue = buy('2026-12-01T06:00:00Z', 2000, 2000);
|
||||
const r = rig([sat, sun, mon10, mon20, tue]);
|
||||
assert.strictEqual((await r.pd.onEvent(sat)).bonus, 100);
|
||||
assert.strictEqual((await r.pd.onEvent(sat)).bonus, 0);
|
||||
assert.strictEqual((await r.pd.onEvent(sun)).bonus, 200);
|
||||
assert.strictEqual((await r.pd.onEvent(mon10)).bonus, 0);
|
||||
assert.strictEqual((await r.pd.onEvent(mon20)).bonus, 600);
|
||||
assert.strictEqual((await r.pd.onEvent(tue)).bonus, 0);
|
||||
assert.deepStrictEqual(r.granted.map(g => g.note.split(':')[0]), ['Network Weekend Saturday', 'Network Weekend Sunday', 'Cyber Monday']);
|
||||
assert.ok(r.granted.every(g => g.purchased));
|
||||
assert.strictEqual(await r.fr.onEvent(sat), null); // friday.js never pays a Saturday
|
||||
});
|
||||
|
||||
test('bundles: $20+ in the window shows the LinkSpin code; $100+ also says DownlineHydra Pro; outside the window nothing', async () => {
|
||||
const s20 = buy('2026-11-29T15:00:00Z', 2000, 2000), b100 = buy('2026-11-27T06:00:01Z', 10000, 12000, 21), b5 = buy('2026-11-28T15:00:00Z', 500, 500);
|
||||
const late = buy('2026-12-01T06:00:00Z', 10000, 12000), early = buy('2026-11-27T05:59:59Z', 10000, 12000);
|
||||
const r = rig([s20, b100, b5, late, early], { weekendLinkspinCode: 'weekend500' });
|
||||
const a = await r.pd.onEvent(s20); assert.ok(a.starter && !a.builder);
|
||||
const b = await r.pd.onEvent(b100); assert.ok(b.starter && b.builder);
|
||||
assert.ok(!(await r.pd.onEvent(b5)).starter);
|
||||
assert.ok(!(await r.pd.onEvent(late)).starter && !(await r.pd.onEvent(early)).starter);
|
||||
assert.ok(!(await r.pd.onEvent(s20)).starter, 'once per tx');
|
||||
const bn = r.notices.filter(x => x.subject === 'Network Weekend: your bundle extras');
|
||||
assert.strictEqual(bn.length, 2);
|
||||
assert.ok(bn.every(x => /WEEKEND500/.test(x.text) && /linkspin\.app/.test(x.text) && /Ad credits buy advertising, not income\./.test(x.text)));
|
||||
assert.ok(/DownlineHydra Pro/.test(bn[1].text) && /first 25 comps/.test(bn[1].text) && !/DownlineHydra/.test(bn[0].text));
|
||||
});
|
||||
|
||||
test('builders list for DownlineHydra: $100+ packs from Fri 00:00 CT to Tue 00:00 CT, lowercase wallets', async () => {
|
||||
const evs = [buy('2026-11-27T05:59:59Z', 10000, 12000, 1), buy('2026-11-27T06:00:00Z', 10000, 12000, 2), buy('2026-11-30T20:00:00Z', 25000, 32500, 3),
|
||||
buy('2026-11-30T20:00:00Z', 5000, 5500, 4), buy('2026-12-01T06:00:00Z', 50000, 70000, 5), { type: 'MemberActivated', id: 2, account: '0xABCDEF0000000000000000000000000000000002', tx: 'x', ts: 1 }];
|
||||
const r = rig(evs);
|
||||
const out = await r.pd.builders();
|
||||
assert.deepStrictEqual(out.builders.map(b => b.usdCents), [10000, 25000]);
|
||||
assert.strictEqual(out.builders[0].wallet, '0xabcdef0000000000000000000000000000000002');
|
||||
assert.match(out.builders[1].wallet, /^0x[a]+3$/);
|
||||
assert.strictEqual(out.cap, 25);
|
||||
});
|
||||
|
||||
test('Thanksgiving Thu 11-26 18:00 CT: the Friday notice and email carry the Black Friday copy, once; a normal Thursday stays normal', async () => {
|
||||
try {
|
||||
process.env.IAP_TEST_NOW = '2026-11-26T23:59:00Z'; // Thu 17:59 CT: not yet
|
||||
let r = rig([]); await r.fr.tick(); assert.strictEqual(r.mails.length, 0);
|
||||
process.env.IAP_TEST_NOW = '2026-11-27T00:05:00Z'; // Thu 18:05 CT
|
||||
await r.fr.tick(); await r.fr.tick();
|
||||
assert.strictEqual(r.mails.length, 1, 'one email, not two');
|
||||
assert.strictEqual(r.mails[0].subject, 'Black Friday starts at midnight: Network Weekend');
|
||||
assert.match(r.mails[0].text, /midnight to midnight/); assert.match(r.mails[0].text, /\+40% bonus ad credits on any \$5\+ pack/);
|
||||
assert.match(r.mails[0].text, /Ad credits buy advertising, not income\./); assert.ok(!/—/.test(r.mails[0].text));
|
||||
assert.strictEqual(r.notices.filter(x => /Black Friday starts/.test(x.subject)).length, 1);
|
||||
process.env.IAP_TEST_NOW = '2026-12-04T00:05:00Z'; // Thu 12-03 18:05 CT: normal Five Dollar Friday copy
|
||||
r = rig([]); await r.fr.tick(); assert.strictEqual(r.mails[0].subject, 'Tomorrow is Five Dollar Friday');
|
||||
process.env.IAP_TEST_NOW = '2026-11-27T11:05:00Z'; // Fri 05:05 CT kickoff: Black Friday copy
|
||||
r = rig([]); await r.fr.tick(); assert.ok(r.posts.length === 1 && /Black Friday\. Network Weekend is live/.test(r.posts[0]) && /\+40%/.test(r.posts[0]));
|
||||
process.env.IAP_TEST_NOW = '2026-11-25T23:30:00Z'; // the Friday page/strip on Wed 11-25 already says the coming Friday is +40%
|
||||
r = rig([]); const v = r.fr.view(); assert.strictEqual(v.pct, 40); assert.strictEqual(v.name, 'Black Friday');
|
||||
} finally { delete process.env.IAP_TEST_NOW; }
|
||||
});
|
||||
|
||||
test('promoDaysOn 0 switches everything off; a promoDays setting replaces the map for a future holiday', async () => {
|
||||
const ev = buy('2026-11-28T15:00:00Z', 500, 500);
|
||||
let r = rig([ev], { promoDaysOn: '0' }); assert.strictEqual((await r.pd.onEvent(ev)).bonus, 0); assert.strictEqual(r.pd.passBonusDays('legend', ev.ts), 0);
|
||||
r = rig([], { promoDays: JSON.stringify({ '2027-07-04': { pct: 15, minCents: 500, name: 'Fourth of July' } }) });
|
||||
assert.strictEqual(r.pd.dayAt(T('2027-07-04T17:00:00Z')).pct, 15); assert.strictEqual(r.pd.dayAt(T('2026-11-28T15:00:00Z')), null);
|
||||
});
|
||||
|
||||
test('Game Pass bonus days: Explorer/Champion +15, Legend +60, packages fulfilled Fri 11-27 00:00 CT to Fri 12-04 00:00 CT', () => {
|
||||
const { pd } = rig([]);
|
||||
assert.strictEqual(pd.passBonusDays('explorer', T('2026-11-27T05:59:59Z')), 0);
|
||||
assert.strictEqual(pd.passBonusDays('explorer', T('2026-11-27T06:00:00Z')), 15);
|
||||
assert.strictEqual(pd.passBonusDays('champion', T('2026-12-04T05:59:59Z')), 15); // Thu 12-03 23:59:59 CT
|
||||
assert.strictEqual(pd.passBonusDays('legend', T('2026-12-01T12:00:00Z')), 60);
|
||||
assert.strictEqual(pd.passBonusDays('legend', T('2026-12-04T06:00:00Z')), 0);
|
||||
assert.strictEqual(pd.passBonusDays('weekly', T('2026-11-28T12:00:00Z')), 0);
|
||||
assert.strictEqual(pd.passBonusDays('sovereign', T('2026-11-28T12:00:00Z')), 0);
|
||||
});
|
||||
|
||||
test('chatbot: fact and answer only around the window; the Friday question on Black Friday gets 40%', () => {
|
||||
const { pd } = rig([]);
|
||||
assert.strictEqual(pd.chatFact(T('2026-11-25T12:00:00Z')), '');
|
||||
assert.match(pd.chatFact(T('2026-11-26T12:00:00Z')), /starts Fri 2026-11-27 00:00 Central/);
|
||||
assert.match(pd.chatFact(T('2026-11-28T12:00:00Z')), /LIVE now/);
|
||||
assert.match(pd.chatFact(T('2026-12-02T12:00:00Z')), /is over/);
|
||||
assert.strictEqual(pd.chatFact(T('2026-12-04T06:00:00Z')), '');
|
||||
assert.strictEqual(pd.chatAnswer('what is five dollar friday', T('2026-11-20T12:00:00Z')), null);
|
||||
assert.match(pd.chatAnswer('any black friday deal?', T('2026-11-27T15:00:00Z')), /Today is Black Friday: \+40% bonus ad credits on any \$5\+ pack/);
|
||||
assert.match(pd.chatAnswer('cyber monday?', T('2026-11-30T15:00:00Z')), /Today is Cyber Monday: \+30% .* \$20\+/);
|
||||
assert.strictEqual(pd.chatAnswer('black friday', T('2026-12-01T06:00:00Z')), null);
|
||||
for (const t of ['2026-11-26T12:00:00Z', '2026-11-28T12:00:00Z']) assert.ok(!/—|up to/i.test(pd.chatFact(T(t)) + pd.chatAnswer('network weekend', T(t))));
|
||||
});
|
||||
|
||||
test('promo code start gate (NETWORKWEEKEND): dormant until Fri 00:00 CT, expired at Tue 00:00 CT', async () => {
|
||||
process.env.DATABASE_URL = ''; delete process.env.DOCSTORE_URL;
|
||||
const promos = fresh('promos.js'); promos.init({ dataDir: fs.mkdtempSync(path.join(DIR, 'p-')) });
|
||||
const r = await promos.create({ code: 'NETWORKWEEKEND', credits: 300, maxUses: 300, starts: '2026-11-27T00:00:00-06:00', expires: '2026-12-01T00:00:00-06:00', note: 'Network Weekend 2026' });
|
||||
assert.ok(r.ok); assert.strictEqual(r.code.starts, T('2026-11-27T06:00:00Z'));
|
||||
try {
|
||||
process.env.IAP_TEST_NOW = '2026-11-27T05:59:59Z'; assert.match((await promos.check('networkweekend', 'a@x.test')).error, /opens Friday, Nov 27, 12:00 AM Central/);
|
||||
process.env.IAP_TEST_NOW = '2026-11-27T06:00:00Z'; assert.strictEqual(await promos.check('NETWORKWEEKEND', 'a@x.test'), null);
|
||||
const g = await promos.redeem('NETWORKWEEKEND', 'a@x.test', 'dashboard'); assert.strictEqual(g.credits, 300); assert.strictEqual(g.step, 60);
|
||||
assert.match((await promos.redeem('NETWORKWEEKEND', 'a@x.test', 'dashboard')).error, /already used/);
|
||||
process.env.IAP_TEST_NOW = '2026-12-01T05:59:59Z'; assert.strictEqual(await promos.check('NETWORKWEEKEND', 'b@x.test'), null);
|
||||
process.env.IAP_TEST_NOW = '2026-12-01T06:00:01Z'; assert.match((await promos.check('NETWORKWEEKEND', 'b@x.test')).error, /expired/);
|
||||
// an update without starts keeps it (the admin form never drops the gate)
|
||||
const u = await promos.create({ code: 'NETWORKWEEKEND', credits: 300, maxUses: 300, expires: '2026-12-01T00:00:00-06:00' }); assert.strictEqual(u.code.starts, T('2026-11-27T06:00:00Z'));
|
||||
} finally { delete process.env.IAP_TEST_NOW; }
|
||||
});
|
||||
|
||||
test.after(() => fs.rmSync(DIR, { recursive: true, force: true }));
|
||||
|
||||
test('gamepass: a tier pass paid by a package in the window gets the bonus days; the weekly pass and comps never do', async () => {
|
||||
const maps = {}; const pm = k => (maps[k] = maps[k] || new Map());
|
||||
const { pd } = rig([]);
|
||||
const gp = fresh('gamepass.js');
|
||||
gp.init({ dataDir: fs.mkdtempSync(path.join(DIR, 'g-')), siteConfig: () => ({ gamePassEnabled: '1', sovTiers: '1' }), accounts: { byMemberId: async () => ({ email: 'p@x.test' }) },
|
||||
marks: { claim: async () => true }, isProd: false, persistedMap: pm, polUsd: async () => 0.2, blockTime: async () => 0, notify: async () => {}, telegram: async () => {},
|
||||
bonusDays: (tier, ts) => pd.passBonusDays(tier, ts) });
|
||||
const D = 86400000;
|
||||
const pay = async (tier, cents, iso, tx) => {
|
||||
pm('gporders').set('o-' + tx, { status: 'waiting', email: 'p@x.test', ts: T(iso) - 60000, tier });
|
||||
return gp.onEvent({ type: 'Purchase', tx, ts: T(iso), buyerId: 9, priceCents: cents, devEmail: 'p@x.test', devMinedAt: T(iso) });
|
||||
};
|
||||
let r = await pay('explorer', 2000, '2026-11-28T12:00:00Z', '0xe1'); assert.strictEqual(Math.round((r.until - T('2026-11-28T12:00:00Z')) / D), 45);
|
||||
r = await pay('legend', 25000, '2026-12-03T23:00:00Z', '0xl1'); assert.strictEqual(Math.round((r.until - T('2026-12-03T23:00:00Z')) / D), 425);
|
||||
r = await pay('champion', 5000, '2026-12-04T06:00:00Z', '0xc1'); assert.strictEqual(Math.round((r.until - T('2026-12-04T06:00:00Z')) / D), 30); // Fri 12-04 00:00 CT: over
|
||||
r = await pay('weekly', 500, '2026-11-28T12:00:00Z', '0xw1'); assert.strictEqual(Math.round((r.until - T('2026-11-28T12:00:00Z')) / D), 7);
|
||||
const c = gp.comp('q@x.test', 'test', 'explorer', T('2026-11-28T12:00:00Z')); assert.strictEqual(c.days, 30);
|
||||
});
|
||||
@@ -24,6 +24,7 @@
|
||||
# bash qa/run.sh fuel # Fuel Your Offers: refill notices, refuel streak, Refuel Kit, Engine Room (unit + two-copy tests, throwaway data)
|
||||
# bash qa/run.sh policy # profile policy + link-farm scan: prohibited list, bio links, quarantine, 06:30 claim, walls of free/paying members, 404 walls (unit + local copy; also runs in member)
|
||||
# bash qa/run.sh bixpay # BixPay card: partner-link validator, sponsor-follows resolver (own / level 3 / company), gate, click store (unit, no server; also runs in member)
|
||||
# bash qa/run.sh weekend # Network Weekend 2026 (promodays.js): unit tests + local e2e at Black Friday / Cyber Monday / before / after test clocks
|
||||
# bash qa/run.sh theme # light/dark themes: WCAG contrast of the main text/background pairs on the member area, admin and public pages, both themes (local copy)
|
||||
# QA_THEME=dark bash qa/run.sh member # walk every pane in one theme; screenshots land as *-dark.png / *-light.png
|
||||
# Each local run boots server.js on its own port with a throwaway data dir (JSON store, no DB, no
|
||||
@@ -82,6 +83,10 @@ elif [ "$MODE" = "member" ]; then
|
||||
node qa/profile-policy.test.cjs || status=1
|
||||
node qa/sov-heroes-store.cjs || status=1
|
||||
node qa/erase.test.cjs || status=1 # member erase (erase.js + scrub.js, 2026-11-15); qa/erase.mysql.test.cjs needs TEST_DATABASE_URL
|
||||
node --test qa/promodays.test.cjs || status=1 # Network Weekend 2026: promo days, Black Friday via friday.js, bundles, code start gate, pass days (2026-11-17)
|
||||
elif [ "$MODE" = "weekend" ]; then
|
||||
node --test qa/promodays.test.cjs || status=1
|
||||
node qa/weekend.e2e.mjs || status=1 # /weekend, Home strip, ribbon, feeds, builders key at test clocks (local copies + a fake hub)
|
||||
elif [ "$MODE" = "draft" ]; then
|
||||
node qa/draft-partner.test.mjs || status=1
|
||||
elif [ "$MODE" = "theme" ]; then
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
// Network Weekend end to end on a local copy (throwaway data, JSON store, no DB, no mail key): the /weekend page, the Home strip,
|
||||
// the ribbon, /api/promodays, /api/network-deals (from a fake hub that serves the real network-hub deal list at the test time),
|
||||
// and the DownlineHydra builders feed's key check. The test clock is IAP_TEST_NOW (server) + window.__NW_NOW (pages).
|
||||
// node qa/weekend.e2e.mjs (needs ../../network-hub/lib/deals.js beside this repo, playwright from qa-tester)
|
||||
import http from 'node:http'; import { spawn } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path';
|
||||
import { createRequire } from 'node:module'; import assert from 'node:assert';
|
||||
const require = createRequire(import.meta.url);
|
||||
const ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, '$1')), '..');
|
||||
const { chromium } = require(process.env.PW || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright');
|
||||
const deals = require(path.resolve(ROOT, '../../network-hub/lib/deals.js'));
|
||||
const KEY = 'k'.repeat(48);
|
||||
const out = []; const ok = m => { out.push('ok ' + m); console.log('ok', m); };
|
||||
|
||||
async function run(nowIso, port) {
|
||||
const hub = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(deals.current(Date.parse(nowIso)))); });
|
||||
await new Promise(r => hub.listen(0, r));
|
||||
const data = fs.mkdtempSync(path.join(os.tmpdir(), 'iap-nw-')); fs.mkdirSync(path.join(data, 'uploads'));
|
||||
const env = Object.assign({}, process.env, { PORT: String(port), DATA_DIR: data, ADMIN_PASSWORD: 'localtest', IAP_TEST_NOW: nowIso, HUB_URL: 'http://127.0.0.1:' + hub.address().port, WEEKEND_BUNDLE_KEY: KEY, NODE_ENV: 'test', DATABASE_URL: '', DOCSTORE_URL: '' });
|
||||
const srv = spawn(process.execPath, ['server.js'], { cwd: ROOT, env, stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
let log = ''; srv.stdout.on('data', d => { log += d; }); srv.stderr.on('data', d => { log += d; });
|
||||
const base = 'http://127.0.0.1:' + port;
|
||||
try {
|
||||
for (let i = 0; i < 40; i++) { try { if ((await fetch(base + '/api/config')).ok) break; } catch (e) {} await new Promise(r => setTimeout(r, 500)); }
|
||||
return await fn(base, nowIso);
|
||||
} finally { srv.kill(); hub.close(); fs.rmSync(data, { recursive: true, force: true }); if (process.env.QA_LOG) console.log(log.slice(-3000)); }
|
||||
}
|
||||
let fn;
|
||||
(async () => {
|
||||
const browser = await chromium.launch();
|
||||
const page = async (base, nowIso, p) => {
|
||||
const ctx = await browser.newContext(); const pg = await ctx.newPage(); const errs = [];
|
||||
pg.on('pageerror', e => errs.push(e.message)); pg.on('console', m => { if (m.type() === 'error' && /Content Security Policy|Refused/.test(m.text())) errs.push(m.text()); });
|
||||
await pg.addInitScript(t => { window.__NW_NOW = t; }, Date.parse(nowIso));
|
||||
await pg.goto(base + p, { waitUntil: 'networkidle' }); await pg.waitForTimeout(800);
|
||||
return { pg, ctx, errs };
|
||||
};
|
||||
// 1. Black Friday 09:00 CT
|
||||
fn = async (base, nowIso) => {
|
||||
const v = await (await fetch(base + '/api/promodays')).json();
|
||||
assert.ok(v.live && v.today.name === 'Black Friday' && v.today.pct === 40 && v.lsCode === 'WEEKEND500'); ok('Black Friday /api/promodays live 40%');
|
||||
const f = await (await fetch(base + '/api/friday')).json(); assert.ok(f.live && f.pct === 40 && f.name === 'Black Friday'); ok('/api/friday says Black Friday +40%');
|
||||
const d = await (await fetch(base + '/api/network-deals')).json(); assert.strictEqual(d.self, 'iap'); assert.ok(d.events[0] && d.events[0].deals.length > 5); ok('/api/network-deals relays the hub');
|
||||
assert.strictEqual((await fetch(base + '/api/network/weekend-builders')).status, 401);
|
||||
assert.strictEqual((await fetch(base + '/api/network/weekend-builders', { headers: { 'X-Weekend-Key': 'x'.repeat(48) } })).status, 401);
|
||||
const b = await fetch(base + '/api/network/weekend-builders', { headers: { 'X-Weekend-Key': KEY } }); assert.strictEqual(b.status, 200);
|
||||
const bj = await b.json(); assert.ok(Array.isArray(bj.builders) && bj.cap === 25 && bj.start === '2026-11-27T06:00:00.000Z'); ok('builders feed: key required, shape right');
|
||||
let { pg, ctx, errs } = await page(base, nowIso, '/weekend');
|
||||
const state = await pg.textContent('#nwState'); assert.match(state, /It is Black Friday\. \+40% bonus ad credits on any \$5\+/); ok('/weekend live state');
|
||||
assert.strictEqual(await pg.locator('.nw-day').count(), 4); assert.ok(await pg.locator('.nw-day.today').count() === 1);
|
||||
assert.ok((await pg.locator('.nw-deal').count()) > 8); ok('/weekend day cards + every network deal');
|
||||
assert.ok(await pg.locator('.nw-ribbon').count() === 1 && /Black Friday/.test(await pg.textContent('.nw-ribbon'))); ok('ribbon on /weekend (no self link)');
|
||||
assert.strictEqual(await pg.locator('.nw-ribbon a').count(), 0);
|
||||
await pg.screenshot({ path: path.join(ROOT, 'qa/out/weekend-live.png'), fullPage: true });
|
||||
assert.deepStrictEqual(errs, []); await ctx.close();
|
||||
({ pg, ctx, errs } = await page(base, nowIso, '/'));
|
||||
assert.match(await pg.textContent('#nwStrip'), /Network Weekend: it\u2019s Black Friday\. \+40%/); ok('Home strip live');
|
||||
assert.ok(/Ad credits buy advertising, not income\./.test(await pg.textContent('#nwStrip')));
|
||||
assert.strictEqual(await pg.locator('.nw-ribbon').count(), 1); ok('ribbon on Home');
|
||||
await pg.screenshot({ path: path.join(ROOT, 'qa/out/weekend-home.png') });
|
||||
assert.deepStrictEqual(errs, []); await ctx.close();
|
||||
};
|
||||
await run('2026-11-27T15:00:00Z', 8811);
|
||||
// 2. Wed 11-18 (today-ish): nothing shows anywhere
|
||||
fn = async (base, nowIso) => {
|
||||
const v = await (await fetch(base + '/api/promodays')).json(); assert.ok(!v.live && !v.published && v.days.length === 0); ok('before Thursday: /api/promodays publishes nothing');
|
||||
const f = await (await fetch(base + '/api/friday')).json(); assert.strictEqual(f.pct, 20); ok('a normal week: Friday +20%');
|
||||
let { pg, ctx, errs } = await page(base, nowIso, '/weekend');
|
||||
assert.match(await pg.textContent('#nwState'), /Coming/); assert.strictEqual(await pg.locator('.nw-ribbon').count(), 0); assert.strictEqual(await pg.locator('.nw-deal').count(), 0); ok('/weekend dormant, no ribbon');
|
||||
assert.deepStrictEqual(errs, []); await ctx.close();
|
||||
({ pg, ctx, errs } = await page(base, nowIso, '/'));
|
||||
assert.strictEqual(await pg.locator('#nwStrip:not([hidden])').count(), 0); assert.strictEqual(await pg.locator('.nw-ribbon').count(), 0); ok('Home: no strip, no ribbon');
|
||||
assert.deepStrictEqual(errs, []); await ctx.close();
|
||||
};
|
||||
await run('2026-11-18T15:00:00Z', 8812);
|
||||
// 3. Thanksgiving 20:00 CT: heads-up strip, no ribbon yet; Cyber Monday; Tuesday off
|
||||
fn = async (base, nowIso) => {
|
||||
let { pg, ctx } = await page(base, nowIso, '/');
|
||||
assert.match(await pg.textContent('#nwStrip'), /starts at midnight Central/); assert.strictEqual(await pg.locator('.nw-ribbon').count(), 0); ok('Thanksgiving: heads-up strip, ribbon not yet');
|
||||
await ctx.close();
|
||||
};
|
||||
await run('2026-11-27T02:00:00Z', 8813);
|
||||
fn = async (base, nowIso) => {
|
||||
const v = await (await fetch(base + '/api/promodays')).json(); assert.ok(v.live && v.today.pct === 30 && v.today.minUsd === 20); ok('Cyber Monday +30% $20+');
|
||||
const { pg, ctx } = await page(base, nowIso, '/weekend'); assert.match(await pg.textContent('.nw-ribbon'), /Cyber Monday[\s\S]*\+30% bonus ad credits on any \$20\+/); ok('ribbon Cyber Monday text'); await ctx.close();
|
||||
};
|
||||
await run('2026-11-30T20:00:00Z', 8814);
|
||||
fn = async (base, nowIso) => {
|
||||
const v = await (await fetch(base + '/api/promodays')).json(); assert.ok(!v.live && v.today === null && v.passBonusLive === true); ok('Tue 12-01: weekend off, pass days still on');
|
||||
const { pg, ctx } = await page(base, nowIso, '/'); assert.strictEqual(await pg.locator('.nw-ribbon').count(), 0); assert.strictEqual(await pg.locator('#nwStrip:not([hidden])').count(), 0); ok('Tue: no ribbon, no strip'); await ctx.close();
|
||||
};
|
||||
await run('2026-12-01T15:00:00Z', 8815);
|
||||
await browser.close();
|
||||
console.log('ALL OK weekend e2e (' + out.length + ' checks)');
|
||||
})().catch(e => { console.error('FAIL', e.message); process.exit(1); });
|
||||
+1
-1
@@ -65,7 +65,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 InstantAdPay 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 };
|
||||
|
||||
@@ -113,6 +113,7 @@ const leaderboard = require('./leaderboard');
|
||||
const toolkit = require('./toolkit');
|
||||
const badge = require('./badge'); // achievement badge image drawn on the server with ffmpeg (2026-09-16)
|
||||
const friday = require('./friday');
|
||||
const promodays = require('./promodays'); // Network Weekend 2026 (Black Friday to Cyber Monday): date-to-percent bonus days, bundles, pass days
|
||||
const prohibited = require('./prohibited'); // prohibited-content policy shared with LinkSpin (2026-10-30 link-farm incident)
|
||||
const spamscan = require('./spamscan'); // daily link-farm scan + quarantine rule, byte-for-byte copy on LinkSpin
|
||||
const starter = require('./starter'); // member welcome offer from the games (2026-10-05)
|
||||
@@ -135,6 +136,7 @@ const TRAFFIC_PAGES = new Set(['/chasing-unicorns', '/', '/ledger', '/contract',
|
||||
let tankWaitCache = null; // dashboard: who is waiting for a sponsor (refreshed every minute)
|
||||
const geo = require('./geo'); // viewer country -> tier (DB-IP lite), for campaign targeting
|
||||
const netsites = require('./netsites'); // footer network list from the hub (2026-11-14 trust pack)
|
||||
const netdeals = require('./netdeals'); // Network Weekend ribbon: date-gated deal list from the hub (2026-11-17)
|
||||
const burner = require('./burner'); // automatic on-chain credit burns (inert without ENGINE_KEY)
|
||||
|
||||
const PORT = Number(process.env.PORT || 3000);
|
||||
@@ -604,6 +606,7 @@ async function boot() {
|
||||
Promise.all([friday.onEvent(ev).catch(e => { console.error('friday bonus', e.message); return null; }), gamepass.onEvent(ev).then(r => { if (r && r.stackPro && r.email) stackProMark(r.email).catch(() => {}); return r; }).catch(e => { console.error('gamepass order', e.message); return null; })])
|
||||
.then(([bonus, gp]) => fridayPassPerk(ev, bonus, gp)).catch(e => console.error('friday pass perk', e.message));
|
||||
wednesday.onEvent(ev).catch(e => console.error('wednesday bonus', e.message));
|
||||
promodays.onEvent(ev).catch(e => console.error('promo days', e.message)); // Sat-Mon bonus (Fridays: friday.js) + weekend bundle notices
|
||||
refuel.onIapPurchase(ev).catch(e => console.error('refuel streak', e.message)); // its own bonus, stacked on Friday/Wednesday; no-op while refuelStreak is off
|
||||
sponsorSyncOnEvent(ev).catch(e => console.error('sponsor sync', e.message));
|
||||
hubsync.onChain(ev); // network hub: payout switch-on -> contract bind (no-op unless HUB_ENABLED)
|
||||
@@ -645,7 +648,7 @@ async function boot() {
|
||||
messages.init({ dataDir: DATA_DIR });
|
||||
reports.init({ dataDir: DATA_DIR });
|
||||
drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: 'https://instantadpay.com' });
|
||||
chatbot.init({ dataDir: DATA_DIR, chain, bixLive: () => bixpay.live(), gameLive: slug => String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(slug), refuelOn: () => refuel.cfg().on, passTiers: () => { const c = gamepass.cfg(); return { on: c.enabled && c.tierSales, rows: gamepass.TIER_DEFS.filter(d => d.key !== 'weekly').map(d => ({ name: d.name, perks: d.perks, price: c.tiers[d.key].price, usd: c.tiers[d.key].price / 100, days: c.tiers[d.key].days, sale: c.tiers[d.key].sale })) }; },
|
||||
chatbot.init({ dataDir: DATA_DIR, chain, weekend: { fact: () => promodays.chatFact(), answer: m => promodays.chatAnswer(m) }, bixLive: () => bixpay.live(), gameLive: slug => String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(slug), refuelOn: () => refuel.cfg().on, passTiers: () => { const c = gamepass.cfg(); return { on: c.enabled && c.tierSales, rows: gamepass.TIER_DEFS.filter(d => d.key !== 'weekly').map(d => ({ name: d.name, perks: d.perks, price: c.tiers[d.key].price, usd: c.tiers[d.key].price / 100, days: c.tiers[d.key].days, sale: c.tiers[d.key].sale })) }; },
|
||||
heroSale: () => { const h = gamepass.cfg().heroes, N = Object.fromEntries(gamepass.HERO_DEFS.map(d => [d.key, d.name])); return { sale: h.sale, rows: gamepass.HERO_DEFS.map(d => ({ name: d.name, usd: h.price[d.key] / 100, free: h.price[d.key] === 0, freeAt: d.freeAt || null })), bundle: { names: h.bundle.heroes.map(k => N[k]), usd: h.bundle.price / 100 } }; } }); // pass tiers fact follows sovTiers (2026-10-22); bonus heroes follow heroSales (2026-11-05)
|
||||
setTimeout(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 1000);
|
||||
setInterval(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 60 * 1000);
|
||||
@@ -664,7 +667,9 @@ async function boot() {
|
||||
sendPhoto: (c, jpeg, cap, th) => telegramSendPhoto(c, jpeg, cap, th) });
|
||||
fridaybank.init({ db });
|
||||
starter.init({ dataDir: DATA_DIR, siteConfig, chain, ads, accounts });
|
||||
friday.init({ dataDir: DATA_DIR, siteConfig, chain, ads, accounts, mailer, drip, marks,
|
||||
promodays.init({ dataDir: DATA_DIR, siteConfig, chain, ads, accounts, marks,
|
||||
notify: async (memberId, subject, text, kind) => { const a = await accounts.byMemberId(memberId); if (!a || !a.email) return; const html = '<p>' + String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/(https:\/\/[^\s]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>').split('\n\n').join('</p><p>').replace(/\n/g, '<br>') + '</p>'; await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], subject, html, kind || 'notice'); } });
|
||||
friday.init({ dataDir: DATA_DIR, siteConfig, chain, ads, accounts, mailer, drip, marks, promodays,
|
||||
telegram: async text => { const sc = siteConfig(); if (!sc.telegramBotToken || !sc.telegramEchoChatId) return false; return telegramSend(sc.telegramEchoChatId, '\u{1F7E0} <b>InstantAdPay</b> \u00b7 ' + text, sc.telegramEchoTopicId); },
|
||||
notify: async (memberId, subject, text, kind) => { const a = await accounts.byMemberId(memberId); if (!a || !a.email) return; const html = '<p>' + String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/(https:\/\/[^\s]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>').split('\n\n').join('</p><p>').replace(/\n/g, '<br>') + '</p>'; await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], subject, html, kind || 'notice'); } });
|
||||
// Campaign refill notices: an advertiser is told when an ad is nearly out and when it has stopped,
|
||||
@@ -797,6 +802,7 @@ async function boot() {
|
||||
blog.init({ dataDir: DATA_DIR, extraPages: () => bixpay.live() ? ['/bixpay'] : [] });
|
||||
adminMember.init({ accounts, ads, chain, tank, legacy, promos, messages, dataDir: DATA_DIR });
|
||||
gamepass.init({ dataDir: DATA_DIR, siteConfig, accounts, marks, isProd: IS_PROD, persistedMap, polUsd: polUsdLive,
|
||||
bonusDays: (tier, ts) => promodays.passBonusDays(tier, ts), // Network Weekend tier pass bonus days (2026-11-17)
|
||||
blockTime: async n => { const blk = await chain.rpc('eth_getBlockByNumber', ['0x' + Number(n).toString(16), false]); return blk && blk.timestamp ? parseInt(blk.timestamp, 16) : 0; }, // a pass order is fulfilled only by a purchase mined after it
|
||||
telegram: async html => { const sc = siteConfig(); const chat = String(sc.telegramGamesChatId || sc.telegramEchoChatId || '').trim(); if (!sc.telegramBotToken || !chat) return false; await telegramSend(chat, html, sc.telegramGamesTopicId || null); return true; },
|
||||
notify: (to, subject, html) => messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [to], subject, html, 'notice') }); // before loadOpenTokens: its maps must exist to be restored
|
||||
@@ -2399,7 +2405,8 @@ const server = http.createServer(async (req, res) => {
|
||||
// here. 302 (not 301) so links never get pinned in caches; the query (?v= angle, ?promo=) rides along.
|
||||
{ const sh = String(req.headers.host || '').toLowerCase().replace(/:\d+$/, '').replace(/^www\./, '');
|
||||
if (SHARE_HOSTS.includes(sh)) {
|
||||
const ref = /^\/([A-Za-z0-9_]{1,40})\/?$/.exec(p);
|
||||
// a public page name is that page, not a username (2026-11-17: the Network Weekend email links instantadpay.link/weekend)
|
||||
const ref = /^\/(weekend|friday|wednesday|ledger|refuel|facts|games|support|my|join)\/?$/.test(p) ? null : /^\/([A-Za-z0-9_]{1,40})\/?$/.exec(p);
|
||||
const to = 'https://instantadpay.com' + (p === '/' ? '/' : ref ? '/join/' + ref[1] : p) + (u.search || '');
|
||||
res.writeHead(302, { Location: to, 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' }); return res.end();
|
||||
} }
|
||||
@@ -2546,6 +2553,15 @@ const server = http.createServer(async (req, res) => {
|
||||
|
||||
// -- public API
|
||||
if (p === '/api/friday' && req.method === 'GET') return json(res, 200, friday.view(), { 'Cache-Control': 'public, max-age=60' });
|
||||
// Network Weekend (2026-11-17): the promo-day view (strip, Overview card, /weekend), the network deal list for the ribbon,
|
||||
// and the $100+ buyers DownlineHydra grants Pro to (X-Weekend-Key = env WEEKEND_BUNDLE_KEY, compared in constant time)
|
||||
if (p === '/api/promodays' && req.method === 'GET') return json(res, 200, promodays.view(), { 'Cache-Control': 'public, max-age=30' });
|
||||
if (p === '/api/network-deals' && req.method === 'GET') return netdeals.handle(req, res, 'iap');
|
||||
if (p === '/api/network/weekend-builders' && req.method === 'GET') {
|
||||
const want = String(process.env.WEEKEND_BUNDLE_KEY || ''), got = String(req.headers['x-weekend-key'] || '');
|
||||
if (want.length < 32 || got.length !== want.length || !crypto.timingSafeEqual(Buffer.from(got), Buffer.from(want))) return json(res, 401, { error: 'auth' });
|
||||
return json(res, 200, await promodays.builders(), { 'Cache-Control': 'no-store' });
|
||||
}
|
||||
// member welcome offer from the games: public numbers for the game cards, the member's own view, and the 'came from' mark
|
||||
if (p === '/api/starter/public' && req.method === 'GET') return json(res, 200, starter.publicView(), { 'Cache-Control': 'public, max-age=300', 'Access-Control-Allow-Origin': '*' });
|
||||
if (p === '/api/starter' && (req.method === 'GET' || req.method === 'POST')) {
|
||||
@@ -6404,7 +6420,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 InstantAdPay 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=20260921a"></script></body></html>';
|
||||
+ '<script src="/assets/common.js?v=20261117nw"></script><script src="/assets/blog-page.js?v=20260921a"></script></body></html>';
|
||||
res.writeHead(200, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'public, max-age=300' }));
|
||||
return res.end(html);
|
||||
}
|
||||
@@ -6436,6 +6452,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (p === '/wallets') return sendFile(res, path.join(PUBLIC_DIR, 'wallets.html'));
|
||||
if (p === '/support' || /^\/support\/t\/[A-Za-z0-9_.-]{20,80}$/.test(p)) return sendFile(res, path.join(PUBLIC_DIR, 'support.html')); // help desk (2026-10-16): the form, and the private ticket link
|
||||
if (p === '/friday') return sendFile(res, path.join(PUBLIC_DIR, 'friday.html'));
|
||||
if (p === '/weekend') return sendFile(res, path.join(PUBLIC_DIR, 'weekend.html')); // Network Weekend deals page (2026-11-17)
|
||||
if (p === '/wednesday') return sendFile(res, path.join(PUBLIC_DIR, 'wednesday.html'));
|
||||
if (p === '/conversion-tracking') return sendFile(res, path.join(PUBLIC_DIR, 'conversion-tracking.html')); // how to set up the conversion pixel, the member guide (2026-10-24)
|
||||
if (p === '/bixpay') { if (!bixpay.live()) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); } return sendFile(res, path.join(PUBLIC_DIR, 'bixpay.html')); } // the BixPay card guide (2026-10-29), public once bixpayLive is on
|
||||
|
||||
Reference in New Issue
Block a user