diff --git a/ads.js b/ads.js index be36a86..c9d3106 100644 Binary files a/ads.js and b/ads.js differ diff --git a/auth.js b/auth.js index eb40d39..2a772ba 100644 --- a/auth.js +++ b/auth.js @@ -1,6 +1,7 @@ // Wallet sign-in (SIWE / EIP-4361) + session store for LinkSpin. // Sessions are dual-mode like accounts.js: MySQL when DATABASE_URL is set, // volume JSON otherwise. All session functions are async. +const { SITE_HOST } = require('./host'); const fs = require('fs'); const path = require('path'); const crypto = require('crypto'); @@ -11,7 +12,7 @@ const db = require('./db'); let DATA_DIR = null; let chain = null; let IS_PROD = false; -let SITE = 'linkspin-test.saasy.top'; +let SITE = SITE_HOST; const CHALLENGE_TTL = 10 * 60 * 1000; const SESSION_TTL = 24 * 60 * 60 * 1000; // 24h — forces a daily re-login so the login ad shows each day diff --git a/blog.js b/blog.js index c2c40b6..f6dca56 100644 --- a/blog.js +++ b/blog.js @@ -1,13 +1,14 @@ -// Public blog (Marty, 2026-09-12): coaching and teaching articles on linkspin-test.saasy.top, written in +// Public blog (Marty, 2026-09-12): coaching and teaching articles on the site host, written in // Admin > Blog, server-rendered so crawlers see real HTML with real metadata. Storage: MySQL // blog_posts, or DATA_DIR/blog.json. Public: /blog (paged index), /blog/, /blog/feed.xml, // /sitemap.xml, /robots.txt. SEO per post: title, description, canonical, Open Graph, Twitter // card, article dates, BlogPosting JSON-LD, breadcrumb JSON-LD, internal links, related posts. +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const db = require('./db'); let DATA_DIR = null; -const SITE = 'https://linkspin-test.saasy.top'; +const SITE = SITE_URL; const AUTHOR = 'Marty Bostick'; const PER_PAGE = 10; diff --git a/chatbot.js b/chatbot.js index e94fc6d..79c7e4a 100644 --- a/chatbot.js +++ b/chatbot.js @@ -4,6 +4,7 @@ // // HOUSE RULE: whenever a site feature changes, update BOTH the CANNED // answers and FACTS below in the same commit. +const { SITE_HOST, SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const https = require('https'); @@ -22,7 +23,7 @@ function enabled() { return !!key(); } // ---- canned answers: instant, free, always in voice ---- const CANNED = [ { re: /(pyramid|ponzi|scam|scheme)/i, - a: 'Fair question. A pyramid pays for recruiting with no product; here every payment is for real ad delivery, bought by real advertisers, and the whole money flow is public. Check the code and every payout yourself at https://linkspin-test.saasy.top/contract and https://linkspin-test.saasy.top/ledger.' }, + a: 'Fair question. A pyramid pays for recruiting with no product; here every payment is for real ad delivery, bought by real advertisers, and the whole money flow is public. Check the code and every payout yourself at ' + SITE_URL + '/contract and ' + SITE_URL + '/ledger.' }, { re: /(withdraw|cash ?out|payout request|minimum payout)/i, a: 'There are no withdrawals here, ever. The contract pays your share straight to your own wallet in the same transaction as the purchase. Nothing to request, nothing to wait on.' }, { re: /(how (much|do i) earn|commission|percent|split)/i, @@ -34,7 +35,7 @@ const CANNED = [ { re: /(free member|without (a )?wallet|do i (have to|need to) buy|earn (in )?credits|credits (vs|versus|or) pol|earn pol|get paid in)/i, a: 'Free members earn ad credits: view ads, watch videos, make verified visits, read inbox ads, sign in daily. Credits buy your own ads and are never cashed out. POL, the real crypto, is paid to your wallet by the contract when your referrals buy packages, once you are activated: the $20 starter package (2,000 credits to advertise with) and payouts switched on from the Wallet tab. Your own $20 purchase also makes you count as a qualifying buyer for your sponsor, and two or five such buyers in your own line open levels 2 and 3 for you.' }, { re: /(need (a )?wallet|crypto experience|metamask|how (do i|to) join|sign ?up|register)/i, - a: 'Join free with just your email at https://linkspin-test.saasy.top/my, no wallet and no password needed. Your wallet only comes out when you buy a package or switch on payouts, and the site walks you through it.' }, + a: 'Join free with just your email at ' + SITE_URL + '/my, no wallet and no password needed. Your wallet only comes out when you buy a package or switch on payouts, and the site walks you through it.' }, { re: /(referral link|invite link|share link|refer)/i, a: 'You get your share link the moment you sign in, free members included. Open Members > Promo tools: the "Your links" block at the top lists your invite link plus five angle versions (Instant, Ad spend, Free, Ledger, Two), each with a note on who it is for and Copy and Share buttons. They are the same link with a code on the end, so every join and purchase credits you; only the first page the person sees changes. One tip: switch on payouts (one free wallet step in Members) before your people start buying, because the contract locks each buyer to their sponsor at their first purchase.' }, { re: /(promo tools?|social posts?|email swipes?|banners?|text a friend|objection|share buttons?)/i, @@ -42,7 +43,7 @@ const CANNED = [ { re: /(drain (my|your) wallet|stop and go back|trust wallet.*(warn|block|red)|wallet (warning|blocked))/i, a: 'That red "this transaction will drain your wallet" screen is the wallet\'s own safety rule, not a problem with the purchase: Trust Wallet blocks any transaction that spends most of the POL in the wallet. Ways through: buy a smaller package first, add some POL so the purchase is well under half the balance, or connect a different wallet (MetaMask, Phantom, SafePal have no such block). Extra POL always stays yours. If the next try says WalletConnect disconnected, open Wallet, tap Disconnect, then Connect again. Phantom, SafePal and MetaMask do not have the hard block.' }, { re: /(wall (page|slots?|positions?)|banner wall|my wall|three (ads|slots) on (my|the) wall)/i, - a: 'Your wall (linkspin-test.saasy.top/wall/yourname) shows three ads. Position 1 is always your line banner. Positions 2 and 3 show your upline (or LinkSpin) until you earn them: 2 qualifying buyers ($20 or more) make position 2 yours, 5 make position 3 yours, so a fully qualified member owns the whole page with their own links and offers. Set them in Profile > Your wall; an unlocked slot you leave empty keeps showing your upline until you fill it.' }, + a: 'Your wall (' + SITE_HOST + '/wall/yourname) shows three ads. Position 1 is always your line banner. Positions 2 and 3 show your upline (or LinkSpin) until you earn them: 2 qualifying buyers ($20 or more) make position 2 yours, 5 make position 3 yours, so a fully qualified member owns the whole page with their own links and offers. Set them in Profile > Your wall; an unlocked slot you leave empty keeps showing your upline until you fill it.' }, { re: /(solo ad|inbox ad|inbox)/i, a: 'Solo ads are full-message ads delivered straight into member inboxes on-site. Compose one under Campaigns (pick "Solo ad"): subject line, a rich-text message with a real editor (bold, headings, lists, links), an attached image or video if you want one, and a call-to-action button with your own label. You pay 5 credits per guaranteed delivery, 10 deliveries minimum. On the reading side, your Inbox section collects solos from other members — give one a real read (10 seconds on the open message) and claim 2 credits, up to 5 rewarded reads a day. You never receive your own solo.' }, { re: /(wrong sponsor|who is my sponsor|which sponsor|sponsor (cookie|link|credit)|clicked (someone|another|two).*link|last (link|click)|first (link|click|touch)|change (my )?sponsor)/i, @@ -58,21 +59,21 @@ const CANNED = [ { re: /(which|what) (crypto|coin|token|currency|chain|network)|paid in what|get paid in|supported (crypto|coins|wallets)|do you (support|accept)/i, a: 'One coin, one network: POL, the native coin of Polygon. You pay for packages in POL and every payout arrives as POL in your own Polygon wallet, in the same transaction. No other coins, tokens or chains are used. Any Polygon wallet works (MetaMask, SafePal, Phantom, Coinbase Wallet), and you can buy POL with a card from Buy packages if you have never held crypto.' }, { re: /(which wallet|what wallet|best wallet|recommended wallet|set ?up (a )?wallet|buy (pol|crypto|polygon)|get (pol|crypto)|moonpay|card to crypto|no crypto|never (had|held|owned) crypto)/i, - a: 'Preferred wallets: MetaMask (recommended, and the one for Qualified Start extra accounts), Phantom (turn Polygon on first: Settings, Active Networks), SafePal or Coinbase Wallet. Trust Wallet works but blocks a purchase that spends most of the POL in it, so keep about double the package cost there. To buy POL with a card: connect your wallet, open Buy packages, tap "Buy POL with a card". MoonPay opens with POL on Polygon and your own address filled in; pay by card, Apple Pay or Google Pay (first time needs an ID check, minimum order around $30), the POL lands in your wallet in minutes, then buy the package. The full step-by-step guide is in Training: Wallets and buying POL (https://linkspin-test.saasy.top/wallets, members only).' }, + a: 'Preferred wallets: MetaMask (recommended, and the one for Qualified Start extra accounts), Phantom (turn Polygon on first: Settings, Active Networks), SafePal or Coinbase Wallet. Trust Wallet works but blocks a purchase that spends most of the POL in it, so keep about double the package cost there. To buy POL with a card: connect your wallet, open Buy packages, tap "Buy POL with a card". MoonPay opens with POL on Polygon and your own address filled in; pay by card, Apple Pay or Google Pay (first time needs an ID check, minimum order around $30), the POL lands in your wallet in minutes, then buy the package. The full step-by-step guide is in Training: Wallets and buying POL (' + SITE_URL + '/wallets, members only).' }, { re: /(safe|trust|rug|run away|company disappear)/i, - a: 'The money never touches us. An immutable contract splits every purchase in the same transaction, holds zero balance, and has no pause switch or upgrade path. Read the plain-language review and the verified source at https://linkspin-test.saasy.top/contract.' } + a: 'The money never touches us. An immutable contract splits every purchase in the same transaction, holds zero balance, and has no pause switch or upgrade path. Read the plain-language review and the verified source at ' + SITE_URL + '/contract.' } ]; // ---- facts for the AI fallback ---- function systemPrompt() { - return `You are the assistant on LinkSpin (https://linkspin-test.saasy.top), a membership advertising platform. + return `You are the assistant on LinkSpin (${SITE_URL}), a membership advertising platform. FACTS: - 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), each with a who-it-is-for note, Copy and Share. Same credit either way; only the first page differs. Link stats (Coaching pane) shows 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 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 (hook videos in production). 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. -- INVITE PAGES: a member's link linkspin-test.saasy.top/join/ opens a lead-capture page (email first, wallet later); add ?v=instant|adspend|free|ledger|two for an angle-matched headline. 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). +- INVITE PAGES: a member's link ' + SITE_HOST + '/join/ opens a lead-capture page (email first, wallet later); add ?v=instant|adspend|free|ledger|two for an angle-matched headline. 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 MetaMask/Phantom/SafePal (no 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. - LINE BANNER (free, set in Profile): every member can set a destination URL (must allow framing) plus an optional banner image. It is shown to their next THREE levels of new members during welcome tours (position 1 for directs, 2, 3 below), and on their public BANNER WALL at /wall/ — a shareable page showing their line ladder with their join link. Free viral traffic that compounds as the team grows; no credits spent. @@ -82,10 +83,10 @@ FACTS: - INTRO VIDEO ON THE WALL: Profile > social links has an "Intro video" field (YouTube, Vimeo or direct .mp4 link). It embeds on the member's public wall page (/wall/) right under their bio, above the three-level line and the join button. - HOLDING TANK (Members > My line > Holding tank card): free members who joined with no sponsor wait there; a member who has switched on payouts AND bought their own $20+ package can Adopt one (first come, max 2 open adoptions, 7-day window; if the person never links a wallet or buys, they fall back into the tank; a person can be adopted twice at most). Adopting sets the sponsor, opens a chat and emails the member; their first purchase then binds to the adopter on-chain. Members can also "Release to tank" one of their own free referrals (pay it forward), but NOT someone they adopted less than 3 days ago: an adoption is a commitment, and a dropped adoption still counts toward that person's two-adoption lifetime limit. Releases are posted to the feed and Telegram like pickups. Admin sees the tank under Members. - DAILY CLAIM STREAK: finishing the daily ad set and claiming pays 5 credits on day 1, 7 on day 2, 10 from day 3, and 25 on every 7th consecutive day; miss a day and it restarts. After the set, verified visits (up to 20 a day, 1 credit each) keep earning, and the credits are meant to be spent on a campaign. -- BLOG (public, linkspin-test.saasy.top/blog): Marty's coaching and teaching articles on building a line, advertising that pays, and daily habits; each article has its own page and can be shared; RSS at /blog/feed.xml. Members who want to write their own articles: not offered today. -- ACHIEVEMENT BADGES ON TELEGRAM (2026-09-13): when a member unlocks Spark/Surge/Circuit/Nexus, their personalised badge image (username on the ribbon) is posted automatically to the team's Telegram payments topic and the main group, once per badge; members cannot trigger posts themselves (the 'Post to Telegram' button is admin-only); 'Share' opens a picker (X, Facebook, Telegram, WhatsApp, LinkedIn, Massifly (copies the post and opens the feed composer), the phone's own share menu, copy link, save image) that shares the member's public badge page linkspin-test.saasy.top/b//, which shows the badge and their join link. +- BLOG (public, ${SITE_HOST}/blog): Marty's coaching and teaching articles on building a line, advertising that pays, and daily habits; each article has its own page and can be shared; RSS at /blog/feed.xml. Members who want to write their own articles: not offered today. +- ACHIEVEMENT BADGES ON TELEGRAM (2026-09-13): when a member unlocks Spark/Surge/Circuit/Nexus, their personalised badge image (username on the ribbon) is posted automatically to the team's Telegram payments topic and the main group, once per badge; members cannot trigger posts themselves (the 'Post to Telegram' button is admin-only); 'Share' opens a picker (X, Facebook, Telegram, WhatsApp, LinkedIn, Massifly (copies the post and opens the feed composer), the phone's own share menu, copy link, save image) that shares the member's public badge page ' + SITE_HOST + '/b//, which shows the badge and their join link. - PROMO TOOLKIT BY BADGE + AI COPY ENGINE (2026-09-14): Promo tools > AI Copy Engine shows the ladder: Free (links, posts, swipes, banners, wall, objections, shorts, badge pages), Spark (payouts on: one-tap campaign templates aimed at the member's link, printable handout with their QR at /handout/), Surge (first qualifying buyer; the AI Copy Engine is live: posts, DMs, follow-ups, objection replies, emails, story posts, team broadcasts in the member's name with their link, honesty rules built in; 20 free generations a month), Circuit (60 free; Video Maker renders every promo video and short with the member's own end card and QR, hosted for download; split tester compares join angles by views, joins, buyers), Nexus (150 free; Leader Ops: three-level team triage with stalled flags and one-click nudges, AI-drafted team broadcasts, credit grants from the leader's earned pool to anyone in their line, co-branded join page showing the sponsor's bio, and the member's own partner code: welcome credits funded from the leader's pool at each redemption, plus a partner kit page /partners?ref=&promo=CODE). After the free allowance each generation costs 10 ad credits from the earned pool. Credits are advertising, never money. -- MEMBER UPDATE EMAILS (2026-09-14, admin only): Admin > Releases > Email an update to members: pick release notes, add an intro, choose an audience (newsletter opt-ins, opt-ins active in the last 30 days, or everyone including those who declined), preview, send a test to the admin, then send; plain text from no-reply@linkspin-test.saasy.top with an opt-out link; the log shows sent/opted out/failed. +- MEMBER UPDATE EMAILS (2026-09-14, admin only): Admin > Releases > Email an update to members: pick release notes, add an intro, choose an audience (newsletter opt-ins, opt-ins active in the last 30 days, or everyone including those who declined), preview, send a test to the admin, then send; plain text from no-reply@${SITE_HOST} with an opt-out link; the log shows sent/opted out/failed. - LINKED POSITIONS AND BADGES (2026-09-14): qualifying buyers on a member's linked positions count toward their achievement badges (Spark/Surge/Circuit/Nexus) and light their chip on their sponsor's line, and a badge once earned never regresses. CONTRACT RULE: levels 2 and 3 are paid to the MAIN wallet only when that wallet's own count of qualifying buyers reaches 2 and 5; buyers registered under a linked position count for that position, not the main wallet. Qualified Start positions buy UNDER the main wallet, so those buys raise the main count; a member whose old wallet was swapped out (its buyers stay with the old position) needs new $20+ buyers under the current main wallet before level 2 pays it. The contract still pays levels 2 and 3 to each position based on that position's OWN qualifying buyers, so the Qualifying buyers tile shows the main position's count with the linked positions' count underneath. - CREDITS VS POL (2026-09-15, Marty's stance): EVERY member earns CREDITS (viewing, videos, visits, inbox, sign-in bonus, badge bonuses); credits are ad delivery, not money. POL is paid by the contract to a member's wallet when referrals buy packages. ALWAYS describe activation as 'the $20 starter package plus payouts switched on' and lead every earning answer with it; do NOT volunteer that level 1 can pay without a purchase. If someone asks point-blank whether a purchase is required for level-1 payouts, answer truthfully in one sentence: the contract pays level 1 to any member whose payouts are switched on, and the $20 package is what makes them a qualifying buyer for their sponsor, funds their own ads, and unlocks badges, tools, the holding tank and wall positions. A $20+ purchase by a referral makes that referral a qualifying buyer for their sponsor; 2 and 5 open levels 2 and 3. Never claim the payout itself is gated by a purchase. - PIPELINE (coming soon, built 2026-09-15; opens when the site setting pipelineMode is on): a follow-up board on the dashboard, tab 'Pipeline' between My line and Buy packages. Columns: Talking to, Joined, Wallet linked, Payouts on, Bought, Building, Later. Prospects (from the My line prospect list) and directs are placed automatically from what they have actually done (coaching rung, on-chain buys); nobody drags cards. The sponsor adds a note, a follow-up date and a tag (hot, later, no response, not interested); a 'Follow up today' strip lists due cards; stalled cards (quiet 3+ days) are flagged; each card carries the message for its exact stage with 'Open chat with this message' (member chat) or copy. Until it opens, the tab shows a coming-soon card with the roadmap date. @@ -98,10 +99,10 @@ FACTS: - MY LINE SPONSOR LINE (2026-09-14): every row on My line, all three levels, shows who sponsored that person ("sponsored by @name", or "you" for directs). - MY LINE ACTIVITY DROP-DOWN (2026-09-14): every row on My line, all three levels, has an Activity button that opens that person's activity: last seen, joined, stage and next step, ads viewed today and claim streak, campaigns active, link views in 30 days and joins, directs and qualifying buyers, wallet/payouts, badges, and a Working or Quiet verdict. Read-only, phone friendly. - GETTING STARTED CARD (2026-09-14): the top of every new member's Overview shows four steps (username, link wallet, switch on payouts, first package) with the current one explained and one button that opens the right tab and highlights the control (Wallet tab > Link wallet; then Activate payouts). Encouragement only: it can be hidden, and members who only want to view ads and earn credits are never blocked. It disappears once all four are done. -- LEADERBOARD + REFERRAL CONTEST (2026-09-14): linkspin-test.saasy.top/leaderboard ranks members by ad packages sold to people they directly sponsor (dollar value, read from the chain; a member's own linked positions and second accounts never count). Periods: this week (Monday to Sunday, Central time), this month, all time. Weekly and monthly winners are recorded automatically at rollover, announced in Telegram, and the credit prizes set by the admin (a ladder: 1st 1,000 / 2nd 500 / 3rd 250 weekly, 5,000 / 2,500 / 1,000 monthly by default) are granted automatically to those positions; the prize text is shown on the page and on the Overview's Leaderboard card, which also shows the member's own rank. Prizes are credits or packages, never cash. -- WHAT'S NEW / ROADMAP (2026-09-14): linkspin-test.saasy.top/whats-new lists release notes (what shipped, dated, tagged new/improved/fixed) and the roadmap (planned / building, with rough ETAs). The Overview has a "What's new" card with the latest three notes and what is being built; a dot marks notes since the member's last look. Written by the admin in Admin > Releases. +- LEADERBOARD + REFERRAL CONTEST (2026-09-14): ${SITE_HOST}/leaderboard ranks members by ad packages sold to people they directly sponsor (dollar value, read from the chain; a member's own linked positions and second accounts never count). Periods: this week (Monday to Sunday, Central time), this month, all time. Weekly and monthly winners are recorded automatically at rollover, announced in Telegram, and the credit prizes set by the admin (a ladder: 1st 1,000 / 2nd 500 / 3rd 250 weekly, 5,000 / 2,500 / 1,000 monthly by default) are granted automatically to those positions; the prize text is shown on the page and on the Overview's Leaderboard card, which also shows the member's own rank. Prizes are credits or packages, never cash. +- WHAT'S NEW / ROADMAP (2026-09-14): ' + SITE_HOST + '/whats-new lists release notes (what shipped, dated, tagged new/improved/fixed) and the roadmap (planned / building, with rough ETAs). The Overview has a "What's new" card with the latest three notes and what is being built; a dot marks notes since the member's last look. Written by the admin in Admin > Releases. - HOLDING TANK ALERTS: when new members land in the tank, a note at the top of every member's Overview names them (usernames) and a post goes to the team's Telegram payments topic; adopt from My line > Holding tank (your own $20 package required). -- LEGACY WELCOME (former Faucet Wave / Tier One Ads members): they join through linkspin-test.saasy.top/from/faucetwave or linkspin-test.saasy.top/from/tieroneads and, if their email is on the legacy list, welcome-back credits are added automatically at signup (former advertisers 500, former earners 150; once per person; credits, not POL). They land in the holding tank like any member who joins without a sponsor. +- LEGACY WELCOME (former Faucet Wave / Tier One Ads members): they join through ${SITE_HOST}/from/faucetwave or ${SITE_HOST}/from/tieroneads and, if their email is on the legacy list, welcome-back credits are added automatically at signup (former advertisers 500, former earners 150; once per person; credits, not POL). They land in the holding tank like any member who joins without a sponsor. - PROMO CODES: partner site owners get a reusable code; a member redeems it on a join link (?promo=CODE) or in the Overview box "Have a promo code?" and receives free ad credits (amount set per code by the admin, one use per account; codes can cap uses or expire). Credits, not POL. - DORMANT-LEAD RESCUE: a FREE referral (no wallet, no purchase) with no message from their sponsor for 10 days triggers a warning email + dashboard flag to the sponsor ("unreached, tank in N days"); at 14 days (warning at least 4 days old) the lead moves to the holding tank and the sponsor is told. Sponsor resets the clock with a chat, a Nudge, or the "Contacted them" button (for phone/text contact). Leads whose sponsor link resolves to nobody go to the tank after a day. Nothing on-chain moves; anyone bound by a purchase never moves. - PIF (pay it forward) button: on a free direct or an adopted member who has linked a wallet, the sponsor taps PIF, enters an amount (suggested: the $20 package plus fees), and their OWN wallet app opens with the member's address prefilled; the POL goes wallet to wallet. The site never touches the funds; it only logs the transaction and tells the recipient with a Polygonscan link. The gift is theirs; nothing forces a purchase. @@ -157,11 +158,11 @@ async function answer(message, historyText) { const msg = String(message || '').trim(); if (!msg) return { error: 'Say something first.' }; for (const c of CANNED) if (c.re.test(msg)) return { reply: c.a, canned: true }; - if (!enabled()) return { reply: 'Good question. The quick answers I have cover packages, payouts, qualification, and joining; for anything deeper, the plain-language contract review at https://linkspin-test.saasy.top/contract covers most of it.' }; + if (!enabled()) return { reply: 'Good question. The quick answers I have cover packages, payouts, qualification, and joining; for anything deeper, the plain-language contract review at ' + SITE_URL + '/contract covers most of it.' }; try { return { reply: await askAI(msg, historyText) }; } catch (e) { console.error('chat AI failed', e.message); - return { reply: 'I hit a snag answering that one. The contract review at https://linkspin-test.saasy.top/contract and the live ledger at https://linkspin-test.saasy.top/ledger cover most deep questions.' }; + return { reply: 'I hit a snag answering that one. The contract review at ' + SITE_URL + '/contract and the live ledger at ' + SITE_URL + '/ledger cover most deep questions.' }; } } diff --git a/coach.js b/coach.js index 5aabcb4..3db61d3 100644 --- a/coach.js +++ b/coach.js @@ -2,6 +2,7 @@ // automatic nudges to stalled members, a weekly digest to their sponsor, a // prospect list per member, and per-angle link stats. Dual-mode store like the // other modules (MySQL when DATABASE_URL is set, JSON files on the volume otherwise). +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const db = require('./db'); @@ -224,7 +225,7 @@ async function nudgeTick() { if (last && (last.rung === c.rung || now - last.ts < NUDGE_GAP)) continue; // one email per rung, never more than one every 5 days const spon = await accounts.sponsorOf(acct.email); const who = spon ? (spon.username ? '@' + spon.username : 'your sponsor') : null; - const body = R.mail[1] + '\n\nOpen your dashboard: https://linkspin-test.saasy.top/my' + (who ? '\n\nStuck? Message ' + who + ' from My line, that is what they are there for.' : '') + '\n\nLinkSpin'; + const body = R.mail[1] + '\n\nOpen your dashboard: ' + SITE_URL + '/my' + (who ? '\n\nStuck? Message ' + who + ' from My line, that is what they are there for.' : '') + '\n\nLinkSpin'; try { await mailer.send(acct.email, R.mail[0], body); await impl().setNudge(acct.email, c.rung, now); nudges += 1; } catch (e) { console.error('nudge', acct.email, e.message); } if (nudges >= 40) break; // spread the load across ticks @@ -248,24 +249,24 @@ async function nudgeTick() { try { const ids = [acct.memberId, ...(await accounts.positions(acct.email)).map(p => p.memberId)].filter(Boolean); const bal = await X.ads.balances(ids, acct.email); - if (bal.available > 0) parts.push('- You have ' + bal.available.toLocaleString() + ' ad credits sitting unspent. That is ' + bal.available.toLocaleString() + ' cents of delivery doing nothing. Campaigns > New campaign, point it at your invite link: https://linkspin-test.saasy.top/my#campaigns'); + if (bal.available > 0) parts.push('- You have ' + bal.available.toLocaleString() + ' ad credits sitting unspent. That is ' + bal.available.toLocaleString() + ' cents of delivery doing nothing. Campaigns > New campaign, point it at your invite link: ' + SITE_URL + '/my#campaigns'); else if (bal.inCampaigns > 0) parts.push('- All ' + bal.inCampaigns.toLocaleString() + ' of your credits are working in live campaigns. Good.'); } catch (e) {} // streak try { const st = await X.ads.viewStatus(acct.email); if (st.streakDay > 1) parts.push('- Your claim streak is on day ' + st.streakDay + '. Today\'s claim pays ' + (st.claimCredits || 0) + ' credits; miss a day and it restarts at 5.'); - else parts.push('- Five ads and a claim a day is the free way in: 5, 7, 10, then 25 credits every seventh day in a row: https://linkspin-test.saasy.top/my#earn'); + else parts.push('- Five ads and a claim a day is the free way in: 5, 7, 10, then 25 credits every seventh day in a row: ' + SITE_URL + '/my#earn'); } catch (e) {} // contest if (lbWeek && lbWeek.top) { const me = lbWeek.top.find(r => r.name === '@' + acct.username) || null; let mine = me; if (!mine) { try { mine = (await X.lb().view('week', acct.email)).me; } catch (e) {} } parts.push('- Referral contest this week (' + (lbWeek.prize || 'credits to the top 3') + '): ' + (lbWeek.top.length ? lbWeek.top.slice(0, 3).map(r => r.rank + '. ' + r.name + ' (' + r.sales + ' sold)').join(', ') : 'no sales yet, first sale takes the top spot') + '.' - + (mine ? ' You are #' + mine.rank + ' with ' + mine.sales + ' sold.' : ' You are not on the board yet; one $20 package bought by someone you sponsor puts you there.') + ' https://linkspin-test.saasy.top/leaderboard'); + + (mine ? ' You are #' + mine.rank + ' with ' + mine.sales + ' sold.' : ' You are not on the board yet; one $20 package bought by someone you sponsor puts you there.') + ' ' + SITE_URL + '/leaderboard'); } // tank - if (tankN > 0 && acct.memberId) parts.push('- ' + tankN + ' member' + (tankN === 1 ? ' is' : 's are') + ' waiting for a sponsor in the holding tank. Adopt one from My line: https://linkspin-test.saasy.top/my#line'); + if (tankN > 0 && acct.memberId) parts.push('- ' + tankN + ' member' + (tankN === 1 ? ' is' : 's are') + ' waiting for a sponsor in the holding tank. Adopt one from My line: ' + SITE_URL + '/my#line'); // line (sponsors only) if (view.directs.length) { const week = view.directs.filter(d => now - d.joined < 7 * DAY).length; @@ -273,7 +274,7 @@ async function nudgeTick() { const actions = view.directs.filter(d => d.stalled).slice(0, 3).map(d => ' Message ' + d.name + ': "' + d.say.replace('{{name}}', d.name.replace(/^@/, '')) + '"'); if (actions.length) parts.push(actions.join('\n')); } - parts.push('\nTwenty minutes, in order: the set, one message to your line, the tank, one conversation outward. https://linkspin-test.saasy.top/blog/the-twenty-minute-day\n\nLinkSpin · https://linkspin-test.saasy.top/my\nNo income is guaranteed. Credits are advertising, not money.'); + parts.push('\nTwenty minutes, in order: the set, one message to your line, the tank, one conversation outward. ' + SITE_URL + '/blog/the-twenty-minute-day\n\nLinkSpin · ' + SITE_URL + '/my\nNo income is guaranteed. Credits are advertising, not money.'); const subject = lbWeek && lbWeek.top && lbWeek.top.length && lbWeek.top[0].name === '@' + acct.username ? 'You are #1 this week on LinkSpin' : 'Your week on LinkSpin: credits, streak, contest'; try { await mailer.send(acct.email, subject, parts.join('\n')); digests += 1; } catch (e) { console.error('digest', acct.email, e.message); } await impl().setDigest(acct.email, now); diff --git a/drip.js b/drip.js index 28704dd..f158fea 100644 --- a/drip.js +++ b/drip.js @@ -3,12 +3,13 @@ // sends each step when it comes due; a signed unsubscribe link stops it. // Sequence copy lives in DATA_DIR/drip.json (admin-editable) with the // defaults below. Dual-mode storage like the rest of the site (MySQL / JSON). +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const crypto = require('crypto'); const db = require('./db'); -let DATA_DIR = null, mailer = null, accounts = null, chain = null, SITE = 'https://linkspin-test.saasy.top'; +let DATA_DIR = null, mailer = null, accounts = null, chain = null, SITE = SITE_URL; // hours = time after the account was created. Copy drafted through Marty's // Branded Voice engine (one framework per email: gain, logic, PAS, logic, diff --git a/geo.js b/geo.js index 0cbe9a2..4363670 100644 --- a/geo.js +++ b/geo.js @@ -4,6 +4,7 @@ // The server downloads the current month's CSV once, keeps it in DATA_DIR/geo/, // loads it into sorted range tables (IPv4 as uint32, IPv6 as BigInt) and answers // countryOf(ip) by binary search. Refreshes monthly. +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const https = require('https'); @@ -62,7 +63,7 @@ function download(mk) { return new Promise((resolve, reject) => { fs.mkdirSync(path.join(DATA_DIR, 'geo'), { recursive: true }); const tmp = fileFor(mk) + '.part'; - const req = https.get('https://download.db-ip.com/free/dbip-country-lite-' + mk + '.csv.gz', { headers: { 'User-Agent': 'LinkSpin/1.0 (+https://linkspin-test.saasy.top)' }, timeout: 60000 }, res => { + const req = https.get('https://download.db-ip.com/free/dbip-country-lite-' + mk + '.csv.gz', { headers: { 'User-Agent': 'LinkSpin/1.0 (+' + SITE_URL + ')' }, timeout: 60000 }, res => { if (res.statusCode !== 200) { res.resume(); return reject(new Error('HTTP ' + res.statusCode)); } const out = fs.createWriteStream(tmp); res.pipe(out); out.on('finish', () => { fs.renameSync(tmp, fileFor(mk)); resolve(fileFor(mk)); }); out.on('error', reject); diff --git a/host.js b/host.js new file mode 100644 index 0000000..5cf7a17 --- /dev/null +++ b/host.js @@ -0,0 +1,7 @@ +// The one place the site knows its own address. SITE_HOST comes from the environment (Coolify sets it per +// deployment: linkspin-test.saasy.top on the test app, linkspin.app in production). Every module that writes a +// link into an email, a Telegram post, a QR code, an ad click URL or an OG tag reads it from here, so a fork or a +// domain move is an env change, never a search-and-replace (2026-10-07: the first brand fork left ~90 literals). +const SITE_HOST = String(process.env.SITE_HOST || 'linkspin-test.saasy.top').trim().toLowerCase(); +const SITE_URL = 'https://' + SITE_HOST; +module.exports = { SITE_HOST, SITE_URL }; diff --git a/leaderboard.js b/leaderboard.js index 6298df0..734a12a 100644 --- a/leaderboard.js +++ b/leaderboard.js @@ -3,6 +3,7 @@ // positions and second accounts do not count for them (only sales to other people's accounts). Periods run // on Central time: week = Monday 00:00 to Sunday 23:59, month = calendar month. Winners are recorded at // rollover (checked hourly), announced to Telegram, and credit prizes are granted automatically. +const { SITE_HOST, SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); let R = null; // { chain, accounts, ads, dataDir, siteConfig, notify(text), pushFeed(ev) } @@ -114,7 +115,7 @@ async function rolloverTick() { for (let i = 0; i < lad.length && i < top.length; i++) { try { await R.ads.addEarned(top[i].email, lad[i]); rec.granted.push({ rank: i + 1, name: top[i].name, credits: lad[i] }); } catch (e) {} } if (top[0]) { const when = new Date(prevStart).toLocaleDateString('en-US', { timeZone: TZ, month: 'short', day: 'numeric' }); - const line = '\u{1F3C6} LinkSpin · ' + (kind === 'week' ? 'Weekly' : 'Monthly') + ' referral contest (from ' + when + '): ' + top[0].name + ' wins with ' + top[0].sales + ' package' + (top[0].sales === 1 ? '' : 's') + ' sold ($' + top[0].usd + ')' + (top[1] ? ' · 2nd ' + top[1].name + ' ($' + top[1].usd + ')' : '') + (top[2] ? ' · 3rd ' + top[2].name + ' ($' + top[2].usd + ')' : '') + (rec.granted.length ? '\nCredits awarded: ' + rec.granted.map(g => g.name + ' +' + g.credits.toLocaleString()).join(', ') : (prize ? '\nPrize: ' + prize : '')) + '\nlinkspin-test.saasy.top/leaderboard'; + const line = '\u{1F3C6} LinkSpin · ' + (kind === 'week' ? 'Weekly' : 'Monthly') + ' referral contest (from ' + when + '): ' + top[0].name + ' wins with ' + top[0].sales + ' package' + (top[0].sales === 1 ? '' : 's') + ' sold ($' + top[0].usd + ')' + (top[1] ? ' · 2nd ' + top[1].name + ' ($' + top[1].usd + ')' : '') + (top[2] ? ' · 3rd ' + top[2].name + ' ($' + top[2].usd + ')' : '') + (rec.granted.length ? '\nCredits awarded: ' + rec.granted.map(g => g.name + ' +' + g.credits.toLocaleString()).join(', ') : (prize ? '\nPrize: ' + prize : '')) + '\n' + SITE_HOST + '/leaderboard'; try { await R.notify(line); } catch (e) {} try { R.pushFeed({ type: 'Contest', kind, winner: top[0].name, ts: now }); } catch (e) {} } @@ -130,7 +131,7 @@ async function renderPage() { + (v.top.length ? v.top.map(r => '' + r.rank + '' + esc(r.name) + '' + r.sales + '$' + r.usd.toLocaleString() + '' + r.buyers + '' + r.joins + '').join('') : 'No sales yet in this period.') + ''; const fmtD = ts => new Date(ts).toLocaleDateString('en-US', { timeZone: TZ, month: 'short', day: 'numeric' }); const desc = 'Who is selling the most ad packages on LinkSpin this week and this month. Weekly and monthly referral contest standings, read from the chain.'; - let h = 'Leaderboard | LinkSpin' + let h = 'Leaderboard | LinkSpin' + '' + '
' + '

