Tank, roster and downline: sortable/filterable lists with last seen, surf earnings and wallet/payout state; admin Members table loads 5000 accounts
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -494,7 +494,7 @@ async function boot() {
|
||||
notify: async (memberId, subject, text, kind) => { const a = await accounts.byMemberId(memberId); if (!a || !a.email) return; const html = '<p>' + String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/(https:\/\/[^\s]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>').split('\n\n').join('</p><p>').replace(/\n/g, '<br>') + '</p>'; await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], subject, html, kind || 'notice'); } });
|
||||
setInterval(() => wednesday.tick().catch(e => console.error('wednesday', e.message)), 5 * 60 * 1000);
|
||||
setInterval(() => snapshot.tick().catch(e => console.error('snapshot', e.message)), 10 * 60 * 1000);
|
||||
tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: 'https://instantadpay.com' });
|
||||
tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, ads, site: 'https://instantadpay.com' });
|
||||
await fraud.init({ dataDir: DATA_DIR });
|
||||
{ // a suspended account is signed out everywhere: every member route sees no session
|
||||
const realFrom = auth.fromRequest.bind(auth);
|
||||
@@ -1752,10 +1752,14 @@ const server = http.createServer(async (req, res) => {
|
||||
if (acct && acct.username) refs.push(acct.username);
|
||||
if (memberId) refs.push(String(memberId));
|
||||
const joined = await accounts.listByReferrer(refs);
|
||||
const rTot = await ads.earnedTotals(joined.map(r => r.email)); // surf earnings per referral (Marty, 2026-09-29)
|
||||
out.referrals = joined.map(r => ({
|
||||
name: r.username || r.email.replace(/^(.).*(@.*)$/, '$1***$2'), // username, else privacy mask
|
||||
joined: r.created,
|
||||
status: r.address ? 'wallet linked' : 'joined free'
|
||||
lastSeen: r.lastSeen || 0,
|
||||
wallet: !!r.address, activated: !!r.memberId,
|
||||
earned: (rTot[r.email] || {}).earned || 0, balance: (rTot[r.email] || {}).balance || 0,
|
||||
status: r.memberId ? 'payouts on' : r.address ? 'wallet linked' : 'joined free'
|
||||
}));
|
||||
out.isAdmin = !!(ADMIN_EMAIL && out.email && String(out.email).toLowerCase() === ADMIN_EMAIL); // shows the Admin link
|
||||
out.wallUnlocked = wallUnlockedFor(out.buyerCount || 0); // how many wall positions are the member's own
|
||||
@@ -2404,6 +2408,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const idsOf = m => [m.memberId, ...(posIds[m.email] || [])].filter(Boolean);
|
||||
// Clinton's ask (2026-09-14): on levels 2 and 3 show who has made their $20+ buy (counted for their own
|
||||
// sponsor) and how many qualifying buyers of their own they have, so a leader can see who is one short
|
||||
const lTot = await ads.earnedTotals(levels.flatMap(L => L.members.map(m => m.email))); // surf earnings per person (Marty, 2026-09-29)
|
||||
const onchain = {};
|
||||
for (const m of levels.flatMap(L => L.members)) { let bought = false, buyers = 0; for (const id of idsOf(m)) { const mm = await cachedMember(id); if (mm) { if (mm.countedAsBuyer) bought = true; buyers += mm.buyerCount || 0; } } onchain[m.email] = { bought, buyers }; }
|
||||
const out = levels.map(L => ({ level: L.level, members: L.members.map(m => ({
|
||||
@@ -2414,6 +2419,9 @@ const server = http.createServer(async (req, res) => {
|
||||
ref: m.code || null, // opens the activity drop-down (Clinton's ask, 2026-09-14): any of the three levels
|
||||
email: L.level === 1 ? m.email : null, // directs only
|
||||
joined: m.created,
|
||||
lastSeen: m.lastSeen || 0,
|
||||
wallet: !!m.address, activated: !!m.memberId,
|
||||
earned: (lTot[m.email] || {}).earned || 0, balance: (lTot[m.email] || {}).balance || 0,
|
||||
qualified: idsOf(m).some(id => qualified.has(id)),
|
||||
earnedWei: idsOf(m).reduce((n, id) => n + BigInt(earnedBy[id] || '0'), 0n).toString() })) }));
|
||||
// the member's own linked positions sit on level 1 too, labelled as theirs
|
||||
@@ -3117,7 +3125,7 @@ const server = http.createServer(async (req, res) => {
|
||||
}
|
||||
if (p === '/api/admin/members' && req.method === 'GET') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const members = await accounts.listAll(500);
|
||||
const members = await accounts.listAll(5000); // was 500: older members (igor147, joined 09-12) vanished from the table and its search once the site passed 500 accounts (Marty, 2026-09-29)
|
||||
// resolve each sponsor token (username, share code or member #) to the sponsor's name
|
||||
// the lookup covers EVERY account, not the page's slice: built from `members` it called every
|
||||
// sponsor who joined before the newest 500 a dead link (144 of them, Marty 2026-09-23)
|
||||
|
||||
Reference in New Issue
Block a user