Podcast Commission Stack: kit under Promo tools > Network sites (read from its own /api/promo-kit feed, placed after Video App Income, added quietly: no notice, no release note) and the email-check code mail for its network gate. siteinvite.js: each site signs with its own secret (SITE_INVITE_SECRET_PCS for the new site, SITE_INVITE_SECRET unchanged for Video App Income), verify() names the signing site and a body that names any other site is refused; the new site has the code call only, no invite emails; the code limits stay one count for all sites (5 an hour per address, 2,000 a day). Chatbot answer + prompt, KNOWLEDGE_DATE 2026-11-25; qa/site-invite.test.mjs 52 -> 80 checks, routing rows in qa/chatbot-parse.mjs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-25 09:32:18 -06:00
parent 563407e45b
commit c5b9624eda
7 changed files with 117 additions and 22 deletions
+8 -3
View File
@@ -50,7 +50,7 @@ function key() {
function enabled() { return !!key(); }
// ---- canned answers: instant, free, always in voice ----
const KNOWLEDGE_DATE = '2026-11-23'; // bump whenever the canned answers / prompt are brought up to date
const KNOWLEDGE_DATE = '2026-11-25'; // bump whenever the canned answers / prompt are brought up to date
const SUPPORT_RE = /(contact|reach|email|e-mail|message|talk to|speak (to|with)|get hold of) (the )?(support|admin|administrator|owner|marty|staff|team at instantadpay|someone|a (human|person|real person))|support (email|address|ticket|team|desk)|help ?desk|(open|send|file|submit|raise) (a )?(support )?ticket|\b(human|real person|live (agent|person|chat|support))\b|customer (service|support)|support@|how (do|can) i get (help|support)/i;
const CANNED = [
// network sign-in (2026-11-12): signed in on one of InstantAdPay / LinkSpin = signed in on the other, no code (networksso.js)
@@ -152,9 +152,13 @@ const CANNED = [
{ id: 'viral-banner-blitz', title: 'Viral Banner Blitz (network banner loop)', q: ['What is Viral Banner Blitz?', 'How do I post on Viral Banner Blitz?'], tags: ['viral banner blitz', 'vbb', 'banner loop', '125x125'],
re: /(viral ?banner ?blitz|vbb|banner loop)/i,
a: 'Viral Banner Blitz (https://viralbannerblitz.com) is the network’s shared loop of 125x125 banners. InstantAdPay and LinkSpin members get one free post credit each day they sign in there (Sign in with InstantAdPay works). Real, verified visitors move the loop; a banner that rides out the end has cycled and earns network ad views, which are advertising, not cash. Weekly leaderboards count the visitors you send and the traffic sources they come from, with a prize pot paid in POL to the top three on each board. Your link is viralbannerblitz.com/?ref=your-username. Promo tools > Network sites > Viral Banner Blitz (or viralbannerblitz.com/promote) has your links, creatives, lines, headlines, an email and posts.' },
// Podcast Commission Stack (2026-11-25): its kit under Promo tools > Network sites and its email-check code mail (siteinvite.js, code only). Sits before the commission split answer, whose pattern would otherwise take any question with the site's name in it.
{ id: 'podcast-commission-stack', title: 'Podcast Commission Stack', q: ['What is Podcast Commission Stack?', 'I got a code email from Podcast Commission Stack, is it real?', 'Where are the Podcast Commission Stack banners?'], tags: ['podcast commission stack', 'podcastcommissionstack', 'audio', 'podcast', 'email code'],
re: /(podcast ?commission ?stack)/i,
a: 'Podcast Commission Stack (https://podcastcommissionstack.com) is another site in the network. On your phone you paste text, add a link or upload a document and get natural-sounding audio. Easy listening tidies web pages for the ear, you listen in the app or download the MP3, and you can turn your own writing into a podcast with your own show page and feed. It runs on credits: 1 credit is 10 cents and covers up to 10 minutes of audio. Packs are $10 for 100 credits, $25 for 260, $50 for 550 and $100 for 1,200, paid once in POL on Polygon. There is no subscription, and the first hour is free. Each credit purchase is split by its own smart contract at the moment of purchase: 30 percent to the sponsor of the buyer, 8 percent to each of five team levels, and 30 percent to the company side. You must have bought credits there yourself to receive shares. Your network sponsor carries over, so you are placed with the same sponsor you have here. Nothing is promised, and many people will use it only for the audio. Your link is https://podcastcommissionstack.com/join?ref=your-username, and Members > Promo tools > Network sites > Podcast Commission Stack has your link, banners, lines, headlines, an email and posts. If you asked Podcast Commission Stack to confirm your email, the 6-digit code arrives in an email that shows the name Podcast Commission Stack and says it was sent by InstantAdPay, because InstantAdPay is the mail service for the network. That is expected. Type the code into Podcast Commission Stack within 15 minutes. If you did not ask for it, ignore it.' },
{ id: 'network-sites-kits', title: 'Promo tools: Network sites', q: ['Where are the Downline Banners and Viral Banner Blitz banners?', 'How do I promote the other network sites?'], tags: ['network sites', 'promo kit', 'promote', 'creatives'],
re: /(network sites|promo kit|promote (downline|viral|the other|network))/i,
a: 'Members > Promo tools > Network sites shows the promo kits of Downline Banners and Viral Banner Blitz with your InstantAdPay username already in every link: your personal links, creatives in 125x125, 468x60, 728x90, 300x250, 160x600, 1200x630 and 1080x1080 (download, copy the URL or copy ready HTML that links to you), 5 short lines, 3 headlines, an email and 2 social posts. Your username works as your sponsor link on those sites even if you never visited them. Each site keeps its own kit, so the copy here is always the current one; the same kit is on each site’s Promote page. Each link also has a tracked version that goes through LinkSpin first (so the network can see which site sent the visit) and then opens the same page with your username; use either one. Video App Income (short promo videos made from a topic) was added to this tab on 2026-11-23, with banners in web and social sizes, lines, headlines, an email and posts.' },
a: 'Members > Promo tools > Network sites shows the promo kits of Downline Banners and Viral Banner Blitz with your InstantAdPay username already in every link: your personal links, creatives in 125x125, 468x60, 728x90, 300x250, 160x600, 1200x630 and 1080x1080 (download, copy the URL or copy ready HTML that links to you), 5 short lines, 3 headlines, an email and 2 social posts. Your username works as your sponsor link on those sites even if you never visited them. Each site keeps its own kit, so the copy here is always the current one; the same kit is on each site’s Promote page. Each link also has a tracked version that goes through LinkSpin first (so the network can see which site sent the visit) and then opens the same page with your username; use either one. Video App Income (short promo videos made from a topic) was added to this tab on 2026-11-23, with banners in web and social sizes, lines, headlines, an email and posts. Podcast Commission Stack (text turned into audio and podcasts) was added to this tab on 2026-11-25, with the same kind of kit.' },
{ id: 'wired-wednesday', title: 'Wired Wednesday bonus', q: ['What is Wired Wednesday?', 'What happens on Wednesday?'], tags: ['wired wednesday', 'bonus credits', 'promotion'],
re: /(wired wednesday|wednesday (bonus|promo|deal|special)|what happens on wednesday)/i,
a: 'Wired Wednesday: every Wednesday (Central time, midnight to midnight), any ad package from $20 up (the Activation pack and above; there is no $10 pack) earns +25% bonus credits, wired into your balance the moment the purchase settles. They are purchased-grade, so they run on any format, login ads included, and the bonus is labelled in your credit log. The page instantadpay.com/wednesday shows whether it is live now and the next date; add ?ref=yourusername to that address and anyone who joins from it is your referral. Every pack still pays its sponsor line in the same on-chain transaction. Credits buy ad delivery and cannot be withdrawn; no income is guaranteed.' },
@@ -398,7 +402,7 @@ ${WEEKEND ? (() => { try { return WEEKEND.fact() || ''; } catch (e) { return '';
- Free to join with email only (6-digit code sign-in, no passwords). Wallet appears only at purchase or payout activation. Every new member gets a small welcome batch of ad credits — unlocked by the WELCOME TOUR on first sign-in: they visit their upline's line-banner sites (up to 3, 10 seconds each — the same 3 levels the contract pays), then claim the credits. Members with no upline banners get the credits instantly.
- SPONSOR ATTRIBUTION: last touch. The invite link opened most recently sets the sponsor (30-day cookie), shown on the join page and again at the code step ("Joining under @name"). It locks when the account is created; the contract binds the buyer to that sponsor at their first purchase. Wrong sponsor before joining: open the right link. Already joined wrong: admin can move the account before the first purchase.
- YOUR LINKS (top of Members > Promo tools): the plain invite link plus five angle links (?v=instant paid-in-seconds, ?v=adspend you-buy-ads-anyway, ?v=free costs-nothing-to-try, ?v=ledger no-back-office, ?v=two two-buyers-open-level-two, ?v=wide width-unlocks-depth with the Build Wide video; ?v=play opens the games angle), each with a who-it-is-for note, Copy and Share. Same credit either way; only the first page differs. Link stats on the Overview's coaching card show views/joins/buyers per angle.
- PROMO TOOLS (Members > Promo tools, pill menu): Social posts for X/Facebook/LinkedIn/Telegram-WhatsApp with post/share buttons; Text a friend (5 SMS-sized messages with Text it / WhatsApp / Telegram / Copy); Email swipes (short, standard, long, follow-up); Banners in every standard ad size plus 600x300, 250x250, 1080x1080, 1080x1920 and 1280x720 (download or copy URL); the member's Banner wall link; an Objection handling bank (truth + ready-to-send reply); a Videos tab with five hook videos, one per angle (Paid before the page reloads, You were buying traffic anyway, Watch first spend never, No back office, Two buyers open level two), each with a caption and the matched angle link, and at Circuit the Video Maker renders them with the member's own end card and QR; a Toolkit tab showing the badge ladder and the AI Copy Engine. Every piece carries the member's invite link; angle links add ?v=instant|adspend|free|ledger. Members who want copy in their own voice can use mybrandedvoice.com. The Games tab (2026-10-31) also carries the EnjoyBestGames arcade kit: enjoybestgames.com is an engagement site with hundreds of free HTML5 games; the featured row Games that pay Polygon is the network's own games and the only ones that pay; the member link enjoybestgames.com/?r=username sets a 30-day cookie so every featured game and the site strip credit that member on InstantAdPay; share image, 4 posts and the 11 banner sizes are in the kit. The Network sites tab (2026-11-14; Video App Income kit added 2026-11-23) shows the Downline Banners and Viral Banner Blitz promo kits, read live from each site: the member's links (their InstantAdPay username is their sponsor link there too, even if they never visited), creatives in 9 or more sizes per angle (including 600x300 and 250x250), 5 lines, 3 headlines, an email and 2 posts; the same kits are on downlinebanners.com/promote and viralbannerblitz.com/promote. Viral Banner Blitz: a shared loop of 125x125 banners, one free post credit a day for InstantAdPay/LinkSpin members, verified visitors move the loop, a banner that cycles earns network ad views (advertising, not cash), weekly leaderboards with a POL prize pot.
- PROMO TOOLS (Members > Promo tools, pill menu): Social posts for X/Facebook/LinkedIn/Telegram-WhatsApp with post/share buttons; Text a friend (5 SMS-sized messages with Text it / WhatsApp / Telegram / Copy); Email swipes (short, standard, long, follow-up); Banners in every standard ad size plus 600x300, 250x250, 1080x1080, 1080x1920 and 1280x720 (download or copy URL); the member's Banner wall link; an Objection handling bank (truth + ready-to-send reply); a Videos tab with five hook videos, one per angle (Paid before the page reloads, You were buying traffic anyway, Watch first spend never, No back office, Two buyers open level two), each with a caption and the matched angle link, and at Circuit the Video Maker renders them with the member's own end card and QR; a Toolkit tab showing the badge ladder and the AI Copy Engine. Every piece carries the member's invite link; angle links add ?v=instant|adspend|free|ledger. Members who want copy in their own voice can use mybrandedvoice.com. The Games tab (2026-10-31) also carries the EnjoyBestGames arcade kit: enjoybestgames.com is an engagement site with hundreds of free HTML5 games; the featured row Games that pay Polygon is the network's own games and the only ones that pay; the member link enjoybestgames.com/?r=username sets a 30-day cookie so every featured game and the site strip credit that member on InstantAdPay; share image, 4 posts and the 11 banner sizes are in the kit. The Network sites tab (2026-11-14; Video App Income kit added 2026-11-23; Podcast Commission Stack kit added 2026-11-25) shows the Downline Banners and Viral Banner Blitz promo kits, read live from each site: the member's links (their InstantAdPay username is their sponsor link there too, even if they never visited), creatives in 9 or more sizes per angle (including 600x300 and 250x250), 5 lines, 3 headlines, an email and 2 posts; the same kits are on downlinebanners.com/promote and viralbannerblitz.com/promote. Viral Banner Blitz: a shared loop of 125x125 banners, one free post credit a day for InstantAdPay/LinkSpin members, verified visitors move the loop, a banner that cycles earns network ad views (advertising, not cash), weekly leaderboards with a POL prize pot.
- INVITE PAGES: a member's link instantadpay.com/join/<username> opens a lead-capture page (email first, wallet later); add ?v=instant|adspend|free|ledger|two|wide|play for an angle-matched headline (?v=wide: 'Width unlocks depth.', opens on the Build Wide video, vertical on phones). New free members get a short getting-started email series over the first week (unsubscribe link in every email; the admin edits the sequence in /admin > Settings).
- WALLET DRAIN WARNING: Trust Wallet hard-blocks any purchase that spends most of the wallet's POL ("this transaction will drain your wallet", only "Stop and go back"). It is a balance-proportion heuristic, not a contract issue (there are no token approvals; a buy is one native-POL payable call). Advice: smaller package first, or add POL so the buy is well under half the balance, or use SafePal or another wallet without the hard block. The dashboard warns Trust Wallet users before sending when a buy would use more than ~55% of the balance; other wallets are not prompted. After a blocked attempt the WalletConnect session may be dead: Wallet tab > Disconnect > Connect again.
- WALL OWNERSHIP LADDER: the public wall has 3 positions. Position 1 = the member's line banner. Positions 2 and 3 show upline banners (then house ads) UNTIL the member earns them: 2 qualifying buyers ($20+) unlock position 2, 5 unlock position 3; a fully qualified member's wall is 100% their own links/offers (set in Profile > Your wall: label, https link, optional banner image). Empty unlocked slots fall back to upline banners, then house ads.
@@ -481,6 +485,7 @@ ${WEEKEND ? (() => { try { return WEEKEND.fact() || ''; } catch (e) { return '';
- The contract cannot be paused, upgraded, or drained. The operator can only manage the ad catalog ($1-$500 bounds, 24h price timelock) and rotate keys.
- VIDEO APP INCOME VIDEOS AS VIDEO ADS (2026-11-22): a member of Video App Income (a network site that makes short phone videos, shown publicly on Social Tube, socialtube.club) can tap "Run this on InstantAdPay" on that site's Share tab. It opens /my#campaigns with the Video ad (watch to earn) form filled in with their video file, its title and their Social Tube page as the target. Nothing is purchased automatically: the member picks the watch length and budget and submits; it costs their InstantAdPay credits at the normal video rates. Portrait videos play in Shorts. If the video is remade or deleted on Video App Income its file address changes, so the campaign should be paused and a new one made. No results are promised.
- PODCAST COMMISSION STACK (2026-11-25, https://podcastcommissionstack.com): a network site that turns text into audio on a phone. Paste text, add a link or upload a document and get natural-sounding audio; "Easy listening" tidies web pages for the ear; listen in the app or download the MP3; a member can turn their own writing into a podcast with their own show page and feed. Price: credits, 1 credit = 10 cents = up to 10 minutes of audio; packs $10 = 100, $25 = 260, $50 = 550, $100 = 1,200 credits; paid once in POL on Polygon; no subscription; the first hour is free. Each credit purchase is split by its own smart contract at the moment of purchase: 30% to the buyer's sponsor, 8% to each of five team levels, 30% company side. A member must have bought credits there to receive shares. The network sponsor carries over. Member link: https://podcastcommissionstack.com/join?ref=<network username>; its kit is in Members > Promo tools > Network sites. Its email-check code (6 digits, good for 15 minutes) is mailed by InstantAdPay under the name Podcast Commission Stack, the same way as for Video App Income; sponsor invite emails are NOT sent for this site. Only answer about it when asked; never quote earnings figures or promise results.
- EARN BY WATCHING ON SOCIAL TUBE (2026-11-22): Social Tube (socialtube.club, the network's video gallery) has an Earn page that plays InstantAdPay's watch-to-earn video ads. A member signs in there with the network account, watches for the full time, and earns the SAME InstantAdPay credits as in Shorts / Watch videos here. InstantAdPay picks the video, times it, charges the advertiser and credits the viewer, so the daily video limit is ONE limit shared by both sites, each video pays once per day, and nobody is served their own video. Credit activity reads "Watched a video on Social Tube". Advertisers do nothing extra: every live video campaign can also be watched there.
PAGES (the ONLY addresses that exist; never invent others): home https://instantadpay.com, member dashboard https://instantadpay.com/my with tabs as hashes: /my#overview, /my#line (My line, holding tank, prospects), /my#pipeline, /my#buy (Buy packages, Qualified Start, Buy POL with a card), /my#campaigns (New campaign, campaign rows, Credit activity), /my#earn (Watch ads, Watch videos, Verified visits, Inbox), /my#earnings (Trace a payment, payouts, referrals, purchases), /my#promo (Your links, Social posts, Text a friend, Email swipes, Banners, Wall, Objections, Videos, Toolkit), /my#training, /my#games (PolHunter, Drip Runner, Gem Kingdom, ClutterHunt, SpellWheel, PolyWarriors, PolyBreak, Spooky Doors in season), /games (public list of every game), /my#wallet, /my#profile, /my#help (Help: support tickets). Public: /support (contact form for anyone signed out or locked out; support@instantadpay.com also works), /join/<username> (invite page, ?v=angle), /wall/<username>, /b/<username>/<badge>, /handout/<username>, /ledger, /tx/<hash>, /contract, /leaderboard, /whats-new, /blog, /plays, /wallets (members), /launch (members), /partners, /earning, /shorts, /terms, /privacy, /disclaimer, /from/faucetwave, /from/tieroneads and /from/socialpix.
+2 -1
View File
@@ -1,5 +1,5 @@
// Promo tools > Network sites (Marty 2026-11-14): the promo kits of the other network sites, read live from each site's own public
// feed (GET <site>/api/promo-kit?u=<username>), so a creative or line changed on any of those sites shows here (ViralAdBlitz, DownlineHydra and 5xYourTeam added 2026-11-15, ViralAdSource and YourProgramBuilder 2026-11-17)
// feed (GET <site>/api/promo-kit?u=<username>), so a creative or line changed on any of those sites shows here (ViralAdBlitz, DownlineHydra and 5xYourTeam added 2026-11-15, ViralAdSource and YourProgramBuilder 2026-11-17, Video App Income 2026-11-23, Podcast Commission Stack 2026-11-25)
// at once. Usernames are network-wide: the member's InstantAdPay username is their sponsor link on those sites even if they never
// visited them. Nothing is stored here.
window.IAPNetKits = (function () {
@@ -11,6 +11,7 @@ window.IAPNetKits = (function () {
{ key: 'ypb', name: 'YourProgramBuilder', feed: 'https://yourprogrambuilder.com/api/promo-kit', blurb: 'Plant a program you already use, free, and network members save their own IDs in it. A visitor who comes through you sees your link first. At 10 saved IDs it goes to review for the Crypto Team Build Network builder. A $10 Spotlight buys 1,000 views, split by the contract. Nothing is promised.' },
{ key: 'dh', name: 'DownlineHydra', feed: 'https://downlinehydra.com/api/promo-kit', blurb: 'One join, many heads: one free account and one sponsor line across the network, plus the downline builder for the programs you promote. Pro is $30 one time, never a subscription, split on-chain. Nothing is promised.' },
{ key: 'vai', name: 'Video App Income', feed: 'https://videoappincome.com/api/promo-kit', blurb: 'Short promo videos made from your phone: type a topic, paste a link, and about a minute later there is a finished video with a voice, captions and music on its own tracked page. The first video is free. Credit purchases are split on-chain in the same transaction. Nothing is promised.' },
{ key: 'pcs', name: 'Podcast Commission Stack', feed: 'https://podcastcommissionstack.com/api/promo-kit', blurb: 'Text turned into audio on your phone: paste text, add a link or upload a document and get natural-sounding audio to hear in the app or download as an MP3. Your own writing can become a podcast with its own show page and feed. The first hour is free. Credits are paid once in POL on Polygon, with no subscription, and every credit purchase is split by its own smart contract at the moment of purchase. Nothing is promised.' },
{ key: 'fivex', name: '5xYourTeam', feed: 'https://5xyourteam.com/api/promo-kit', blurb: 'The weekly draft for people who need a sponsor. A $10 position lets you draft people waiting in the holding tank and coach them. Nothing is promised.' }
];
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+1 -1
View File
@@ -1312,7 +1312,7 @@
<script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20261103gp"></script>
<script src="/assets/support.js?v=20261116sg"></script>
<script src="/assets/netkits.js?v=20261123vai"></script>
<script src="/assets/netkits.js?v=20261125pcs"></script>
<script src="/assets/tankready.js?v=20261118rd"></script>
<script src="/assets/my.js?v=20261120tx"></script>
<script src="/assets/fuel.js?v=20261113sso"></script><script src="/assets/tankfeed.js?v=20261115tb"></script>
+6 -2
View File
@@ -77,7 +77,9 @@ const WANT = {
PRICE: /packages, priced in dollars/, // the count changed (five, then seven); match the answer, not the number
EARN: /Every package splits the same way/,
TANK: /The holding tank is where free members/,
GAMEPOL: /Game POL is paid to the wallet linked/
GAMEPOL: /Game POL is paid to the wallet linked/,
PCS: /^Podcast Commission Stack \(https:\/\/podcastcommissionstack\.com\) is another site in the network/, // 2026-11-25: its name holds the word commission, which the split answer would take
VAI: /Video App Income is another site in the network that makes short promo videos/
};
const ROUTES = [
['PIF', 'should I pif someone from the holding tank'], ['PIF', 'what is pif'],
@@ -92,7 +94,9 @@ const ROUTES = [
['EARN', 'what will i get paid'], ['EARN', 'what is the commission'],
['TANK', 'how does the holding tank work'], ['TANK', 'can I adopt someone from the tank'],
['GAMEPOL', 'my gem kingdom pol was never sent'], ['GAMEPOL', 'it says 1.50 POL is waiting for your wallet'],
['GAMEPOL', 'do I need to switch on payouts to get my game pol']
['GAMEPOL', 'do I need to switch on payouts to get my game pol'],
['PCS', 'what is podcast commission stack'], ['PCS', 'I got a code email from Podcast Commission Stack, is it real?'], ['PCS', 'where are the podcastcommissionstack banners'],
['VAI', 'what is video app income'], ['EARN', 'what commission do I get']
];
for (const [want, q] of ROUTES) {
const reply = await ask(q);
+68
View File
@@ -138,5 +138,73 @@ const send = (items, x) => SI.handle('send', Object.assign({ rid: 'rid-' + Math.
if (r.ok && r.sent === 1) ok(sent.length === n + 1 && sent[n][1] === 'bob sent you a video' && /shows how it works/.test(sent[n][2]), 'the send call passes the kind through to the email', sent[n] && sent[n][1]);
else ok(false, 'promo send through the full path', r);
}
// ---- a second site, Podcast Commission Stack (2026-11-25): its own secret, the code mail only, Video App Income exactly as before ----
{
const PCS = 'podcastcommissionstack', VAI = 'videoappincome', pSecret = 'p'.repeat(40), vSecret = 's'.repeat(40);
const base = { dataDir: dir, accounts, mailer, prohibited, siteConfig: () => conf, secret: vSecret, linkHosts: 'clickvidpro.com', clock: () => now, gapMs: 0, hooks: { excluded: em => em === 'flagged@mail.test' } };
const signed = (body, secret) => { const raw = JSON.stringify(body), ts = String(Date.now()); return SI.verify({ 'x-invite-ts': ts, 'x-invite-sig': SI.sign(ts, raw, secret) }, raw); };
// the whole HTTP path: verify names the signing site, and that name goes to handle (server.js: handle(op, sg.body, sg.site))
const call = async (op, body, secret) => { const sg = signed(body, secret); return sg.body ? SI.handle(op, sg.body, sg.site) : sg; };
const vaiText = c => 'Your code is: ' + c + '\n\nEnter it in Video App Income to confirm your email. It works for 15 minutes. If you did not ask for it, ignore this email.\n\nVideo App Income is part of the Crypto Team Build Network. This email was sent by InstantAdPay, the mail service of the network.';
// before its secret is set, the new site cannot call at all and Video App Income is as it was
await SI.init(base); now += 24 * 3600000;
ok(signed({ site: PCS, email: 'a@mail.test', code: '111111' }, pSecret).status === 401, 'with no secret set for Podcast Commission Stack, a call signed for it is refused');
ok(signed({ site: VAI }, vSecret).site === VAI, 'and a Video App Income call is still accepted');
await SI.init(Object.assign({}, base, { secrets: { [PCS]: vSecret } }));
ok(signed({ site: PCS }, vSecret).site === VAI && (await call('code', { site: PCS, email: 'a@mail.test', code: '111111' }, vSecret)).code === 'site', 'the same secret given to both sites does not open the second site');
await SI.init(Object.assign({}, base, { secrets: { [PCS]: 'short' } }));
ok(signed({ site: PCS }, 'short').status === 401, 'a secret under 32 characters is not accepted for the second site');
// the env var, by its exact name
process.env.SITE_INVITE_SECRET_PCS = pSecret; await SI.init(base);
ok(signed({ site: PCS }, pSecret).site === PCS, 'SITE_INVITE_SECRET_PCS is the secret Podcast Commission Stack signs with');
delete process.env.SITE_INVITE_SECRET_PCS;
await SI.init(Object.assign({}, base, { secrets: { [PCS]: pSecret } }));
ok(signed({ site: PCS }, pSecret).site === PCS && signed({ site: VAI }, vSecret).site === VAI, 'each site is recognised by its own secret');
ok(signed({ site: PCS }, 'x'.repeat(40)).status === 401, 'a secret that belongs to neither site is refused');
// the code mail for the new site
let n = sent.length, r = await call('code', { site: PCS, email: 'Pod.Person@Mail.test', code: '730155' }, pSecret), m = sent[sent.length - 1];
ok(r.ok && sent.length === n + 1 && m[0] === 'pod.person@mail.test' && m[1] === '730155 is your Podcast Commission Stack code', 'the code mail goes out for Podcast Commission Stack', [r, m && m.slice(0, 2)]);
ok(m[2] === vaiText('730155').split('Video App Income').join('Podcast Commission Stack') && !/Video App Income|https?:/.test(m[2] + m[1]), 'its wording names Podcast Commission Stack, never Video App Income, and has no links', m[2]);
ok(m[3] == null && m[4] && m[4].transactional === true && m[4].fromName === 'Podcast Commission Stack', 'it is sent as a requested mail with the From name Podcast Commission Stack', m[4]);
ok((await call('code', { site: PCS, email: 'x@mailinator.com', code: '111111' }, pSecret)).code === 'email' && (await call('code', { site: PCS, email: 'flagged@mail.test', code: '111111' }, pSecret)).code === 'email' && (await call('code', { site: PCS, email: 'a@mail.test', code: '12ab' }, pSecret)).code === 'email', 'the same address and code checks apply to it');
// one site's secret never acts for the other
n = sent.length;
ok((await call('code', { site: PCS, email: 'b@mail.test', code: '111111' }, vSecret)).code === 'site', 'the Video App Income secret cannot send a Podcast Commission Stack code');
ok((await call('code', { site: VAI, email: 'b@mail.test', code: '111111' }, pSecret)).code === 'site', 'the Podcast Commission Stack secret cannot send a Video App Income code');
ok((await call('eligible', { site: VAI, sender: { email: 'ann@mail.test' } }, pSecret)).code === 'site' && (await call('send', { rid: 'rid-cross-000001', site: VAI, sender: { email: 'zed@mail.test' }, items: [{ username: 'z2', link: L('z2') }] }, pSecret)).code === 'site', 'nor reach the Video App Income invite calls');
ok(sent.length === n, 'and none of those sent an email');
// invite emails are not open to the new site, with its own secret or from inside the app
const before = (await SI.adminView()).recent.length;
r = await call('eligible', { site: PCS, sender: { email: 'ann@mail.test' } }, pSecret); ok(r.code === 'op' && !r.directs, 'Podcast Commission Stack cannot ask who is eligible for invites', r);
r = await call('send', { rid: 'rid-pcs-0000001', site: PCS, sender: { email: 'zed@mail.test' }, items: [{ username: 'z2', link: L('z2') }] }, pSecret); ok(r.code === 'op' && !r.results, 'or send invite emails', r);
ok((await SI.handle('send', { rid: 'rid-pcs-0000002', site: PCS, sender: { email: 'zed@mail.test' }, items: [{ username: 'z2', link: L('z2') }] })).code === 'op' && (await SI.handle('eligible', { site: PCS, sender: { email: 'ann@mail.test' } })).code === 'op', 'the same refusal without a signer');
ok((await SI.sample('owner@mail.test', PCS)).error === 'unknown site', 'and there is no sample invite for it');
ok(sent.length === n && (await SI.adminView()).recent.length === before, 'nothing was sent or recorded');
ok(SI.SITES[PCS].ops.join() === 'code' && !SI.SITES[VAI].ops && !SI.SITES[VAI].secretEnv, 'the site list: code only for the new site, Video App Income with no restriction and its original secret');
// Video App Income after the change: same words, same calls
n = sent.length; r = await call('code', { site: VAI, email: 'vai.person@mail.test', code: '204681' }, vSecret); m = sent[sent.length - 1];
ok(r.ok && sent.length === n + 1 && m[1] === '204681 is your Video App Income code' && m[2] === vaiText('204681') && m[4].transactional === true && m[4].fromName === 'Video App Income', 'the Video App Income code mail is word for word what it was', m && m.slice(1, 3));
r = await call('eligible', { site: VAI, sender: { email: 'zed@mail.test' } }, vSecret); ok(r.ok && r.sender === 'zed' && r.directs.length === 3, 'Video App Income can still ask who is eligible', r);
n = sent.length; r = await call('send', { rid: 'rid-vai-still-01', site: VAI, sender: { email: 'zed@mail.test' }, items: [{ username: 'z2', link: L('z2') }] }, vSecret);
ok(r.ok && r.sent === 1 && sent.length === n + 1 && sent[n][1] === 'zed made you a video' && sent[n].length === 4, 'and still send an invite email, worded as before', r);
ok((await call('code', { site: 'nosuchsite', email: 'a@mail.test', code: '111111' }, vSecret)).error === 'unknown site', 'an unknown site is refused as before');
// the limits are one count for both sites: nothing is doubled by adding a site
for (let i = 0; i < 2; i++) await call('code', { site: PCS, email: 'both@mail.test', code: '111111' }, pSecret);
for (let i = 0; i < 3; i++) await call('code', { site: VAI, email: 'both@mail.test', code: '111111' }, vSecret);
n = sent.length;
ok((await call('code', { site: PCS, email: 'both@mail.test', code: '111111' }, pSecret)).code === 'limit' && (await call('code', { site: VAI, email: 'both@mail.test', code: '111111' }, vSecret)).code === 'limit' && sent.length === n, 'five codes an hour to one address, counted across both sites');
now += 24 * 3600000; n = sent.length; let okN = 0;
for (let i = 0; i < 2000; i++) { const pcs = i % 2 === 0; if ((await call('code', { site: pcs ? PCS : VAI, email: 'day' + i + '@mail.test', code: '111111' }, pcs ? pSecret : vSecret)).ok) okN++; }
ok(okN === 2000 && sent.length === n + 2000, '2,000 codes in a day go out between the two sites', okN);
ok((await call('code', { site: PCS, email: 'over1@mail.test', code: '111111' }, pSecret)).code === 'limit' && (await call('code', { site: VAI, email: 'over2@mail.test', code: '111111' }, vSecret)).code === 'limit' && sent.length === n + 2000, 'and the 2,001st is refused for either site: the daily limit is still 2,000 in all');
}
fs.rmSync(dir, { recursive: true, force: true });
console.log('\n' + passes + ' passed, ' + fails + ' failed'); process.exit(fails ? 1 : 0);
+2 -2
View File
@@ -1060,7 +1060,7 @@ const MIME = { '.html': 'text/html; charset=utf-8', '.css': 'text/css', '.js': '
'.png': 'image/png', '.jpg': 'image/jpeg', '.svg': 'image/svg+xml', '.webp': 'image/webp',
'.ico': 'image/x-icon', '.json': 'application/json', '.mp4': 'video/mp4', '.woff2': 'font/woff2',
'.gif': 'image/gif', '.webm': 'video/webm', '.vtt': 'text/vtt; charset=utf-8', '.txt': 'text/plain; charset=utf-8', '.xml': 'application/xml; charset=utf-8' };
const CSP = "default-src 'self'; script-src 'self' https://cdn.jsdelivr.net https://www.networkadspace.com https://networkadspace.com https://polhunter.com 'sha256-NzvNrqk5jB9YZATwo5BF4JoRlJ02HsnFikbKXgEPdaQ=' " + themehead.CSP_HASH + "; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https:; media-src 'self' https: blob:; connect-src 'self' https://polhunter.com https://*.walletconnect.com wss://*.walletconnect.com https://*.walletconnect.org wss://*.walletconnect.org https://*.reown.com wss://*.reown.com https://*.reown.org wss://*.reown.org https://*.web3modal.org https://*.drpc.org https://*.publicnode.com https://*.coinbase.com https://linkspin.app https://downlinebanners.com https://viralbannerblitz.com https://viraladblitz.com https://viraladsource.com https://yourprogrambuilder.com https://downlinehydra.com https://5xyourteam.com https://videoappincome.com; font-src 'self' data: https://fonts.gstatic.com https://fonts.reown.com; form-action 'self'; frame-src https: http:";
const CSP = "default-src 'self'; script-src 'self' https://cdn.jsdelivr.net https://www.networkadspace.com https://networkadspace.com https://polhunter.com 'sha256-NzvNrqk5jB9YZATwo5BF4JoRlJ02HsnFikbKXgEPdaQ=' " + themehead.CSP_HASH + "; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https:; media-src 'self' https: blob:; connect-src 'self' https://polhunter.com https://*.walletconnect.com wss://*.walletconnect.com https://*.walletconnect.org wss://*.walletconnect.org https://*.reown.com wss://*.reown.com https://*.reown.org wss://*.reown.org https://*.web3modal.org https://*.drpc.org https://*.publicnode.com https://*.coinbase.com https://linkspin.app https://downlinebanners.com https://viralbannerblitz.com https://viraladblitz.com https://viraladsource.com https://yourprogrambuilder.com https://downlinehydra.com https://5xyourteam.com https://videoappincome.com https://podcastcommissionstack.com; font-src 'self' data: https://fonts.gstatic.com https://fonts.reown.com; form-action 'self'; frame-src https: http:";
function baseHeaders(extra) {
return Object.assign({ 'Content-Security-Policy': CSP, 'X-Content-Type-Options': 'nosniff',
'Referrer-Policy': 'strict-origin-when-cross-origin' }, extra || {});
@@ -4006,7 +4006,7 @@ const server = http.createServer(async (req, res) => {
const sg = siteinvite.verify(req.headers, raw); if (!sg.body) return json(res, sg.status, { error: sg.error });
const op = p.slice('/api/partner/invite/'.length);
if (!['eligible', 'send', 'code'].includes(op)) return json(res, 404, { error: 'unknown op' });
const r = await siteinvite.handle(op, sg.body);
const r = await siteinvite.handle(op, sg.body, sg.site); // sg.site = the site whose own secret signed the call (Podcast Commission Stack: SITE_INVITE_SECRET_PCS, code only, 2026-11-25)
return json(res, r.error ? 400 : 200, r);
}
// -- watch-to-earn videos played on another network site (Social Tube, Marty 2026-11-22: "a member watching on Social Tube earns the same
+30 -13
View File
@@ -13,6 +13,10 @@
// the email-check code for the site's network gate: the SITE makes and checks the 6-digit code, this app only mails it
// (a requested code is transactional, like a sign-in code). Fixed wording, no links; 5 an hour per address, 2,000 a day in all.
// Signature: X-Invite-Ts (ms) + X-Invite-Sig = hex HMAC-SHA256(SITE_INVITE_SECRET, 'invite.v1.' + ts + '\n' + raw body), 5 minutes.
// A second site (2026-11-25, Podcast Commission Stack): each site signs with ITS OWN secret (SITES[id].secretEnv, else SITE_INVITE_SECRET).
// verify() says which site's secret signed the call and handle() refuses a body that names any other site, so one site's secret can
// never act for another. SITES[id].ops lists what a site may ask for: Podcast Commission Stack has the code mail only, no invite
// emails (their wording is about Video App Income and was approved for it alone). The code limits stay one count for all sites.
//
// The rules:
// - DIRECTS ONLY: each recipient is checked with accounts.isDownlineOf(sender, recipient, 1) at send time (the directs-only email
@@ -31,7 +35,8 @@ const path = require('path');
const crypto = require('crypto');
const db = require('./db');
const SITES = { videoappincome: { name: 'Video App Income' } };
const SITES = { videoappincome: { name: 'Video App Income' }, // no ops list = every call; its secret is SITE_INVITE_SECRET, as before
podcastcommissionstack: { name: 'Podcast Commission Stack', ops: ['code'], secretEnv: 'SITE_INVITE_SECRET_PCS' } };
const THROWAWAY = new Set(['mailinator.com', 'guerrillamail.com', 'guerrillamail.net', 'sharklasers.com', 'grr.la', '10minutemail.com', 'tempmail.com', 'temp-mail.org',
'yopmail.com', 'trashmail.com', 'getnada.com', 'maildrop.cc', 'dispostable.com', 'throwawaymail.com', 'fakeinbox.com', 'mintemail.com', 'mohmal.com', 'emailondeck.com',
'tempail.com', 'tempr.email', 'discard.email', 'spamgourmet.com', 'mailnesia.com', 'mytemp.email', 'tempmailo.com', 'burnermail.io', 'example.com', 'test.com']);
@@ -43,6 +48,17 @@ let R = null; // { dataDir, accounts, mailer, siteConfig, prohibited, hooks: { e
const clock = () => (R && R.clock ? R.clock() : Date.now());
const SECRET = () => String((R && R.secret) || process.env.SITE_INVITE_SECRET || '').trim();
const enabled = () => SECRET().length >= 32;
// the secret a site signs with. A site with its own secretEnv never falls back to SITE_INVITE_SECRET, and a secret that is too short
// or the same as another site's is treated as not set: two sites must not share one.
const secretOf = id => { const s = SITES[id]; if (!s) return ''; if (!s.secretEnv) return SECRET(); const v = String((R && R.secrets && R.secrets[id]) || process.env[s.secretEnv] || '').trim(); return v.length >= 32 && v !== SECRET() ? v : ''; };
const keys = () => Object.keys(SITES).map(id => ({ id, secret: secretOf(id) })).filter(k => k.secret.length >= 32);
// the site a call is for, or the refusal. signer = the site whose secret signed it (from verify); a call made inside this app has none.
function siteOf(b, op, signer) {
const id = lc(b.site), site = SITES[id]; if (!site) return { error: 'unknown site', code: 'site' };
if (signer && signer !== id) return { error: 'That site is not the one this key belongs to.', code: 'site' };
if (site.ops && !site.ops.includes(op)) return { error: 'That call is not open to this site.', code: 'op' };
return { id, site };
}
const hosts = () => String((R && R.linkHosts) || process.env.SITE_INVITE_LINK_HOSTS || 'clickvidpro.com').split(',').map(lc).filter(Boolean);
function cfg() { const sc = (R && R.siteConfig && R.siteConfig()) || {}; const n = (k, lo, hi) => { const v = Math.round(Number(sc[k] == null ? DEFAULTS[k] : sc[k])); return v >= lo && v <= hi ? v : DEFAULTS[k]; };
return { paused: String(sc.siteInvitesPaused == null ? DEFAULTS.siteInvitesPaused : sc.siteInvitesPaused) === '1', perSender: n('siteInvitePerSender', 1, 500), perDay: n('siteInvitePerDay', 1, 5000) }; }
@@ -85,12 +101,12 @@ async function init(opts) { R = opts; J.st = null; await ensureTables(); }
// ---- signature ----
function sign(ts, raw, secret) { return crypto.createHmac('sha256', secret || SECRET()).update('invite.v1.' + ts + '\n' + raw).digest('hex'); }
function verify(headers, raw) {
if (!enabled()) return { status: 503, error: 'site invites not configured' };
const ks = keys(); if (!ks.length) return { status: 503, error: 'site invites not configured' };
const ts = String(headers['x-invite-ts'] || ''), sig = String(headers['x-invite-sig'] || '');
if (!/^\d{13}$/.test(ts) || Math.abs(Date.now() - Number(ts)) > 5 * 60000) return { status: 401, error: 'stale' };
const want = sign(ts, raw);
if (want.length !== sig.length || !crypto.timingSafeEqual(Buffer.from(want), Buffer.from(sig))) return { status: 401, error: 'bad signature' };
try { const b = JSON.parse(raw || '{}'); return b && typeof b === 'object' ? { body: b } : { status: 400, error: 'bad json' }; } catch (e) { return { status: 400, error: 'bad json' }; }
let signer = ''; for (const k of ks) { const want = sign(ts, raw, k.secret); if (!signer && want.length === sig.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(sig))) signer = k.id; }
if (!signer) return { status: 401, error: 'bad signature' };
try { const b = JSON.parse(raw || '{}'); return b && typeof b === 'object' ? { body: b, site: signer } : { status: 400, error: 'bad json' }; } catch (e) { return { status: 400, error: 'bad json' }; }
}
// ---- who ----
@@ -149,8 +165,8 @@ function cleanNote(n) {
const linkOk = l => { try { const u = new URL(String(l)); return u.protocol === 'https:' && hosts().includes(u.hostname.toLowerCase()) && /^\/p\/[A-Za-z0-9]{4,20}(\/[A-Za-z0-9]{4,20})?$/.test(u.pathname) && !u.search && !u.hash; } catch (e) { return false; } };
// ---- the two calls ----
async function eligible(b) {
const site = SITES[lc(b.site)]; if (!site) return { error: 'unknown site', code: 'site' };
async function eligible(b, signer) {
const so = siteOf(b, 'eligible', signer); if (so.error) return so;
const sender = await senderOf(b.sender); if (!sender) return { error: 'The sender has no InstantAdPay account with a username.', code: 'sender' };
const lv = await R.accounts.downline(sender.email, 1), kids = (lv[0] && lv[0].members) || [];
const sent = await S().sentTo(lc(b.site), kids.map(k => lc(k.email))), directs = [];
@@ -158,8 +174,8 @@ async function eligible(b) {
return { ok: true, sender: sender.username, directs, left: await left(sender), paused: cfg().paused };
}
const sleep = ms => new Promise(r => setTimeout(r, ms));
async function send(b) {
const siteId = lc(b.site), site = SITES[siteId]; if (!site) return { error: 'unknown site', code: 'site' };
async function send(b, signer) {
const so = siteOf(b, 'send', signer); if (so.error) return so; const siteId = so.id, site = so.site;
const rid = String(b.rid || ''); if (!/^[A-Za-z0-9_.:-]{8,80}$/.test(rid)) return { error: 'rid needed', code: 'rid' };
const before = await S().byRid(rid); if (before.length) return { ok: true, already: true, results: before.map(r => ({ username: r.username, status: r.status })), sent: before.filter(r => r.status === 'sent').length };
if (cfg().paused) return { error: 'Invites are paused right now.', code: 'paused' };
@@ -191,8 +207,8 @@ async function send(b) {
}
// ---- the email-check code a site asks for when a new person gives their email at its network gate ----
const codeLog = new Map(); let codeDay = { start: 0, n: 0 };
async function code(b) {
const site = SITES[lc(b.site)]; if (!site) return { error: 'unknown site', code: 'site' };
async function code(b, signer) {
const so = siteOf(b, 'code', signer); if (so.error) return so; const site = so.site;
const em = lc(b.email), c = String(b.code || '');
if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(em) || em.length > 190 || !/^\d{6}$/.test(c)) return { error: 'That does not look like an email address.', code: 'email' };
const d = em.split('@')[1] || '';
@@ -210,9 +226,10 @@ async function code(b) {
try { await R.mailer.send(em, c + ' is your ' + site.name + ' code', text, null, { transactional: true, fromName: site.name }); } catch (e) { console.error('site code mail', e.message); return { error: 'The email could not be sent. Check the address and try again.', code: 'mail' }; }
return { ok: true };
}
async function handle(op, b) { if (op === 'eligible') return eligible(b || {}); if (op === 'send') return send(b || {}); if (op === 'code') return code(b || {}); return { error: 'unknown op' }; }
// signer: the site verify() named (the HTTP route always passes it), so a body can only name the site whose secret signed it
async function handle(op, b, signer) { if (op === 'eligible') return eligible(b || {}, signer); if (op === 'send') return send(b || {}, signer); if (op === 'code') return code(b || {}, signer); return { error: 'unknown op' }; }
async function adminView() { const since = dayStart(clock()), c = cfg(); return { on: enabled(), paused: c.paused, perSender: c.perSender, perDay: c.perDay, today: await S().count(since), recent: (await S().recent(200)).map(r => ({ site: r.site, to: r.username, from: r.senderName, ts: r.ts, status: r.status, link: r.link })) }; }
// one sample to one address, for the owner to read before the feature opens. Not counted, not recorded.
async function sample(to, siteId) { const site = SITES[lc(siteId) || 'videoappincome']; if (!site) return { error: 'unknown site' }; const m = compose(site, 'yoursponsor', 'yourname', 'https://' + hosts()[0] + '/p/faceless', ''); await R.mailer.send(to, '[SAMPLE] ' + m.subject, m.text, m.html); return { ok: true, to, subject: m.subject, text: m.text }; }
async function sample(to, siteId) { const site = SITES[lc(siteId) || 'videoappincome']; if (!site || (site.ops && !site.ops.includes('send'))) return { error: 'unknown site' }; const m = compose(site, 'yoursponsor', 'yourname', 'https://' + hosts()[0] + '/p/faceless', ''); await R.mailer.send(to, '[SAMPLE] ' + m.subject, m.text, m.html); return { ok: true, to, subject: m.subject, text: m.text }; }
module.exports = { init, enabled, verify, sign, handle, adminView, sample, compose, cleanNote, linkOk, DEFAULTS, SITES };