Referral contest

Leaderboard: who is selling.

Ranked by ad packages sold to other people (your own positions never count, and the company account is not a contestant). Read from the chain, updated live. Weeks run Monday to Sunday, Central time.

'; diff --git a/mailer.js b/mailer.js index 7f6000c..58dfa8d 100644 --- a/mailer.js +++ b/mailer.js @@ -1,12 +1,13 @@ -// Outbound mail via SendGrid v3 (domain-authenticated linkspin-test.saasy.top). +// Outbound mail via SendGrid v3 (domain-authenticated the site host). // Key sources: SENDGRID_KEY env, else DATA_DIR/sendgrid.key in the volume. // No key = email sign-in stays feature-flagged off in production. +const { SITE_HOST, SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const https = require('https'); let DATA_DIR = null; -const FROM = { email: 'no-reply@linkspin-test.saasy.top', name: 'LinkSpin' }; +const FROM = { email: 'no-reply@' + SITE_HOST, name: 'LinkSpin' }; function init(opts) { DATA_DIR = opts.dataDir; } function key() { @@ -46,7 +47,7 @@ function sendCode(to, code) { return send(to, code + ' is your LinkSpin sign-in code', 'Your sign-in code is: ' + code + '\n\n' + 'It works for 15 minutes. If you did not request it, ignore this email.\n\n' - + 'LinkSpin\nAdvertise and earn instantly. Locked in code, not promises.\nhttps://linkspin-test.saasy.top'); + + 'LinkSpin\nAdvertise and earn instantly. Locked in code, not promises.\n' + SITE_URL); } module.exports = { init, hasKey, send, sendCode }; diff --git a/nas.js b/nas.js index 94fa5ff..fc31bdd 100644 --- a/nas.js +++ b/nas.js @@ -12,6 +12,7 @@ // // FEATURE-FLAGGED: inert unless NAS_DB_HOST/USER/PASSWORD/NAME are all set. // Nothing here runs (no connection, no writes) when the flag is off. +const { SITE_HOST, SITE_URL } = require('./host'); const crypto = require('crypto'); let pool = null; @@ -76,9 +77,9 @@ async function pushCampaign(c, opts = {}) { Name, Email, PaymentDetails, EDate, sp, width, height, BannerURL, pid, ref_by, catid) VALUES (?,?,?,?,?,?,0,1,?,?,?,?,?,?,'',?,?,?,?,0,?)`, // clicks route through our redirect so they count and carry the network site as the referrer - [token, c.title || null, c.type === 'text' ? (c.body || null) : null, 'https://linkspin-test.saasy.top/api/ads/click/' + c.id, + [token, c.title || null, c.type === 'text' ? (c.body || null) : null, SITE_URL + '/api/ads/click/' + c.id, assigned, assigned, now, kind.adtype, - opts.name || 'LinkSpin member', opts.email || 'ads@linkspin-test.saasy.top', + opts.name || 'LinkSpin member', opts.email || 'ads@' + SITE_HOST, 'LinkSpin campaign #' + c.id, edate, c.width || '', c.height || '', c.type === 'banner' ? c.imageUrl : null, kind.pid, CATID_CRYPTO]); return { nasAdId: ad.insertId, manageToken: token, assigned }; @@ -111,7 +112,7 @@ async function deactivate(nasAdId) { // point an existing NAS ad at our click redirect (migration for rows pushed before 2026-09-10) async function setClickUrl(nasAdId, campaignId) { if (!enabled()) return { skipped: 'flag-off' }; - await q('UPDATE sponsorads SET WebsiteURL=? WHERE ID=?', ['https://linkspin-test.saasy.top/api/ads/click/' + Number(campaignId), Number(nasAdId)]); + await q('UPDATE sponsorads SET WebsiteURL=? WHERE ID=?', [SITE_URL + '/api/ads/click/' + Number(campaignId), Number(nasAdId)]); return { ok: true }; } async function topUp(nasAdId, addImpressions, days) { diff --git a/public/admin.html b/public/admin.html index 1bdad5b..357d9b4 100644 --- a/public/admin.html +++ b/public/admin.html @@ -308,7 +308,7 @@

