Commit Graph

621 Commits

Author SHA1 Message Date
martbost ce977698b9 Campaigns > Conversion tracking panel: goals (name, default value, pixel id, 30-day conversions, last test), add goal, landing tag + goal pixel snippets (JS version under a toggle), Send a test conversion, autoresponder thank-you page advice, how-sure legend; each campaign row shows goals and cost per goal in credits from the LinkSpin summary. LinkSpin down: the card says so, the rows omit the goal line. my.js?v=20261023cv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:01:08 -05:00
martbost 46bb7dd9dd Conversion tracking, click side: every /api/ads/click gets a click id (i + 11 hex) appended as lsclk=<id> (existing params and hash kept, an existing lsclk never replaced, unparsable targets unchanged), the owner's own click flagged self. Rows in ad_clicks (MySQL) or a capped JSON file, pushed signed to LinkSpin /api/partner/clicks every 3 s (500 per request, retry with backoff, marked pushed only on ok). Member proxies /api/my/conversions (summary, 60 s cache), /goal (create/update/remove), /test. Admin lssync view shows push stats.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:01:02 -05:00
martbost ebdab6c545 Restore each file's original line endings (the override commit rewrote CRLF/LF)
No content change: server.js back to CRLF, my.js/admin.js/html back to LF, so the override
commit's real diff is ~800 lines, not 13,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:16:08 -05:00
martbost 43e841721a Level 4 override payer, shipped OFF (Marty approved 2026-10-23)
override.js: the weekly payer for the 3% level-4 override. It pays only when overrideMode is 'live' AND
overrideGoLive is set AND OVERRIDE_PAYER_KEY (or _FILE) is present; otherwise the Monday dry-run report
runs as before. Default stays 'dryrun'. Nothing in this commit moves money.

- Week = Monday 00:00 to Monday 00:00 Central; settled from 9 AM CT the Monday after, weeks in order.
- Plan frozen once per week (claim plan:<week>), one row per recipient (POL wei summed), on the volume.
- Claims fail closed: exclusive file create on the shared volume plus event_marks when MySQL is on.
- Row marked 'sending' before the tx, tx hash stored on acceptance; lost answers become 'review' and are
  never re-sent (settled from the chain index or by the admin). Pre-flight revert = carried, no gas.
- Dust under overrideDustPol (0.01) carried to next week; overridePayCapPol (100) holds the whole week;
  wallet must cover total + gas or nothing is sent; Telegram alerts once each.
- Telegram summary to Marty's private chat says PAID with tx links.
- Members: AwardPaid from the payer emails + on-site notice "Your Level 4 override is paid" and shows in
  Earnings as "Level 4 override" (common.js / my.js tags bumped to 20261023ov).
- Admin: /api/admin/override adds week status + payer state; POST /api/admin/override/pay (only when live)
  and /api/admin/override/resolve; P&L pane card with "Pay this week now" shown only when live.
- Comp plan (earning.html) + Platform Facts card hidden behind data-when="override-live" (shown only when
  overrideMode is live). Chatbot copy drafted in D:/tmp/override-copy, TODO in chatbot.js.
- qa/override.test.cjs (bash qa/run.sh override): 30 checks on a fake chain/signer/DB, throwaway data.

