Stack POL Pro pages (Marty 2026-11-09): a Pro member's page shows their own LinkSpin Banner Spins in the ad spots (a spot with no fitting size keeps the network zone), their spin links, a purple Polygon QR to the page (/qr/<username>.svg, qrcode module) and a "Want a personalized page like this?" panel (join under the member, or Unlock Pro in IAP). Every page opened with ?ref=<Pro member> credits them on every call to action (join links, game links, program pages, internal links carry the ref) and shows their banners; no ref or a non-Pro ref = the standard network pages and zones. Blog posts now carry an ad spot after the third paragraph, and personalized posts end with the member's links and the Pro panel. Member pages also get a network spot and the latest blog posts. Indexer reads pro[] from IAP stack-optin.json and adds each Pro member's active spins and spin links (matched by username in LinkSpin).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-09 15:31:39 -06:00
parent e53565051b
commit 05f3514b9e
9 changed files with 431 additions and 21 deletions
+1
View File
@@ -0,0 +1 @@
node_modules
+1
View File
@@ -0,0 +1 @@
node_modules/
+2 -1
View File
@@ -1,6 +1,7 @@
FROM node:20-alpine FROM node:20-alpine
WORKDIR /app WORKDIR /app
COPY package.json server.js layout.js blog.js programs.js ./ COPY package.json package-lock.json server.js layout.js blog.js programs.js ./
RUN npm ci --omit=dev --no-audit --no-fund
COPY content/ ./content/ COPY content/ ./content/
COPY public/ ./public/ COPY public/ ./public/
ENV NODE_ENV=production PORT=80 ENV NODE_ENV=production PORT=80
+6 -4
View File
@@ -5,7 +5,7 @@
'use strict'; 'use strict';
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const { SITE, esc, head, tail, ZONES, spot } = require('./layout'); const { SITE, esc, head, tail, ZONES, spot, memberLinks, proCta } = require('./layout');
const AUTHOR = 'Marty Bostick'; const AUTHOR = 'Marty Bostick';
const PER_PAGE = 9; const PER_PAGE = 9;
const DIR = path.join(__dirname, 'content', 'blog'); const DIR = path.join(__dirname, 'content', 'blog');
@@ -78,7 +78,7 @@ function renderIndex(page, tag) {
function related(p) { function related(p) {
return listPublished().filter(x => x.slug !== p.slug).map(x => ({ x, s: x.tags.filter(t => p.tags.includes(t)).length })).sort((a, b) => b.s - a.s || b.x.publishedAt - a.x.publishedAt).slice(0, 3).map(r => r.x); return listPublished().filter(x => x.slug !== p.slug).map(x => ({ x, s: x.tags.filter(t => p.tags.includes(t)).length })).sort((a, b) => b.s - a.s || b.x.publishedAt - a.x.publishedAt).slice(0, 3).map(r => r.x);
} }
function renderPost(p) { function renderPost(p, pc) {
const url = SITE + '/blog/' + p.slug; const url = SITE + '/blog/' + p.slug;
const ld = [{ '@context': 'https://schema.org', '@type': 'BlogPosting', headline: p.title, description: p.excerpt, image: p.cover ? (p.cover.startsWith('http') ? p.cover : SITE + p.cover) : SITE + '/og-stackpol-1200x630.jpg', const ld = [{ '@context': 'https://schema.org', '@type': 'BlogPosting', headline: p.title, description: p.excerpt, image: p.cover ? (p.cover.startsWith('http') ? p.cover : SITE + p.cover) : SITE + '/og-stackpol-1200x630.jpg',
datePublished: new Date(p.publishedAt).toISOString(), dateModified: new Date(p.updated).toISOString(), wordCount: words(p.body).split(' ').length, keywords: p.tags.join(', '), datePublished: new Date(p.publishedAt).toISOString(), dateModified: new Date(p.updated).toISOString(), wordCount: words(p.body).split(' ').length, keywords: p.tags.join(', '),
@@ -89,9 +89,11 @@ function renderPost(p) {
h += '<div class="bl"><p class="crumb"><a href="/">Stack POL</a> / <a href="/blog">Blog</a>' + (p.tags[0] ? ' / <a href="/blog/tag/' + encodeURIComponent(p.tags[0]) + '">' + esc(p.tags[0]) + '</a>' : '') + '</p>'; h += '<div class="bl"><p class="crumb"><a href="/">Stack POL</a> / <a href="/blog">Blog</a>' + (p.tags[0] ? ' / <a href="/blog/tag/' + encodeURIComponent(p.tags[0]) + '">' + esc(p.tags[0]) + '</a>' : '') + '</p>';
h += '<h1>' + esc(p.title) + '</h1><p class="meta">By ' + AUTHOR + ' · ' + fmtDate(p.publishedAt) + (p.updated > p.publishedAt + 864e5 ? ' · updated ' + fmtDate(p.updated) : '') + ' · ' + readMinutes(p.body) + ' min read</p>'; h += '<h1>' + esc(p.title) + '</h1><p class="meta">By ' + AUTHOR + ' · ' + fmtDate(p.publishedAt) + (p.updated > p.publishedAt + 864e5 ? ' · updated ' + fmtDate(p.updated) : '') + ' · ' + readMinutes(p.body) + ' min read</p>';
if (p.cover) h += '<img class="cover" src="' + esc(p.cover) + '" alt="' + esc(p.coverAlt) + '" width="1200" height="630">'; if (p.cover) h += '<img class="cover" src="' + esc(p.cover) + '" alt="' + esc(p.coverAlt) + '" width="1200" height="630">';
h += '<article>' + p.body; // an ad spot inside the article (Marty 2026-11-09): after the third paragraph of a long post; a Pro member's banner when personalized
let body = p.body; const paras = body.split('</p>'); if (paras.length > 6) body = paras.slice(0, 3).join('</p>') + '</p>' + spot(ZONES.blogBox, ZONES.strip) + paras.slice(3).join('</p>');
h += '<article>' + body;
if (p.faq.length) h += '<h2>Questions people ask</h2>' + p.faq.map(q => '<h3>' + esc(q.q) + '</h3><p>' + esc(q.a) + '</p>').join(''); if (p.faq.length) h += '<h2>Questions people ask</h2>' + p.faq.map(q => '<h3>' + esc(q.q) + '</h3><p>' + esc(q.a) + '</p>').join('');
h += '</article>' + spot(ZONES.blogBox, ZONES.blogBox); h += '</article>' + (pc && pc.st.pro ? memberLinks(pc.who, pc.st) : '') + spot(ZONES.blogBox, ZONES.blogBox) + (pc && pc.st.pro ? proCta(pc.who) : '');
if (p.tags.length) h += '<p class="tags" style="margin-top:22px">' + p.tags.map(t => '<a href="/blog/tag/' + encodeURIComponent(t) + '">' + esc(t) + '</a>').join('') + '</p>'; if (p.tags.length) h += '<p class="tags" style="margin-top:22px">' + p.tags.map(t => '<a href="/blog/tag/' + encodeURIComponent(t) + '">' + esc(t) + '</a>').join('') + '</p>';
h += '<p class="share" style="margin-top:18px"><a href="https://x.com/intent/tweet?url=' + encodeURIComponent(url) + '&text=' + encodeURIComponent(p.title) + '" target="_blank" rel="noopener">Share on X</a><a href="https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url) + '" target="_blank" rel="noopener">Share on Facebook</a><a href="https://t.me/share/url?url=' + encodeURIComponent(url) + '&text=' + encodeURIComponent(p.title) + '" target="_blank" rel="noopener">Telegram</a></p>'; h += '<p class="share" style="margin-top:18px"><a href="https://x.com/intent/tweet?url=' + encodeURIComponent(url) + '&text=' + encodeURIComponent(p.title) + '" target="_blank" rel="noopener">Share on X</a><a href="https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url) + '" target="_blank" rel="noopener">Share on Facebook</a><a href="https://t.me/share/url?url=' + encodeURIComponent(url) + '&text=' + encodeURIComponent(p.title) + '" target="_blank" rel="noopener">Telegram</a></p>';
h += '<div class="author"><span class="av">M</span><div><b>' + AUTHOR + '</b><span>Founder of InstantAdPay, LinkSpin and the Crypto Team Build Network. Twenty-plus years of internet marketing, and a habit of writing down what actually worked.</span></div></div>'; h += '<div class="author"><span class="av">M</span><div><b>' + AUTHOR + '</b><span>Founder of InstantAdPay, LinkSpin and the Crypto Team Build Network. Twenty-plus years of internet marketing, and a habit of writing down what actually worked.</span></div></div>';
+45 -2
View File
@@ -84,6 +84,13 @@ footer.site b{display:block;color:var(--ink);font:700 14px var(--display);margin
.crumb{font-size:13px;color:var(--muted);margin-top:26px}.crumb a{color:var(--muted)} .crumb{font-size:13px;color:var(--muted);margin-top:26px}.crumb a{color:var(--muted)}
/* ad spots (LinkSpin zones): neutral class names, ad blockers hide .adzone-style names (feedback 2026-10-08) */ /* ad spots (LinkSpin zones): neutral class names, ad blockers hide .adzone-style names (feedback 2026-10-08) */
.spot{display:flex;flex-direction:column;align-items:center;gap:4px;margin:28px auto;max-width:100%;overflow:hidden}.spot .sl{font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)} .spot{display:flex;flex-direction:column;align-items:center;gap:4px;margin:28px auto;max-width:100%;overflow:hidden}.spot .sl{font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
/* Stack POL Pro (2026-11-09): the member's own links, the purple QR, the get-a-page-like-this panel */
.mylinks{margin:26px 0}.mylinks .ml{display:flex;flex-wrap:wrap;gap:10px;margin-top:8px}
.prorow{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:22px;align-items:center;background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:20px;margin:28px 0}
.qr{background:#fff;border-radius:14px;padding:10px;width:170px;text-align:center}.qr img{display:block;width:150px;height:150px}.qr span{font:700 11px var(--body);color:#5b2bb5;letter-spacing:.06em;text-transform:uppercase}
.procta{display:flex;flex-wrap:wrap;gap:12px 16px;align-items:center;border:1px solid var(--violet);border-radius:18px;padding:18px 20px;margin:30px 0;background:linear-gradient(135deg,rgba(130,71,229,.16),transparent)}
.procta div{flex:1 1 280px;min-width:0}.procta b{display:block;font:800 18px var(--display);margin-bottom:4px}.procta span{color:var(--muted)}
@media (max-width:640px){.prorow{grid-template-columns:1fr}.qr{margin:0 auto}}
@media (prefers-reduced-motion:reduce){.card,.btn{transition:none}.card:hover{transform:none}} @media (prefers-reduced-motion:reduce){.card,.btn{transition:none}.card:hover{transform:none}}
`; `;
@@ -116,7 +123,43 @@ function head(o) {
// hidden size never counts a view. Zones are on Marty's LinkSpin account, site stackpol.com (created 2026-11-09). // hidden size never counts a view. Zones are on Marty's LinkSpin account, site stackpol.com (created 2026-11-09).
const ZONES = { banner: 'ls-9c2a52', strip: 'ls-dc8bdd', blogBox: 'ls-72413f', ledgerBox: 'ls-1f308f' }; const ZONES = { banner: 'ls-9c2a52', strip: 'ls-dc8bdd', blogBox: 'ls-72413f', ledgerBox: 'ls-1f308f' };
const spot = (wide, narrow) => '<div class="spot" data-w="' + (wide || '') + '" data-n="' + (narrow || wide || '') + '"><span class="sl">Sponsored</span></div>'; const spot = (wide, narrow) => '<div class="spot" data-w="' + (wide || '') + '" data-n="' + (narrow || wide || '') + '"><span class="sl">Sponsored</span></div>';
const SPOT_JS = '<script>(function(){var w=innerWidth>=760;document.querySelectorAll(".spot").forEach(function(d){var id=w?d.dataset.w:d.dataset.n;if(!id){d.remove();return;}var s=document.createElement("script");s.async=true;s.src="https://linkspin.app/z.js";s.setAttribute("data-zone",id);d.appendChild(s);});})();</script>'; const MEMBER_HOST = 'rubav.com'; // a LinkSpin link domain: /i/<code>.gif image, /c/<code> click, /r/<code> spin link
const SPOT_JS = '<script>(function(){var w=innerWidth>=760;document.querySelectorAll(".spot").forEach(function(d){var m=w?d.dataset.mw:d.dataset.mn;if(m){m=m.split("|");var a=document.createElement("a");a.href="https://' + MEMBER_HOST + '/c/"+m[0];a.target="_blank";a.rel="sponsored noopener";var i=document.createElement("img");i.src="https://' + MEMBER_HOST + '/i/"+m[0]+".gif";i.width=+m[1];i.height=+m[2];i.alt="";i.style.cssText="max-width:100%;height:auto";a.appendChild(i);d.appendChild(a);return;}var id=w?d.dataset.w:d.dataset.n;if(!id){d.remove();return;}var s=document.createElement("script");s.async=true;s.src="https://linkspin.app/z.js";s.setAttribute("data-zone",id);d.appendChild(s);});})();</script>';
// Stack POL Pro (2026-11-09): a page that belongs to a Pro member (their /<username>, or any page opened with ?ref=<username>) shows
// THEIR LinkSpin Banner Spins in the ad spots instead of the network zones (a spot with no spin of a fitting size keeps the network
// zone), and every internal link and join link carries their referral. Free members' pages keep the network zones but still credit
// the member on join links. Not personalized = the standard network ads.
const FIT = { [ZONES.banner]: ['728x90', '468x60'], [ZONES.strip]: ['468x60', '300x250', '125x125'], [ZONES.blogBox]: ['300x250', '125x125', '468x60'], [ZONES.ledgerBox]: ['300x250', '125x125', '468x60'] };
function pickSpin(spins, zone) {
for (const size of FIT[zone] || []) { const c = spins.filter(x => x.size === size); if (c.length) { const x = c[Math.floor(Math.random() * c.length)]; return x.code + '|' + size.replace('x', '|'); } }
return '';
}
function personalize(html, who, st) {
if (!who) return html;
const pro = st && st.pro, spins = (pro && pro.spins) || [];
if (spins.length) html = html.replace(/<div class="spot" data-w="([^"]*)" data-n="([^"]*)">/g, (m, w, n) => {
const mw = pickSpin(spins, w), mn = pickSpin(spins, n);
return '<div class="spot mine" data-w="' + w + '" data-n="' + n + '"' + (mw ? ' data-mw="' + mw + '"' : '') + (mn ? ' data-mn="' + mn + '"' : '') + '>';
});
return html.replace(/href="([^"]*)"/g, (m, h) => {
if (/^\/(earn|blog|programs|ledger)(\/|\?|$)/.test(h) && !/\/blog\/feed\.xml/.test(h)) return 'href="' + h + (h.includes('?') ? '&amp;' : '?') + 'ref=' + who + '"';
if (h === '/') return 'href="/' + who + '"';
if (/^https:\/\/(instantadpay\.com|linkspin\.app)\/?$/.test(h)) return 'href="' + h.replace(/\/?$/, '/join/' + who) + '"';
if (/^https:\/\/(instantadpay\.com|linkspin\.app)\//.test(h)) return 'href="' + h.replace(/\/join\/martbost\b/, '/join/' + who).replace(/([?&](?:amp;)?ref=)martbost\b/, '$1' + who) + '"';
return m;
});
}
// shown on a Pro page and on articles opened from one: the visitor can get a page like this (Marty 2026-11-09). New visitors join
// under the Pro member; members go straight to the Stack POL tab, where Get Pro opens the order a $10+ package fulfils.
function proCta(who) {
return '<div class="procta"><div><b>Want a personalized page like this?</b><span>Your own Stack POL page with your banners, your links and your QR code. Unlocked one time with any InstantAdPay ad package of $10 or more.</span></div>'
+ '<a class="btn" href="https://instantadpay.com/join/' + esc(who) + '?src=stackpol-pro" rel="noopener">Get your own page</a><a class="btn sec" href="https://instantadpay.com/my#promo?s=stackpol" rel="noopener">Already a member? Unlock Pro</a></div>';
}
// the member's spin links, as a block for their page and the end of articles opened from it
function memberLinks(who, st) {
const links = (st && st.pro && st.pro.links) || []; if (!links.length) return '';
return '<div class="mylinks"><p class="kick">@' + esc(who) + ' recommends</p><div class="ml">' + links.map(l => '<a class="chip" href="https://' + MEMBER_HOST + '/r/' + esc(l.code) + '" target="_blank" rel="sponsored noopener">' + esc(l.name || 'Open link') + ' &rarr;</a>').join('') + '</div></div>';
}
function tail(extra) { function tail(extra) {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
return '<footer class="site"><div><b>Stack POL</b>Every POL payout across the network, stacked in one place and checkable on Polygon.</div>' return '<footer class="site"><div><b>Stack POL</b>Every POL payout across the network, stacked in one place and checkable on Polygon.</div>'
@@ -126,4 +169,4 @@ function tail(extra) {
+ '<p class="disc">&copy; ' + year + ' Stack POL, part of the Crypto Team Build Network. Stack POL shows payouts; it does not hold, invest or pay out anyone\'s money.</p>' + '<p class="disc">&copy; ' + year + ' Stack POL, part of the Crypto Team Build Network. Stack POL shows payouts; it does not hold, invest or pay out anyone\'s money.</p>'
+ '</div>' + (extra || '') + SPOT_JS + '</body></html>'; + '</div>' + (extra || '') + SPOT_JS + '</body></html>';
} }
module.exports = { SITE, esc, head, tail, OG, V, ZONES, spot }; module.exports = { SITE, esc, head, tail, OG, V, ZONES, spot, personalize, memberLinks, proCta, MEMBER_HOST };
+320
View File
@@ -0,0 +1,320 @@
{
"name": "stackpol",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "stackpol",
"version": "1.0.0",
"dependencies": {
"qrcode": "1.5.4"
}
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"license": "ISC",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^6.2.0"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"license": "MIT"
},
"node_modules/decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/dijkstrajs": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
"license": "MIT"
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT"
},
"node_modules/find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"license": "MIT",
"dependencies": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"license": "ISC",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"license": "MIT",
"dependencies": {
"p-locate": "^4.1.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"license": "MIT",
"dependencies": {
"p-try": "^2.0.0"
},
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-locate": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"license": "MIT",
"dependencies": {
"p-limit": "^2.2.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/pngjs": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
"license": "MIT",
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/qrcode": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
"license": "MIT",
"dependencies": {
"dijkstrajs": "^1.0.1",
"pngjs": "^5.0.0",
"yargs": "^15.3.1"
},
"bin": {
"qrcode": "bin/qrcode"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"license": "ISC"
},
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"license": "ISC"
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/which-module": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
"license": "ISC"
},
"node_modules/wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/y18n": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"license": "ISC"
},
"node_modules/yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"license": "MIT",
"dependencies": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^18.1.2"
},
"engines": {
"node": ">=8"
}
},
"node_modules/yargs-parser": {
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"license": "ISC",
"dependencies": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
},
"engines": {
"node": ">=6"
}
}
}
}
+1 -1
View File
@@ -1 +1 @@
{ "name": "stackpol", "version": "1.0.0", "private": true, "main": "server.js", "scripts": { "start": "node server.js" } } { "name": "stackpol", "version": "1.0.0", "private": true, "main": "server.js", "scripts": { "start": "node server.js" }, "dependencies": { "qrcode": "1.5.4" } }
+35 -13
View File
@@ -9,7 +9,8 @@ const http = require('http');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const zlib = require('zlib'); const zlib = require('zlib');
const { SITE, esc, head, tail, ZONES, spot } = require('./layout'); const { SITE, esc, head, tail, ZONES, spot, personalize, memberLinks, proCta } = require('./layout');
let QR = null; try { QR = require('qrcode'); } catch (e) { console.error('[stackpol] qrcode module missing: no QR on Pro pages'); }
const { PROGRAMS, BY_KEY, BY_SLUG } = require('./programs'); const { PROGRAMS, BY_KEY, BY_SLUG } = require('./programs');
const blog = require('./blog'); const blog = require('./blog');
@@ -89,7 +90,7 @@ function programsPage() {
h += '<div class="cards" style="margin-top:22px">' + ps.map(p => card(p, prog(p.k).pol, prog(p.k).payments, OWNER)).join('') + '</div>'; h += '<div class="cards" style="margin-top:22px">' + ps.map(p => card(p, prog(p.k).pol, prog(p.k).payments, OWNER)).join('') + '</div>';
return h + tail(); return h + tail();
} }
function programPage(p) { function programPage(p, who) { const ref = who || OWNER; // a Pro member's ref (2026-11-09) or the site owner
const s = prog(p.k), rows = ((IDX && IDX.progRecent && IDX.progRecent[p.k]) || ((IDX && IDX.recent) || []).filter(r => r.k === p.k)).slice(0, 20); const s = prog(p.k), rows = ((IDX && IDX.progRecent && IDX.progRecent[p.k]) || ((IDX && IDX.recent) || []).filter(r => r.k === p.k)).slice(0, 20);
const desc = p.n + ' pays POL on Polygon. ' + fmt(s.pol) + ' POL paid in ' + fmtInt(s.payments) + ' payments to ' + fmtInt(s.wallets) + ' wallets so far. ' + p.d.slice(0, 90); const desc = p.n + ' pays POL on Polygon. ' + fmt(s.pol) + ' POL paid in ' + fmtInt(s.payments) + ' payments to ' + fmtInt(s.wallets) + ' wallets so far. ' + p.d.slice(0, 90);
const ld = [{ '@context': 'https://schema.org', '@type': 'BreadcrumbList', itemListElement: [{ '@type': 'ListItem', position: 1, name: 'Stack POL', item: SITE + '/' }, { '@type': 'ListItem', position: 2, name: 'Programs', item: SITE + '/programs' }, { '@type': 'ListItem', position: 3, name: p.n, item: SITE + '/earn/' + p.slug }] }, const ld = [{ '@context': 'https://schema.org', '@type': 'BreadcrumbList', itemListElement: [{ '@type': 'ListItem', position: 1, name: 'Stack POL', item: SITE + '/' }, { '@type': 'ListItem', position: 2, name: 'Programs', item: SITE + '/programs' }, { '@type': 'ListItem', position: 3, name: p.n, item: SITE + '/earn/' + p.slug }] },
@@ -100,13 +101,13 @@ function programPage(p) {
h += '<section class="hero" style="padding-top:10px"><div><p class="kick">' + esc(p.kind) + '</p><h1>' + esc(p.n) + '</h1><p class="lead">' + esc(p.d) + '</p>'; h += '<section class="hero" style="padding-top:10px"><div><p class="kick">' + esc(p.kind) + '</p><h1>' + esc(p.n) + '</h1><p class="lead">' + esc(p.d) + '</p>';
h += '<div class="total"><span class="n">' + fmt(s.pol) + '</span><span class="u">POL</span></div><div class="stats"><div><b>' + fmtInt(s.payments) + '</b><span>payments</span></div><div><b>' + fmtInt(s.wallets) + '</b><span>wallets paid</span></div>' + (s.last ? '<div><b>' + ago(s.last) + '</b><span>last payout</span></div>' : '') + '</div>'; h += '<div class="total"><span class="n">' + fmt(s.pol) + '</span><span class="u">POL</span></div><div class="stats"><div><b>' + fmtInt(s.payments) + '</b><span>payments</span></div><div><b>' + fmtInt(s.wallets) + '</b><span>wallets paid</span></div>' + (s.last ? '<div><b>' + ago(s.last) + '</b><span>last payout</span></div>' : '') + '</div>';
if (p.season) h += '<p style="color:#fb923c;font-weight:700">' + esc(p.season.label) + '</p>'; if (p.season) h += '<p style="color:#fb923c;font-weight:700">' + esc(p.season.label) + '</p>';
h += '<div class="cta"><a class="btn" href="' + esc(p.join(OWNER)) + '" rel="nofollow noopener" target="_blank">' + (p.k === 'iap' || p.k === 'ls' ? 'Join ' : 'Play ') + esc(p.n) + ' free</a><a class="btn sec" href="/ledger?p=' + p.k + '">Its payouts on the ledger</a></div></div>'; h += '<div class="cta"><a class="btn" href="' + esc(p.join(ref)) + '" rel="nofollow noopener" target="_blank">' + (p.k === 'iap' || p.k === 'ls' ? 'Join ' : 'Play ') + esc(p.n) + ' free</a><a class="btn sec" href="/ledger?p=' + p.k + '">Its payouts on the ledger</a></div></div>';
h += '<aside><img src="/img/' + p.k + '.jpg" alt="' + esc(p.n) + '" width="800" height="420" style="border-radius:18px;border:1px solid var(--line)"></aside></section>'; h += '<aside><img src="/img/' + p.k + '.jpg" alt="' + esc(p.n) + '" width="800" height="420" style="border-radius:18px;border:1px solid var(--line)"></aside></section>';
h += '<div class="sec-head"><h2>How ' + esc(p.n) + ' pays</h2></div><p class="lead" style="max-width:72ch">' + esc(p.how || ('Rewards are sent in POL from ' + p.n + '\'s own payout wallet straight to the wallet on your account, on the Polygon network. Every payment is a public transaction you can open on Polygonscan.')) + '</p>'; h += '<div class="sec-head"><h2>How ' + esc(p.n) + ' pays</h2></div><p class="lead" style="max-width:72ch">' + esc(p.how || ('Rewards are sent in POL from ' + p.n + '\'s own payout wallet straight to the wallet on your account, on the Polygon network. Every payment is a public transaction you can open on Polygonscan.')) + '</p>';
h += '<div class="sec-head"><h2>Latest ' + esc(p.n) + ' payouts</h2><p><a href="/ledger?p=' + p.k + '">All of them</a></p></div>' + tableHead(true) + ledgerRows(rows, true) + '</tbody></table></div>'; h += '<div class="sec-head"><h2>Latest ' + esc(p.n) + ' payouts</h2><p><a href="/ledger?p=' + p.k + '">All of them</a></p></div>' + tableHead(true) + ledgerRows(rows, true) + '</tbody></table></div>';
const posts = blog.listPublished().filter(b => b.tags.includes(p.slug) || b.tags.includes(p.n.toLowerCase())).slice(0, 3); const posts = blog.listPublished().filter(b => b.tags.includes(p.slug) || b.tags.includes(p.n.toLowerCase())).slice(0, 3);
if (posts.length) h += '<div class="sec-head"><h2>Guides</h2></div><div class="posts">' + posts.map(blog.cardHtml).join('') + '</div>'; if (posts.length) h += '<div class="sec-head"><h2>Guides</h2></div><div class="posts">' + posts.map(blog.cardHtml).join('') + '</div>';
h += '<div class="sec-head"><h2>More programs that pay POL</h2></div><div class="cards">' + sortedProgs().filter(x => x.k !== p.k).slice(0, 3).map(x => card(x, prog(x.k).pol, prog(x.k).payments, OWNER)).join('') + '</div>'; h += '<div class="sec-head"><h2>More programs that pay POL</h2></div><div class="cards">' + sortedProgs().filter(x => x.k !== p.k).slice(0, 3).map(x => card(x, prog(x.k).pol, prog(x.k).payments, ref)).join('') + '</div>';
return h + tail(); return h + tail();
} }
function ledgerPage(k) { function ledgerPage(k) {
@@ -128,9 +129,23 @@ function stackPage(u, st) {
h += '<div class="cta"><a class="btn" href="https://instantadpay.com/join/' + esc(u) + '?src=stackpol" rel="noopener">Start your own stack, free</a><span class="fine">Free to join. One member\'s results, not a promise. What you stack depends on what you do.</span></div></div>' + heroVideo + '</section>'; h += '<div class="cta"><a class="btn" href="https://instantadpay.com/join/' + esc(u) + '?src=stackpol" rel="noopener">Start your own stack, free</a><span class="fine">Free to join. One member\'s results, not a promise. What you stack depends on what you do.</span></div></div>' + heroVideo + '</section>';
const feat = PROGRAMS.filter(p => p.season && seasonOn(p)), rest = PROGRAMS.filter(p => !(p.season && seasonOn(p))).sort((a, b) => ((st.byProg[b.k] || {}).pol || 0) - ((st.byProg[a.k] || {}).pol || 0)); const feat = PROGRAMS.filter(p => p.season && seasonOn(p)), rest = PROGRAMS.filter(p => !(p.season && seasonOn(p))).sort((a, b) => ((st.byProg[b.k] || {}).pol || 0) - ((st.byProg[a.k] || {}).pol || 0));
h += '<div class="sec-head"><h2>Where @' + esc(u) + '\'s POL comes from</h2><p>Tap any program to start. Each pays to your own wallet.</p></div>' + feat.map(p => feature(p, u)).join('') + '<div class="cards">' + rest.map(p => card(p, (st.byProg[p.k] || {}).pol || 0, (st.byProg[p.k] || {}).payments || 0, u)).join('') + '</div>'; h += '<div class="sec-head"><h2>Where @' + esc(u) + '\'s POL comes from</h2><p>Tap any program to start. Each pays to your own wallet.</p></div>' + feat.map(p => feature(p, u)).join('') + '<div class="cards">' + rest.map(p => card(p, (st.byProg[p.k] || {}).pol || 0, (st.byProg[p.k] || {}).payments || 0, u)).join('') + '</div>';
if (st.pro) { // Stack POL Pro (2026-11-09): the member's own links and a purple Polygon QR that opens this page
h += '<div class="prorow"><div style="min-width:0">' + (memberLinks(u, st) || '<p class="kick">@' + esc(u) + '\'s page</p>') + '<p class="lead" style="margin:6px 0 0">Scan the code to open @' + esc(u) + '\'s stack on your phone, or share it anywhere people can see it.</p></div>'
+ (QR ? '<div class="qr"><img src="/qr/' + esc(u) + '.svg" alt="QR code for stackpol.com/' + esc(u) + '" width="150" height="150"><span>stackpol.com/' + esc(u) + '</span></div>' : '') + '</div>';
}
h += spot(ZONES.banner, ZONES.strip);
h += '<div class="sec-head"><h2>@' + esc(u) + '\'s latest payouts</h2></div>' + tableHead(false) + ledgerRows(st.recent || [], false) + '</tbody></table></div>'; h += '<div class="sec-head"><h2>@' + esc(u) + '\'s latest payouts</h2></div>' + tableHead(false) + ledgerRows(st.recent || [], false) + '</tbody></table></div>';
const posts = blog.listPublished().slice(0, 3);
if (posts.length) h += '<div class="sec-head"><h2>From the blog</h2><p><a href="/blog">All posts</a></p></div><div class="posts">' + posts.map(blog.cardHtml).join('') + '</div>';
if (st.pro) h += proCta(u);
return h + tail(videoJs); return h + tail(videoJs);
} }
const QRC = new Map(); // username -> svg (the page URL never changes)
async function qrSvg(un) {
if (QRC.has(un)) return QRC.get(un);
const svg = await QR.toString(SITE + '/' + un, { type: 'svg', margin: 1, width: 300, errorCorrectionLevel: 'M', color: { dark: '#6a2fd6', light: '#ffffff' } }); // Polygon purple, dark enough to scan
QRC.set(un, svg); return svg;
}
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 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() { function sitemap() {
const d = new Date().toISOString().slice(0, 10); const d = new Date().toISOString().slice(0, 10);
@@ -178,22 +193,29 @@ const server = http.createServer((req, res) => {
if (req.method !== 'GET' && req.method !== 'HEAD') { res.writeHead(405); return res.end(); } if (req.method !== 'GET' && req.method !== 'HEAD') { res.writeHead(405); return res.end(); }
if (p === '/api/totals') return send(req, res, 200, 'application/json', JSON.stringify({ at: IDX ? IDX.at : null, network: net(), programs: (IDX && IDX.programs) || {} }), 'public, max-age=120'); if (p === '/api/totals') return send(req, res, 200, 'application/json', JSON.stringify({ at: IDX ? IDX.at : null, network: net(), programs: (IDX && IDX.programs) || {} }), 'public, max-age=120');
if (p === '/health') return send(req, res, 200, 'text/plain', 'ok', 'no-store'); if (p === '/health') return send(req, res, 200, 'text/plain', 'ok', 'no-store');
if (p === '/') return html(req, res, 200, home(), 'public, max-age=120'); // ?ref=<username> of a Pro member (Marty 2026-11-09): every call to action credits them (join links, game links, program
if (p === '/programs') return html(req, res, 200, programsPage(), 'public, max-age=300'); // pages) and their banners fill the ad spots. Anyone else, or no ref: the standard network pages and zones.
if (p === '/ledger') return html(req, res, 200, ledgerPage(u.searchParams.get('p')), 'public, max-age=120'); const refName = String(u.searchParams.get('ref') || '').toLowerCase(), refSt = /^[a-z0-9_]{3,30}$/.test(refName) && IDX && IDX.stacks && IDX.stacks[refName];
let m = /^\/earn\/([a-z0-9-]+)\/?$/.exec(p); if (m) return BY_SLUG[m[1]] ? html(req, res, 200, programPage(BY_SLUG[m[1]]), 'public, max-age=300') : html(req, res, 404, notFound()); const pc = refSt && refSt.pro ? { who: refName, st: refSt } : null;
if (p === '/blog' || p === '/blog/') return html(req, res, 200, blog.renderIndex(1)); const page = body => pc ? personalize(body, pc.who, pc.st) : body;
m = /^\/blog\/page\/(\d+)$/.exec(p); if (m) return html(req, res, 200, blog.renderIndex(Number(m[1]))); const q = /^\/qr\/([a-z0-9_]{3,30})\.svg$/.exec(p);
m = /^\/blog\/tag\/([^/]+)$/.exec(p); if (m) return html(req, res, 200, blog.renderIndex(1, m[1].toLowerCase())); 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 (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());
if (p === '/blog' || p === '/blog/') return html(req, res, 200, page(blog.renderIndex(1)));
m = /^\/blog\/page\/(\d+)$/.exec(p); if (m) return html(req, res, 200, page(blog.renderIndex(Number(m[1]))));
m = /^\/blog\/tag\/([^/]+)$/.exec(p); if (m) return html(req, res, 200, page(blog.renderIndex(1, m[1].toLowerCase())));
if (p === '/blog/feed.xml') return send(req, res, 200, 'application/rss+xml; charset=utf-8', blog.rss(), 'public, max-age=600'); if (p === '/blog/feed.xml') return send(req, res, 200, 'application/rss+xml; charset=utf-8', blog.rss(), 'public, max-age=600');
m = /^\/blog\/([a-z0-9-]+)\/?$/.exec(p); if (m) { const post = blog.get(m[1]); return post ? html(req, res, 200, blog.renderPost(post), 'public, max-age=600') : html(req, res, 404, notFound('That post is not here.')); } m = /^\/blog\/([a-z0-9-]+)\/?$/.exec(p); if (m) { const post = blog.get(m[1]); return post ? html(req, res, 200, page(blog.renderPost(post, pc)), 'public, max-age=600') : html(req, res, 404, notFound('That post is not here.')); }
if (p === '/sitemap.xml') return send(req, res, 200, 'application/xml; charset=utf-8', sitemap(), 'public, max-age=3600'); if (p === '/sitemap.xml') return send(req, res, 200, 'application/xml; charset=utf-8', sitemap(), 'public, max-age=3600');
if (p === '/robots.txt') return send(req, res, 200, 'text/plain; charset=utf-8', robots(), 'public, max-age=86400'); if (p === '/robots.txt') return send(req, res, 200, 'text/plain; charset=utf-8', robots(), 'public, max-age=86400');
if (staticFile(req, res, p)) return; if (staticFile(req, res, p)) return;
m = /^\/@?([a-z0-9_]{3,30})\/?$/i.exec(p); m = /^\/@?([a-z0-9_]{3,30})\/?$/i.exec(p);
if (m && !RESERVED.has(m[1].toLowerCase())) { if (m && !RESERVED.has(m[1].toLowerCase())) {
const name = m[1].toLowerCase(), st = IDX && IDX.stacks && IDX.stacks[name]; const name = m[1].toLowerCase(), st = IDX && IDX.stacks && IDX.stacks[name];
if (st) return html(req, res, 200, stackPage(name, st), 'public, max-age=120'); if (st) return html(req, res, 200, st.pro ? personalize(stackPage(name, st), name, st) : stackPage(name, st), 'public, max-age=120');
return html(req, res, 404, notFound('@' + name + ' has not switched on a Stack POL page yet. Members turn it on in InstantAdPay Promo tools.')); return html(req, res, 404, notFound('@' + name + ' has not switched on a Stack POL page yet. Members turn it on in InstantAdPay Promo tools.'));
} }
return html(req, res, 404, notFound()); return html(req, res, 404, notFound());
+20
View File
@@ -144,6 +144,26 @@ def main():
stacks[un] = {'total': round(sum(r['pol'] for r in mine), 4), 'payments': len(mine), 'since': min(r['ts'] for r in mine), stacks[un] = {'total': round(sum(r['pol'] for r in mine), 4), 'payments': len(mine), 'since': min(r['ts'] for r in mine),
'byProg': {k: {'pol': round(v['pol'], 4), 'payments': v['payments']} for k, v in by.items()}, 'byProg': {k: {'pol': round(v['pol'], 4), 'payments': v['payments']} for k, v in by.items()},
'recent': [{'k': r['k'], 'pol': round(r['pol'], 4), 'tx': r['tx'], 'ts': r['ts']} for r in mine[:25]]} 'recent': [{'k': r['k'], 'pol': round(r['pol'], 4), 'tx': r['tx'], 'ts': r['ts']} for r in mine[:25]]}
# Stack POL Pro (2026-11-09): a paid one-time unlock in IAP. Pro pages (and blog/program pages opened from one) show the member's own
# LinkSpin Banner Spins and spin links in place of the network zones. Matched by username (one identity across IAP and LinkSpin).
pro = {str(k).lower() for k, v in ((so.get('pro') or {}) if isinstance(so, dict) else {}).items() if v}
if pro and lsd:
em = {}
for e, a in (load(os.path.join(lsd, 'accounts.json'), {}).get('byEmail', {}) or {}).items():
un = str(a.get('username') or '').lower()
if un in pro:
em[str(e).lower()] = un
bs = load(os.path.join(lsd, 'bannerspin.json'), {}).get('spins', []) or []
rt = load(os.path.join(lsd, 'rotator.json'), {}).get('rotations', []) or []
for un in pro:
if un not in stacks:
continue
mine = [e for e, u in em.items() if u == un]
spins = [{'code': x['code'], 'size': x.get('size', ''), 'name': str(x.get('name') or '')[:60]} for x in bs
if str(x.get('owner', '')).lower() in mine and not x.get('paused') and any(b.get('active', True) for b in x.get('banners') or [])]
links = [{'code': x['code'], 'name': str(x.get('name') or '')[:60]} for x in rt
if str(x.get('owner', '')).lower() in mine and not x.get('paused') and any(d.get('active', True) for d in x.get('destinations') or [])]
stacks[un]['pro'] = {'spins': spins[:40], 'links': links[:20]}
snap = {'v': 1, 'at': now, 'network': {'pol': round(sum(r['pol'] for r in rows), 4), 'payments': len(rows), 'wallets': len(wallets - {''})}, snap = {'v': 1, 'at': now, 'network': {'pol': round(sum(r['pol'] for r in rows), 4), 'payments': len(rows), 'wallets': len(wallets - {''})},
'last7': {'pol': round(sum(r['pol'] for r in l7), 4), 'payments': len(l7)}, 'programs': programs, 'recent': recent, 'progRecent': prog_recent, 'stacks': stacks} 'last7': {'pol': round(sum(r['pol'] for r in l7), 4), 'payments': len(l7)}, 'programs': programs, 'recent': recent, 'progRecent': prog_recent, 'stacks': stacks}
print('network %.2f POL, %d payments, %d wallets | last7 %.2f | stacks %s' % (snap['network']['pol'], snap['network']['payments'], snap['network']['wallets'], snap['last7']['pol'], ','.join(stacks) or '-')) print('network %.2f POL, %d payments, %d wallets | last7 %.2f | stacks %s' % (snap['network']['pol'], snap['network']['payments'], snap['network']['wallets'], snap['last7']['pol'], ','.join(stacks) or '-'))