By day

page views, signups

Partner promo codes

free ad credits for members who redeem a partner's code
-

Give a site owner a code. Their members redeem it on a join link (linkspin-test.saasy.top/join/martbost?promo=CODE) or in the "Have a promo code?" box on the Overview. One use per account; uses and the last redemptions are listed below.

+

Give a site owner a code. Their members redeem it on a join link ({{SITE_HOST}}/join/martbost?promo=CODE) or in the "Have a promo code?" box on the Overview. One use per account; uses and the last redemptions are listed below.

@@ -325,7 +325,7 @@
-
linkspin-test.saasy.top/ledger
+
{{SITE_HOST}}/ledger
🧾 member #7 bought package #2 ($20.00)−213 POL
💸 level 1 payout → member #3+106.5 POL
diff --git a/public/join.html b/public/join.html index ff9fd92..5d39ea0 100644 --- a/public/join.html +++ b/public/join.html @@ -94,7 +94,7 @@
-
linkspin-test.saasy.top/ledger · worked example
+
{{SITE_HOST}}/ledger · worked example
🧾 member #7 bought package #2 ($20.00)paid
💸 level 1 payout → member #3 (50%)same block
diff --git a/public/ledger.html b/public/ledger.html index fac3453..2cb390a 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -4,16 +4,16 @@ Live ledger | LinkSpin - + - + - + - + diff --git a/public/partners.html b/public/partners.html index aa5724e..12df7dc 100644 --- a/public/partners.html +++ b/public/partners.html @@ -106,9 +106,9 @@

