diff --git a/server.js b/server.js index 4b326f8..e1ab985 100644 --- a/server.js +++ b/server.js @@ -724,7 +724,7 @@ async function boot() { domains.init({ dataDir: DATA_DIR, siteConfig, saveSite: patch => fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(siteConfig(), patch), null, 2)), notify: async text => { const sc = siteConfig(); if (sc.telegramBotToken && sc.telegramAdminChatId) await telegramSend(sc.telegramAdminChatId, text); else if (ADMIN_EMAIL && mailer.hasKey()) await mailer.send(ADMIN_EMAIL, 'LinkSpin: link domain burned', text.replace(/<[^>]+>/g, '')); } }); zonereport.init({ dataDir: DATA_DIR }); - snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, rotator, bannerspin, zones, pages, send: async (c, t, th) => { await telegramSend(c, t, th); return true; } }); + snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, accounts, rotator, bannerspin, zones, pages, send: async (c, t, th) => { await telegramSend(c, t, th); return true; } }); setInterval(() => snapshot.tick().catch(e => console.error('snapshot', e.message)), 10 * 60 * 1000); tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: SITE_URL, follow, store: followStore, // network alignment + activation hold + 24-hour safety net (2026-10-27): a tank member's plain activation is never diff --git a/snapshot.js b/snapshot.js index 45f7e0c..fb4ff16 100644 --- a/snapshot.js +++ b/snapshot.js @@ -26,6 +26,11 @@ async function gather(now = Date.now()) { const q = (a, b) => X.db.q(a, b || []); const a = (await q('SELECT COUNT(*) total, SUM(created>=?) s24, SUM(created>=? AND created0) payouts, SUM(last_seen>=?) seen FROM accounts', [since, prior, since, since]))[0] || {}; s.members = Number(a.total || 0); s.signups = Number(a.s24 || 0); s.signupsPrior = Number(a.sPrior || 0); s.wallets = Number(a.wallet || 0); s.payoutsOn = Number(a.payouts || 0); s.seen24h = Number(a.seen || 0); + } else if (X.accounts && X.accounts.listAll) { + // JSON store (production LinkSpin runs without MySQL): the same counts from the account records + const all = await X.accounts.listAll(1e6); + s.members = all.length; s.signups = all.filter(a => (a.created || 0) >= since).length; s.signupsPrior = all.filter(a => (a.created || 0) >= prior && (a.created || 0) < since).length; + s.wallets = all.filter(a => a.address).length; s.payoutsOn = all.filter(a => Number(a.memberId) > 0).length; s.seen24h = all.filter(a => (a.lastSeen || 0) >= since).length; } try { for (const ev of X.chain.recentEvents(1e9)) {