Admin Member content pane: every page, link, source, zone, ad, postback, upload, profile, broadcast, audience and video members made, in one list

- GET /api/admin/content?type=&q=&from=&to=&flagged=1&page=&per=&fresh=1 (admin only, read-only): content.js normalizes
  rows from each module's own adminAll() (new one-pass accessors in pages, rotator, sources, zones, postbacks,
  audiences, messages.adminBroadcasts, videomaker.adminJobs) plus ads.adminList and accounts.listAll; owner shown as
  @username, email and member #; created in Central time; totals per type; busiest hosts in the current view
- Flags: open member reports on an ad, dead or parked destinations, burned link domains, failing postbacks,
  admin-paused zones, home-page demo links. No deny list exists yet
- Row actions only reuse existing moderation routes (campaign pause/resume, zone pause/resume); "Open member" jumps
  to the member card; page Preview works for drafts and is never counted (admin allowed on ?preview=1)
- Uploads: /uploads files now recorded with their uploader in uploads-index.json; older files get the owner from
  whatever uses them (campaign creative, profile, wall offer)
- Credits > Your purchases: buys made from linked positions are included, labelled "Position N"
- Cache tags: admin.css 20261018a, admin.js 20261018b, credits-screen.js 20261018b

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-18 07:01:58 -05:00
parent f4b3058a58
commit afede88c4a
15 changed files with 464 additions and 16 deletions
+11 -1
View File
@@ -282,5 +282,15 @@ function servedToday() {
const rawRotations = () => J.db.rotations;
const save = () => J.save();
const findMine = (owner, id) => J.db.rotations.find(r => r.id === Number(id) && r.owner === norm(owner)) || null;
module.exports = { init, list, get, create, update, remove, addDest, updateDest, resolve, stats, totals, convert, summary, createDemo, claim, sweepDemos, servedToday,
// admin Member content (2026-10-18): every rotation of every owner, click counts in ONE pass over the hits (pub() per rotation is O(rotations x hits))
function adminAll() {
const since7 = Date.now() - 7 * DAY; const by = {}, cv = {};
for (const h of J.db.hits) { const o = by[h.r] = by[h.r] || { hits: 0, hits7: 0, bots: 0 }; if (h.bot) { o.bots++; continue; } o.hits++; if (h.ts >= since7) o.hits7++; }
for (const c of J.db.conv) cv[c.r] = (cv[c.r] || 0) + 1;
return J.db.rotations.map(r => { const o = by[r.id] || { hits: 0, hits7: 0, bots: 0 };
return { id: r.id, code: r.code, name: r.name, owner: r.owner, created: r.created, paused: !!r.paused, demo: !!r.demo, expires: r.expires || 0, fallback: r.fallback || '', sourceId: r.sourceId || '', dayparted: !!r.hours,
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, list, get, create, update, remove, addDest, updateDest, resolve, stats, totals, convert, summary, createDemo, claim, sweepDemos, servedToday,
pub, rawRotations, save, findMine, PRESETS, cleanHours, cleanTz, cellAt, zoneFor, isOn, COUNTRY_TZ, sourceCounts, detachSource };