Daily LinkSpin snapshot card (Marty 2026-11-02): spin links served, Banner Spin views, zone views, page views and leads, then sign-ups, purchases and POL paid, posted once a day to the LinkSpin Support topic (new target 'support', settings telegramSupportChatId/TopicId); window24() helpers on rotator, bannerspin, zones and pages; POST /api/admin/snapshot/send takes {target} for a one-off

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-02 08:17:38 -06:00
parent fb0afbcb3c
commit d22b8adada
7 changed files with 77 additions and 38 deletions
+8 -1
View File
@@ -295,6 +295,13 @@ function sweepDemos() {
if (gone.size) { J.db.hits = J.db.hits.filter(h => !gone.has(h.r)); J.db.conv = J.db.conv.filter(c => !gone.has(c.r)); J.save(); }
return gone.size;
}
// site-wide figures for the daily snapshot (snapshot.js): the last `since` window, every owner, bots left out
function window24(since) {
const hits = J.db.hits.filter(h => h.ts >= since); const real = hits.filter(h => !h.bot);
return { links: J.db.rotations.length, created: J.db.rotations.filter(r => (r.created || 0) >= since).length,
served: real.length, unique: new Set(real.map(h => h.v)).size, bots: hits.length - real.length,
countries: new Set(real.map(h => h.c).filter(Boolean)).size };
}
function servedToday() {
// Central-time day, like Reports
const now = new Date(); const ct = new Date(now.toLocaleString('en-US', { timeZone: 'America/Chicago' }));
@@ -315,5 +322,5 @@ function adminAll() {
destinations: (r.destinations || []).map(d => ({ id: d.id, url: d.url, label: d.label || '', weight: d.weight, active: !!d.active, autoPaused: d.autoPaused || 0, health: d.health ? { state: d.health.state, note: d.health.note || '', checkedAt: d.health.checkedAt || 0 } : null })),
hits: o.hits, hits7: o.hits7, bots: o.bots, conversions: cv[r.id] || 0 }; });
}
module.exports = { init, adminAll, hitById, list, get, create, update, remove, addDest, updateDest, resolve, stats, totals, convert, summary, createDemo, claim, sweepDemos, servedToday,
module.exports = { init, adminAll, hitById, list, get, create, update, remove, addDest, updateDest, resolve, stats, totals, convert, summary, createDemo, claim, sweepDemos, servedToday, window24,
pub, rawRotations, save, findMine, setExternalConvert, PRESETS, cleanHours, cleanTz, cellAt, zoneFor, isOn, COUNTRY_TZ, sourceCounts, detachSource };