Reconciliation 2026-10-23: the dry run reads every Purchase in chain-index (229 events, full history);
per Central week it matches the index exactly. The ~$1,775 figure was the rolling 7 days 09-10..09-17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:14:58 -05:00
martbost 87a45169d0 Five Dollar Friday copy: chatbot canned answer + FACTS and the /friday page mention the free 7-day Game Pass perk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:15:44 -05:00
martbost 38369d6858 Five Dollar Friday Game Pass perk, automatic (Marty 2026-10-23): a $5+ Friday package also gives the buyer a free 7-day Game Pass, once per member per Friday (event_marks claim), not on top of a purchase that itself started a paid pass; on-site notice; the Game Pass badge posts once ever (postBadgeOnce). Switch: fridayPassPerk '0'. Counts as no sale (comp).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:13:20 -05:00
martbost 91f2e2ec74 Game Pass card on Fridays: the package that starts the pass also gets the Five Dollar Friday bonus (pass + 600 ad credits on a $5 pack), from /api/friday live pct (Marty 2026-10-23)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:54:30 -05:00
martbost 4587b5cc58 Campaigns rate strip: login ads show '1,000 cr / 30-day slot' instead of the retired 'Login 100 cr / day' (and the same in the rates line); my.js tag bumped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:36:03 -05:00
martbost eac83c3eee Admin member card: visit packs show delivered visits as 'N of M visits' (Marty 2026-10-23); admin.js tag bumped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:35:22 -05:00
martbost e2eb1578aa Login ads: the AdRevLinks popup starts when the login ad goes live, including a reservation that starts from the line (sized on the slot price), and pauses when it expires/pauses/archives as before (Marty 2026-10-23)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:25:40 -05:00
martbost 89b5969b25 Prepaid login-ad line: when all member slots are taken, members pay now to reserve the next one (Marty, 2026-10-23: "they need to pay for the slot now to get a place in line")
- ads.js: a login buy with every slot taken returns full:true and a reserve offer; with reserve:true it is charged the full slot price at once (purchased credits only, credit log 'Login slot reserved (queue #N)') and stored with status 'queued' + queuedAt, no starts/expires, never served or counted as a slot. First paid, first served.
- Promotion (promoteLoginQueue): on a slot expiring (scheduleSweep), a member pausing a slot, every new login buy, and a one-minute tick. The oldest reservation becomes active, starts now, ends in 30 days; the owner gets an on-site notice (kind 'notice') and an email unless unsubscribed.
- Deploy-overlap safety: the cap decision runs under a lease row in the new app_locks table (one conditional UPDATE takes it, an expired lease can be taken over); every start/cancel/edit is a conditional UPDATE on status='queued', so a reservation starts at most once and a cancel racing a start has exactly one winner. Live login buys and paused-slot resumes also take the lease, so the cap holds for them too.
- A freed slot goes to the line first: a paused slot resumes only while live + queued < loginSlotsMax, with a plain message saying the line is ahead.
- Cancel before the start: full refund as purchased-grade credits (credit log 'Login slot reservation cancelled: refund'), once. Edit target/image/headline before the start, free. Cancelled reservations can be archived.
- Estimated start per place from the live slots' end dates and the reservations ahead, shown in Central time and labelled an estimate.
- db.js: campaigns.queued_at BIGINT NULL, app_locks table + 'login_queue' row, all added on boot.
- server.js: loginLine in GET /api/my/campaigns, POST /api/my/campaigns/:id/cancel-reservation and /edit-reservation (safe-browsing, reach and image checks), GET /api/admin/login-queue, POST /api/admin/login-queue/:id/cancel, the promotion notice hook and the one-minute tick.
- Member UI (my.js, my.html): open slots or the line with place and estimated start on the Login ad form, the button becomes "Reserve the next slot", IAP.confirmBox before paying, In line #N + estimated start in the list, Edit and Cancel and refund. Admin (admin.js, admin.html): Login-ad line card with owner, queued at, place, estimated start, cancel + refund. Tags bumped to 20261023lq.
- chatbot.js: new canned 'login-ads' answer and the LOGIN ADS fact updated (6 slots, the paid line, cancel = full refund before start). The knowledge base seeds the new entry on boot.
- audit.js: queued/cancelled reservations are not per-day login campaigns.
- QA: qa/login-queue.cjs (JSON store end to end) and qa/login-queue-sql.cjs (SQL path guard logic against a fake SQL layer), bash qa/run.sh login-queue. qa/login-slot.mjs pattern follows the refactor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:14:57 -05:00
martbost c45f1769e7 Admin member card: Views column read c.views, which campaigns never had (always 0). Now imps + impsNas (views here plus network views; delivered visits for visit packs)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:02:24 -05:00
martbost 610f47c625 Chatbot: login-ad slots now 6 (raised from 3, Marty 2026-10-23); KNOWLEDGE_DATE 2026-10-23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 06:34:29 -05:00
martbost a405c2cdd1 Games card: pass wording says what paid passes add (heroes, islands, a higher level cap, new looks); the 'never stronger' line is retired (Marty, 2026-10-22). my.js tag bumped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:14:21 -05:00
martbost 31b167e046 Game Pass package rail, part two: Admin > Game Pass gets a Pass sales table (every sale labelled package / credit-paid (old rule) / package (old rule), pass value, package value, package tx link) and stats passes.pay + sales; the chatbot canned answer, tier fact and system prompt say every pass is paid by a new package bought after tapping Get (sponsor and team paid, credits kept for ads, held credits never buy a pass); docs/GAME-PASS.md "Payment: the package rail" section; release-note update draft (not sent); admin.js tag bumped. Fulfilment stamps the pass at the event time again (as before). Tests: sov-passes store + local rebuilt on order + fresh package (seeded credits never spent), gamepass ALL PASS, member walk 0 bugs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:49:39 -05:00
martbost 6a3313a861 Game Pass: no pass is ever bought with credits again (Marty, 2026-10-22). Buy only opens a waiting order and sends the member to buy a package of at least the tier price; the order is fulfilled only by a fresh on-chain package Purchase by one of the member's own positions (main or linked), mined after the order was opened (block time, 30 s clock grace), each purchase tx used once across every account. The member keeps the package credits for ads; sponsors and team are paid by the package as usual. Existing passes untouched. Card and confirm copy say so; my.js tag bumped. qa/gamepass.mjs updated for the new flow (older-than-order, too small, another member, replayed tx): ALL PASS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:42:59 -05:00
martbost 839c867595 Pass tiers restructure (Dallas, Marty approved 2026-10-22): Explorer $19.99 (1999 credits) and Champion $39.99 (3999) for 30 days, new Sovereign $99.99 (9999, 30 days) and Legend $249.99 (24999, 365 days, the yearly pass). One table (gamepass.js TIER_DEFS: rank, names, settings stem, defaults, member-card perks); settings gamePassSovereign*/gamePassLegend* with kill switches; flag()/partner player/hand-off token carry sovereign/legend; buy, waiting orders ($100/$250 package copy), extend from max(now, until), comp/revoke, admin By pass tier table and comp options; chatbot tier fact says coming soon while sovTiers is off. All behind sovTiers (still 0): weekly Game Pass price, length and caps unchanged. Tests: sov-passes store + local extended (all pass), member QA 0 bugs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 10:26:58 -05:00
martbost 32eefae473 Admin badge repost accepts the Game Pass badge for anyone who has held a pass, even before their next dashboard load records it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 09:20:28 -05:00
martbost 7e902b9b26 Game Pass badge gets its unlock moment (Orlando bought a pass and nothing appeared): badges with no credit bonus (CELEBRATE_NO_BONUS: gamepass) are recorded once and celebrated like the rest (toast + team post), toast wording without credits, dashboard reloads right after a pass purchase; Promo tools pill renamed back to '✨ Your toolkit' (a member could not find it under 'AI Copy Engine'). QA member 0 bugs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 09:17:07 -05:00
martbost 4e51470cf5 Sponsor follow + one network holding tank + Sponsor check (Marty, 2026-10-22, approved 1-3)
Deliberate sponsor changes (tank adoption, dormant-lead rescue, release, adoption window ending, admin edit) are now
recorded (sponsorfollow.json: when, how, the sponsor before, origin) and travel on the LinkSpin sync rows as
sponsorSetAt/By/PrevEmail/Origin. A deliberate change from LinkSpin is applied here (a clear back to the tank included)
only when the member is not bound on the InstantAdPay contract (memberId or wallet on chain), it is newer than our own
deliberate change, and both sides agreed before it (or we have no sponsor). Bound, diverged and race cases change
nothing and are logged. Race within 15 min: the earlier change wins on both. Ordinary bindings keep the first-platform
rule. Accounts with no record behave as before; rows without the new facts hash exactly as before (no resend on deploy).

