Terms, Privacy and Earnings disclaimer pages + footer links + sitemap (network tidy-up 2026-11-17, TrustClickz, no street address)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,7 @@ const fmtInt = n => Number(n || 0).toLocaleString('en-US');
|
||||
const ago = ts => { const s = Math.max(0, (Date.now() - ts) / 1000); return s < 90 ? 'just now' : s < 5400 ? Math.round(s / 60) + ' min ago' : s < 129600 ? Math.round(s / 3600) + ' h ago' : Math.round(s / 86400) + ' days ago'; };
|
||||
const when = ts => new Date(ts).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit', timeZone: 'America/Chicago' }) + ' CT';
|
||||
const shortTx = tx => tx ? tx.slice(0, 10) + '…' + tx.slice(-4) : '';
|
||||
const RESERVED = new Set(['blog', 'ledger', 'programs', 'earn', 'api', 'img', 'sitemap', 'robots', 'favicon', 'about', 'admin', 'login', 'join', 'feed', 'www', 'static', 'assets']);
|
||||
const RESERVED = new Set(['blog', 'ledger', 'programs', 'earn', 'api', 'img', 'sitemap', 'robots', 'favicon', 'about', 'admin', 'login', 'join', 'feed', 'www', 'static', 'assets', 'terms', 'privacy', 'disclaimer']);
|
||||
const net = () => (IDX && IDX.network) || { pol: 0, payments: 0, wallets: 0 };
|
||||
const prog = k => (IDX && IDX.programs && IDX.programs[k]) || { pol: 0, payments: 0, wallets: 0 };
|
||||
const live = () => IDX ? '<div class="live"><span class="dot"></span>Ledger refreshed ' + ago(IDX.at) + '</div>' : '<div class="live"><span class="dot" style="background:var(--gold)"></span>Ledger warming up</div>';
|
||||
@@ -162,7 +162,7 @@ async function qrSvg(un) {
|
||||
function notFound(msg) { return head({ title: 'Not found | Stack POL', desc: 'This page is not on Stack POL.', path: '/404', noindex: true }) + '<section style="padding:60px 0"><h1>Nothing stacked here</h1><p class="lead">' + esc(msg || 'That page does not exist.') + '</p><p><a class="btn" href="/">Go to Stack POL</a></p></section>' + tail(); }
|
||||
function sitemap() {
|
||||
const d = new Date().toISOString().slice(0, 10);
|
||||
const u = [['/', 'daily', '1.0'], ['/programs', 'daily', '0.9'], ['/ledger', 'hourly', '0.8'], ['/blog', 'daily', '0.9']].map(([p, f, pr]) => '<url><loc>' + SITE + p + '</loc><lastmod>' + d + '</lastmod><changefreq>' + f + '</changefreq><priority>' + pr + '</priority></url>').join('')
|
||||
const u = [['/', 'daily', '1.0'], ['/programs', 'daily', '0.9'], ['/ledger', 'hourly', '0.8'], ['/blog', 'daily', '0.9'], ['/terms', 'yearly', '0.2'], ['/privacy', 'yearly', '0.2'], ['/disclaimer', 'yearly', '0.2']].map(([p, f, pr]) => '<url><loc>' + SITE + p + '</loc><lastmod>' + d + '</lastmod><changefreq>' + f + '</changefreq><priority>' + pr + '</priority></url>').join('')
|
||||
+ PROGRAMS.map(p => '<url><loc>' + SITE + '/earn/' + p.slug + '</loc><lastmod>' + d + '</lastmod><changefreq>daily</changefreq><priority>0.8</priority></url>').join('')
|
||||
+ blog.listPublished().map(p => '<url><loc>' + SITE + '/blog/' + p.slug + '</loc><lastmod>' + new Date(p.updated).toISOString().slice(0, 10) + '</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>').join('')
|
||||
+ Object.keys((IDX && IDX.stacks) || {}).map(x => '<url><loc>' + SITE + '/' + x + '</loc><changefreq>daily</changefreq><priority>0.5</priority></url>').join('');
|
||||
@@ -193,6 +193,7 @@ function staticFile(req, res, p) {
|
||||
|
||||
// the site assistant (2026-11-15): chatcore.js + kb.js + the network knowledge base (netkb.js); no admin editing on Stack POL
|
||||
const chatbot = require('./chatbot');
|
||||
const legal = require('./legal');
|
||||
const chatJson = (res, code, obj, extra) => { res.writeHead(code, Object.assign({ 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' }, extra || {})); res.end(JSON.stringify(obj)); };
|
||||
const chatBody = req => new Promise(resolve => { const ch = []; let n = 0; req.on('data', c => { n += c.length; if (n <= 32768) ch.push(c); }); req.on('end', () => { try { resolve(n && n <= 32768 ? JSON.parse(Buffer.concat(ch).toString('utf8')) : {}); } catch (e) { resolve({}); } }); req.on('error', () => resolve({})); });
|
||||
const server = http.createServer((req, res) => {
|
||||
@@ -221,6 +222,7 @@ const server = http.createServer((req, res) => {
|
||||
const q = /^\/qr\/([a-z0-9_]{3,30})\.svg$/.exec(p);
|
||||
if (q) { const st = IDX && IDX.stacks && IDX.stacks[q[1]]; if (!QR || !st || !st.pro) return html(req, res, 404, notFound()); return qrSvg(q[1]).then(svg => send(req, res, 200, 'image/svg+xml', svg, 'public, max-age=86400')).catch(() => html(req, res, 500, notFound())); }
|
||||
if (p === '/') return html(req, res, 200, page(home()), 'public, max-age=120');
|
||||
if (legal.PATHS.includes(p)) return html(req, res, 200, page(legal.render(p)), 'public, max-age=3600'); // Terms / Privacy / Disclaimer (2026-11-17)
|
||||
if (p === '/programs') return html(req, res, 200, page(programsPage()), 'public, max-age=300');
|
||||
if (p === '/ledger') return html(req, res, 200, page(ledgerPage(u.searchParams.get('p'))), 'public, max-age=120');
|
||||
let m = /^\/earn\/([a-z0-9-]+)\/?$/.exec(p); if (m) return BY_SLUG[m[1]] ? html(req, res, 200, page(programPage(BY_SLUG[m[1]], pc && pc.who)), 'public, max-age=300') : html(req, res, 404, notFound());
|
||||
|
||||
Reference in New Issue
Block a user