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:
+10
-1
@@ -454,6 +454,15 @@ function settings() { return { off: !!J.db.settings.off, grants: J.db.grants };
|
||||
// image files Banner Spins use, for the admin upload list (file name -> owner + where)
|
||||
function imageRefs() { const out = {}; for (const s of J.db.spins) for (const im of s.banners.map(b => b.image).concat(s.fallbackImage || [])) { const m = LOCAL_IMG.exec(im || ''); if (m) out[m[1]] = { email: s.owner, where: 'Banner Spin ' + s.code }; } for (const [n, r] of Object.entries(J.db.images)) if (!out[n]) out[n] = { email: r.owner, where: '' }; return out; }
|
||||
function totals() { return { spins: J.db.spins.length, banners: J.db.spins.reduce((n, s) => n + s.banners.length, 0), clicks: J.db.clicks.length }; }
|
||||
// site-wide figures for the daily snapshot: impressions counted today (Central day, merged counts + pending deltas),
|
||||
// clicks and new Banner Spins inside the `since` window
|
||||
function window24(since) {
|
||||
const day = ctDay(); let imps = 0;
|
||||
const add = store => { try { for (const sid of Object.keys((store && store.d) || {})) { const r = (store.d[sid] || {})[day]; if (r && r.b) for (const k of Object.keys(r.b)) imps += Number(r.b[k]) || 0; } } catch (e) {} };
|
||||
add(C.db); add(PENDING);
|
||||
const clicks = J.db.clicks.filter(c => c.ts >= since && !c.bot);
|
||||
return { spins: J.db.spins.length, banners: J.db.spins.reduce((n, s) => n + s.banners.length, 0), created: J.db.spins.filter(s => (s.created || 0) >= since).length, impsToday: imps, clicks: clicks.length };
|
||||
}
|
||||
|
||||
// a transparent PNG at the exact banner size, for the blank image (admin off, nothing to show); cached per size
|
||||
const BLANK = new Map();
|
||||
@@ -480,4 +489,4 @@ const rawSpins = () => J.db.spins;
|
||||
const save = () => J.save();
|
||||
function imageSource(img) { const m = LOCAL_IMG.exec(String(img || '')); return m ? { file: path.join(UPLOADS_DIR, m[1]) } : /^https:\/\//i.test(String(img || '')) ? { url: String(img) } : null; }
|
||||
const _test = { notes: () => NOTES, flush, vkey, cacheFlag, winnerOf };
|
||||
module.exports = { init, SIZES, TIERS, MAX_BYTES, tierFor, list, create, update, addBanner, updateBanner, noteImage, dims, image, script, click, clickById, convert, stats, summary, adminAll, adminSet, setGlobal, settings, imageRefs, totals, blankPng, readImage, flush, findMine, rawSpins, save, imageSource, live, _test };
|
||||
module.exports = { init, SIZES, TIERS, MAX_BYTES, tierFor, list, create, update, addBanner, updateBanner, noteImage, dims, image, script, click, clickById, convert, stats, summary, adminAll, adminSet, setGlobal, settings, imageRefs, totals, window24, blankPng, readImage, flush, findMine, rawSpins, save, imageSource, live, _test };
|
||||
|
||||
Reference in New Issue
Block a user