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
+49
View File
@@ -130,6 +130,42 @@ textarea.json{font-family:var(--mono);font-size:12px;width:100%;min-height:260px
.kv-row input[type=checkbox]{width:auto;justify-self:start}
.ed-bar button{font-size:12px}
/* member content (2026-10-18): type tiles, tabs, filters, busiest hosts, one row per item */
.ct-totals{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px;margin:0 0 16px}
.ct-tile{text-align:left;cursor:pointer;font:inherit;color:inherit;display:block;width:100%}
.ct-tile .nv{font-size:22px;font-weight:700;font-family:var(--display);color:var(--ink)}
.ct-tile .lb{font-size:12px;font-weight:700;color:var(--ink-2);margin:2px 0}
.ct-tile:hover{border-color:var(--accent)}
.ct-tile.on{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}
.ct-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 10px}
.ct-filters{display:flex;gap:8px 10px;flex-wrap:wrap;align-items:center}
.ct-filters #ctQ{flex:1 1 260px;min-width:0}
.ct-filters label.small{display:flex;align-items:center;gap:6px;font-weight:600;color:var(--ink-2)}
.ct-filters input[type=date]{width:auto}
.ct-filters .ct-chk input{width:auto;margin:0}
.ct-hosts{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:0 0 10px}
.ct-hosts .chip-t{font-family:var(--mono);text-transform:none;letter-spacing:0;font-size:11px}
.ct-hosts .chip-t.bad{border-color:rgba(185,28,28,.5);color:var(--bad);background:var(--bad-soft)}
.ct-table .ct-type{font:700 10.5px var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--accent-hi);white-space:nowrap}
.ct-table .ct-title{font-weight:700;margin:0 0 3px;overflow-wrap:anywhere}
.ct-table td{overflow-wrap:anywhere}
.ct-table .ct-l{font-size:12.5px;color:var(--ink-2);margin:2px 0;line-height:1.45}
.ct-table .ct-flags{margin:2px 0 4px;display:flex;gap:4px;flex-wrap:wrap}
.ct-table .ct-flags .st{text-transform:none;letter-spacing:0;font-family:var(--body);font-size:11px}
.ct-table tr.ct-flagged td{background:rgba(185,28,28,.035)}
.ct-table .ct-nums div{white-space:nowrap}
.ct-table td[data-l="Status"] .st{white-space:nowrap}
.ct-table .ct-mem{font-weight:700}
.ct-table td[data-l="Owner"]{min-width:180px;overflow-wrap:break-word}
.ct-table .ct-dest{display:inline-block;margin:0 8px 2px 0;font-size:12px}
.ct-table .ct-dest.off a{text-decoration:line-through;opacity:.7}
.ct-table .bad{color:var(--bad)}
.ct-thumb{display:inline-block;vertical-align:middle;border:1px solid var(--line);border-radius:4px;overflow:hidden;background:var(--panel-2);line-height:0}
.ct-thumb img{max-height:40px;max-width:90px;display:block}
.ct-thumb.big img{max-height:64px;max-width:240px}
.ct-pager{display:flex;gap:12px;align-items:center;justify-content:center;margin:12px 0 0}
.ct-pager:empty{display:none}
/* phone: the rail is a scrolling bottom bar with icon + label (twelve admin panes do not fit side by side) */
@media (max-width:760px){
.adm .rail{justify-content:flex-start;overflow-x:auto;overflow-y:hidden;gap:2px;scrollbar-width:none}
@@ -149,4 +185,17 @@ textarea.json{font-family:var(--mono);font-size:12px;width:100%;min-height:260px
.kv-row{grid-template-columns:1fr} .kv-row .btn{justify-self:start}
.adm .pane [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important}
.trunc{max-width:160px}
.ct-totals{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.ct-tile.statx{padding:8px 10px} .ct-tile .nv{font-size:17px} .ct-tile .lb{font-size:10.5px}
.ct-table,.ct-table tbody,.ct-table tr,.ct-table td{display:block;width:100%}
.ct-table tr:first-child{display:none}
.ct-table tr{border-bottom:1px solid var(--line);padding:8px 0}
.ct-table td{border:0;padding:3px 12px}
.ct-table td[data-l]::before{content:attr(data-l);display:block;font:700 9.5px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.ct-table td[data-l="Type"]::before{display:none}
.ct-table td.act{width:auto}
.ct-table .ct-nums{display:flex;flex-wrap:wrap;gap:2px 12px}
.ct-table .ct-nums::before{flex-basis:100%}
.ct-filters label.small{flex:1 1 140px}
.ct-filters input[type=date]{flex:1;min-width:0}
}
+121 -2
View File
@@ -44,8 +44,8 @@
});
// ── panes ──
const TITLES = { overview: 'Overview', house: 'House ads', campaigns: 'All campaigns', members: 'Members', reports: 'Reports', zones: 'Zones', domains: 'Link domains', traffic: 'Traffic', blog: 'Blog', releases: 'Releases and roadmap', pnl: 'Profit and loss', settings: 'Settings' };
const loaders = { overview: loadOverview, house: loadHouse, campaigns: loadCampaigns, members: loadMembers, reports: loadReports, zones: loadZones, domains: loadDomains, traffic: loadTraffic, blog: loadBlog, releases: loadReleases, pnl: loadPnl, settings: loadSettings };
const TITLES = { overview: 'Overview', house: 'House ads', campaigns: 'All campaigns', members: 'Members', content: 'Member content', reports: 'Reports', zones: 'Zones', domains: 'Link domains', traffic: 'Traffic', blog: 'Blog', releases: 'Releases and roadmap', pnl: 'Profit and loss', settings: 'Settings' };
const loaders = { overview: loadOverview, house: loadHouse, campaigns: loadCampaigns, members: loadMembers, content: loadContent, reports: loadReports, zones: loadZones, domains: loadDomains, traffic: loadTraffic, blog: loadBlog, releases: loadReleases, pnl: loadPnl, settings: loadSettings };
function setPane(name) {
if (!TITLES[name]) name = 'overview';
document.querySelectorAll('.pane').forEach(p => { p.hidden = p.id !== 'pane-' + name; });
@@ -503,6 +503,125 @@
try { await api('/api/admin/zones/' + s.dataset.zntier + '/tier', { tier: s.value }, 'POST'); IAP.status('Tier saved: ' + s.value, 'ok'); loadZones(); } catch (e) { IAP.status(e.message, 'bad'); loadZones(); }
}));
}
// ── member content (Marty, 2026-10-18): everything members made in one list, newest first. Read-only: the only
// buttons are the moderation routes that already exist (campaign pause / resume, zone pause / resume) ──
const CT = { type: 'all', page: 1, data: null, timer: 0 };
const ctN = v => Number(v || 0).toLocaleString();
const ctWhen = ts => ts ? new Date(Number(ts)).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT' : '';
const ctSize = b => (b || 0) >= 1048576 ? (b / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round((b || 0) / 1024)) + ' KB';
const ctSafe = u => /^(https?:\/\/|\/(?!\/))/i.test(String(u || '')) ? String(u) : ''; // member URLs: http(s) or our own paths, never javascript:
const ctA = (u, text) => { const h = ctSafe(u); return h ? '<a href="' + esc(h) + '" target="_blank" rel="noopener noreferrer">' + esc(text == null ? h : text) + '</a>' : (u ? esc(text == null ? u : text) : ''); };
const ctImg = (u, big) => { const h = ctSafe(u); return h ? '<a href="' + esc(h) + '" target="_blank" rel="noopener noreferrer" class="ct-thumb' + (big ? ' big' : '') + '"><img src="' + esc(h) + '" alt="" loading="lazy" referrerpolicy="no-referrer"></a>' : ''; };
const ctHost = u => { try { return new URL(u, location.origin).hostname.replace(/^www\./, ''); } catch (e) { return ''; } };
const ctCut = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
const ctLabel = k => ((CT.data && CT.data.types) || []).reduce((m, t) => t.key === k ? t.label : m, k);
const CT_ONE = { page: 'Page', link: 'Link', source: 'Source', zone: 'Zone', ad: 'Ad', postback: 'Postback', upload: 'Upload', profile: 'Profile', message: 'Broadcast', audience: 'Audience', video: 'Video' };
function ctDetail(r) {
const d = r.detail || {}; const L = [];
const line = h => { if (h) L.push('<div class="ct-l">' + h + '</div>'); };
if (r.type === 'page') {
line('<span class="chip-t">' + esc(d.kind) + '</span> ' + ctA(r.url, ctCut(r.url, 70)) + (r.open ? ' · <a href="' + esc(r.open) + '" target="_blank" rel="noopener">Preview</a>' : ''));
if (d.headline) line('<b>' + esc(ctCut(d.headline, 140)) + '</b>');
line('Button: ' + (d.ctaUrl ? ctA(d.ctaUrl, ctCut(d.ctaUrl, 80)) : (d.formProvider ? 'form (' + esc(d.formProvider) + ')' : '<span class="muted">not set</span>')) + (d.scanUrl && d.scanUrl !== d.ctaUrl ? ' · scanned ' + ctA(d.scanUrl, ctHost(d.scanUrl)) : ''));
if (d.image) line(ctImg(d.image));
} else if (r.type === 'link') {
const ds = d.destinations || [];
line(ctA(r.url, ctCut(r.url, 60)) + ' · <span class="mono">' + esc(d.code) + '</span> · ' + ds.length + ' destination' + (ds.length === 1 ? '' : 's') + (d.dayparted ? ' · dayparted' : '') + (d.expires ? ' · demo expires ' + ctWhen(d.expires) : ''));
line(ds.slice(0, 6).map(x => '<span class="ct-dest' + (x.active ? '' : ' off') + '">' + ctA(x.url, ctHost(x.url) || x.url) + (x.weight > 1 ? ' ×' + x.weight : '') + (!x.active ? ' <span class="muted">' + (x.autoPaused ? 'auto-paused' : 'paused') + '</span>' : '') + (x.health && x.health !== 'ok' && x.health !== 'live' ? ' <span class="bad">' + esc(x.health) + '</span>' : '') + '</span>').join(' ') + (ds.length > 6 ? ' <span class="muted">+' + (ds.length - 6) + ' more</span>' : ''));
if (d.fallback) line('Fallback: ' + ctA(d.fallback, ctCut(d.fallback, 70)));
} else if (r.type === 'source') {
line(esc(d.template === 'custom' ? 'Custom source' : 'Template ' + d.template) + (d.site ? ' · ' + ctA('https://' + d.site, d.site) : '') + (d.costModel ? ' · ' + esc(d.costModel) : '') + ' · ' + ctN(d.params) + ' params');
line(d.postbackUrl ? 'Postback (' + esc(d.method) + ', ' + esc((d.events || []).join(', ')) + '): <span class="mono small">' + esc(ctCut(d.postbackUrl, 90)) + '</span>' : '<span class="muted">No postback</span>');
} else if (r.type === 'zone') {
line(ctA(r.url, d.site) + ' · ' + esc(d.size) + ' · ' + esc(d.tier) + ' · <span class="mono small">' + esc(r.id) + '</span>');
line(esc(d.statusLabel) + (d.lastSeen ? ' · last view ' + ctWhen(d.lastSeen) : ' · <span class="muted">never seen</span>'));
} else if (r.type === 'ad') {
line('<span class="chip-t">' + esc(d.adType) + '</span> #' + esc(r.id) + ' · target ' + ctA(r.url, ctCut(r.url, 70)));
if (d.imageUrl) line(ctImg(d.imageUrl, true) + (d.width ? ' <span class="muted small">' + d.width + '×' + d.height + '</span>' : ''));
if (d.title || d.body) line((d.title ? '<b>' + esc(ctCut(d.title, 100)) + '</b> ' : '') + esc(ctCut(d.body, 200)));
line('Budget ' + ctN(d.budget) + ' · spent ' + ctN(d.spent) + ' · left ' + ctN(Math.max(0, (d.budget || 0) - (d.spent || 0))) + (d.dailyCap ? ' · cap ' + ctN(d.dailyCap) + '/day' : '') + (d.geo ? ' · tiers ' + esc(d.geo) : '') + (d.starts ? ' · starts ' + ctWhen(d.starts) : '') + (d.expires ? ' · ends ' + ctWhen(d.expires) : ''));
} else if (r.type === 'postback') {
line('<span class="mono small">' + esc(ctCut(d.postbackUrl, 110)) + '</span>');
line(esc(d.method) + ' · ' + esc((d.events || []).join(', ')) + (d.lastStatus ? ' · last ' + esc(d.lastStatus) + ' ' + ctWhen(d.lastAt) : ''));
} else if (r.type === 'upload') {
line((d.image ? ctImg(r.url) + ' ' : '') + ctA(r.url, ctCut(d.file, 60)) + ' · ' + ctSize(d.size) + ' · ' + esc(d.store));
if (d.usedBy && d.usedBy.length) line('Used by ' + d.usedBy.map(esc).join(', ') + (d.ownerGuess ? ' <span class="muted">(owner taken from that use)</span>' : ''));
else if (d.store === 'Uploads') line('<span class="muted">Not used by any campaign or profile right now</span>');
} else if (r.type === 'profile') {
line((d.avatarUrl ? ctImg(d.avatarUrl) + ' ' : '') + (d.bio ? esc(ctCut(d.bio, 220)) : '<span class="muted">No bio</span>') + (r.url ? ' · ' + ctA(r.url, 'Wall') : ''));
if (d.lineTargetUrl || d.lineBannerUrl) line('Line banner: ' + (d.lineBannerUrl ? ctImg(d.lineBannerUrl) + ' ' : '') + ctA(d.lineTargetUrl, ctCut(d.lineTargetUrl, 70)));
if (d.wallOffers && d.wallOffers.length) line('Wall offers: ' + d.wallOffers.map(o => (o.bannerUrl ? ctImg(o.bannerUrl) + ' ' : '') + ctA(o.targetUrl, (o.title ? o.title + ' · ' : '') + ctHost(o.targetUrl))).join(' · '));
const so = Object.entries(d.socials || {}); if (so.length) line(so.map(([k, v]) => ctA(v, k)).join(' · '));
} else if (r.type === 'message') {
line(esc(ctCut(d.body, 320)));
} else if (r.type === 'audience') {
line('<span class="mono small">' + esc(d.audienceId) + '</span> · pixel <code>' + esc(d.pixel) + '</code>');
} else if (r.type === 'video') {
line((r.url ? ctA(r.url, 'Watch the render') : '<span class="muted">No file yet</span>') + (d.username ? ' · end card for @' + esc(d.username) : '') + (d.error ? ' · <span class="bad">' + esc(ctCut(d.error, 140)) + '</span>' : ''));
}
return L.join('');
}
function ctNums(r) {
const c = r.counts || {}; const d = r.detail || {}; const k = (n, l) => '<div><b>' + (n == null ? '-' : n) + '</b> <span class="muted">' + l + '</span></div>';
if (r.type === 'page') return k(ctN(c.views), 'views') + k(ctN(c.uniques), 'uniques') + k(ctN(c.clicks), 'clicks out') + k(ctN(c.leads), 'leads');
if (r.type === 'link') return k(ctN(c.clicks7), 'clicks 7d') + k(ctN(c.clicks), 'all time') + (c.conversions ? k(ctN(c.conversions), 'conversions') : '') + (c.bots ? k(ctN(c.bots), 'bots') : '');
if (r.type === 'zone') return k(ctN(c.views30), 'imps 30d') + k(c.viewablePct == null ? '-' : c.viewablePct + '%', 'viewable') + k(ctN(c.clicks30), 'clicks') + k(ctN(c.credits), 'credits paid');
if (r.type === 'ad') return k(ctN(d.spent) + ' / ' + ctN(d.budget), 'spent') + k(ctN(c.imps) + (c.impsNas ? ' +' + ctN(c.impsNas) : ''), 'views') + k(ctN(c.clicks), 'clicks');
if (r.type === 'source' || r.type === 'postback') return k(ctN(c.sent), 'sent') + k(ctN(c.fails), 'fails');
if (r.type === 'audience') return k(ctN(c.size30), 'people 30d') + k(ctN(c.size7), '7d');
if (r.type === 'message') return k(ctN(c.recipients), 'recipients');
return '<span class="muted">-</span>';
}
function ctOwner(o) {
if (!o || o.demo) return '<span class="muted">demo visitor</span>';
if (!o.email) return '<span class="muted">unknown</span>';
return (o.username ? '<b>@' + esc(o.username) + '</b><br>' : '') + '<span class="small">' + esc(o.email) + '</span><br><span class="muted small">' + (o.memberId ? 'member #' + o.memberId : 'free member') + '</span>'
+ '<br><a href="#members" class="small ct-mem" data-ctmember="' + esc(o.email) + '">Open member</a>';
}
function drawContent() {
const d = CT.data; if (!d) return;
$('ctTotals').innerHTML = d.types.map(t => { const x = d.totals[t.key] || {}; return '<button type="button" class="statx ct-tile' + (CT.type === t.key ? ' on' : '') + '" data-cttype="' + t.key + '"><div class="nv">' + ctN(x.n) + '</div><div class="lb">' + esc(t.label) + '</div><div class="small muted">' + ctN(x.live) + ' live' + (x.flagged ? ' · <span class="bad">' + ctN(x.flagged) + ' flagged</span>' : '') + '</div></button>'; }).join('');
$('ctTabs').innerHTML = '<button type="button" class="chip-t' + (CT.type === 'all' ? ' on' : '') + '" data-cttype="all" role="tab">All, newest first (' + ctN(d.all) + ')</button>'
+ d.types.map(t => '<button type="button" class="chip-t' + (CT.type === t.key ? ' on' : '') + '" data-cttype="' + t.key + '" role="tab">' + esc(t.label) + ' (' + ctN((d.totals[t.key] || {}).n) + ')</button>').join('');
$('ctSub').textContent = ctN(d.matched) + ' match' + (d.matched === 1 ? '' : 'es') + ' of ' + ctN(d.all) + ' · ' + ctN(d.flaggedAll) + ' flagged · as of ' + ctWhen(d.generated);
$('ctBadge').hidden = !d.flaggedAll; $('ctBadge').textContent = d.flaggedAll || '';
$('ctHosts').innerHTML = d.hosts.length ? '<span class="small muted">Busiest hosts in this view:</span> ' + d.hosts.map(h => '<button type="button" class="chip-t' + (h.burned ? ' bad' : '') + '" data-cthost="' + esc(h.host) + '">' + esc(h.host) + ' <b>' + h.n + '</b></button>').join('') : '';
$('ctTable').innerHTML = '<tr><th>Type</th><th>Item</th><th>Owner</th><th>Created</th><th>Status</th><th>Numbers</th><th></th></tr>'
+ (d.items.length ? d.items.map((r, i) => '<tr' + (r.flags.length ? ' class="ct-flagged"' : '') + '>'
+ '<td data-l="Type"><span class="ct-type">' + esc(CT_ONE[r.type] || r.type) + '</span></td>'
+ '<td data-l="Item"><div class="ct-title">' + esc(r.title || '(untitled)') + '</div>' + (r.flags.length ? '<div class="ct-flags">' + r.flags.map(f => '<span class="st rejected" title="' + esc(f.t) + '">' + esc(f.t) + '</span>').join(' ') + '</div>' : '') + ctDetail(r) + '</td>'
+ '<td data-l="Owner">' + ctOwner(r.owner) + '</td>'
+ '<td data-l="Created" class="small when">' + ctWhen(r.created) + '</td>'
+ '<td data-l="Status"><span class="st ' + esc(r.live ? 'active' : (r.status === 'draft' || r.status === 'paused' ? r.status : 'out')) + '">' + esc(r.status) + '</span></td>'
+ '<td data-l="Numbers" class="small ct-nums">' + ctNums(r) + '</td>'
+ '<td class="act">' + (r.actions || []).map((a, j) => '<button type="button" class="btn small ' + (/^Pause/.test(a.label) ? 'sec' : '') + '" data-ctact="' + i + ':' + j + '">' + esc(a.label) + '</button>').join('') + (r.open && r.type !== 'page' ? ctA(r.open, 'Open') : '') + '</td></tr>').join('')
: '<tr><td colspan="7" class="muted">Nothing matches.</td></tr>');
$('ctPager').innerHTML = d.pages > 1 ? '<button type="button" class="btn small sec" data-ctpage="' + (d.page - 1) + '"' + (d.page <= 1 ? ' disabled' : '') + '>&larr; Newer</button><span class="small muted">Page ' + d.page + ' of ' + d.pages + ' · ' + d.per + ' per page</span><button type="button" class="btn small sec" data-ctpage="' + (d.page + 1) + '"' + (d.page >= d.pages ? ' disabled' : '') + '>Older &rarr;</button>' : '';
}
async function loadContent(fresh) {
const sp = new URLSearchParams({ type: CT.type, page: String(CT.page), per: '50' });
const q = $('ctQ').value.trim(); if (q) sp.set('q', q);
if ($('ctFrom').value) sp.set('from', $('ctFrom').value); if ($('ctTo').value) sp.set('to', $('ctTo').value);
if ($('ctFlagged').checked) sp.set('flagged', '1'); if (fresh === true) sp.set('fresh', '1');
CT.data = await api('/api/admin/content?' + sp.toString()); drawContent();
}
const ctReload = (fresh) => loadContent(fresh).catch(e => IAP.status(e.message, 'bad'));
$('ctQ').addEventListener('input', () => { clearTimeout(CT.timer); CT.timer = setTimeout(() => { CT.page = 1; ctReload(); }, 250); });
['ctFrom', 'ctTo', 'ctFlagged'].forEach(id => $(id).addEventListener('change', () => { CT.page = 1; ctReload(); }));
$('ctClear').addEventListener('click', () => { $('ctQ').value = ''; $('ctFrom').value = ''; $('ctTo').value = ''; $('ctFlagged').checked = false; CT.type = 'all'; CT.page = 1; ctReload(); });
$('ctRefresh').addEventListener('click', busy($('ctRefresh'), () => loadContent(true)));
$('pane-content').addEventListener('click', async e => {
const t = e.target.closest('[data-cttype]'); if (t) { CT.type = t.dataset.cttype; CT.page = 1; return ctReload(); }
const h = e.target.closest('[data-cthost]'); if (h) { $('ctQ').value = h.dataset.cthost; CT.page = 1; return ctReload(); }
const pg = e.target.closest('[data-ctpage]'); if (pg && !pg.disabled) { CT.page = Number(pg.dataset.ctpage) || 1; await ctReload(); $('ctTable').scrollIntoView({ block: 'start', behavior: 'smooth' }); return; }
const m = e.target.closest('[data-ctmember]'); if (m) { e.preventDefault(); setPane('members'); return openMember(m.dataset.ctmember); }
const b = e.target.closest('[data-ctact]'); if (!b || b.disabled) return;
const [i, j] = b.dataset.ctact.split(':').map(Number); const r = CT.data && CT.data.items[i]; const a = r && r.actions[j]; if (!a) return;
if (a.warn && !await IAP.confirmBox(a.warn, { title: a.label, ok: a.label, cancel: 'Cancel' })) return;
b.disabled = true;
try { await api(a.path, a.body || {}, 'POST'); IAP.status(a.label + ': done.', 'ok'); await loadContent(true); } catch (err) { IAP.status(err.message, 'bad'); b.disabled = false; }
});
// ── link domains: channel per domain, last safety check, burned flag; check now / clear / pull (2026-10-10) ──
async function loadDomains() {
const d = await api('/api/admin/domains');
+1 -1
View File
@@ -121,7 +121,7 @@
$('buysMeta').textContent = buys.length + (buys.length === 1 ? ' purchase' : ' purchases') + ' · every row links to the transaction';
$('buyRows').innerHTML = buys.length ? buys.slice(0, 50).map(x => {
const ts = Number(x.ts || x.time || 0); const when = ts ? new Date(ts * (ts > 1e12 ? 1 : 1000)).toLocaleString() : '';
const pkg = x.priceCents ? usd(x.priceCents) : (x.package || x.product || ('#' + (x.productId || '')));
const pkg = (x.priceCents ? usd(x.priceCents) : (x.package || x.product || ('#' + (x.productId || '')))) + (x.position ? ' · Position ' + x.position : ''); // bought from a linked position (2026-10-18)
const paid = x.amountWei || x.valueWei || x.paidWei ? pol(x.amountWei || x.valueWei || x.paidWei) + ' POL' : '';
const tx = x.tx || x.hash || '';
return '<div class="rw"><span class="mono muted" style="font-size:12px">' + esc(when) + '</span><span class="num">' + esc(String(pkg)) + '</span><span class="mono">' + esc(paid) + '</span><span>' + (tx ? '<a class="mono" href="' + esc((CFG && CFG.explorer) || 'https://polygonscan.com') + '/tx/' + esc(tx) + '" target="_blank" rel="noopener">' + esc(tx.slice(0, 10)) + '…' + esc(tx.slice(-6)) + '</a>' : '') + '</span></div>';