Buyer names: an admin wallet alias (POST /api/admin/wallet-alias {wallet, username}, a MySQL document) for members who bought from a second wallet (bizventures, spot #3, Marty 2026-11-14); the sale toast shows a short wallet instead of 'A member' when no name is known; common.js?v=20261114a. Smoke 76/76

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-14 07:38:06 -06:00
parent 2c0e0dcedc
commit 7c2aab8f65
9 changed files with 19 additions and 9 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ window.BL = (function () {
const box = document.createElement('div'); box.className = 'bl-toasts'; box.setAttribute('aria-live', 'polite'); document.body.appendChild(box);
const show = it => {
const top = it.pays.filter(p => !p.failed).sort((a, b) => (BigInt(b.wei) > BigInt(a.wei) ? 1 : -1))[0];
const name = it.ownerName ? '@' + esc(it.ownerName) : 'A member';
const name = it.ownerName ? '@' + esc(it.ownerName) : esc(String(it.owner || '').slice(0, 6) + '...' + String(it.owner || '').slice(-4)); // never a blank buyer (Marty 2026-11-14)
const el = document.createElement('a'); el.className = 'bl-toast'; el.href = '/ledger';
el.innerHTML = '<b>' + name + '</b> took spot #' + it.spotId
+ (top ? '<br><span>' + (it.pays.length > 1 ? it.pays.length + ' members paid, ' : '') + (top.name ? '@' + esc(top.name) : 'a member') + ' got ' + fmtPol(top.wei, 2) + ' POL</span>' : '<br><span>paid on-chain, $5</span>');
+1 -1
View File
@@ -31,7 +31,7 @@
<div class="card"><h3>The line so far</h3><div id="stats" class="grid2"></div></div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/board.js?v=1"></script>
</body>
</html>
+1 -1
View File
@@ -35,7 +35,7 @@
<li>Open any sale in the <a href="/ledger">live ledger</a> and look at its <b>Logs</b>: one SpotBought event, then one Paid event per payment.</li></ol></div>
<div id="zContract"></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/contract.js?v=z1"></script>
</body>
</html>
+1 -1
View File
@@ -39,7 +39,7 @@
<div class="card"><h3>The momentum fund</h3><p>When no spot has sold for 4 hours, the fund buys one (at most 12 a day). It gifts the spot to an active member who owns a paid spot and has not had a gift in 7 days, members who referred someone recently first. If nobody qualifies, the fund keeps the spot and its line money goes back into the fund.</p></div>
<div class="card"><h3>The rest of the network</h3><p>Open board slots show network sites such as InstantAdPay and LinkSpin. On InstantAdPay, ad credits buy advertising, not income.</p></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/how.js?v=z1"></script>
</body>
</html>
+1 -1
View File
@@ -52,7 +52,7 @@
</section>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/gate.js?v=1"></script>
</body>
</html>
+1 -1
View File
@@ -48,7 +48,7 @@
<div id="status" class="note" hidden></div>
<div class="card" id="doneCard" hidden><h3>Your spot is in the line</h3><p>Next: add your image and link in My Spots. One free signature signs you in (it cannot move funds).</p><div class="row"><button class="btn" id="toMyBtn">Open My Spots</button></div><p class="small mono" id="txLink"></p><div id="zBought"></div></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/join.js?v=z1"></script>
</body>
+1 -1
View File
@@ -30,7 +30,7 @@
<div class="card"><div class="row" style="justify-content:space-between"><h3 style="margin:0">Spot sales</h3><span class="muted small" id="upd"></span></div>
<div id="rows"><p class="muted">Loading the ledger...</p></div><div id="zLedger"></div><div id="rows2"></div></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/ledger.js?v=z1"></script>
</body>
</html>
+1 -1
View File
@@ -41,7 +41,7 @@
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=4"></script>
<script src="/assets/common.js?v=20261114a"></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/my.js?v=z1"></script>
</body>
+11 -1
View File
@@ -97,7 +97,11 @@ async function netMember(q) {
if (m) netCache.set('a:' + m.address, { at: Date.now(), m });
return m;
}
const nameOf = async addr => { const m = await netMember({ a: addr }); return m && m.address === addr.toLowerCase() ? m.username : null; };
// extra wallets a member bought with (Marty 2026-11-14: bizventures bought spot #3 from a second wallet the network does not know):
// wallet -> network username, set by the admin; wallet-aliases.json is a MySQL document (docstore)
const ALIAS_F = () => path.join(C.dataDir, 'wallet-aliases.json');
function aliases() { try { return JSON.parse(fs.readFileSync(ALIAS_F(), 'utf8')); } catch (e) { return {}; } }
const nameOf = async addr => { const al = aliases()[String(addr || '').toLowerCase()]; if (al) return al.username; const m = await netMember({ a: addr }); return m && m.address === addr.toLowerCase() ? m.username : null; };
// ---- LinkSpin Banner Spins for My Spots (Marty 2026-11-13: pull a Banner Spin in with a couple of clicks) ----
// Signed with NETWORK_SSO_SECRET: X-Net-Ts + X-Net-Sig = hex HMAC-SHA256('net.v1.' + ts + newline + raw body). LinkSpin answers
// for the account holding the signed-in wallet only.
@@ -465,6 +469,12 @@ const server = http.createServer(async (req, res) => {
}
// returning-member results: personal links opened, and how many of those visitors went on to buy (matched by the wallet that
// signed in on the same browser is not tracked; this counts link opens and new members since the first open)
if (p === '/api/admin/wallet-alias' && req.method === 'POST') { // {wallet, username} adds; {wallet, remove: true} drops
const tok = process.env.ADMIN_TOKEN; if (!tok || req.headers['x-admin-token'] !== tok) return json(res, 401, { error: 'no' });
const b = await readBody(req); const w = String(b.wallet || '').toLowerCase(); if (!/^0x[0-9a-f]{40}$/.test(w)) return json(res, 400, { error: 'wallet' });
const al = aliases(); if (b.remove) delete al[w]; else { const un = String(b.username || '').trim(); if (!/^[A-Za-z0-9_.-]{2,40}$/.test(un)) return json(res, 400, { error: 'username' }); al[w] = { username: un, at: Date.now(), note: String(b.note || '').slice(0, 200) }; }
fs.writeFileSync(ALIAS_F(), JSON.stringify(al)); return json(res, 200, { ok: true, aliases: al });
}
if (p === '/api/admin/welcome-stats' && req.method === 'GET') {
const tok = process.env.ADMIN_TOKEN; if (!tok || req.headers['x-admin-token'] !== tok) return json(res, 401, { error: 'no' });
let v = {}; try { v = JSON.parse(fs.readFileSync(path.join(C.dataDir, 'welcome-visits.json'), 'utf8')); } catch (e) {}