YourProgramBuilder, the Seed Bed (Marty 2026-11-17: "keep fleshing it out"): STAGING build
Plant a program free (referral link with {id}, link check green / yellow / red, daily recheck, reports), members save their
referral IDs in its packet, a sponsor-first link (member page / ?r= / the hub sponsor line, then the planter), the sprout meter
to REVIEW_SAVES (DEFAULT 25) -> Marty's review queue -> approved packets exported for the CTB builder / DownlineHydra wild heads
with every saved ID. Dormant old programs confirmed by their owner, old-link redirects (oldrefs), Spotlight on YPBShop (NOT
deployed; DEFAULT $10 / 1,000 views, 20/5/5/5/5, company 60), verified views with Spotlight delivery, trust pack (ledger,
contract, toasts, Telegram card, terms / disclaimer / privacy, TrustClickz only), network footer row, chatbot, promo kit,
Guides, PolHunter slot, LinkSpin tracked-link and zone hooks, AI writer through the hub. Seed-catalog look from the approved
mockup. Tests: qa/unit.test.cjs 33/33, qa/e2e.mjs 121/121 on a local anvil chain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// Admin (Marty): status, the review queue (approve = transplant, reject), held packets (link check yellow / red, reports), the export
|
||||
// for the CTB builder / DownlineHydra, a link recheck, and the staging-only test-member switch. The token stays in this tab only.
|
||||
(function () {
|
||||
const $ = YPB.$, esc = YPB.esc;
|
||||
let tok = ''; try { tok = sessionStorage.getItem('ypb.admin') || ''; } catch (e) {}
|
||||
$('tok').value = tok;
|
||||
const api = (url, body) => fetch(url, body ? { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-admin-token': tok }, body: JSON.stringify(body) } : { headers: { 'x-admin-token': tok } }).then(r => r.json());
|
||||
function row(x, acts) {
|
||||
const chk = x.check ? x.check.state + (x.check.why && x.check.why.length ? ': ' + x.check.why.join('; ') : '') : 'not checked';
|
||||
return '<div class="panel" style="border-width:1.5px"><div class="row" style="justify-content:space-between"><b>No. ' + esc(x.no) + ' ' + esc(x.name) + '</b><span class="mono" style="font-size:12px">' + esc(x.status) + ' / ' + esc(x.stage) + ' / ' + x.saves + ' of ' + x.need + ' saves</span></div>'
|
||||
+ '<p class="muted" style="font-size:14px;margin:6px 0">' + esc(x.desc) + '</p><p style="font-size:13px;margin:0 0 6px"><span class="mono">' + esc(x.url) + '</span> (planter ID ' + esc(x.ownerId || '') + ', @' + esc(x.planter || '?') + ')</p>'
|
||||
+ '<p style="font-size:13px;margin:0 0 6px">Link check: ' + esc(chk) + (x.flags && x.flags.length ? ' | flags: ' + esc(x.flags.join(', ')) : '') + (x.heldWhy ? ' | held: ' + esc(x.heldWhy) : '') + '</p>'
|
||||
+ (x.reports && x.reports.length ? '<p style="font-size:13px;margin:0 0 6px">Reports: ' + x.reports.map(r => esc(r.reason + (r.note ? ' (' + r.note + ')' : '') + ' by ' + r.by)).join('; ') + '</p>' : '')
|
||||
+ '<div class="row"><input type="text" placeholder="note (optional)" data-note="' + x.id + '" style="max-width:260px">' + acts.map(a => '<button class="btn sm" type="button" data-act="' + a + '" data-id="' + x.id + '">' + a + '</button>').join('') + '</div></div>';
|
||||
}
|
||||
async function load() {
|
||||
try { sessionStorage.setItem('ypb.admin', tok); } catch (e) {}
|
||||
const s = await api('/api/admin/status');
|
||||
if (s.error) { YPB.status('Wrong token.', 'err'); return; }
|
||||
YPB.status('', '');
|
||||
$('aStats').innerHTML = [['Shown', s.packets.shown], ['Held', s.packets.held], ['In review', s.packets.review], ['Transplanted', s.packets.approved], ['Dormant', s.packets.dormant], ['Saved IDs', s.saves], ['Members', s.members], ['Old links', s.oldrefs]].map(v => '<div class="stat"><b>' + YPB.n(v[1]) + '</b><span>' + v[0] + '</span></div>').join('');
|
||||
$('aRaw').textContent = JSON.stringify({ config: s.config, shop: s.shop, hub: s.hub, hubLookup: s.hubLookup, sso: s.sso, linkspin: s.linkspin, docstore: s.docstore, adWriter: s.adWriter }, null, 1);
|
||||
$('testBox').hidden = !s.testSwitch;
|
||||
const q = await api('/api/admin/queue');
|
||||
$('qReview').innerHTML = q.review.length ? q.review.map(x => row(x, ['approve', 'reject', 'hold', 'remove'])).join('') : '<p class="muted">Nothing in review.</p>';
|
||||
$('qHeld').innerHTML = q.held.length ? q.held.map(x => row(x, ['show', 'recheck', 'remove'])).join('') : '<p class="muted">Nothing held.</p>';
|
||||
$('qApproved').innerHTML = q.approved.length ? q.approved.map(x => row(x, ['reopen'])).join('') : '<p class="muted">Nothing transplanted yet.</p>';
|
||||
document.querySelectorAll('[data-act]').forEach(b => { b.onclick = async () => {
|
||||
b.disabled = true; const note = (document.querySelector('[data-note="' + b.dataset.id + '"]') || {}).value || '';
|
||||
const r = await api('/api/admin/packet', { id: Number(b.dataset.id), action: b.dataset.act, note }); YPB.status(r.error || 'Done: ' + b.dataset.act, r.error ? 'err' : 'ok'); load(); }; });
|
||||
}
|
||||
$('go').onclick = () => { tok = $('tok').value.trim(); load(); };
|
||||
$('recheck').onclick = async () => { const r = await api('/api/admin/recheck', { max: 50 }); YPB.status(r.error || 'Rechecked ' + r.checked + ' packets.', r.error ? 'err' : 'ok'); load(); };
|
||||
$('exportBtn').onclick = async e => {
|
||||
e.preventDefault(); const r = await api('/api/admin/export?all=1');
|
||||
const blob = new Blob([JSON.stringify(r, null, 1)], { type: 'application/json' }); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'ypb-transplants-' + new Date().toISOString().slice(0, 10) + '.json'; a.click();
|
||||
};
|
||||
$('tGo').onclick = async () => { const r = await api('/api/admin/test-member', { address: $('tAddr').value.trim(), username: $('tName').value.trim() || undefined }); YPB.status(r.error || 'Marked ' + r.member.address + ' as a test network member.', r.error ? 'err' : 'ok'); };
|
||||
if (tok) load();
|
||||
})();
|
||||
Reference in New Issue
Block a user