Contract, live ledger, terms, privacy and disclaimer on the Instrument scheme; contract page shows chain totals and never falls back to another contract's source; terms and privacy updated for links, pages, zones and leads; share images point at the LinkSpin image; toolkit banners use the LinkSpin house set

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-07 09:15:03 -05:00
parent a50640c890
commit 3c52e2704a
11 changed files with 351 additions and 275 deletions
+14 -20
View File
@@ -1,31 +1,25 @@
// Live ledger: recent history + SSE stream of new chain events.
// Live ledger: recent history + SSE stream of new chain events (feed rows from common.js; no shared nav, 2026-10-07).
(async function () {
await IAP.renderNav('ledger');
const $ = id => document.getElementById(id);
const c = await IAP.getConfig();
IAP.$('contractLink').href = c.explorer ? c.explorer + '/address/' + c.contract : '/contract';
const feed = IAP.$('feed');
const { events } = await (await fetch('/api/feed?n=150')).json();
feed.innerHTML = '';
if (!events.length) feed.innerHTML = '<div class="row muted">No activity yet. The first purchase will appear here the moment it lands.</div>';
for (const ev of events) feed.appendChild(IAP.feedRow(ev, c));
if (c.explorer && c.contract) $('contractLink').href = c.explorer + '/address/' + c.contract;
const feed = $('feed');
try {
const { events } = await (await fetch('/api/feed?n=150')).json();
feed.innerHTML = '';
if (!events.length) feed.innerHTML = '<div class="row muted">No activity yet. The first purchase will appear here the moment it lands.</div>';
for (const ev of events) feed.appendChild(IAP.feedRow(ev, c));
} catch (e) { feed.innerHTML = '<div class="row muted">Could not read the chain just now. Refresh in a minute.</div>'; }
try {
const stats = await (await fetch('/api/stats')).json();
IAP.$('statLine').textContent = stats.onchainMembers + ' on-chain member(s)';
$('statLine').innerHTML = 'members on-chain <b>' + Number(stats.onchainMembers || 0).toLocaleString() + '</b> · packages bought <b>' + Number(stats.purchases || 0).toLocaleString() + '</b>';
} catch (e) {}
IAP.adSlot('banner', 'adSlotBanner');
IAP.adSlot('text', 'adSlotText');
const es = new EventSource('/api/feed/live');
es.onopen = () => { const b = IAP.$('liveBadge'); b.textContent = '● live'; };
es.onerror = () => { const b = IAP.$('liveBadge'); b.textContent = 'reconnecting…'; };
es.onopen = () => { $('liveBadge').textContent = 'live'; $('liveDot').className = 'dot'; };
es.onerror = () => { $('liveBadge').textContent = 'reconnecting'; $('liveDot').className = 'dot off'; };
es.onmessage = m => {
try {
const ev = JSON.parse(m.data);
feed.prepend(IAP.feedRow(ev, c));
while (feed.children.length > 200) feed.removeChild(feed.lastChild);
} catch (e) {}
try { const ev = JSON.parse(m.data); feed.prepend(IAP.feedRow(ev, c)); while (feed.children.length > 200) feed.removeChild(feed.lastChild); } catch (e) {}
};
})();