diff --git a/chatbot.js b/chatbot.js index 83c6217..d5c74ae 100644 --- a/chatbot.js +++ b/chatbot.js @@ -153,7 +153,7 @@ const CANNED = [ a: 'BTC4Hits is now LinkSpin. If your BTC4Hits email checked out as deliverable, your account came over on 2026-11-11: sign in at linkspin.app/from/btc4hits with the same email (we send you a code, there is no password). Your BTC4Hits sponsor came with you when they were also a member here; if not, you wait in the holding tank, where a member can pick you up as your sponsor, or you can name the person who invited you in the Who invited you? box. Rotators that had visits in the last month are now LinkSpin spin links on your Links screen, named BTC4Hits rotator and the old number, and the old btc4hits.com rotator link forwards to them. Destination URLs that no longer worked were left out. Every other btc4hits.com page now opens linkspin.app/from/btc4hits. Pro upgrades and any old BTC4Hits commissions do not carry over.' }, { id: 'holding-tank', title: 'Holding tank and adoptions', q: ['What is the holding tank?', 'How do I adopt a member?'], tags: ['holding tank', 'adopt', 'no sponsor'], re: /(holding tank|adopt|no sponsor|without a sponsor|orphan)/i, - a: 'Members who join from the public site with no sponsor wait in the holding tank under More, My line, unless the network already knows their sponsor (the same email or wallet on InstantAdPay), in which case they are placed under that sponsor. A new sign-up shows an Opens in badge with no Adopt button for their first 24 hours, so they have a day to tell us who invited them (the 24-hour safety net for wallet-linked members still runs on its own clock). After that, a member who has switched on payouts and bought their own qualifying package can adopt one, first come, with a 7-day window for the new member to link a wallet or buy; otherwise they return to the tank. Adopting sets the sponsor, and their first purchase then binds to the adopter on the contract. Members who have linked a wallet show a Ready to activate badge with the hours left and sit at the top of the list; adopting one switches their payouts on under you right away. If nobody adopts them within 24 hours, the site assigns them to the next eligible adopter in turn (own $25 package, fewer than 10 people held from the tank who have not switched on payouts yet, signed in within the last 7 days); the one assigned least recently goes first. Someone waiting in the InstantAdPay tank as well is assigned there, and the adoption carries over to LinkSpin.' }, + a: 'Members who join from the public site with no sponsor wait in the holding tank under More, My line, unless the network already knows their sponsor (the same email or wallet on InstantAdPay), in which case they are placed under that sponsor. Members who can adopt (payouts on and their own $25 package) see a Holding tank item in the Control Room menu, with the number waiting, that opens the tank under More, My line. You can adopt up to 10 people at a time: anyone you picked up who has not switched on payouts yet counts, and a slot opens when one of them switches on payouts or their 7-day window ends. A new sign-up shows an Opens in badge with no Adopt button for their first 24 hours, so they have a day to tell us who invited them (the 24-hour safety net for wallet-linked members still runs on its own clock). After that, a member who has switched on payouts and bought their own qualifying package can adopt one, first come, with a 7-day window for the new member to link a wallet or buy; otherwise they return to the tank. Adopting sets the sponsor, and their first purchase then binds to the adopter on the contract. Members who have linked a wallet show a Ready to activate badge with the hours left and sit at the top of the list; adopting one switches their payouts on under you right away. If nobody adopts them within 24 hours, the site assigns them to the next eligible adopter in turn (own $25 package, fewer than 10 people held from the tank who have not switched on payouts yet, signed in within the last 7 days); the one assigned least recently goes first. Someone waiting in the InstantAdPay tank as well is assigned there, and the adoption carries over to LinkSpin.' }, { id: 'team', title: 'My line: the Team screen', q: ['How do I see my downline?', 'Who is in my team?'], tags: ['team', 'my line', 'downline', 'levels'], re: /(my line|downline|my team|who (is|are) (in|on) my|three levels|level 1\b)/i, a: 'Team shows your line as a working table, three levels deep: who joined through your link, who has switched on payouts, who has bought, and how many qualifying buyers each person has. The chip count is what opens your levels: two qualifying buyers ($25 or larger) open level 2, five open level 3.' }, @@ -208,7 +208,7 @@ ${refuelFact()}${synFact()}- PRODUCT, all free with an email account: SPIN LINKS - ACCOUNT: join at ${SITE_URL}/join with email only, a six-digit code, no password. Wallet linking happens inside the Control Room (Credits screen): one signature to link, then payouts switch on by activating (one transaction, gas only) or by buying any package. SafePal is the recommended wallet; MetaMask, Phantom (turn Polygon on first) and any WalletConnect wallet work; Trust Wallet blocks a buy that spends most of its POL. No card button on the site: members buy POL with a card on any major exchange or on-ramp, then send it to their own wallet on the Polygon network (guide at ${SITE_URL}/wallets); never name a specific exchange or on-ramp brand. - SPONSOR: the invite link opened most recently sets the sponsor (30-day cookie), shown on the join page, locked when the account is created; the contract binds the buyer to that sponsor at the first purchase. CARRY-OVER: Crypto Team Build Network members who sign in with the email they use on InstantAdPay get their InstantAdPay sponsor from the network registry automatically when no invite link was used. Wrong sponsor before the first purchase: the admin can move the account. Members should switch on payouts before their people buy. - CONTROL ROOM screens: Links, Pages, Zones (with Audiences), Ads, Credits, Reports, Team (three levels, who has payouts on, who bought, qualifying-buyer counts), Wallet (what was paid to this wallet, payout history). More at ${SITE_URL}/tools: Promo tools, Training, Pipeline (a follow-up board for prospects and directs), My line (including the holding tank: members who joined with no sponsor wait there and can be adopted by a member with payouts on and their own qualifying package), Profile. -- BTC4HITS (2026-11-11): the closed BTC4Hits rotator site moved here. Its members with a deliverable email were imported as waiting accounts (InstantAdPay first, carried here by the registry sync), with their BTC4Hits sponsor when that sponsor was also imported or already a member, otherwise into the holding tank. Sign-in page: /from/btc4hits (same email, code sign-in, no welcome-back credits). Rotators with visits in the last month became spin links named 'BTC4Hits rotator #' on the owner's account with every working destination (dead, parked or erroring URLs left out), on a 'BTC4Hits' traffic source; btc4hits.com/ro.php?id= forwards to the spin link, other btc4hits.com pages go to /from/btc4hits. Pro status and old BTC4Hits commissions do not carry over. HOLDING TANK CAP: an adopter may hold up to 10 people from the tank at one time (open adoptions whose person has not switched on payouts yet; was 2). +- BTC4HITS (2026-11-11): the closed BTC4Hits rotator site moved here. Its members with a deliverable email were imported as waiting accounts (InstantAdPay first, carried here by the registry sync), with their BTC4Hits sponsor when that sponsor was also imported or already a member, otherwise into the holding tank. Sign-in page: /from/btc4hits (same email, code sign-in, no welcome-back credits). Rotators with visits in the last month became spin links named 'BTC4Hits rotator #' on the owner's account with every working destination (dead, parked or erroring URLs left out), on a 'BTC4Hits' traffic source; btc4hits.com/ro.php?id= forwards to the spin link, other btc4hits.com pages go to /from/btc4hits. Pro status and old BTC4Hits commissions do not carry over. HOLDING TANK CAP: an adopter may hold up to 10 people from the tank at one time (open adoptions whose person has not switched on payouts yet; was 2). The cap is the site setting tankAdoptCap (default 10). HOLDING TANK MENU ITEM: members who can adopt (payouts on, own $25 package) see Holding tank in the Control Room menu (rail), with a badge of how many can be adopted right now; it opens More > My line, where the Holding tank card lists them and says how many you can adopt at a time. Members who cannot adopt do not see the item. - WHO INVITED YOU (2026-11-07, Marty approved): a member with no sponsor and no member number sees a Who invited you? box at the top of their Control Room screens. They type a username, confirm in an in-page box, and that member becomes their sponsor (it follows to InstantAdPay, lifts the hold, and the sponsor gets a new-referral email and notice); with a wallet already linked the site switches their payouts on under that sponsor right away. Refused: themselves, a username that does not exist, someone in their own line, a member who cannot take new members, a member with no payouts on and nobody above them on the contract, and anyone who already has a sponsor or a member number. Nobody invited me hides the box (a small link under More brings it back while they are in the tank) and changes nothing else. It never blocks the site. It is not an adoption: no 7-day window and it does not count toward the two. - SIGN-UP GRACE (2026-11-07): for 24 hours from sign-up nobody can adopt a member by hand. The 24-hour auto-assign is unchanged and runs from the wallet link, so a member who links a wallet in their first hour is matched about 24 hours after linking, with at most a short hand-adoption window first. Members back in the tank later have no grace. - HOLDING TANK ACTIVATION HOLD (2026-10-27): a member with no sponsor is first matched to their network sponsor (the same email or wallet with a sponsor on InstantAdPay). Nobody known: the free Switch on payouts waits for an adopter and the Credits screen says "You're being matched with a sponsor. Payouts switch on as soon as someone picks you up (within 24 hours)." with the time left; they show at the top of every holding tank with a green Ready to activate badge and the hours left, and the shared payments topic on Telegram is told. Nobody adopts in 24 hours: the site assigns them to the next eligible adopter in rotation (own $25+ package, fewer than 10 people held from the tank who have not switched on payouts yet, signed in within 7 days; least recently auto-assigned first), and the pickup is posted marked (auto-assigned). The moment they have a sponsor (adopted, assigned or matched), the site switches their payouts on under that sponsor (engine-paid) and sends them the transaction link. A PURCHASE IS NEVER HELD: a tank member can buy at any time; with no sponsor yet that purchase places them under the platform position for good. Someone who arrived through a sponsor link is never held. diff --git a/public/ads.html b/public/ads.html index 5aa6c18..53e01eb 100644 --- a/public/ads.html +++ b/public/ads.html @@ -75,7 +75,7 @@ - + diff --git a/public/assets/cr-shell.js b/public/assets/cr-shell.js index f92d50f..0dbed7c 100644 --- a/public/assets/cr-shell.js +++ b/public/assets/cr-shell.js @@ -19,6 +19,7 @@ window.CR = (function () { ['reports', 'Reports', '/reports', ''], ['conversions', 'Conversions', '/conversions', ''], // conversion pixel goals (2026-10-23) ['team', 'Team', '/team', ''], + ['tank', 'Holding tank', '/tools#line', ''], // adopters only (2026-11-11): shown by tankItem() ['wallet', 'Wallet', '/wallet', ''], ['promo', 'Promo tools', '/tools#promo', ''], ['training', 'Training', '/tools#training', '', 1], @@ -30,7 +31,7 @@ window.CR = (function () { ]; // screens not built yet fall back to the classic dashboard pane so nothing is a dead end const FALLBACK = {}; // the classic /my dashboard is retired (2026-10-08); its leftover panes live at /tools - const BUILT = new Set(['forum', 'links', 'sources', 'pages', 'zones', 'ads', 'credits', 'refuel', 'reports', 'conversions', 'team', 'wallet', 'tools', 'promo', 'training', 'pipeline', 'profile', 'help']); // Training, Pipeline and Profile on the rail, not behind More (Marty 2026-10-11); Help = support tickets (2026-10-16) + const BUILT = new Set(['tank', 'forum', 'links', 'sources', 'pages', 'zones', 'ads', 'credits', 'refuel', 'reports', 'conversions', 'team', 'wallet', 'tools', 'promo', 'training', 'pipeline', 'profile', 'help']); // Training, Pipeline and Profile on the rail, not behind More (Marty 2026-10-11); Help = support tickets (2026-10-16) let ME = null, toastT; // Deep links (2026-10-25): /credits#refuel, /credits#buy and /ads#engine scroll to their panel once it has loaded (and any // sign-in or sponsor pop-up is closed) and flash it, so a button that says "Refuel" lands ON the Refuel panel. @@ -108,7 +109,7 @@ window.CR = (function () { const act = railActive(o); const app = document.createElement('div'); app.className = 'app'; let railWide = true; try { railWide = localStorage.getItem('cr.rail') !== 'narrow'; } catch (e) {} if (railWide) app.classList.add('wide'); // expanded by default (Marty 2026-10-08), the choice remembered per browser app.innerHTML = '' + '
' + esc(o.crumb || 'Control room') + '

