diff --git a/audiences.js b/audiences.js index d1411e3..9355f49 100644 --- a/audiences.js +++ b/audiences.js @@ -97,4 +97,6 @@ function prune() { // per-request closure for ads.js: opts.audienceHas(id) function matcher(req) { const vid = cookieVid(req), soft = softKey(req); return { vid, soft, audienceHas: id => has(id, vid, soft) }; } -module.exports = { init, list, create, rename, remove, owns, get, nameOf, defaultFor, hit, has, prune, flush, isId, cookieVid, newVid, cookieHeader, softKey, matcher }; +// admin Member content (2026-10-18): the audiences members made by hand (every member has an automatic one, not listed) +function adminAll() { return Object.values(load().audiences).filter(a => !a.auto).map(a => Object.assign({}, a, sizes(a.id))); } +module.exports = { init, adminAll, list, create, rename, remove, owns, get, nameOf, defaultFor, hit, has, prune, flush, isId, cookieVid, newVid, cookieHeader, softKey, matcher }; diff --git a/content.js b/content.js new file mode 100644 index 0000000..ec71b58 --- /dev/null +++ b/content.js @@ -0,0 +1,195 @@ +// Member content (admin, Marty 2026-10-18): "in the admin view, I need to be able to see all the pages that are created +// and anything else that's created by a member." One read-only list across every module that stores member-made things: +// pages, links (rotations + destinations), traffic sources, zones, ad campaigns, postbacks, uploads, profiles (bio, avatar, +// line banner, wall offers), sponsor broadcasts, hand-made audiences and Video Maker renders. Each module hands over its +// own records (adminAll and friends); this file only turns them into one row shape, flags what looks wrong, and filters / +// pages the result for GET /api/admin/content. Moderation stays where it already lives (campaign pause/resume, zone +// pause/resume); a row only points at those routes. +// Uploads in /uploads had no owner record before 2026-10-18: the owner is inferred from whatever references the file +// (a campaign creative, a profile avatar or line banner, a wall offer). New uploads are noted in DATA_DIR/uploads-index.json. +'use strict'; +const fs = require('fs'); +const path = require('path'); + +let R = null; // { dataDir, uploadsDir, accounts, pages, rotator, sources, zones, ads, postbacks, audiences, messages, videomaker, reports, domains, adminEmail, houseOwner, linkHost(), pagesHost(), siteHost } +function init(refs) { R = refs; } + +const TYPES = [ + { key: 'page', label: 'Pages' }, { key: 'link', label: 'Links' }, { key: 'source', label: 'Sources' }, { key: 'zone', label: 'Zones' }, + { key: 'ad', label: 'Ads' }, { key: 'postback', label: 'Postbacks' }, { key: 'upload', label: 'Uploads' }, { key: 'profile', label: 'Profiles' }, + { key: 'message', label: 'Broadcasts' }, { key: 'audience', label: 'Audiences' }, { key: 'video', label: 'Videos' } +]; +const CT_FMT = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit' }); +const ctDay = ts => ts ? CT_FMT.format(new Date(Number(ts))) : ''; +const hostOf = u => { try { return new URL(String(u || '')).hostname.toLowerCase().replace(/^www\./, ''); } catch (e) { return ''; } }; +const strip = s => String(s || '').replace(/ - +
Dates are Central time. Flags: open member reports on an ad, a destination that failed its health check, a host that is one of our burned link domains, failing postbacks, admin-paused zones and home-page demo links. LinkSpin has no destination deny list yet, so the busiest hosts below are the quickest way to spot a cluster: click one to filter by it. Opening a short link counts as a click on it; page previews are never counted.
+ +