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:
@@ -253,4 +253,14 @@ async function removeImage(owner, id) {
|
||||
}
|
||||
// the file behind /u/pages/<hash>/<id>.<ext>, only when the index knows it (never a raw directory read)
|
||||
function imageFile(hash, id, ext) { const i = J.db.images.find(x => x.h === String(hash) && x.id === String(id) && x.ext === String(ext)); return i ? { file: path.join(DATA_DIR, 'uploads', 'pages', i.h, i.id + '.' + i.ext), mime: i.mime } : null; }
|
||||
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 };
|
||||
// -- admin Member content (2026-10-18): every page and every hosted image, all owners; counts in one pass over the views
|
||||
function adminAll() {
|
||||
const by = {}; for (const v of J.db.views) { const o = by[v.p] = by[v.p] || { views: 0, u: new Set(), clicks: 0 }; if (v.k === 'cta') o.clicks++; else { o.views++; o.u.add(v.v); } }
|
||||
const ld = {}; for (const l of J.db.leads) ld[l.p] = (ld[l.p] || 0) + 1;
|
||||
return J.db.pages.map(p => { const o = by[p.id] || { views: 0, u: new Set(), clicks: 0 }; const c = p.content || {};
|
||||
return { id: p.id, owner: p.owner, slug: p.slug, type: p.type, title: p.title, status: p.status, created: p.created, updated: p.updated, angle: p.angle || '', scanUrl: p.scan && p.scan.url || '',
|
||||
headline: c.headline || '', sub: c.sub || '', body: String(c.body || '').slice(0, 600), ctaUrl: c.cta && c.cta.url || '', ctaText: c.cta && c.cta.text || '', image: c.image || '', bonus: String(c.bonus || '').slice(0, 300),
|
||||
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 };
|
||||
|
||||
Reference in New Issue
Block a user