' + esc(o.title || '') + '

' + esc(o.sub || '') + '' + (o.actions || '') + '' + themeSeg('crTheme') + '
' // pre-launch notice (Marty, 2026-10-17): open to everyone from today, official launch November 15; date-driven since 2026-11-02 so it drops off by itself at midnight Central on launch day @@ -213,11 +214,27 @@ window.CR = (function () { } return m; } + // Holding tank on the rail (Marty 2026-11-11): only for members who can adopt (their own qualifying package, payouts on), + // a badge with how many can be adopted right now, and the at-one-time cap from the site setting in its title and on the card + function badgeCss() { + if (!document.getElementById('crHelpCss')) { const st = document.createElement('style'); st.id = 'crHelpCss'; st.textContent = '.rail a .rbadge{position:absolute;top:3px;right:3px;min-width:16px;height:16px;padding:0 4px;border-radius:999px;background:var(--sig);color:#fff;font:700 10px/16px var(--mono);text-align:center;box-sizing:border-box}.rail.wide a .rbadge,.app.wide .rail a .rbadge{right:8px;top:50%;transform:translateY(-50%)}'; document.head.appendChild(st); } + } + async function tankItem() { + const a = $('crTank'); if (!a) return null; + let r = null; try { r = await get('/api/my/tank/summary'); } catch (e) { return null; } + if (!r || !r.adopter) { a.hidden = true; return r; } + a.hidden = false; const cap = Number(r.cap) || 0; + const t = 'Holding tank: ' + (r.waiting ? fmt(r.waiting) + ' waiting for a sponsor' : 'nobody waiting right now') + '. You can adopt up to ' + cap + ' people at a time.'; + a.title = t; a.setAttribute('aria-label', t); + badgeCss(); + let b = a.querySelector('.rbadge'); if (!r.waiting) { if (b) b.remove(); } else { if (!b) { b = document.createElement('b'); b.className = 'rbadge'; a.appendChild(b); } b.textContent = r.waiting > 999 ? '999+' : String(r.waiting); } + return r; + } // Help badge on the rail: how many of the member's tickets have a reply from Marty they have not opened (helpdesk.js) async function helpBadge() { const a = $('crHelp'); if (!a) return 0; let n = 0; try { n = Number((await get('/api/my/support/unread')).unread) || 0; } catch (e) { return 0; } - if (!document.getElementById('crHelpCss')) { const st = document.createElement('style'); st.id = 'crHelpCss'; st.textContent = '.rail a .rbadge{position:absolute;top:3px;right:3px;min-width:16px;height:16px;padding:0 4px;border-radius:999px;background:var(--sig);color:#fff;font:700 10px/16px var(--mono);text-align:center;box-sizing:border-box}.rail.wide a .rbadge,.app.wide .rail a .rbadge{right:8px;top:50%;transform:translateY(-50%)}'; document.head.appendChild(st); } + badgeCss(); let b = a.querySelector('.rbadge'); if (!n) { if (b) b.remove(); return 0; } if (!b) { b = document.createElement('b'); b.className = 'rbadge'; a.appendChild(b); } b.textContent = n > 9 ? '9+' : String(n); a.title = 'Help: ' + n + ' new repl' + (n === 1 ? 'y' : 'ies'); return n; @@ -253,7 +270,7 @@ window.CR = (function () { const small = () => { box.innerHTML = 'Remembered who invited you? Tell us'; $('inviteBack').addEventListener('click', e => { e.preventDefault(); full(); $('inviteWho').focus(); }); }; if (ask.dismissed) small(); else full(); } - async function requireSession(onReady) { let m = await me(); whoPaint(m); themeSync(m); if (m && m.signedIn) { strip(); helpBadge(); m = await ensureUsername(m); await loginAd(); inviteCard(m); return onReady(m); } signInFlow(async r => { whoPaint(r); themeSync(r); strip(); helpBadge(); await loginAd(); me(true).then(inviteCard); onReady(r); }); } + async function requireSession(onReady) { let m = await me(); whoPaint(m); themeSync(m); if (m && m.signedIn) { strip(); helpBadge(); tankItem(); m = await ensureUsername(m); await loginAd(); inviteCard(m); return onReady(m); } signInFlow(async r => { whoPaint(r); themeSync(r); strip(); helpBadge(); await loginAd(); me(true).then(inviteCard); onReady(r); }); } // tiles with a sparkline and a delta chip (Instrument scheme, 2026-09-29): series = numbers oldest first function sparkline(series) { const s = (series || []).map(Number); if (s.length < 2 || !s.some(Boolean)) return ''; @@ -272,5 +289,5 @@ window.CR = (function () { return '
' + esc(o.k) + '
' + o.v + (o.unit ? '' + esc(o.unit) + '' : '') + '' + sparkline(o.series) + '
' + (o.delta ? '' + esc(o.delta.text) + '' : '') + (o.note ? '' + esc(o.note) + '' : '') + '
'; } - return { esc, fmt, api, get, copy, dialog, toast, mount, sub, me, requireSession, signInFlow, tile, sparkline, delta, helpBadge }; + return { esc, fmt, api, get, copy, dialog, toast, mount, sub, me, requireSession, signInFlow, tile, sparkline, delta, helpBadge, tankItem }; })(); diff --git a/public/assets/my.js b/public/assets/my.js index e5cad6c..b4176d3 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -1277,7 +1277,7 @@ const r = await (await fetch('/api/my/tank')).json(); if (r.error) { el.innerHTML = ''; return; } $('tankCap').textContent = r.cap; $('tankTtl').textContent = r.ttlDays; - $('tankSub').textContent = r.waiting.length ? r.waiting.length + ' waiting' : 'nobody waiting right now'; + $('tankSub').textContent = (r.waiting.length ? r.waiting.length + ' waiting' : 'nobody waiting right now') + (r.cap ? ' · you can adopt up to ' + r.cap + ' at a time' : ''); const why = $('tankWhy'); why.hidden = r.eligible; why.innerHTML = r.eligible ? '' : 'not yet ' + esc(r.reason); $('tankMine').innerHTML = r.mine.length ? '

Your open adoptions

' + r.mine.map(m => '
' + esc(m.name) + '' + '' + (m.bought ? 'bought' : m.wallet ? 'wallet linked' : 'free, no wallet yet') + ' · last seen ' + ago(m.lastSeen) + '' diff --git a/public/conversions.html b/public/conversions.html index e5b9740..e3c08a7 100644 --- a/public/conversions.html +++ b/public/conversions.html @@ -70,7 +70,7 @@
- + diff --git a/public/credits.html b/public/credits.html index 8807cfb..836aa9d 100644 --- a/public/credits.html +++ b/public/credits.html @@ -83,7 +83,7 @@ - + diff --git a/public/help.html b/public/help.html index 851a69d..0b53238 100644 --- a/public/help.html +++ b/public/help.html @@ -30,7 +30,7 @@
loading
- + diff --git a/public/links.html b/public/links.html index 171e1d8..f1a864d 100644 --- a/public/links.html +++ b/public/links.html @@ -270,7 +270,7 @@ - + diff --git a/public/my.html b/public/my.html index 966f1fb..af5e492 100644 --- a/public/my.html +++ b/public/my.html @@ -1016,11 +1016,11 @@ - + - + diff --git a/public/pages.html b/public/pages.html index 601b8fb..e605596 100644 --- a/public/pages.html +++ b/public/pages.html @@ -73,7 +73,7 @@ - + diff --git a/public/reports.html b/public/reports.html index 9b86aa5..9a184c9 100644 --- a/public/reports.html +++ b/public/reports.html @@ -90,7 +90,7 @@ - + diff --git a/public/sources.html b/public/sources.html index dc296df..5912242 100644 --- a/public/sources.html +++ b/public/sources.html @@ -128,7 +128,7 @@ - + diff --git a/public/team.html b/public/team.html index c8059da..c220652 100644 --- a/public/team.html +++ b/public/team.html @@ -38,7 +38,7 @@ - + diff --git a/public/traffic-guide.html b/public/traffic-guide.html index 6bdefe4..b3cbefc 100644 --- a/public/traffic-guide.html +++ b/public/traffic-guide.html @@ -64,7 +64,7 @@
- + diff --git a/public/wallet.html b/public/wallet.html index d80340a..3c6bbc3 100644 --- a/public/wallet.html +++ b/public/wallet.html @@ -36,7 +36,7 @@ - + diff --git a/public/zones.html b/public/zones.html index fa1fecd..1e41cab 100644 --- a/public/zones.html +++ b/public/zones.html @@ -42,7 +42,7 @@ - + diff --git a/qa/btc4hits-bridge.test.mjs b/qa/btc4hits-bridge.test.mjs index bf86348..a008305 100644 --- a/qa/btc4hits-bridge.test.mjs +++ b/qa/btc4hits-bridge.test.mjs @@ -9,7 +9,7 @@ import { spawn } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { fileURLToPath } from 'node:url'; +import { fileURLToPath, pathToFileURL } from 'node:url'; const SITE = path.join(path.dirname(fileURLToPath(import.meta.url)), '..'); const PORT = Number(process.env.B4H_PORT || 8831), BASE = 'http://127.0.0.1:' + PORT; const sleep = ms => new Promise(r => setTimeout(r, ms)); @@ -45,6 +45,33 @@ try { ok(!fs.existsSync(path.join(dir, 'legacy-grants.json')) && !/legacy grant/.test(fs.readFileSync(log, 'utf8')), 'no welcome-back credits granted'); const a = JSON.parse(fs.readFileSync(path.join(dir, 'accounts.json'), 'utf8')).byEmail['newb4h@qa.test']; ok(a && a.joinedVia === 'b4h' && a.joinedRef === 'legacy:btc4hits', 'account records angle b4h + source legacy:btc4hits', JSON.stringify(a && { v: a.joinedVia, r: a.joinedRef })); + // 1b. Holding tank menu item (2026-11-11): the summary route, and the rail item in a real browser + const cookies = (v.headers.getSetCookie ? v.headers.getSetCookie() : []).map(c => c.split(';')[0]); + const sum = await (await fetch(BASE + '/api/my/tank/summary', { headers: { Cookie: cookies.join('; ') } })).json(); + ok(sum.adopter === false && sum.cap === 10 && typeof sum.waiting === 'number', '/api/my/tank/summary: a new member is not an adopter, cap 10 from the setting', JSON.stringify(sum)); + ok((await fetch(BASE + '/api/my/tank/summary')).status === 401, '/api/my/tank/summary needs a sign-in'); + try { + const PW = process.env.PW || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright'; + const { chromium } = (await import(pathToFileURL(PW + '/index.js').href)).default; + const browser = await chromium.launch(); + const shot = async (summary) => { + const ctx = await browser.newContext(); await ctx.addCookies(cookies.map(c => { const i = c.indexOf('='); return { name: c.slice(0, i), value: c.slice(i + 1), domain: '127.0.0.1', path: '/' }; })); + const page = await ctx.newPage(); const errs = []; page.on('pageerror', e => errs.push(e.message)); + if (summary) await page.route('**/api/my/tank/summary', r => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(summary) })); + await page.goto(BASE + '/links', { waitUntil: 'domcontentloaded' }); await page.waitForTimeout(2500); + const out = await page.evaluate(() => { const a = document.getElementById('crTank'); return a ? { hidden: a.hidden, href: a.getAttribute('href'), title: a.title, badge: (a.querySelector('.rbadge') || {}).textContent || '', label: (a.querySelector('.lbl') || {}).textContent || '' } : null; }); + await ctx.close(); return Object.assign({ errs }, out || {}); + }; + const s1 = await shot(null); + ok(s1.href === '/tools#line' && s1.hidden === true, 'rail: Holding tank item hidden for a member who cannot adopt', JSON.stringify(s1)); + const s2 = await shot({ adopter: true, eligible: true, full: false, held: 2, cap: 10, waiting: 1234 }); + ok(s2.hidden === false && s2.label === 'Holding tank' && s2.badge === '999+', 'rail: shown for an adopter, with the waiting badge', JSON.stringify(s2)); + ok(/You can adopt up to 10 people at a time\./.test(s2.title) && /1,234 waiting/.test(s2.title) && !/\u2014/.test(s2.title), 'rail: one line with the cap from the setting', s2.title); + const s3 = await shot({ adopter: true, eligible: false, full: true, held: 7, cap: 7, waiting: 0 }); + ok(s3.hidden === false && !s3.badge && /up to 7 people at a time/.test(s3.title), 'rail: an adopter at the cap still sees it; cap read from the response (7), no badge when nobody waits', JSON.stringify(s3)); + ok(!s1.errs.length && !s2.errs.length, 'no page errors', JSON.stringify(s1.errs.concat(s2.errs)).slice(0, 200)); + await browser.close(); + } catch (e) { ok(false, 'browser check ran', e.message); } } else ok(false, 'dev sign-in code available', JSON.stringify(st)); // 2. admin spin links ok((await admin('/api/admin/rotations?email=owner@qa.test', 'GET', null, false)).status === 401, 'GET needs admin'); diff --git a/server.js b/server.js index f49b822..3fd73e7 100644 --- a/server.js +++ b/server.js @@ -2498,6 +2498,15 @@ const server = http.createServer(async (req, res) => { for (let i = 2; i < 100 && await accounts.byUsername(pick); i++) pick = base.slice(0, 20 - String(i).length) + i; return json(res, 200, { suggest: pick }); } + // the menu item (2026-11-11): may this member adopt, how many can be adopted right now, the at-one-time cap. Cheap: the waiting + // list is the same 60-second cache the Overview notice uses; the full list stays on /api/my/tank. + if (p === '/api/my/tank/summary' && req.method === 'GET') { + const s = await auth.fromRequest(req); + if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); + if (!tankWaitCache || Date.now() - tankWaitCache.ts > 60000) tankWaitCache = { ts: Date.now(), list: await tank.waiting() }; + const el = await tank.eligibility(s.email); + return json(res, 200, { adopter: !!(el.ok || el.full), eligible: !!el.ok, full: !!el.full, held: el.held != null ? el.held : null, cap: tank.capOpen(), waiting: tank.adoptableOf(tankWaitCache.list).length }, { 'Cache-Control': 'no-store' }); + } if (p === '/api/my/tank' && req.method === 'GET') { const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });