Network Ad Space + board fill (Marty 2026-11-13 'proceed'): dlbnas.js keeps one standing 468x60 house banner in NAS (25k views, refilled when low, link ?src=nas) and places any spot past 30 days with fewer than 300 views in NAS for exactly the views owed; NAS-served views count toward the spot's 300 (My Spots). Empty board slots show members' own LinkSpin Banner Spins (one active 468x60 per member, refreshed every 10 min) before house ads. art/house-strip-nas.png. Smoke 76/76.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ const board = require('./board');
|
||||
const safety = require('./safety');
|
||||
const keeper = require('./keeper');
|
||||
const { iface } = require('./abi');
|
||||
const dlbnas = require('./dlbnas'); // Network Ad Space: standing house banner + finishing spots still owed views after 30 days (2026-11-13)
|
||||
const refuelspots = require('./refuelspots'); // refuel spots: $50+ Monthly Refuels earn a spot, engine wallet pays (2026-11-13)
|
||||
const tgproof = require('./tgproof'); // payment proof in the Telegram payments topic, one message per spot sale (2026-11-13)
|
||||
const hubreport = require('./hubreport'); // network hub, shadow mode: members reported by wallet (2026-11-13), off unless HUB_ENABLED
|
||||
@@ -189,7 +190,7 @@ const boardTokens = new Map();
|
||||
|
||||
// ---- dashboard data ----
|
||||
function spotView(s) {
|
||||
const v = store.views(s.id); const m = store.spotMeta(s.id) || {}; const cr = board.creative(s); const now = Date.now();
|
||||
const v0 = store.views(s.id); const nasV = dlbnas.spotServed(s.id); const v = Object.assign({}, v0, { total: v0.total + nasV, nas: nasV }); const m = store.spotMeta(s.id) || {}; const cr = board.creative(s); const now = Date.now();
|
||||
const left = Math.max(0, C.spotDays - Math.floor((now - s.boughtAt) / 86400000));
|
||||
return { id: s.id, kind: s.kind, boughtAt: s.boughtAt, tx: s.tx, valueWei: s.valueWei, views: v.total, gateViews: v.gate, owed: C.viewsOwed,
|
||||
clicks: store.clicks(s.id), daysLeft: left, delivering: s.kind !== 3 && left > 0 && v.total < C.viewsOwed,
|
||||
@@ -447,7 +448,7 @@ const server = http.createServer(async (req, res) => {
|
||||
// -- admin (ADMIN_TOKEN header): keeper preview + index status. No key material is ever returned.
|
||||
if (p === '/api/admin/status' && req.method === 'GET') {
|
||||
const tok = process.env.ADMIN_TOKEN; if (!tok || req.headers['x-admin-token'] !== tok) return json(res, 401, { error: 'no' });
|
||||
return json(res, 200, { index: chain.status(), totals: chain.totals(), keeper: keeper.statusInfo(), hub: hubreport.view(), refuelSpots: refuelspots.view() });
|
||||
return json(res, 200, { index: chain.status(), totals: chain.totals(), keeper: keeper.statusInfo(), hub: hubreport.view(), refuelSpots: refuelspots.view(), nas: dlbnas.view() });
|
||||
}
|
||||
|
||||
if (p.startsWith('/api/')) return json(res, 404, { error: 'Not found' });
|
||||
@@ -470,6 +471,18 @@ const server = http.createServer(async (req, res) => {
|
||||
hubreport.init({ dataDir: C.dataDir, members: () => chain.allMembers() });
|
||||
refuelspots.init({ lock: () => keeper.busy() }); keeper.setOtherBusy(() => refuelspots.busy());
|
||||
keeper.init();
|
||||
dlbnas.init({ spots: () => chain.spots(), views: id => store.views(id).total, creative: board.creative });
|
||||
// members' LinkSpin Banner Spins for empty board slots: one active 468x60 spin per member, refreshed every 10 minutes
|
||||
const refreshSpins = async () => {
|
||||
const out = [];
|
||||
for (const m of chain.allMembers()) {
|
||||
const r = await lsSpins({ wallet: m.address }).catch(() => null);
|
||||
const sp = r && r.account && (r.spins || []).find(x => !x.paused && x.banners > 0);
|
||||
if (sp) out.push({ img: 'https://rubav.com/i/' + sp.code + '.gif', link: 'https://rubav.com/c/' + sp.code + '?placement=board&s1=fill', title: (r.username ? '@' + r.username + ': ' : '') + sp.name });
|
||||
}
|
||||
board.setMemberSpins(out);
|
||||
};
|
||||
setTimeout(() => refreshSpins().catch(() => {}), 20000); setInterval(() => refreshSpins().catch(() => {}), 10 * 60000).unref();
|
||||
server.listen(C.port, () => console.log('Downline Banners on :' + C.port + ' chain ' + C.chainName + ' (' + C.chainId + ') contract ' + (C.contract || '(not set)') + ' store: ' + (docstore.isOn() ? 'MySQL documents' : 'volume JSON')));
|
||||
})().catch(e => { console.error('start failed:', e.message); process.exit(1); });
|
||||
process.on('SIGTERM', () => { store.flush(); process.exit(0); });
|
||||
|
||||
Reference in New Issue
Block a user