Setting it up takes about fifteen minutes

    -
  1. Claim your spot with the button below. It places you directly under the company at the top. Join with your email and pick your username; your own invite link is live immediately: linkspin-test.saasy.top/join/yourname.
  2. +
  3. Claim your spot with the button below. It places you directly under the company at the top. Join with your email and pick your username; your own invite link is live immediately: {{SITE_HOST}}/join/yourname.
  4. Send me your username and the site you are listing it on. I mint your code with the credit amount we agree on.
  5. -
  6. Add LinkSpin to your downline builder with your link plus the code: https://linkspin-test.saasy.top/join/yourname?promo=YOURCODE. Members who click it land under you and their credits apply the moment their account exists.
  7. +
  8. Add LinkSpin to your downline builder with your link plus the code: {{SITE_URL}}/join/yourname?promo=YOURCODE. Members who click it land under you and their credits apply the moment their account exists.
  9. Use the banners and text ads from the kit. Members who already have an account can type the code into the "Have a promo code?" box on their Overview.
  10. Link a wallet, switch on payouts, and activate with at least the $20 package. That claims your spot at the top and makes you a qualifying buyer in your own right.
diff --git a/public/robots.txt b/public/robots.txt index 694cfb4..f04ee48 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -3,4 +3,4 @@ Allow: / Disallow: /my Disallow: /admin Disallow: /api/ -Sitemap: https://linkspin-test.saasy.top/sitemap.xml +Sitemap: {{SITE_URL}}/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml deleted file mode 100644 index 7eb7f06..0000000 --- a/public/sitemap.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - https://instantadpay.com/daily1.0 - https://instantadpay.com/ledgeralways0.8 - https://instantadpay.com/contractmonthly0.7 - diff --git a/releases.js b/releases.js index c14937a..9cff447 100644 --- a/releases.js +++ b/releases.js @@ -1,10 +1,11 @@ // Release notes + roadmap (Marty, 2026-09-14): what shipped and what is coming, written in Admin > Releases, // shown on the public /whats-new page and in a "What's new" card on every member's Overview. // Storage: DATA_DIR/releases.json { notes: [{id, date, title, body, tags[]}], roadmap: [{id, title, note, status, eta}] } +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); let FILE = null; -const SITE = 'https://linkspin-test.saasy.top'; +const SITE = SITE_URL; const TAGS = ['new', 'improved', 'fixed']; const STATUSES = ['planned', 'building', 'done']; const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); diff --git a/server.js b/server.js index ab8508a..3c14b3b 100644 --- a/server.js +++ b/server.js @@ -58,7 +58,7 @@ const PUBLIC_DIR = path.join(ROOT, 'public'); const DATA_DIR = process.env.DATA_DIR || path.join(ROOT, 'data'); const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD || 'changeme'; const ADMIN_EMAIL = String(process.env.ADMIN_EMAIL || '').trim().toLowerCase(); -const SITE_HOST = String(process.env.SITE_HOST || 'linkspin-test.saasy.top').trim().toLowerCase(); +const { SITE_HOST, SITE_URL } = require('./host'); // Admin portal sessions: email-code sign-in allowlisted to ADMIN_EMAIL, kept // in the volume so a restart doesn't log the admin out. Separate cookie and // store from member sessions; the Bearer ADMIN_PASSWORD API path still works. @@ -174,7 +174,7 @@ function parseWallOffers(a) { // Configurable by dropping data/admin-wall-ads.json ([{name,targetUrl,bannerUrl}]). function getAdminWallAds() { try { const j = JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'admin-wall-ads.json'), 'utf8')); if (Array.isArray(j) && j.length) return j; } catch (e) {} - return [{ name: 'LinkSpin', targetUrl: 'https://linkspin-test.saasy.top/', bannerUrl: null }]; + return [{ name: 'LinkSpin', targetUrl: SITE_URL + '/', bannerUrl: null }]; } const chatHits = new Map(); function chatLimited(ip) { @@ -272,8 +272,12 @@ function frameFetch(url, depth) { if (de) return resolve({ error: 'that domain does not resolve' }); if (PRIVATE_IP.test(addr)) return resolve({ error: 'that address is not reachable from here' }); const mod = u.protocol === 'https:' ? https : http; - const rq = mod.get(u.href, { timeout: 8000, - headers: { 'User-Agent': 'Mozilla/5.0 (compatible; LinkSpin-FrameCheck/1.0)', Accept: 'text/html' } }, r => { + // Our own hosts (the app and the link domains) answer the curtain's 503 to anonymous fetches while the + // app is curtained, which made a test ad aimed at a spin link look dead (2026-10-07). Carry the pass. + const own = [SITE_HOST].concat(String(siteConfig().linkDomains || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean)); + const hdrs = { 'User-Agent': 'Mozilla/5.0 (compatible; LinkSpin-FrameCheck/1.0)', Accept: 'text/html' }; + if (CURTAIN && own.includes(u.hostname.toLowerCase())) hdrs.Cookie = 'ls.pass=' + encodeURIComponent(CURTAIN); + const rq = mod.get(u.href, { timeout: 8000, headers: hdrs }, r => { const loc = r.headers.location; r.resume(); // headers are all we need if ([301, 302, 303, 307, 308].includes(r.statusCode) && loc && depth < 4) { @@ -327,10 +331,10 @@ async function handleUpload(req, res, who) { const JOIN_ALIASES = { company: 'martbost', top: 'martbost' }; // neutral partner links -> the top position const JOIN_ANGLES = { // legacy bridge pages (/from/): former members of Marty's closed EvolutionScript sites - 'fw-adv': { t: 'Your next ad budget pays you back.', d: 'Faucet Wave closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/faucetwave?seg=advertiser' }, - 'fw-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Faucet Wave. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/faucetwave' }, - 't1-adv': { t: 'Your next ad budget pays you back.', d: 'Tier One Ads closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/tieroneads?seg=advertiser' }, - 't1-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Tier One Ads. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/tieroneads' }, + 'fw-adv': { t: 'Your next ad budget pays you back.', d: 'Faucet Wave closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: SITE_URL + '/from/faucetwave?seg=advertiser' }, + 'fw-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Faucet Wave. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: SITE_URL + '/from/faucetwave' }, + 't1-adv': { t: 'Your next ad budget pays you back.', d: 'Tier One Ads closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: SITE_URL + '/from/tieroneads?seg=advertiser' }, + 't1-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Tier One Ads. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: SITE_URL + '/from/tieroneads' }, instant: { t: 'Paid before the page reloads.', d: 'A smart contract on Polygon splits every ad package the moment it sells. Same transaction, real wallets, public ledger. Join free by email.' }, adspend: { t: 'You were buying ads anyway.', d: 'Here the ad spend in your line pays you, in the same transaction, on a public ledger. Seven formats, packages from $5. Join free.' }, free: { t: 'Watch first. Spend never.', d: 'Join free, view a few ads, earn credits, run your first campaign for zero dollars. Every payout public on Polygon.' }, @@ -340,7 +344,7 @@ const JOIN_ANGLES = { function serveJoinPage(res, tok, angle, ang, setCookies) { let html; try { html = fs.readFileSync(path.join(PUBLIC_DIR, 'join.html'), 'utf8'); } catch (e) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); } - const base = 'https://linkspin-test.saasy.top'; + const base = SITE_URL; const url = (ang && ang.url) || (base + '/join/' + tok + (angle ? '?v=' + angle : '')); const title = ang ? ang.t : 'Advertise and earn. Paid on-chain, instantly.'; const desc = ang ? ang.d : 'You are invited to LinkSpin: real ad packages with same-transaction payouts on Polygon, every payment public. Join free by email.'; @@ -366,7 +370,7 @@ async function frameCheck(url) { const fa = /frame-ancestors\s+([^;]+)/i.exec(String(h.csp)); if (fa && !fa[1].split(/\s+/).some(x => { const v = x.replace(/['"]/g, '').toLowerCase(); - return v === '*' || v === 'https:' || v.includes('linkspin-test.saasy.top'); + return v === '*' || v === 'https:' || v.includes(SITE_HOST); })) return { ok: false, reason: 'That site blocks framing (CSP frame-ancestors), so it would show members a blank page in the ad viewer. Use a landing page that allows framing.' }; return { ok: true }; @@ -375,13 +379,13 @@ async function boot() { await db.init({ dataDir: DATA_DIR }); // no-op without DATABASE_URL (JSON mode) chain.init({ onEvent: ev => { attachNames([ev]).then(a => pushFeed(a[0])).catch(() => pushFeed(ev)); emailOnEvent(ev).catch(() => {}); telegramOnEvent(ev).catch(() => {}); if (ev && ev.type === 'Purchase' && ev.buyerId) accounts.byMemberId(Number(ev.buyerId)).then(a => { if (a) return postbacks.convertFor(a.email, 'purchase', { payout: (Number(ev.priceCents) || 0) / 100, currency: 'USD', txid: ev.tx || '' }); }).catch(() => {}); } }); - auth.init({ dataDir: DATA_DIR, chain, isProd: IS_PROD, site: 'linkspin-test.saasy.top' }); + auth.init({ dataDir: DATA_DIR, chain, isProd: IS_PROD, site: SITE_HOST }); accounts.init({ dataDir: DATA_DIR }); ads.init({ dataDir: DATA_DIR, chain }); mailer.init({ dataDir: DATA_DIR }); messages.init({ dataDir: DATA_DIR }); reports.init({ dataDir: DATA_DIR }); - drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: 'https://linkspin-test.saasy.top' }); + drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: SITE_URL }); chatbot.init({ dataDir: DATA_DIR, chain }); 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); @@ -398,7 +402,7 @@ async function boot() { pages.init({ dataDir: DATA_DIR, ownHosts, openrouterKey: () => { if (process.env.OPENROUTER_API_KEY) return process.env.OPENROUTER_API_KEY.trim(); try { return fs.readFileSync(path.join(DATA_DIR, 'openrouter.key'), 'utf8').trim(); } catch (e) { return ''; } } }); snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, send: async (c, t, th) => { await telegramSend(c, t, th); return true; } }); setInterval(() => snapshot.tick().catch(e => console.error('snapshot', e.message)), 10 * 60 * 1000); - tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: 'https://linkspin-test.saasy.top' }); + tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: SITE_URL }); legacy.init({ dataDir: DATA_DIR }); traffic.init({ dataDir: DATA_DIR }); promos.init({ dataDir: DATA_DIR }); @@ -449,7 +453,7 @@ function siteConfig() { tagline: 'Advertise and earn. Locked in code, not promises.', rehearsal: true, // shows the testnet banner; flipped off at mainnet launch // payment-proof Telegram feed (blank = off) and the P&L pane's fixed monthly cost - telegramBotToken: '', telegramChatId: '', telegramTopicId: '', telegramEvents: 'payouts', telegramCtaUrl: 'https://linkspin-test.saasy.top/', + telegramBotToken: '', telegramChatId: '', telegramTopicId: '', telegramEvents: 'payouts', telegramCtaUrl: SITE_URL + '/', telegramEchoChatId: '', telegramEchoTopicId: '', telegramEchoEvents: 'payouts', // shared cross-program payments topic telegramAdminChatId: '', // private chat for admin alerts (sign-up guard bursts); falls back to ADMIN_EMAIL launchAt: '', // public launch moment, ISO 8601 with offset (e.g. 2026-09-18T19:00:00-05:00): countdown on /launch + dashboard mark @@ -489,6 +493,9 @@ function sendFile(res, file) { fs.readFile(file, (err, data) => { if (err) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); } const ext = path.extname(file).toLowerCase(); + // Public pages carry {{SITE_URL}} / {{SITE_HOST}} in canonical, OG and sitemap lines so the same files + // serve every deployment (test host today, linkspin.app at launch); filled here, per request. + if (ext === '.html' || ext === '.txt' || ext === '.xml') data = Buffer.from(data.toString('utf8').split('{{SITE_URL}}').join(SITE_URL).split('{{SITE_HOST}}').join(SITE_HOST)); res.writeHead(200, baseHeaders({ 'Content-Type': MIME[ext] || 'application/octet-stream', // HTML is never stored (so a fresh load always gets the current asset // versions — aggressive in-app wallet browsers were serving stale pages @@ -600,7 +607,7 @@ async function notifyNewReferral(ref, newAcct) { + 'They count toward your qualification once they make a $20+ purchase.\n\n'; if (!owner.address) body += 'Make sure payouts are switched on (one free wallet step) so you never miss a commission — ' + 'the contract locks each buyer to their sponsor at their first purchase.\n\n'; - body += 'See your team: https://linkspin-test.saasy.top/my\n\nLinkSpin'; + body += 'See your team: ' + SITE_URL + '/my\n\nLinkSpin'; mailer.send(owner.email, 'You have a new referral on LinkSpin', body) .catch(e => console.error('referral notify failed', e.message)); } catch (e) {} @@ -632,7 +639,7 @@ async function sendWelcome(email, ref) { + '1. Pick your username and fill out your profile.\n' + '2. Grab your invite link and start sharing to build your line.\n' + '3. Explore the ad packages when you are ready. Every payout settles on-chain, straight to your wallet.\n\n' - + 'Sign in anytime: https://linkspin-test.saasy.top/my\n\nLinkSpin').catch(() => {}); + + 'Sign in anytime: ' + SITE_URL + '/my\n\nLinkSpin').catch(() => {}); } catch (e) {} } // on-chain event emails: a payout received, or a payout that passed you by @@ -642,7 +649,7 @@ async function emailOnEvent(ev) { const notify = async (memberId, subject, body) => { if (!memberId || !mailer.hasKey()) return; const a = await accounts.byMemberId(memberId); - if (a && a.email) mailer.send(a.email, subject, body + '\n\nSee it on the live ledger: https://linkspin-test.saasy.top/ledger\n\nLinkSpin').catch(() => {}); + if (a && a.email) mailer.send(a.email, subject, body + '\n\nSee it on the live ledger: ' + SITE_URL + '/ledger\n\nLinkSpin').catch(() => {}); }; // Marty (2026-09-15): payment and missed-payment notices also land in the on-site inbox, so // they are waiting (login modal + Messages card) whether or not the email was read. Sent as @@ -654,7 +661,7 @@ async function emailOnEvent(ev) { if (!a || !a.email) return; const html = '

