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
+9 -1
View File
@@ -131,6 +131,14 @@ async function adminSet(id, body) {
if (body.tier != null) { const t = String(body.tier).toLowerCase(); if (!TIERS.includes(t)) return { error: 'Tier is standard or verified.' }; z.tier = t; }
J.save(); return { ok: true, zone: Object.assign(pubZone(z), { owner: z.owner, note: z.adminNote || '' }) };
}
// admin Member content (2026-10-18): every zone with the same 30-day numbers, imps grouped in ONE pass (pubZone filters all imps per zone)
function adminAll() {
const since30 = Date.now() - 30 * DAY; const g = {}, last = {};
for (const i of J.db.imps) { last[i.z] = i.ts; if (i.ts >= since30 && !i.bot) (g[i.z] = g[i.z] || []).push(i); }
return J.db.zones.map(z => { const imps = g[z.id] || []; const st = statusOf(z, imps); const seen = imps.filter(i => i.ok).length;
return { id: z.id, name: z.name, site: z.site, size: z.size, tier: tierOf(z), active: !!z.active, paused: !!z.adminPaused, note: z.adminNote || '', owner: z.owner, created: z.created,
views30: imps.length, viewable30: seen, viewablePct: imps.length ? Math.round(seen / imps.length * 100) : null, clicks30: imps.filter(i => i.k).length, offsite30: imps.filter(i => i.off).length, credits: z.credits || 0, status: st.state, statusLabel: st.label, lastSeen: last[z.id] || 0 }; });
}
function totals() { const since = Date.now() - 30 * DAY; const imps = J.db.imps.filter(i => i.ts >= since && !i.bot); return { zones: J.db.zones.length, views30: imps.length, viewable30: imps.filter(i => i.ok).length, clicks30: imps.filter(i => i.k).length, nas30: imps.filter(i => i.nas).length, credits: J.db.zones.reduce((n, z) => n + (z.credits || 0), 0) }; }
// -- publisher program totals (Reports screen + the public strip): the last N days, Central days, per day and per zone.
// "live" = switched on, not admin-paused, and seen by a real visitor inside the window. Credits are read from the pay log
@@ -156,4 +164,4 @@ function publisherPublic() {
rates: { viewsPerCredit: s.viewsPerCredit, nasViewsPerCredit: s.nasViewsPerCredit, nasViewsPerCreditVerified: s.nasViewsPerCreditVerified, capPerVisitorDay: s.capPerVisitorDay }, warmup: WARMUP, holdRatio: HOLD_RATIO, updated: Date.now() };
pubCache = { ts: Date.now(), data }; return data;
}
module.exports = { init, SIZES, NAS_SIZES, TIERS, WARMUP, HOLD_RATIO, settings, tierOf, rateFor, nasFrame, list, create, update, tag, serve, seen, click, totals, publisherTotals, publisherPublic, adminList, adminSet };
module.exports = { init, SIZES, NAS_SIZES, TIERS, WARMUP, HOLD_RATIO, settings, tierOf, rateFor, nasFrame, list, create, update, tag, serve, seen, click, totals, publisherTotals, publisherPublic, adminList, adminSet, adminAll };