Network tank: rows carry this site's own adoptions of a person; the waiting list hides someone adopted on LinkSpin, the
two-adoptions limit counts both sites, the 3-day hold applies to a LinkSpin adoption too, follows close local open
adoptions quietly (no chat, mail or feed post).

Admin > Members > Sponsor check: shared members whose sponsor differs or is one-sided, each side's when/how, chain
binding, and Use InstantAdPay's / Use LinkSpin's sponsor (applied on the other site, refused when bound there).
Partner endpoints /api/partner/sponsor-facts and /api/partner/sponsor-apply (same HMAC as the registry rows).

Tests: qa/sponsorfollow.test.cjs 27/27, qa/sponsorfollow-e2e.mjs 20/20 (local IAP + local LinkSpin, throwaway data),
QA member walk 0 bugs. No sponsor was changed on production.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 09:05:07 -05:00
martbost 06b0924651 Restore LF line endings in badge.js, chatbot.js and my.js (the Game Pass commit 1c29285 rewrote them as CRLF from a Windows text-mode edit; no content change)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:25:02 -05:00
martbost 16ec626d2c Dollar value at today's POL price on the member's own pages (Marty, 2026-10-22, Brian's ask; US dollars, not a dollar token): /api/public/polusd serves the contract's own package rate (Chainlink POL/USD) cached 5 min on the server; Overview 'POL earned' shows '≈ $x.xx today', every Earnings line gets '≈ $x.xx', and a note under Earnings gives the rate, when it was updated, and that it is today's value, not the payout-day value. Browser re-reads at most every 2 min; no outside price service. QA member walk 0 bugs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:21:29 -05:00
martbost 1c2928553a Game Pass: what you get, game by game (Marty, 2026-10-22: members must see what they are buying). The Game Pass card lists the account-wide caps, the weekly Pass Tournament, the badge, and each of the nine games' perks; new gold Game Pass achievement badge (badge-gamepass.jpg, name on the ribbon at 0.84) unlocked once a member has ever held a pass, shareable and postable like the others; chatbot canned answer + prompt carry the per-game perks and the 2026-10-29 free-cap date, KNOWLEDGE_DATE 2026-10-22; my.js cache tag bumped. QA member walk 0 bugs; qa/gamepass.mjs 2 date-based tournament expectations fail with or without this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 07:40:42 -05:00
martbost 3ee605a8bf Email typo check on new addresses: "Did you mean you@gmail.com?" for gmai.com / gmial.com / hotmial.com / outlook.comz / gmail.con etc., and refuse domains that cannot receive mail (no MX/A). Applies only to addresses with no account yet (existing members always sign in), on sign-in/sign-up, password signup and the support form; skipped when the server has no mail key (local QA). DNS errors fail open. Same emailcheck.js in IAP and LinkSpin. Prompted by SendGrid bounces to gmai.com and outlook.comz (2026-10-22).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 06:09:38 -05:00
martbost 8b1395a90c Chatbot: replies never carry an em dash (scrubbed to a comma)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:57:31 -05:00
martbost 9992dd061d Merge InstantAdPay knowledge-base chatbot + Save as KB entry on support replies
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:52:06 -05:00
martbost 2e0a4af28f Share-link domains: ctbgo.com (active, site config shareDomain) and mylinehq.com (spare) 302 /<name> to /join/<name> (query kept, noindex); member invite line and promo tools now hand out https://ctbgo.com/<name>; old instantadpay.com/join links keep working
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:46:58 -05:00
martbost 6f194596fe Support: no 'Save as KB entry' on LinkSpin tickets (they would land in the InstantAdPay knowledge base; LinkSpin keeps its own)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:39:02 -05:00
martbost 1e040f21ff Chat knowledge base: the assistant answers from maintained entries, and support replies become entries
- kb.js: entries { id, title, questions, answer, tags, pattern, handoff, order, source, updated } in MySQL table kb_entries (created on boot) or DATA_DIR/kb.json without DATABASE_URL. BM25 over title, question variants and tags (answer at a low weight) with word bigrams; the top hits (within 30% of the best, score 3+) go into the system prompt as KNOWLEDGE BASE, and when nothing fits the prompt says to answer "I'm not sure, ask support".
- One source: chatbot.js CANNED seeds the KB (ids c-*, its regex becomes the entry's instant-answer pattern, same first-match order), kb-seed.js seeds the home FAQ, Platform Facts, wallets FAQ and the Coinbase support reply (f-*). The fast path now serves the KB entry, so an admin edit changes the instant answer; the in-code CANNED only answers if the KB store fails. Unedited seeds follow code changes, edited ones are left alone, deleted seeds stay deleted.
- Admin > Knowledge base: list, search, filter by source, add, edit, delete, and Try a question (instant answer or what the AI is given). Support tickets: "Save as KB entry" under each sent reply opens a draft with the member's question and the reply (greeting and sign-off trimmed). Em dashes in admin input become commas.
- chatbot.js: OPENROUTER_URL override for tests; solo-ads answer em dash removed; KNOWLEDGE_DATE 2026-10-20.
- qa/chatbot-sync.mjs: takes the later of KNOWLEDGE_DATE and /api/chat/kb-stamp (newest KB edit by a person, Central day; seed refreshes do not count).
- QA: qa/kb-retrieval.cjs (13 sample questions rank the right entry first, off-topic returns nothing), qa/kb-chat.mjs (local copy + mock OpenRouter: Coinbase answered from the KB, fast path without an AI call, admin CRUD, restart keeps edits), bash qa/run.sh kb; walk covers admin#kb and Save as KB entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:37:09 -05:00
martbost 4df932723e Speed: member reads cached 15 s (cleared on every new chain event) so line, stats and positions stop repeating RPC round trips
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:21:42 -05:00
martbost 0e528ae854 Game sign-in kit: a remembered sign-in on this device opens on 'Continue as @name' (new POST /api/game/auth/resume turns the 29-day kit pass into a fresh hand-off token, no code; pass checked for this game, suspended accounts refused), 'Use a different account' falls back to email; Shards of Valor login ad uses the card view (frames: false)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:26:15 -05:00
martbost 7af47ae921 Speed: catalog reads run in parallel and /api/catalog serves the cached ladder while refreshing in the background (was ~6 s of sequential chain reads on every 20 s miss); position rows read the chain side by side
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:30:30 -05:00
martbost 0aa22e9984 Merge Shards of Valor Explorer/Champion passes (behind sovTiers, default off)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:47:30 -05:00
martbost 0688bdeb72 Pass tiers: Explorer ($20/30 days) and Champion ($40/30 days) beside the weekly Game Pass, behind sovTiers (default off, admin-only preview)
Islands and looks in Shards of Valor, never power and never more POL: every tier gets exactly the weekly pass caps and polgrant
still answers pass: true. Per-tier expiry side by side (record.tiers, legacy until mirrors weekly, lazy migration); flag() adds
tier (highest active) and tiers; hand-off token gamePass { active, until, tier }; /api/partner/player pass { active, until, tier,
tiers }. Buy { tier } with purchased credits or a waiting order per tier that a big-enough package fulfils (highest price first,
each tx once). No auto-renew, no proration. Admin: per-tier stats (Central week/month), comp per tier, end-a-tier (refund).
Tournament pool keeps weekly sales only unless passTournamentTierSales. Member card shows three tiers; /my#passes opens it.
Tests: qa/sov-passes-store.cjs, qa/sov-passes-local.mjs (bash qa/run.sh sov-passes). Cache tags my.js/admin.js 20261018tiers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:46:51 -05:00
martbost 5e8f2c0b6b Shards of Valor sign-in: /api/my/shardsofvalor hand-off (SOV_SSO_SECRET, Game Pass flag rides along), in-game sign-in entry, Game Pass game list + caps, return-to-game after sign-in; not in the public games list until launch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:08:15 -05:00
martbost 34a1de0b15 P&L: Game payouts card, an all-time running total of every game wallet's payouts read from Polygon (incremental, cached); PolHunter ledger detail folded under it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 07:11:25 -05:00
martbost 017017ad63 Login ad in the games: the sponsor interstitial after a fresh in-game sign-in, counted per surface
- Game sign-in kit (game-signin.js): after a fresh email sign-in (never a remembered
  pass) the kit shows the login ad before the hand-off to /auth?t=, same as the
  dashboard: sponsor card, Open Ad (a counted click through /api/ads/click), sponsor
  framed in a full-screen overlay when frameable else a new tab, 10 s countdown
  (loginDwellSeconds), then Continue to the game. No ad, an error, a non-200 or a
  7 s stall all go straight to the game. A game page whose CSP blocks the frame gets a
  new-tab link instead. mount option loginAd: false switches it off.
- GET /api/game/ads/login?game=<slug>: CORS only for that game's GAME_AUTH origins
  (dev: localhost); the dashboard /api/ads/slot route keeps no CORS. Both share
  loginAdFor() (ads.serve: impression + lastShownDay as before). Drip Runner and
  PolyBreak are marked frames: false (their CSP is default-src 'self'), so their ad
  opens in a new tab; frame checks for games ignore an instantadpay.com-only
  frame-ancestors allowance.
- loginshows.js: every login-ad request tallied per Central day, surface (dashboard or
  game slug) and kind (member slot, house, none); MySQL table login_shows (created on
  first use) or DATA_DIR/login-shows.json. GET /api/admin/login-shows + a Login-ad
  showings card on the admin Traffic pane (dashboard vs games, house, no-ad, by game).
- The kit is served no-cache so games pick it up without a tag bump; admin.js tag bumped.
- Chatbot fact updated (slot rules + games), KNOWLEDGE_DATE 2026-10-18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 06:17:41 -05:00
martbost d520eb67af Login slots: purchased-only at charge time, resume obeys the cap, no top-up on slots
- chargeCredits takes opts.purchasedOnly (new poolShare helper, JSON + MySQL): the
  1,000-credit slot charge draws only the credited purchased-grade pool, the rest burns
  on-chain; viewing credits never pay, even when the member holds enough of them.
- setStatus: resuming a paused member login slot is refused while 3 are live
  (loginSlots() helper, exported).
- topUpCampaign refuses login slots; the dashboard no longer offers Buy more views on one.
- audit: the days-charged check skips 30-day slots (expires set).
- JSON grantWelcome keeps the purchased grade, milestones and streak fields.
- my.js cache tag bumped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 05:57:28 -05:00
martbost 716dd8066f Override dry run: dollar amounts were 100x (cents shown as dollars); POL amounts were right
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:32:01 -05:00
martbost 34d2284051 Level-4 override DRY RUN: 3% of each purchase to the 4th upline with 5+ qualifying buyers, hunting upward up to 25 hops; weekly Monday report to Marty's Telegram + /api/admin/override; no money moves
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:29:52 -05:00
martbost af66f7f865 Help desk translation: member messages in other languages get an English translation (Telegram, admin email, admin view, bot thread); Marty's replies go back in the member's language with his English underneath (OpenRouter, reasoning off; failures fall back to untranslated)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:03:30 -05:00
martbost e490e15abf Email intake: iap-support@linkspin.app is the InstantAdPay support alias (NameSilo's forwarder will not deliver to the help. subdomain)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:57:04 -05:00
martbost ad17017250 Help desk email intake: SendGrid Inbound Parse -> /api/inbound/email (secret key) creates tickets or threads replies; robots, bounces, auto-replies and our own mail dropped; ticket mail carries reply+<ref>@ reply-to and Auto-Submitted
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:10:53 -05:00
martbost 524ce843dc Help desk: signed partner API for LinkSpin tickets (LS- refs on the one shared desk)
POST /api/partner/support/{create,list,view,reply,token,token-reply}, signed exactly
like the registry rows (LS_SYNC_SECRET, X-LS-Ts + X-LS-Sig, now one readLsSigned helper
shared with /api/partner/registry). Only platform 'linkspin' tickets are reachable there.

LinkSpin tickets: requester mail, links and footer say LinkSpin support and point at
LS_URL (/support/t/<token>, /help#t=<ref>); no InstantAdPay in-app notice is sent for
them. Telegram ping, admin mail and the support bot's thread/list views mark them
LinkSpin. The member Help pane here lists InstantAdPay tickets only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:04:52 -05:00
martbost 80885705d2 Restore CRLF line endings changed by the previous commit's cache-tag bump (no content change)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:22:02 -05:00
martbost e2d15aa751 Support in the top nav of every public page, and the chat bubble's greeting points to support; cache tags bumped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:20:31 -05:00
martbost 8fe527ab67 Support bot menu: persistent buttons (Open, Waiting, High, Recently closed, Help), command menu via setMyCommands, tappable ticket lists that open the thread
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:01:55 -05:00
martbost 6f6412d908 Help desk in Telegram: @CTBTickets_bot pings with Close/Waiting/High/Open buttons, reply to a ping to answer (/note = internal), /tickets and /t <ref>; secret-header webhook, only Marty's private chat is obeyed; old one-way ping stays as fallback
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:56:54 -05:00
martbost 9be58bd5ef Help desk: support tickets for members (Help pane), the public /support page with private ticket links, chatbot hand-off, and an admin Support pane
- tickets.js: one shared desk (platform iap now, linkspin later), dual-mode store (MySQL tables tickets + ticket_messages, else support.json); refs IAP-<1000+id> / LS-; private no-login link /support/t/<ref>.<HMAC> signed with DATA_DIR/support.key (or SUPPORT_SECRET); ingestEmail() ready for the support@ intake step (threads by Message-ID, then [ref] in the subject from the same sender)
- Member Help pane (/my#help): list with status + unread badge, new ticket (category, subject, message, up to 2 screenshots via /api/my/upload), thread + reply (a reply reopens a closed ticket)
- Public /support: name, email, category, subject, message behind the sign-up walls (honeypot, form age, per-IP limits with the icon check, global cap) plus a per-email cap; confirmation email with the ref and the private link
- Chatbot: CANNED + systemPrompt know the help desk; answers that cannot help (or "talk to a human") offer "Send this to support", which files the last turns as a ticket (members: Help pane; signed out: email + the same guard)
- Admin Support pane: open / waiting / closed / all, platform, category, search; open-count badge; ticket view with requester account info, internal notes, status/priority/category, saved replies (site setting supportTemplates); deep link /admin#support?t=<ref>
- Notifications: new ticket / member reply -> Telegram to Marty's private chat only (supportTelegramChat, default 1289244227, site bot then Hermes fallback, never a group or the Discord relay) + email to ADMIN_EMAIL, max one per ticket per 10 min; Marty's reply -> email "[IAP-1042] subject" + a 'notice' inbox message for members, bursts batched
- support* settings are kept out of /api/config; Support link in the site footer, home footer, member page foot, terms and privacy; "Contact support" errors point at /support
- QA walk: member Help ticket flow, admin Support pane + deep link, internal-note leak check, public /support + private link + tampered token + form-age refusal
- Cache tags: common.js 20261016a, chat.js 20261016a, my.js 20261016r, admin.js 20261016sp, support.js 20261016a

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:51:30 -05:00
martbost f0c868ef23 Leader tools: Training section (Leader's Guide PDF, presentation, build-wide video) with cards in My line and Pipeline; #training?g=leader deep link; training entries can name their button; chatbot knows it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:09:55 -05:00