' + String(text).replace(/&/g, '&').replace(//g, '>') .replace(/(https:\/\/[^\s]+)/g, '$1').split('\n\n').join('

').replace(/\n/g, '
') + '

'; - await messages.deliver(1, ADMIN_EMAIL || 'house@linkspin-test.saasy.top', [a.email], subject, html); + await messages.deliver(1, ADMIN_EMAIL || 'house@' + SITE_HOST, [a.email], subject, html); } catch (e) {} }; const tell = async (memberId, subject, text) => { await notify(memberId, subject, text); await inboxNote(memberId, subject, text); }; @@ -689,7 +696,7 @@ async function emailOnEvent(ev) { : ' (Purchases under $20 do not count toward qualification.)'; mailer.send(sp.email, bn + ' just bought a ' + usd + ' ad package', 'Your referral ' + bn + ' (member #' + ev.buyerId + ') just purchased a package (' + usd + ' — ' + ev.creditAmount + ' credits).' + qual + '\n\n' + - 'See your team and the live ledger: https://linkspin-test.saasy.top/my\n\nLinkSpin').catch(() => {}); + 'See your team and the live ledger: ' + SITE_URL + '/my\n\nLinkSpin').catch(() => {}); } } } catch (e) {} @@ -700,9 +707,9 @@ async function emailOnEvent(ev) { const pol = weiToPol(ev.amountWei); await tell(ev.recipientId, 'You just got paid ' + pol + ' POL on LinkSpin', buyer + ' just bought an ad package on your level ' + ev.tier + (pur ? ' ($' + (pur.priceCents / 100).toFixed(2).replace(/\.00$/, '') + ')' : '') + '. Your ' + pct + ' percent share, ' + pol + ' POL' + usdShare(pur, pct) + ', landed in your wallet in the same transaction' + (ev.hops ? ', passed up to you because someone between you was not qualified for this level' : '') + '.\n\n' + - 'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://linkspin-test.saasy.top/my'); + 'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: ' + SITE_URL + '/my'); } - else if (ev.type === 'AwardPaid') await tell(ev.toId, 'You just got paid ' + weiToPol(ev.amountWei) + ' POL on LinkSpin', weiToPol(ev.amountWei) + ' POL just landed in your wallet.\n\nTransaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://linkspin-test.saasy.top/my'); + else if (ev.type === 'AwardPaid') await tell(ev.toId, 'You just got paid ' + weiToPol(ev.amountWei) + ' POL on LinkSpin', weiToPol(ev.amountWei) + ' POL just landed in your wallet.\n\nTransaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: ' + SITE_URL + '/my'); else if (ev.type === 'PassedUp' && ev.reason === 'send-failed') { // the member WAS qualified but their wallet rejected the POL (usually a smart-contract // wallet that needs more than the capped gas): tell them and the admin, loudly @@ -722,7 +729,7 @@ async function emailOnEvent(ev) { buyer + ' just bought an ad package on your level ' + ev.tier + '. Your share was ' + what + ', and it passed you by because level ' + ev.tier + ' is not open on your account yet. The contract paid it to the next qualified person above you.\n\n' + 'Level ' + ev.tier + ' opens at ' + need + ' qualifying buyers (people you referred who bought a $20 or larger package). You have ' + bc + (short ? ', so you are ' + short + ' buyer' + (short === 1 ? '' : 's') + ' away.' : '.') + '\n\n' + 'Two ways to close the gap: bring ' + (short || 1) + ' more buyer' + (short === 1 ? '' : 's') + ' from your My line page, or use Qualified Start under Buy packages to be your own buyer today. Every package on level ' + ev.tier + ' pays you ' + pct + ' percent once it is open, and the next one is coming whether you are ready or not.\n\n' + - 'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://linkspin-test.saasy.top/my'); + 'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: ' + SITE_URL + '/my'); } } // payment-proof Telegram feed (same pattern as the RM Circle proof channel): one compact @@ -767,7 +774,7 @@ async function tankNotifyTick() { const named = fresh.filter(w => w.username).map(w => '@' + w.username); const who = named.length ? ': ' + named.slice(0, 8).join(', ') + (named.length > 8 ? ' and ' + (named.length - 8) + ' more' : '') : ''; const text = '\u{1FAA3} LinkSpin \u00b7 ' + fresh.length + ' new member' + (fresh.length === 1 ? '' : 's') + ' waiting for a sponsor in the holding tank' + who - + '\nAdopt from My line \u203a Holding tank: linkspin-test.saasy.top/my'; + + '\nAdopt from My line \u203a Holding tank: ' + SITE_HOST + '/my'; await telegramSend(sc.telegramEchoChatId, text, sc.telegramEchoTopicId); } // one sendMessage call; never throws, never logs the token @@ -953,7 +960,7 @@ const server = http.createServer(async (req, res) => { if (m && (req.method === 'GET' || req.method === 'HEAD')) { // lead-capture page: email first, wallet later. ?v= picks the hook // copy and is remembered so the account records which angle converted. - // partner placement: linkspin-test.saasy.top/join/company (or /top) places the visitor directly under + // partner placement: /join/company (or /top) places the visitor directly under // member #1, the company position, with no sponsor in between (Marty, 2026-09-12 partner kit) const tok = JOIN_ALIASES[m[1].toLowerCase()] || m[1].toLowerCase(); const cookies = parseCookies(req); @@ -1699,7 +1706,7 @@ const server = http.createServer(async (req, res) => { if (u.searchParams.get('manual') === '1' && s.email !== ADMIN_EMAIL) return json(res, 403, { error: 'Badges post automatically when they unlock.' }); const a = await accounts.byEmail(s.email); const who = a && a.username ? '@' + a.username : (a && a.memberId ? 'member #' + a.memberId : 'a member'); - const link = a && a.username ? 'linkspin-test.saasy.top/join/' + a.username : 'linkspin-test.saasy.top'; + const link = a && a.username ? SITE_HOST + '/join/' + a.username : SITE_HOST; const [label, sub] = BADGE_META[key]; const caption = '\u{1F3C6} LinkSpin \u00b7 ' + who.replace(/[<>&]/g, '') + ' unlocked ' + label + ': ' + sub + '\n' + link; const sc = siteConfig(); let sent = 0; @@ -1724,7 +1731,7 @@ const server = http.createServer(async (req, res) => { const a = await accounts.byEmail(s.email); if (!a || !a.username) return json(res, 400, { error: 'Pick a username first; the share page carries it.' }); fs.writeFileSync(path.join(UPLOADS_DIR, 'badge-' + a.username + '-' + key + '.jpg'), jpeg); - return json(res, 200, { ok: true, page: 'https://linkspin-test.saasy.top/b/' + a.username + '/' + key, image: 'https://linkspin-test.saasy.top/badge-img/' + a.username + '/' + key + '.jpg' }); + return json(res, 200, { ok: true, page: SITE_URL + '/b/' + a.username + '/' + key, image: SITE_URL + '/badge-img/' + a.username + '/' + key + '.jpg' }); } if (p === '/api/my/badge-posted' && req.method === 'GET') { // which of my badges are already on Telegram const s = await auth.fromRequest(req); @@ -2186,7 +2193,7 @@ const server = http.createServer(async (req, res) => { const from = who && who.username ? '@' + who.username : 'your sponsor'; for (const to of recipients) { mailer.send(to, 'Message from ' + from + ': ' + subject, - plain + '\n\n— sent via your LinkSpin upline. Read it in your dashboard: https://linkspin-test.saasy.top/my#line') + plain + '\n\n— sent via your LinkSpin upline. Read it in your dashboard: ' + SITE_URL + '/my#line') .catch(() => {}); } } @@ -2229,7 +2236,7 @@ const server = http.createServer(async (req, res) => { const scT = siteConfig(); items = items.filter(it => !it.feature || (it.feature === 'pipeline' && pipeline.visible(scT.pipelineMode, s.email, ADMIN_EMAIL))); if (!items.length) items = [{ title: 'Getting started with LinkSpin', desc: 'How the platform works, how every payout splits on-chain to real wallets, and how to build your line.', - docUrl: 'https://linkspin-test.saasy.top/' }]; + docUrl: SITE_URL + '/' }]; return json(res, 200, { items }); } // daily login bonus (once/day, gentle streak) — granted after the login flow @@ -2300,7 +2307,7 @@ const server = http.createServer(async (req, res) => { const who = await accounts.byEmail(me); const from = who && who.username ? '@' + who.username : 'someone in your LinkSpin line'; mailer.send(to, 'New message from ' + from, - text.slice(0, 400) + '\n\n— reply in your dashboard: https://linkspin-test.saasy.top/my').catch(() => {}); + text.slice(0, 400) + '\n\n— reply in your dashboard: ' + SITE_URL + '/my').catch(() => {}); } } } catch (e) {} @@ -2481,7 +2488,7 @@ const server = http.createServer(async (req, res) => { .map(x => ({ name: x.username ? '@' + x.username : x.memberId ? 'member #' + x.memberId : 'a member', bannerUrl: x.lineBannerUrl || null, targetUrl: x.lineTargetUrl, upline: true })); const adAds = getAdminWallAds(); let ai = 0; - const houseAd = () => { if (!adAds.length) return null; const ad = adAds[ai++ % adAds.length]; return { name: ad.name || 'LinkSpin', bannerUrl: ad.bannerUrl || null, targetUrl: ad.targetUrl || 'https://linkspin-test.saasy.top/', admin: true }; }; + const houseAd = () => { if (!adAds.length) return null; const ad = adAds[ai++ % adAds.length]; return { name: ad.name || 'LinkSpin', bannerUrl: ad.bannerUrl || null, targetUrl: ad.targetUrl || SITE_URL + '/', admin: true }; }; const ladder = [{ name: ownName, bannerUrl: a.lineBannerUrl || null, targetUrl: a.lineTargetUrl || null, own: true }]; for (let i = 1; i < 3; i++) { const o = offers[i - 1]; @@ -2500,7 +2507,7 @@ const server = http.createServer(async (req, res) => { let socials = null; try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {} return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0), avatarUrl: a.avatarUrl || null, bio: a.bio || null, socials, badge, - joinUrl: joinPath, qrUrl: '/api/qr?d=' + encodeURIComponent('https://linkspin-test.saasy.top' + joinPath), ladder: finalLadder, unlocked, buyerCount: bc }); + joinUrl: joinPath, qrUrl: '/api/qr?d=' + encodeURIComponent(SITE_URL + joinPath), ladder: finalLadder, unlocked, buyerCount: bc }); } // -- watch-to-earn video ads: serve one, then reward a server-clock-verified watch if (p === '/api/my/videos' && req.method === 'GET') { @@ -2992,7 +2999,7 @@ const server = http.createServer(async (req, res) => { if (!a || !fs.existsSync(file) || !(await ads.milestonesOf(a.email)).includes(key)) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); } const [label, sub] = BADGE_META[key]; const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); - const url = 'https://linkspin-test.saasy.top/b/' + un + '/' + key, img = 'https://linkspin-test.saasy.top/badge-img/' + un + '/' + key + '.jpg'; + const url = SITE_URL + '/b/' + un + '/' + key, img = SITE_URL + '/badge-img/' + un + '/' + key + '.jpg'; const title = '@' + un + ' unlocked ' + label + ' on LinkSpin'; const desc = label + ': ' + sub + '. LinkSpin pays sponsors in the same transaction, on-chain. Join @' + un + '\u2019s line free.'; const html = '' + esc(title) + '' @@ -3049,8 +3056,8 @@ const server = http.createServer(async (req, res) => { const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); const title = nm + ' on LinkSpin'; const desc = a.bio ? esc(a.bio).slice(0, 200) : 'Join ' + nm + '’s line on LinkSpin — instant on-chain ad payouts, free to join.'; - const img = a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : 'https://linkspin-test.saasy.top/banners/iap-hero-1200x630.png'; - const url = 'https://linkspin-test.saasy.top/wall/' + (a.username || a.code); + const img = a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : SITE_URL + '/banners/iap-hero-1200x630.png'; + const url = SITE_URL + '/wall/' + (a.username || a.code); const og = [ '', '', diff --git a/snapshot.js b/snapshot.js index 6d2310a..4fd824b 100644 --- a/snapshot.js +++ b/snapshot.js @@ -3,6 +3,7 @@ // whole picture: sign-ups, purchases, POL paid out, campaigns posted, ads viewed. Every number comes // from the same tables and chain index the dashboards read. Settings: snapshotEnabled (1/0), // snapshotHourUtc (default 14 = 9 AM Central), snapshotTargets (feed,echo). State: snapshot-state.json. +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); @@ -57,7 +58,7 @@ function compose(s, cta) { L.push('\u{1F4E3} Campaigns: ' + n(s.campaigns) + ' posted by ' + n(s.advertisers) + ' advertiser' + (s.advertisers === 1 ? '' : 's') + ' · ' + n(s.active) + ' running now · ' + n(s.imps) + ' ad impressions served'); L.push('\u{1F440} Earning: ' + n(s.viewers) + ' members viewed ads today · ' + n(s.seen24h) + ' signed in'); L.push('\u{1F3C1} So far: ' + n(s.members) + ' members · ' + n(s.wallets) + ' wallets linked · ' + n(s.payoutsOn) + ' with payouts on · ' + n(s.lifeBuys) + ' purchases · ' + pol(s.lifePaidWei) + ' POL paid out in ' + n(s.lifePayouts) + ' payouts, every one on the public ledger'); - L.push('Live ledger' + (cta ? ' · Join free' : '')); + L.push('Live ledger' + (cta ? ' · Join free' : '')); return L.join('\n'); } diff --git a/syndicate.js b/syndicate.js index 2ef8ffb..0018b34 100644 --- a/syndicate.js +++ b/syndicate.js @@ -2,11 +2,12 @@ // through Blotato to X (@cryptoteambuild, account 7998) and Instagram (marketingwithmarty, 16261). // Key: DATA_DIR/blotato.key (never logged). Record per slug in DATA_DIR/blog-syndication.json so a // republish never double-posts; admin can see the result on the article row. No Facebook (Marty's call). +const { SITE_HOST, SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const https = require('https'); let DATA_DIR = null, PUBLIC_DIR = null, UPLOADS_DIR = null; -const SITE = 'https://linkspin-test.saasy.top'; +const SITE = SITE_URL; const ACCOUNTS = { x: { id: 7998, target: { targetType: 'twitter' }, platform: 'twitter' }, instagram: { id: 16261, target: { targetType: 'instagram' }, platform: 'instagram' } }; const FILE = () => path.join(DATA_DIR, 'blog-syndication.json'); function init(opts) { DATA_DIR = opts.dataDir; PUBLIC_DIR = opts.publicDir; UPLOADS_DIR = opts.uploadsDir; } @@ -47,7 +48,7 @@ function xText(post) { return t + '\n\n' + url; } function igText(post) { - return post.title + '\n\n' + (post.excerpt || '') + '\n\nRead it: linkspin-test.saasy.top/blog/' + post.slug + '\n\n#LinkSpin #advertising #teambuilding #polygon #crypto'; + return post.title + '\n\n' + (post.excerpt || '') + '\n\nRead it: ' + SITE_HOST + '/blog/' + post.slug + '\n\n#LinkSpin #advertising #teambuilding #polygon #crypto'; } // returns { x: {ok, id|error}, instagram: {...} }; never throws, never posts twice for one slug async function publish(post, opts) { diff --git a/tank.js b/tank.js index 8df43b4..1c5f11b 100644 --- a/tank.js +++ b/tank.js @@ -7,6 +7,7 @@ // Members can also release one of their own free referrals into the tank // (pay it forward). The contract binds sponsor at first purchase, so every // hand-off here is a site record until then. +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const db = require('./db'); @@ -19,7 +20,7 @@ const MIN_OWN_BUY_CENTS = 2000; // adopter must have bought a $20+ package them const WARN_DAYS = 10; // dormant lead: sponsor warned after this many days without contact const RESCUE_DAYS = 14; // ...and the lead moves to the tank after this many (warning at least 4 days old) -let DATA_DIR = '.', accounts, chain, messages, mailer, siteUrl = 'https://linkspin-test.saasy.top'; +let DATA_DIR = '.', accounts, chain, messages, mailer, siteUrl = SITE_URL; const J = { db: { v: 1, nextId: 1, adoptions: [], marks: {} }, diff --git a/toolkit.js b/toolkit.js index 82c7406..7cf7798 100644 --- a/toolkit.js +++ b/toolkit.js @@ -4,6 +4,7 @@ // allowance by tier, then costs ad credits from the member's earned pool (credits are advertising, 1 = 1 cent). // The engine is the same OpenRouter model the chatbot uses; the LinkSpin facts, the compliance rules and // the voice live here in version control and travel with every request. +const { SITE_HOST, SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); const https = require('https'); @@ -47,7 +48,7 @@ const COMPLIANCE = [ 'Payments are POL on Polygon, wallet to wallet, on a public ledger anyone can check. Cryptocurrency carries real risk; results depend on effort.', 'No em dashes and no double hyphens anywhere. No fake urgency, no fake scarcity, no invented testimonials.' ].join(' '); -const FACTS = 'LinkSpin (linkspin-test.saasy.top) is an advertising platform: members join free by email, earn ad credits daily by viewing a short set of ads (the claim grows with a streak), and spend credits on their own banner, text, login, solo, video, featured and verified-visit campaigns across the site and a partner network; views are timed on the server so a real person saw the ad. Ad packages from $5 buy more reach. Every package sold pays the sponsor instantly on-chain in the same transaction; there is no balance to withdraw because nothing is held. The daily routine members are taught: do the five-ad set and spend the claim, message one person in your line, check the holding tank, have one conversation with someone who already pays for traffic. Two qualifying buyers open the next level; five open the one after. Founder: Marty Bostick; brought to you by the Crypto Team Build Network.'; +const FACTS = 'LinkSpin (' + SITE_HOST + ') is an advertising platform: members join free by email, earn ad credits daily by viewing a short set of ads (the claim grows with a streak), and spend credits on their own banner, text, login, solo, video, featured and verified-visit campaigns across the site and a partner network; views are timed on the server so a real person saw the ad. Ad packages from $5 buy more reach. Every package sold pays the sponsor instantly on-chain in the same transaction; there is no balance to withdraw because nothing is held. The daily routine members are taught: do the five-ad set and spend the claim, message one person in your line, check the holding tank, have one conversation with someone who already pays for traffic. Two qualifying buyers open the next level; five open the one after. Founder: Marty Bostick; brought to you by the Crypto Team Build Network.'; const VOICE = 'Write like a straight-talking internet marketer who has been around long enough to hate hype: plain words, short sentences, honest about risk, warm and confident, never salesy. First person, as the member. Specific beats clever.'; const KINDS = { post: { label: 'Social post', shape: 'Write ONE social media post of 40-90 words. Strong first line. No hashtags. At most one emoji. End with a soft invitation to look, not a hard sell, and put the link on its own last line.' }, @@ -92,9 +93,9 @@ async function status(email) { const u = usage()[email] || {}; const used = (u.months || {})[monthKey()] || 0; const allowance = allowanceFor(tier, sc); const cost = Number(sc.aiCreditsPerGen) || 10; let available = 0; try { const st = await R.ads.viewStatus(email); available = st.earnedAvailable != null ? st.earnedAvailable : (st.earned || 0); } catch (e) {} - const link = 'https://linkspin-test.saasy.top/join/' + (acct.username || acct.code); + const link = SITE_URL + '/join/' + (acct.username || acct.code); const partner = tier === 'nexus' ? await partnerStatus(email) : null; - const handoutUrl = rank[tier] >= rank.spark && acct.username ? 'https://linkspin-test.saasy.top/handout/' + acct.username : null; + const handoutUrl = rank[tier] >= rank.spark && acct.username ? SITE_URL + '/handout/' + acct.username : null; return { tier, badges, username: acct.username || null, partner, handoutUrl, videoMaker: !!(R.videomaker && R.videomaker.available()), unlocked: ['surge', 'circuit', 'nexus'].includes(tier), engine: !!key(), allowance, used, freeLeft: Math.max(0, allowance - used), cost, available, link, kinds: Object.entries(KINDS).map(([k, v]) => ({ key: k, label: v.label })), angles: Object.keys(ANGLES), tiers: TIERS.map(t => ({ key: t.key, name: t.name, needText: t.needText || '', blurb: t.blurb, items: t.items, reached: t.key === 'free' || badges.includes(t.need) })), @@ -128,7 +129,7 @@ async function adminUsage() { } // ---- the rest of the ladder (Marty, 2026-09-14): Spark templates + handout, Circuit split tester + Video // Maker, Nexus Leader Ops + team grants + a member-funded partner code ---- -const KIT = 'https://linkspin-test.saasy.top'; +const KIT = SITE_URL; async function tierOf(email) { return tierFor(await R.ads.milestonesOf(email)); } const rank = { free: 0, spark: 1, surge: 2, circuit: 3, nexus: 4 }; const atLeast = (tier, need) => rank[tier] >= rank[need]; diff --git a/updates.js b/updates.js index f6424de..2005d90 100644 --- a/updates.js +++ b/updates.js @@ -2,10 +2,11 @@ // audience, previews, sends a test to themselves, then sends. Plain text through the site mailer (SendGrid), // one recipient at a time with a small gap, opt-outs honoured (the same unsubscribe link the drip uses). // Log: DATA_DIR/updates-log.json. Nothing here sends on its own: every send is a click in Admin > Releases. +const { SITE_URL } = require('./host'); const fs = require('fs'); const path = require('path'); let R = null; // { dataDir, accounts, releases, mailer, drip, sendy, adminEmail } -const SITE = 'https://linkspin-test.saasy.top'; +const SITE = SITE_URL; const FILE = () => path.join(R.dataDir, 'updates-log.json'); function log() { try { return JSON.parse(fs.readFileSync(FILE(), 'utf8')); } catch (e) { return { sends: [] }; } } function saveLog(l) { try { fs.writeFileSync(FILE(), JSON.stringify(l)); } catch (e) {} } diff --git a/videomaker.js b/videomaker.js index ee22a7d..29b6042 100644 --- a/videomaker.js +++ b/videomaker.js @@ -3,6 +3,7 @@ // ffmpeg + a DejaVu font in the image (Dockerfile). One job at a time; sources are the hosted promo // videos in the Spaces bucket; output is hosted at promo/made//.mp4 and cached forever // (a member's link never changes). Jobs live in DATA_DIR/video-jobs.json. +const { SITE_HOST } = require('./host'); const fs = require('fs'); const path = require('path'); const https = require('https'); @@ -112,7 +113,7 @@ async function render(job) { await download(src.url, srcFile); const { w, h } = await probe(srcFile); const total = (await durationOf(srcFile)) + 4.5; setProgress(job.id, 20, 'Drawing your end card'); - const link = 'linkspin-test.saasy.top/join/' + job.username; + const link = SITE_HOST + '/join/' + job.username; await QR.toFile(qrFile, 'https://' + link, { width: Math.round(Math.min(w, h) * 0.34), margin: 1, color: { dark: '#061c17', light: '#ffffff' } }); const F = font(); const portrait = h > w; const big = Math.round(Math.min(w, h) * (portrait ? 0.075 : 0.07)), mid = Math.round(big * 0.62), small = Math.round(big * 0.48); const qrSize = Math.round(Math.min(w, h) * 0.34);