Commit Graph

20 Commits

Author SHA1 Message Date
martbost 541457bc24 Chat knowledge base: the assistant answers from maintained entries (port of InstantAdPay's kb.js)
- kb.js: entries { id, title, questions, answer, tags, pattern, handoff, order, source, updated } in DATA_DIR/kb.json (temp file + rename). BM25 over title, question variants and tags (answer at a low weight) with word bigrams; the top hits go into the system prompt as KNOWLEDGE BASE, and when nothing fits the prompt says to answer "I'm not sure, ask support" (Help at SITE_URL/help).
- One source: chatbot.js CANNED seeds the KB (ids c-*, regex = instant-answer pattern, same first-match order); kb-seed.js seeds the network notes from the home page, the wallets guide FAQ, the earning guide and the Coinbase support reply in LinkSpin wording (f-*). The fast path serves the KB entry; 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, Try a question. Em dashes in admin input become commas.
- chatbot.js: reasoning off for deepseek (as on IAP), keepalive-padded OpenRouter replies parsed, OPENROUTER_URL override for tests, KNOWLEDGE_DATE 2026-10-20. New public GET /api/chat/kb-stamp.
- QA: qa/kb-retrieval.cjs (12 sample questions rank the right entry first), qa/kb-chat.mjs (local copy + mock OpenRouter), bash qa/run.sh kb; walk lists admin#kb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:38:46 -05:00
martbost 7be213311f Ad editing: fix the link, image, text or name of a running ad; first edit free, then campaignEditFee credits
Orlando (#30) could only pause, resume or top up a banner or login ad with a wrong link.
- POST /api/my/campaigns/<id>/edit (owner) and /api/admin/campaigns/<id>/edit (any ad, free,
  never uses the member's free edit). Banner: link, image, name. Text: link, headline, line, name.
  Login and the rest: link, name. Type, size, budget, geo, schedule, audience are refused.
- Create and edit share one path: checkName/checkTarget/checkBannerImage/checkTextCopy in ads.js
  (validate() now calls them) and adChecks() in server.js (frame check + a new banner image check:
  loads, is a real PNG/JPG/GIF/WebP, up to 3 MB; own uploads read off the volume).
- Fee: campaigns.edits counts member edits; the first is free, each later one costs the site
  setting campaignEditFee (default 100, admin Settings). Charged from the engine pool via
  spendEarned (earned first, then credited purchased); with neither, a burn row on the
  best-funded position (the normal burn queue). Guarded claim so two saves cannot both be free;
  a failed save refunds exactly what was taken.
- History: campaigns.edit_log (ts, by, fields, old/new values, fee), last 50.
- NAS: clicks already route through /api/ads/click/<id>, so a new link needs no write; a new
  image or text goes to the NAS row via nas.updateCreative. Failures never block the edit and
  retry on the next reconcile pass. Open ad-viewer tokens get the new link.
- UI: Edit button on the Ads screen (CR.dialog editor, real-size preview, upload, free/fee note
  and confirm), /ads#edit=<id> deep link from the /tools list, admin Member content shows edit
  count + history with an Edit action. Chatbot canned answer + FACTS.
- qa/adedit.mjs: 51 checks against a throwaway DATA_DIR, Playwright screenshots in D:/tmp/ad-edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 19:24:05 -05:00
martbost c4d6cdfb3d Pipeline colours: stage rules now outrank the grey default
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 16:44:03 -05:00
martbost 4dae478902 Pipeline board colour: one colour per stage (tinted column, top bar, coloured title, count pill, card stripe), white cards with dark names, amber stalled cards and chips; cache tags bumped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 16:42:19 -05:00
martbost c963226703 LinkSpin copy: every $20 qualifying-package reference is now $25 (LinkSpin sells $10, $25, $50, $100, $250, $500; there is no $20 package), first package From $10, the $10 test, partner kit split on a $25 package, team-building math; POL suggestion looks up the $25 product (the $20 lookup never matched); cache tags bumped. The $100 split examples ($20 level 2 / platform) are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 16:23:03 -05:00
martbost 406113bc03 Banner Spin engine (phase 1): /i/ image with no-store + fresh ETag, /c/ click matching (visitor key + placement host note, 15 min) with fallback, /s/ exact-match script embed, impression counters flushed every 5 s (read-add-write), banner clicks with lsid conversions + source postbacks, tiers ($25 own package; Starter 2x5, Builder 5x15, Leader 10x25), member + admin API, admin kill switch per Banner Spin / per banner / global, Banner Spins in admin Member content
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 10:58:44 -05:00
martbost afede88c4a Admin Member content pane: every page, link, source, zone, ad, postback, upload, profile, broadcast, audience and video members made, in one list
- GET /api/admin/content?type=&q=&from=&to=&flagged=1&page=&per=&fresh=1 (admin only, read-only): content.js normalizes
  rows from each module's own adminAll() (new one-pass accessors in pages, rotator, sources, zones, postbacks,
  audiences, messages.adminBroadcasts, videomaker.adminJobs) plus ads.adminList and accounts.listAll; owner shown as
  @username, email and member #; created in Central time; totals per type; busiest hosts in the current view
- Flags: open member reports on an ad, dead or parked destinations, burned link domains, failing postbacks,
  admin-paused zones, home-page demo links. No deny list exists yet
- Row actions only reuse existing moderation routes (campaign pause/resume, zone pause/resume); "Open member" jumps
  to the member card; page Preview works for drafts and is never counted (admin allowed on ?preview=1)
- Uploads: /uploads files now recorded with their uploader in uploads-index.json; older files get the owner from
  whatever uses them (campaign creative, profile, wall offer)
- Credits > Your purchases: buys made from linked positions are included, labelled "Position N"
- Cache tags: admin.css 20261018a, admin.js 20261018b, credits-screen.js 20261018b

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 07:01:58 -05:00
martbost 8a1a6b1f6d Chat bubble back on every Control Room screen: the shell loads chat.js once per page (it only lived on the retired /my dashboard); Control Room styles for the widget
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 06:35:55 -05:00
martbost 57b8eb4208 Login ads: flat 30-day slot, same as InstantAdPay
- Engine (JSON + MySQL twin): login ads are a slot buy (loginSlotCredits 1000,
  loginSlotDays 30, loginSlotsMax 3, dwell 10 s). createCampaign pins the budget
  to the slot price, sets the 30-day expiry and charges it once, purchased credits
  only (credited purchased grade first, the rest burns on-chain; viewing credits
  never pay). countLoginSlots counts live member slots (house never counts); a 4th
  is refused while 3 are live. Sign-in pick prefers member slots over the house.
  The per-day charge loop only runs for legacy login ads with no expiry.
- Day keys on Central time (ctDay / dayKeyNow / today) instead of UTC toISOString,
  incl. login lastShownDay, the daily sweep, claim streak and sign-in bonus.
- Beyond IAP: resuming a paused slot obeys the same cap, top-up is refused on a
  slot, the audit's days-charged check skips slots, JSON grantWelcome keeps the
  purchased grade.
- Ads screen: slot wording, loginSlots { max, used, free } from the API, chip and
  cost line show open slots, Launch disabled with an explanation when full; no Top
  up on slots; classic dashboard, earning page, admin rate labels and chatbot
  (canned answer + FACTS, KNOWLEDGE_DATE 2026-10-18) updated. Cache tags bumped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 05:45:30 -05:00
martbost 44d40863db Ads screen layout by real width + Qualified Start positions on Credits (wallet switch fix)
Ads: the campaign table squeezed its empty-state note (and the first column) to a
word or a letter per line beside the side cards. Container queries now stack the
side cards under the table and turn rows into cards when the table cannot hold
seven columns, whatever the rail state. cr.css: an empty-state row (one muted
note) spans every column on every Control Room table.

Wallet: Disconnect really lets go (keeps wagmi's disconnected marker, revokes the
injected permission, next connect opens the account picker), so MetaMask no longer
snaps back to the first account. Credits gains Switch account, Disconnect, Add a
position wallet and a Buy from picker (ported from the classic Buy pane), so a
member can add wallets #2..#5 and buy from each while staying signed in as
themselves. Classic dashboard and Wallet screen copy point to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 05:15:15 -05:00
martbost df1b900f45 Support: Help screen, public /support page, ticket link and chat hand-off on InstantAdPay's shared desk
helpdesk.js proxies to InstantAdPay's partner API (/api/partner/support/*), signed with the
same LS_SYNC_SECRET + X-LS-Ts/X-LS-Sig as iapsync.js, IAP_URL as the base. No tickets are
stored here.

- /help: Control Room screen (list, new ticket with the desk's categories, thread, reply);
  Help on the rail with an unread badge when Marty has replied (/api/my/support/unread, 60 s cache)
- /support and /support/t/<token>: public form + private ticket link, behind the sign-up
  guard's walls (honeypot, form age, IP/email limits, icon check) on their own counters;
  these pages, their API and their files pass the curtain for anonymous visitors
- chat bubble: "Send this to support" hand-off, greeting points to Help and /support;
  chatbot flags hand-off on support questions and unsure answers; CANNED + FACTS updated,
  KNOWLEDGE_DATE 2026-10-16
- Support in the home nav, common.js nav/footer and every public footer; copy that said
  "message support" now points at Help
- cache tags bumped (common.js, cr-shell.js, chat.js, my.js, credits-screen.js)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:05:02 -05:00
martbost d1a25e72f2 Admin wears the Control Room: light workspace, dark rail and topbar, Instrument scheme
The /admin console now looks like the member screens instead of the dark-navy
site.css back office (Marty: "the admin should be the same color as the site").
Same recipe as /tools (2026-10-08): cr.css is the design system, site.css loads
inside @layer legacy so the cr tokens win, tools.css restyles the shared legacy
panes, and the new admin.css does the admin-only parts.

- admin.html: page wrapped in #page; the pane menu (nav.bo-menu, same
  data-pane buttons and ids) is a dark rail with the Collapse toggle and Site
  links; topbar carries the crumb, #boTitle, #chainLine readout, admin who
  pill and Log out; a status strip with the chain and a Central clock; the
  sign-in card centred on the light workspace. Inline <style> moved to
  admin.css; the two dark-only inline backgrounds switched to panel tokens.
  Cache tags: admin.css/admin.js ?v=20261012a.
- admin.css: rail buttons mirror cr .rail a (wide and icon-only, phone bottom
  bar scrolls with icon + label), tables with mono headers and hover rows,
  status pills and the house tag in the light scheme, drip steps, rates and
  kv forms, label-wrapped inputs, blue action buttons, phone grids.
- admin.js: rail collapse remembers cr.rail like the member shell, strip
  clock, strip chain line, error text uses var(--bad) instead of #ff8a8a.

Member rail and cr-shell.js are untouched; the admin sign-in flow is the
same /api/admin/auth endpoints as before. Verified locally with Playwright
at 1366x900 and 390x844 on every pane plus /links as a member.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-12 10:55:10 -05:00
martbost 0a30b1da60 Link-domain pool by channel + safety checks, hosted page images + provider allowlist, Reports pages and zones sections
Item 1 (domains.js): every short link domain in linkDomains gets a channel (email / messaging / social / reserve)
via the new linkDomainChannels site setting ("host:channel,..."; default order email, messaging, social, email,
reserve). Checks every 6 h + Admin > Link domains "Check now": Google Safe Browsing v4 when GSB_API_KEY is set
(unknown otherwise), URIBL + SURBL DNS lists (answer = listed, NXDOMAIN = clean, 127.0.0.1 or errors = unknown),
and a TelegramBot-UA reachability probe. Flagged or listed = BURNED: out of domains.live() (no new links or
pages on it, existing /r/ codes still resolve), admin told once via telegramAdminChatId or ADMIN_EMAIL.
State in DATA_DIR/domains.json. New: GET /api/my/link-hosts, GET+POST /api/admin/domains, admin pane.
/api/my/pages now hands out hosts from domains.live().

Item 2 (pages.js, formrestyle.js): POST /api/my/pages/upload (raw image body, multipart, or JSON base64) for
png/jpg/webp up to 2 MB, 50 per member, magic bytes checked, sharp re-encode when installed, stored under
DATA_DIR/uploads/pages/<owner-hash>/<id>.<ext>, served at /u/pages/... immutable for a year; delete via
POST /api/my/pages/images/<id> {remove}. Pages editor: Upload image button beside the image field + a strip of
the member's images. Provider allowlist (17 autoresponders, Sendy by /subscribe path) exposed as `providers`;
the editor says "Recognised: AWeber" or "Unknown provider: plain post to <host>" at paste time; pub() carries
formProvider. Unknown hosts still allowed when parse-or-refuse passes.

Item 3 (zonereport.js, pages.summary): /api/my/reports returns {spins, pages, zones} (spins still spread at the
top level) for the chosen days; Pages and Zones sections on /reports with 30-day bars, totals, per-item tables,
phone width checked. Zone numbers are a read-only view over zones.json (zones.js untouched).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 11:28:47 -05:00
martbost 3eda2fe0cc Blog surfaced (header nav, home strip, footer) + five seed articles with kit-derived covers and the seed/publish tooling; zones: network tier default OFF until NAS is switched on at the end of testing
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 06:24:55 -05:00
martbost 8ec82bd282 Retire the classic /my dashboard: control-room screens take over (links/ads/credits/wallet/team), leftover panes (welcome tour, line broadcast, pipeline, promo tools, training, profile) live at /tools as 'More' in the rail; /my redirects by #pane; every link and email retargeted
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 15:37:00 -05:00
martbost ad744d8c0f Site host from one module: host.js exports SITE_HOST/SITE_URL and every module, email, Telegram post, QR, ad click URL and OG tag reads it (no more hard-coded test hostname); public pages carry {{SITE_URL}} filled at serve time; frame check carries the curtain pass for our own hosts so a test ad can point at a spin link; stale IAP sitemap removed
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 08:52:04 -05:00
martbost cfb9ed13d0 Zones guardrails: origin lock to the declared site, warm-up then earning, hold under 40% viewable, admin Zones pane with pause
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-29 17:38:08 -05:00
martbost 00ab223ce6 LinkSpin marks: wordmark in every header, LinkSpin logo and icon files, split brand strings replaced 2026-09-16 04:41:16 -05:00
martbost c5ffe1570e LinkSpin identity: sapphire and chrome after the Nexus badge, Rajdhani display type, circuit texture, wordmark logo 2026-09-16 04:37:18 -05:00
martbost 010e8d7ffc LinkSpin test area: InstantAdPay engine fork rebranded, network registry, sponsor carry-over with engine activation and claim window, rotator with /r/ redirects, link-domain mini-sites
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 16:16:52 -05:00