Files
stackpol/README.md
T
martbost ffa0d74c70 My Stack POL: network sign-in through the hub + signed-in member area at /my (Marty approved 2026-11-19)
- networksso.js (shared file, same copy as IAP/LinkSpin/YPB): hub-only sign-in (HUB_SSO=on), silent check on /my, sign-out
- my.js: signed session cookie (keyed off HUB_SECRET), sign-outs in the my-signouts.json MySQL document; /my shows the page
  link + on/off, Pro, join links per program, share kit, own payout rows with Polygonscan links and totals from the ledger
- iapswitch.js: the page switch stays in IAP's stack-optin.json; Stack POL calls IAP POST /api/partner/stackpol/switch
  (signed, STACKPOL_SWITCH_KEY; spec in the file). Until IAP has it, /my links to IAP Promo tools
- tools/indexer.py: snapshot gains `my` (every paid member's rows, wallets, page flag, IAP switches, Pro list); public data unchanged
- header Sign in / My Stack POL entry; robots keeps /my and /sso/ out
- qa/my.test.mjs: 66 checks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 06:57:11 -06:00

14 lines
4.4 KiB
Markdown

# Stack POL
stackpol.com: every POL payout across the network, stacked. Live app since 2026-11-09 (replaced the Oct 1 placeholder in the same Coolify slot k6p591wzomylttvsva3e6w7i).
- server.js (Node 20, no dependencies): home with live network totals, /programs, /earn/<slug> per program, /ledger (?p=<key>), opt-in member stacks at /<username>, /blog (+ /blog/<slug>, /blog/tag/<t>, /blog/feed.xml), /sitemap.xml, /robots.txt, /api/totals. Full SEO head on every page (layout.js): canonical, robots, Open Graph, Twitter card, JSON-LD (WebSite, Organization, FAQPage, BlogPosting, Breadcrumb, ItemList, VideoGame/WebApplication, ProfilePage).
- Data: tools/indexer.py runs on core every 5 min (/etc/cron.d/stackpol-indexer, copy in /root/stackpol-indexer) and POSTs a snapshot to /api/ingest (Bearer STACK_INGEST_KEY, key file /root/.stackpol-ingest-key). Sources: each game's payout file, IAP + LinkSpin chain-index TierPaid events, Downline Banners chain-index Paid events (sponsor + line), Viral Banner Blitz VBBShop Paid role 0 + Claimed logs read from Polygon (scan cache /root/stackpol-indexer/vbb-chain.json) and on-chain-checked weekly prize transfers from VBB prizes.json, ViralAdBlitz VABShop Paid level 1-5 + Claimed logs (cache vab-chain.json), Earners Corner + PassiveDrip payout ledgers, wallet->username from IAP accounts/positions and LinkSpin accounts. Members are named only when opted in (/root/stackpol-indexer/optin.txt + IAP stack-optin.json).
- Blog: content/blog/<slug>.json, one file per post (title, seoTitle, excerpt, body HTML, cover, tags, publishedAt, updated, faq[]). Same engine as InstantAdPay/LinkSpin blog.js, ported to file storage. Future-dated posts stay hidden until their time. Generators in tools/write_posts_*.py.
- programs.js: program registry (keys match the indexer); game blurbs are InstantAdPay's own.
- mockup/: the Oct design mockup (artifact https://claude.ai/artifact/1mN4dCYUcbw7EHicCdejM3).
- Standing rule (Marty 2026-11-15): every rebuilt network site is added here when it goes live: a programs.js entry, its /earn/<slug> page (automatic from the entry, plus public/img/<key>.jpg 800x420) and an indexer source for its member payouts (house/company wallets excluded). ViralAdBlitz, 5xYourTeam and DownlineHydra added 2026-11-15.
- Site assistant (2026-11-15): chat widget on every page (`public/assets/chat.js` + `chat.css`, loaded from layout.js). `chatbot.js` holds what it knows (CANNED + FACTS from this repo); `chatcore.js`, `kb.js` (kb.json is a MySQL document, see Storage) and `netkb.js` (the shared network knowledge on the hub, signed as `HUB_SITE=stackpol` with `HUB_SECRET`) are the same files as the rebuilt sites. OpenRouter key: Coolify env `OPENROUTER_API_KEY`. No admin KB editing on Stack POL. Test: `node qa/chatbot.test.mjs`.
- Storage (Marty 2026-11-16: "they should live in the database"): MySQL, Coolify `stackpol-mysql` yw404lxgfkbb5n9s3pxu1hxk (db `stackpol`, binlog expiry 3 h persisted, in core's hourly dumps). App env `DOCSTORE_URL`; `docstore.js` (same file as LinkSpin, skips unchanged writes) keeps the data documents of DATA_DIR (/app/data, no volume) in table `docs`: `stack-index.json` (the last indexer snapshot minus `at`), `stack-index-at.json` ({at}), `kb.json` (chatbot entries), `netkb-cache.json` (network knowledge cache). Loaded before the server listens, so a deploy serves the last totals at once. The ingest API is unchanged. Without DOCSTORE_URL (local only) they are plain files in DATA_DIR.
- My Stack POL (Marty approved 2026-11-19): signed-in member area at /my (my.js), "Sign in" / "My Stack POL" in the header. Network sign-in through the hub only (networksso.js, the shared file, unchanged copy of IAP's): envs HUB_SSO=on, HUB_URL, HUB_SECRET, HUB_SITE=stackpol (the last three already serve netkb). Needs stackpol in the hub's HUB_SSO_SITES. Session = signed cookie sp.sid (7 days, keyed off HUB_SECRET); sign-out writes my-signouts.json (MySQL document) so older cookies stop working. Shows the page link + switch, Pro (IAP's rule via stack-optin.json pro), join links (programs.js), share kit, and the member's own payout rows from the snapshot's `my` block (tools/indexer.py). The switch stays in IAP's stack-optin.json: iapswitch.js calls IAP POST /api/partner/stackpol/switch (spec in the file header) with STACKPOL_SWITCH_KEY; until IAP has that route and both apps have the key, /my links to IAP Promo tools instead. Test: node qa/my.test.mjs.