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:
@@ -172,6 +172,12 @@ async function write(owner, id, body) {
|
||||
return { ok: true, page: pub(p), by };
|
||||
}
|
||||
function totals() { return { pages: J.db.pages.length, published: J.db.pages.filter(p => p.status === 'published').length, leads: J.db.leads.length }; }
|
||||
// site-wide figures for the daily snapshot: page views, leads and new pages inside the `since` window
|
||||
function window24(since) {
|
||||
const views = J.db.views.filter(v => v.ts >= since && (v.k || 'view') === 'view');
|
||||
return { pages: J.db.pages.length, published: J.db.pages.filter(p => p.status === 'published').length, created: J.db.pages.filter(p => (p.created || 0) >= since).length,
|
||||
views: views.length, unique: new Set(views.map(v => v.v)).size, leads: J.db.leads.filter(l => l.ts >= since).length };
|
||||
}
|
||||
// -- Reports (2026-10-10): the member's page views, uniques, clicks-through and leads for the last N days, by Central day and by page
|
||||
const ctDay = ts => new Date(ts).toLocaleDateString('en-CA', { timeZone: 'America/Chicago' });
|
||||
async function summary(owner, days) {
|
||||
@@ -263,4 +269,4 @@ function adminAll() {
|
||||
formProvider: p.type === 'squeeze' && c.formEmbed ? formrestyle.provider(c.formEmbed) : null, views: o.views, uniques: o.u.size, clicks: o.clicks, leads: ld[p.id] || 0 }; });
|
||||
}
|
||||
function adminImages() { return J.db.images.map(i => Object.assign(pubImage(i), { owner: i.owner })); }
|
||||
module.exports = { init, TYPES, list, get, bySlug, create, update, html, view, lead, leads, csv, scan, write, totals, summary, readUpload, uploadImage, images, removeImage, imageFile, IMG_MAX, IMG_BYTES, providers: () => formrestyle.PROVIDERS, provider: formrestyle.provider, adminAll, adminImages };
|
||||
module.exports = { init, TYPES, list, get, bySlug, create, update, html, view, lead, leads, csv, scan, write, totals, window24, summary, readUpload, uploadImage, images, removeImage, imageFile, IMG_MAX, IMG_BYTES, providers: () => formrestyle.PROVIDERS, provider: formrestyle.provider, adminAll, adminImages };
|
||||
|
||||
Reference in New Issue
Block a user