diff --git a/accounts.js b/accounts.js index 7959233..deb9623 100644 --- a/accounts.js +++ b/accounts.js @@ -39,7 +39,9 @@ const pub = a => a ? { email: a.email, sponsorRef: a.sponsorRef || '', code: a.c bixPartnerLink: a.bixPartnerLink || null, // BixPay partner link (bixpay.js, 2026-10-29): one identity, follows the member to LinkSpin/CTB profileQuarantined: !!a.profileQuarantined, // 2026-10-30: first profile save of a brand-new free account planted a link; stored, never rendered publicly (spamscan.js) chatAvailable: a.chatAvailable === false ? false : true, lastSeen: a.lastSeen || 0, + theme: a.theme || null, // 2026-11-01 appearance: auto | light | dark, follows the member across browsers (common.js IAP.themeSync) address: a.address || null, created: a.created } : null; +const THEMES = new Set(['auto', 'light', 'dark']); const USER_RE = /^[a-zA-Z0-9_]{3,20}$/; const normUser = u => String(u || '').trim().toLowerCase(); @@ -130,6 +132,7 @@ const J = { }, async setBixLink(e, link) { const acct = this.db.byEmail[e]; if (!acct) return { error: 'No such account.' }; acct.bixPartnerLink = link || null; this.save(); return { ok: true, account: pub(acct) }; }, async touchSeen(e) { const a = this.db.byEmail[e]; if (a) { a.lastSeen = Date.now(); this.save(); } }, + async setTheme(e, t) { const a = this.db.byEmail[e]; if (!a) return { error: 'No such account.' }; a.theme = THEMES.has(t) ? t : null; this.save(); return { ok: true, account: pub(a) }; }, async setChatAvailable(e, v) { const a = this.db.byEmail[e]; if (!a) return { error: 'No such account.' }; a.chatAvailable = !!v; this.save(); return { ok: true, available: !!v }; }, async getMutes(e) { const a = this.db.byEmail[e]; return (a && Array.isArray(a.chatMutes)) ? a.chatMutes : []; }, async setMute(owner, target, muted) { @@ -233,7 +236,7 @@ const rowPub = r => r ? pub({ email: r.email, sponsorRef: r.sponsor_ref, code: r username: r.username, memberId: r.member_id || 0, joinedVia: r.joined_via || null, joinedRef: r.joined_ref || null, lineBannerUrl: r.line_banner_url, lineTargetUrl: r.line_target_url, wallOffers: r.wall_offers || null, avatarUrl: r.avatar_url, bio: r.bio, socials: r.socials, bixPartnerLink: r.bix_partner_link || null, profileQuarantined: !!r.profile_quarantined, - chatAvailable: r.chat_available === 0 ? false : true, lastSeen: Number(r.last_seen || 0), + chatAvailable: r.chat_available === 0 ? false : true, lastSeen: Number(r.last_seen || 0), theme: r.theme || null, address: r.address, created: Number(r.created) }) : null; const D = { async signup(e, password, ref) { @@ -296,6 +299,7 @@ const D = { }, async setBixLink(e, link) { const r = await db.q('UPDATE accounts SET bix_partner_link=? WHERE email=?', [link || null, e]); if (!r || !r.affectedRows) return { error: 'No such account.' }; return { ok: true, account: await this.byEmail(e) }; }, async touchSeen(e) { await db.q('UPDATE accounts SET last_seen=? WHERE email=?', [Date.now(), e]); }, + async setTheme(e, t) { await db.q('UPDATE accounts SET theme=? WHERE email=?', [THEMES.has(t) ? t : null, e]); return { ok: true, account: await this.byEmail(e) }; }, async setChatAvailable(e, v) { await db.q('UPDATE accounts SET chat_available=? WHERE email=?', [v ? 1 : 0, e]); return { ok: true, available: !!v }; }, async getMutes(e) { const r = await db.q('SELECT chat_mutes FROM accounts WHERE email=?', [e]); @@ -512,6 +516,7 @@ module.exports = { init, signup, login, ensure, onChange, isUnclaimedShell, byEm setProfile: async (e, a, bio, socials, quarantined) => { const r = await impl().setProfile(String(e || '').toLowerCase(), a, bio, socials, quarantined); if (!(r && r.error)) changed(String(e || '').toLowerCase()); return r; }, // profile edits reach LinkSpin too setBixLink: async (e, link) => { const r = await impl().setBixLink(normEmail(e), link ? String(link).slice(0, 300) : null); if (!(r && r.error)) changed(normEmail(e)); return r; }, // the BixPay partner link rides to LinkSpin in the profile row (lssync.js) touchSeen: e => impl().touchSeen(String(e || '').toLowerCase()), + setTheme: (e, t) => impl().setTheme(String(e || '').toLowerCase(), t), // appearance only: no changed() tap, LinkSpin does not mirror it either (its accounts.js says the same) adminSetAddress: (e, a) => impl().adminSetAddress(String(e || '').toLowerCase(), a ? normAddr(a) : null), positionByAddress: a => impl().positionByAddress(normAddr(a)), removeAccount: e => impl().removeAccount(String(e || '').toLowerCase()), diff --git a/blog.js b/blog.js index 4771ccc..1d2b370 100644 --- a/blog.js +++ b/blog.js @@ -6,6 +6,7 @@ const fs = require('fs'); const path = require('path'); const db = require('./db'); +const themehead = require('./themehead'); // light/dark theme head script (2026-11-01) let DATA_DIR = null; const SITE = 'https://instantadpay.com'; const AUTHOR = 'Marty Bostick'; @@ -97,19 +98,19 @@ async function bumpViews(slug) { try { await impl().bumpViews(slug); } catch (e) function head(o) { const url = SITE + o.path; const img = o.image ? (o.image.startsWith('http') ? o.image : SITE + o.image) : SITE + '/banners/iap-hero-1200x630.png'; - return '' + return '' + '' + esc(o.title) + '' + '' + '' + (o.article ? '' + (o.article.tags || []).map(t => '').join('') : '') + '' + '' - + '' - + '' + + '' + themehead.tag() + '' + + '' + '
'; } function tail() { - return '
'; + return ''; } const authorBox = () => '
InstantAdPay
' + AUTHOR + 'Founder of InstantAdPay and the Crypto Team Build Network. Twenty-plus years of internet marketing, and a habit of writing down what actually worked.
'; const cardHtml = p => '' + (p.cover ? '' : '') + '

' + esc(p.title) + '

' + esc(p.excerpt) + '

' + fmtDate(p.publishedAt || p.created) + ' · ' + readMinutes(p.body) + ' min read' + (p.tags.length ? ' · ' + p.tags.map(esc).join(', ') : '') + '

'; diff --git a/db.js b/db.js index 830d6c9..ac9e954 100644 --- a/db.js +++ b/db.js @@ -346,6 +346,7 @@ async function bootstrap() { await alterSafe('ALTER TABLE accounts ADD COLUMN wall_offers VARCHAR(2000) NULL'); // JSON [{title,bannerUrl,targetUrl}] for wall positions 2-3 (unlock at 2 / 5 qualifying buyers) await alterSafe('ALTER TABLE accounts ADD COLUMN profile_quarantined TINYINT NOT NULL DEFAULT 0'); // 2026-10-30 link-farm rule: first profile save of a new free account carried a link (spamscan.js) await alterSafe('ALTER TABLE accounts ADD COLUMN bix_partner_link VARCHAR(300) NULL'); // BixPay partner link (bixpay.js, 2026-10-29); column name checked against MySQL 8 reserved words + await alterSafe('ALTER TABLE accounts ADD COLUMN theme VARCHAR(8) NULL'); // 2026-11-01 appearance: auto | light | dark (same column as LinkSpin) // help desk (2026-10-16, tickets.js): one shared desk for IAP and, later, LinkSpin; email_message_id threads inbound mail await q(`CREATE TABLE IF NOT EXISTS tickets ( id INT AUTO_INCREMENT PRIMARY KEY, diff --git a/leaderboard.js b/leaderboard.js index 6476cdf..bbdcadc 100644 --- a/leaderboard.js +++ b/leaderboard.js @@ -5,6 +5,7 @@ // rollover (checked hourly), announced to Telegram, and credit prizes are granted automatically. const fs = require('fs'); const path = require('path'); +const themehead = require('./themehead'); // light/dark theme head script (2026-11-01) let R = null; // { chain, accounts, ads, dataDir, siteConfig, notify(text), pushFeed(ev) } const TZ = 'America/Chicago'; let cache = { at: 0, rows: null }; @@ -131,9 +132,9 @@ async function renderPage() { + (v.top.length ? v.top.map(r => '' + r.rank + '' + esc(r.name) + '' + r.sales + '$' + r.usd.toLocaleString() + '' + r.buyers + '' + r.joins + '').join('') : 'No sales yet in this period.') + ''; const fmtD = ts => new Date(ts).toLocaleDateString('en-US', { timeZone: TZ, month: 'short', day: 'numeric' }); const desc = 'Who is selling the most ad packages on InstantAdPay this week and this month. Weekly and monthly referral contest standings, read from the chain.'; - let h = 'Leaderboard | InstantAdPay' - + '' - + '
' + let h = 'Leaderboard | InstantAdPay' + + '' + themehead.tag() + '' + + '
' + '

Referral contest

Leaderboard: who is selling.

Ranked by ad packages sold to other people (your own positions never count, and the company account is not a contestant). Read from the chain, updated live. Weeks run Monday to Sunday, Central time.

'; h += '

' + week.label + ' ' + fmtD(week.start) + ' to Sunday

' + (week.prize ? '
Weekly prizes: ' + esc(week.prize) + '
' : '') + table(week); h += '

' + month.label + '

' + (month.prize ? '
Monthly prizes: ' + esc(month.prize) + '
' : '') + table(month); diff --git a/public/admin.html b/public/admin.html index 3a93048..ce0dbdb 100644 --- a/public/admin.html +++ b/public/admin.html @@ -1,12 +1,13 @@ - + Admin | InstantAdPay + - + @@ -70,7 +71,7 @@

The button opens a BixPay partner sign-up link.

Sign up on the page the button opens. Don’t install the BIX app first and don’t use the portal’s own Sign Up menu: your sponsor is lost and BIX shows the referrer as N/A.

- +

Available in 31 US states so far. Not in your state yet? You can still get the wallet and build. Elsewhere, availability varies by country.

@@ -164,7 +165,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/contract.html b/public/contract.html index 4c2975f..66d301e 100644 --- a/public/contract.html +++ b/public/contract.html @@ -1,5 +1,5 @@ - + The contract | InstantAdPay @@ -15,9 +15,10 @@ + - +
@@ -142,7 +143,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.
- + diff --git a/public/conversion-tracking.html b/public/conversion-tracking.html index 6ed8426..5d8df47 100644 --- a/public/conversion-tracking.html +++ b/public/conversion-tracking.html @@ -1,5 +1,5 @@ - + Conversion tracking: see which ad brings sign-ups and sales | InstantAdPay @@ -11,9 +11,10 @@ + - + @@ -262,7 +263,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/disclaimer.html b/public/disclaimer.html index 72cfad5..ffb1278 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -1,11 +1,12 @@ - + Disclaimer | InstantAdPay + - + @@ -26,7 +27,7 @@

You decide whether, and how much, to spend. Never spend more than you can afford to lose.

- + diff --git a/public/earning.html b/public/earning.html index b0ab224..fa57b58 100644 --- a/public/earning.html +++ b/public/earning.html @@ -1,14 +1,15 @@ - + How earning works: credits and POL payouts | InstantAdPay + - + @@ -96,6 +97,6 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/facts.html b/public/facts.html index 344a736..69ca8a2 100644 --- a/public/facts.html +++ b/public/facts.html @@ -1,13 +1,14 @@ - + Platform Facts | InstantAdPay + - + @@ -71,6 +72,6 @@ - + diff --git a/public/games.html b/public/games.html index f7d293c..0a80dd9 100644 --- a/public/games.html +++ b/public/games.html @@ -1,5 +1,5 @@ - + Games that pay POL | InstantAdPay @@ -12,19 +12,20 @@ + - + @@ -78,6 +79,6 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/index.html b/public/index.html index dd87049..15cc0f0 100644 --- a/public/index.html +++ b/public/index.html @@ -1,5 +1,5 @@ - + @@ -19,9 +19,10 @@ + - + @@ -505,7 +506,7 @@ - + diff --git a/public/join.html b/public/join.html index f4323d7..8d84438 100644 --- a/public/join.html +++ b/public/join.html @@ -1,163 +1,164 @@ - - - - - -You're invited | InstantAdPay - - - - - - -
-
- InstantAdPay - Already a member? Sign in -
- -
- -

InstantAdPay · Advertise and earn on Polygon

- -

Advertise and earn.
Paid on-chain, instantly.

-

Every ad package splits to real wallets in the same transaction it sells. No pending payouts, no withdraw button, and every payment is public.

-
- -
-
- -
-
-
instantadpay.com/ledger · worked example
-
-
🧾 member #7 bought package #2 ($20.00)paid
-
💸 level 1 payout → member #3 (50%)same block
-
💸 level 2 payout → member #2 (20%)same block
-
💸 level 3 payout → member #1 (10%)same block
-
🏛 platform fee settled (20%)same block
-
⭐ member #3 now has 2 qualifying buyerslevel 2 ✓
-
-
-
-

One purchase, one transaction, four payments. Open the real ledger →

- -
- -
-

Join free

-

Type your email and we send a 6-digit code. No password, no wallet needed today.

-

- - - - - - - - - -

Advertising, not investing. No income is guaranteed; results depend on your effort. Crypto carries risk of loss.

-
- -
- -
-
- Paid in POL, Polygon's own coin, to your wallet - Same transaction payouts - Public ledger on Polygon - Free to join by email -
-

The one crypto here is POL on the Polygon network: packages are paid in POL and every payout arrives as POL in your own wallet. Any Polygon wallet works (MetaMask, SafePal, Phantom, Coinbase Wallet). Never held crypto? Buy POL with a card inside the member area.

-
-
-

How it works

Three steps. The first one takes a minute and costs nothing.

-
-
STEP 1

Join free by email

A 6-digit code, no password. You get an invite link and welcome credits to try real ads.

-
STEP 2

Advertise or earn

Seven ad formats. View ads to earn credits, or buy a package from $5 when you want reach.

-
STEP 3

Get paid in the same transaction

Activate with the $20 starter package and switch on payouts, and anyone who buys through your link pays you 50 percent, on-chain, the moment it happens.

-
-
-
-

The packages

Priced in dollars, settled in POL at the live rate. One credit is one cent of ad delivery.

-
-

Every package pays 50 / 20 / 10 up the line the moment it sells, on a public ledger. Join free and look around first.

-
- -
- InstantAdPay · Contract · Terms · Privacy · Disclaimer -
-
- - - - + + + + + +You're invited | InstantAdPay + + + + + + + +
+
+ InstantAdPay + Already a member? Sign in +
+ +
+ +

InstantAdPay · Advertise and earn on Polygon

+ +

Advertise and earn.
Paid on-chain, instantly.

+

Every ad package splits to real wallets in the same transaction it sells. No pending payouts, no withdraw button, and every payment is public.

+
+ +
+
+ +
+
+
instantadpay.com/ledger · worked example
+
+
🧾 member #7 bought package #2 ($20.00)paid
+
💸 level 1 payout → member #3 (50%)same block
+
💸 level 2 payout → member #2 (20%)same block
+
💸 level 3 payout → member #1 (10%)same block
+
🏛 platform fee settled (20%)same block
+
⭐ member #3 now has 2 qualifying buyerslevel 2 ✓
+
+
+
+

One purchase, one transaction, four payments. Open the real ledger →

+ +
+ +
+

Join free

+

Type your email and we send a 6-digit code. No password, no wallet needed today.

+

+ + + + + + + + + +

Advertising, not investing. No income is guaranteed; results depend on your effort. Crypto carries risk of loss.

+
+ +
+ +
+
+ Paid in POL, Polygon's own coin, to your wallet + Same transaction payouts + Public ledger on Polygon + Free to join by email +
+

The one crypto here is POL on the Polygon network: packages are paid in POL and every payout arrives as POL in your own wallet. Any Polygon wallet works (MetaMask, SafePal, Phantom, Coinbase Wallet). Never held crypto? Buy POL with a card inside the member area.

+
+
+

How it works

Three steps. The first one takes a minute and costs nothing.

+
+
STEP 1

Join free by email

A 6-digit code, no password. You get an invite link and welcome credits to try real ads.

+
STEP 2

Advertise or earn

Seven ad formats. View ads to earn credits, or buy a package from $5 when you want reach.

+
STEP 3

Get paid in the same transaction

Activate with the $20 starter package and switch on payouts, and anyone who buys through your link pays you 50 percent, on-chain, the moment it happens.

+
+
+
+

The packages

Priced in dollars, settled in POL at the live rate. One credit is one cent of ad delivery.

+
+

Every package pays 50 / 20 / 10 up the line the moment it sells, on a public ledger. Join free and look around first.

+
+ +
+ InstantAdPay · Contract · Terms · Privacy · Disclaimer +
+
+ + + + diff --git a/public/launch.html b/public/launch.html index 3542241..035e6bf 100644 --- a/public/launch.html +++ b/public/launch.html @@ -1,41 +1,42 @@ - + Founding week checklist | InstantAdPay + - + @@ -130,7 +131,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford to lose.
- + diff --git a/public/plays.html b/public/plays.html index 46e5d7a..3baf771 100644 --- a/public/plays.html +++ b/public/plays.html @@ -1,16 +1,17 @@ - + Team-building plays | InstantAdPay + - + @@ -115,10 +116,10 @@

The flow

What happens when you buy a package

- Streak moves forward - Bonus boost - No refuel bonus - A question + Streak moves forward + Bonus boost + No refuel bonus + A question
  1. 1You buy a new ad package on either siteInstantAdPay or LinkSpin, paid from your own wallet.
  2. @@ -260,6 +261,6 @@
    Advertising services with a performance referral program. Not an investment product; no income guarantees.
    - + diff --git a/public/refuel.html b/public/refuel.html index ab1356d..6c9a5ec 100644 --- a/public/refuel.html +++ b/public/refuel.html @@ -1,11 +1,12 @@ - + Refuel · InstantAdPay verified visit - + + @@ -64,6 +65,6 @@ - + diff --git a/releases.js b/releases.js index a4ecb16..b2b69af 100644 --- a/releases.js +++ b/releases.js @@ -3,6 +3,7 @@ // Storage: DATA_DIR/releases.json { notes: [{id, date, title, body, tags[]}], roadmap: [{id, title, note, status, eta}] } const fs = require('fs'); const path = require('path'); +const themehead = require('./themehead'); // light/dark theme head script (2026-11-01) let FILE = null; const SITE = 'https://instantadpay.com'; const TAGS = ['new', 'improved', 'fixed']; @@ -54,10 +55,10 @@ const tagChip = t => '' + t + ''; function renderPage() { const v = publicView(); const desc = 'What changed on InstantAdPay and what is coming next: release notes and the roadmap, updated as things ship.'; - let h = 'What\'s new | InstantAdPay' + let h = 'What\'s new | InstantAdPay' + '' - + '' - + '
    ' + + '' + themehead.tag() + '' + + '
    ' + '

    Release notes and roadmap

    What\'s new, and what\'s next.

    ' + esc(desc) + '

    '; h += '

    On the roadmap

    '; h += v.roadmap.length ? '
    ' + v.roadmap.map(r => '
    ' + r.status + (r.eta ? ' · ' + esc(r.eta) : '') + '
    ' + esc(r.title) + '' + (r.note ? '' + esc(r.note) + '' : '') + '
    ').join('') + '
    ' : '

    Nothing queued right now.

    '; diff --git a/server.js b/server.js index d14d9ac..933b193 100644 --- a/server.js +++ b/server.js @@ -16,6 +16,7 @@ const { URL } = require('url'); const chain = require('./chain'); const auth = require('./auth'); const accounts = require('./accounts'); +const themehead = require('./themehead'); // 2026-11-01 light/dark theme head script for server-rendered pages + its CSP hash const ads = require('./ads'); const mailer = require('./mailer'); const { emailIssue } = require('./emailcheck'); // typo / no-mail-domain check for NEW addresses (2026-10-22) @@ -851,7 +852,7 @@ const MIME = { '.html': 'text/html; charset=utf-8', '.css': 'text/css', '.js': ' '.png': 'image/png', '.jpg': 'image/jpeg', '.svg': 'image/svg+xml', '.webp': 'image/webp', '.ico': 'image/x-icon', '.json': 'application/json', '.mp4': 'video/mp4', '.woff2': 'font/woff2', '.gif': 'image/gif', '.webm': 'video/webm', '.vtt': 'text/vtt; charset=utf-8', '.txt': 'text/plain; charset=utf-8', '.xml': 'application/xml; charset=utf-8' }; -const CSP = "default-src 'self'; script-src 'self' https://cdn.jsdelivr.net https://www.networkadspace.com https://networkadspace.com https://polhunter.com 'sha256-NzvNrqk5jB9YZATwo5BF4JoRlJ02HsnFikbKXgEPdaQ='; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https:; media-src 'self' https: blob:; connect-src 'self' https://polhunter.com https://*.walletconnect.com wss://*.walletconnect.com https://*.walletconnect.org wss://*.walletconnect.org https://*.reown.com wss://*.reown.com https://*.reown.org wss://*.reown.org https://*.web3modal.org https://*.drpc.org https://*.publicnode.com https://*.coinbase.com https://linkspin.app; font-src 'self' data: https://fonts.gstatic.com https://fonts.reown.com; form-action 'self'; frame-src https: http:"; +const CSP = "default-src 'self'; script-src 'self' https://cdn.jsdelivr.net https://www.networkadspace.com https://networkadspace.com https://polhunter.com 'sha256-NzvNrqk5jB9YZATwo5BF4JoRlJ02HsnFikbKXgEPdaQ=' " + themehead.CSP_HASH + "; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https:; media-src 'self' https: blob:; connect-src 'self' https://polhunter.com https://*.walletconnect.com wss://*.walletconnect.com https://*.walletconnect.org wss://*.walletconnect.org https://*.reown.com wss://*.reown.com https://*.reown.org wss://*.reown.org https://*.web3modal.org https://*.drpc.org https://*.publicnode.com https://*.coinbase.com https://linkspin.app; font-src 'self' data: https://fonts.gstatic.com https://fonts.reown.com; form-action 'self'; frame-src https: http:"; function baseHeaders(extra) { return Object.assign({ 'Content-Security-Policy': CSP, 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'strict-origin-when-cross-origin' }, extra || {}); @@ -2283,7 +2284,7 @@ const server = http.createServer(async (req, res) => { const r = await drip.unsubscribe(u.searchParams.get('e'), u.searchParams.get('t')); const msg = r.error ? r.error : 'Done. You will not get any more emails from InstantAdPay, apart from sign-in codes you ask for and receipts for payments to or from your account. Your account is unchanged.'; res.writeHead(r.error ? 400 : 200, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' })); - return res.end('InstantAdPay
    InstantAdPay

    ' + (r.error ? 'Hmm.' : 'Unsubscribed.') + '

    ' + msg + '

    Member area

    '); + return res.end('InstantAdPay' + themehead.tag() + '
    InstantAdPay

    ' + (r.error ? 'Hmm.' : 'Unsubscribed.') + '

    ' + msg + '

    Member area

    '); } // -- public API @@ -2844,7 +2845,7 @@ const server = http.createServer(async (req, res) => { if (memberId && acct && acct.memberId !== memberId) accounts.setMemberId(acct.email, memberId).catch(() => {}); const out = { signedIn: true, gkShop: !!parseCookies(req)['iap.gkshop'], sdShop: !!parseCookies(req)['iap.sdshop'], pwMint: !!parseCookies(req)['iap.pwmint'], returnTo: ['polhunter', 'driprunner', 'passivedrip', 'gemkingdom', 'gkshop', 'spookydoors', 'sdshop', 'pwmint', 'polybreak', 'polminer', 'warpwares', 'shardsofvalor'].includes(parseCookies(req)['iap.return']) ? parseCookies(req)['iap.return'] : null, sponsorBlocked, sponsorRouted, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null, address: s.address || (acct && acct.address) || null, memberId, - username: (acct && acct.username) || null, + username: (acct && acct.username) || null, theme: (acct && acct.theme) || null, refCode: (acct && acct.code) || null, sponsorId, tankHold, sponsorFallback, // profile + line-banner fields so the Profile pane repopulates on reload (were being saved but not returned) avatarUrl: (acct && acct.avatarUrl) || null, bio: (acct && acct.bio) || null, @@ -3572,6 +3573,12 @@ const server = http.createServer(async (req, res) => { if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); const b = await readBody(req); const before = await accounts.byEmail(s.email); + // appearance (2026-11-01): theme auto | light | dark rides the same save path; a theme-only save never touches the username + if (b.theme !== undefined) { + const t = ['auto', 'light', 'dark'].includes(String(b.theme)) ? String(b.theme) : null; + const rt = await accounts.setTheme(s.email, t); + if (b.username === undefined) return json(res, rt.error ? 400 : 200, rt); + } // a username is permanent once set: the invite link, the public wall and every // banner already printed carry it (Marty, 2026-09-10) if (before && before.username && String(b.username || '').trim().toLowerCase() !== String(before.username).toLowerCase()) @@ -5803,11 +5810,11 @@ const server = http.createServer(async (req, res) => { const url = 'https://instantadpay.com/b/' + un + '/' + key, img = 'https://instantadpay.com/badge-img/' + un + '/' + key + '.jpg'; const title = '@' + un + ' unlocked ' + label + ' on InstantAdPay'; const desc = label + ': ' + sub + '. InstantAdPay pays sponsors in the same transaction, on-chain. Join @' + un + '\u2019s line free.'; - const html = '' + esc(title) + '' + const html = '' + esc(title) + '' + '' + '' + '' - + '' + + '' + themehead.tag() + '' + '' + '
    ' + esc(label) + ' badge for @' + esc(un) + '

    @' + esc(un) + ' unlocked ' + label + '

    ' + esc(sub.charAt(0).toUpperCase() + sub.slice(1)) + '. On InstantAdPay every ad package that sells pays the sponsor in the same transaction, straight to their wallet, on-chain.

    ' + 'Join @' + esc(un) + '\u2019s line free

    Advertising with a performance referral program. Not an investment; no income is guaranteed.

    ' @@ -5873,7 +5880,7 @@ const server = http.createServer(async (req, res) => { let a = await accounts.byUsername(tok); if (!a) a = await accounts.byCode(tok); // a deleted or never-seen name is a real 404, never a bare "Banner wall" page at 200 (a soft 404 Google kept indexed, 2026-10-30) if (!a) { - const nf = 'No wall under that name | InstantAdPay

    No wall under that name

    This member page does not exist or was removed.

    Go to InstantAdPay

    '; + const nf = 'No wall under that name | InstantAdPay' + themehead.tag() + '

    No wall under that name

    This member page does not exist or was removed.

    Go to InstantAdPay

    '; res.writeHead(404, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-cache', 'X-Robots-Tag': 'noindex' })); return res.end(nf); } diff --git a/themehead.js b/themehead.js new file mode 100644 index 0000000..b59d119 --- /dev/null +++ b/themehead.js @@ -0,0 +1,34 @@ +// Theme head script (2026-11-01). Marty approved light and dark themes for LinkSpin and said InstantAdPay gets the same +// treatment: some readers are vision impaired, some struggle with bright screens, some with dark ones. This is the ONE +// source of the tiny inline script every page carries in its , before any stylesheet, so the first paint is already +// the chosen theme (no flash). LinkSpin's themehead.js is the reference; only the storage key, the global and the event +// name differ (iap.theme / window.IAPTheme / "iap-theme"). +// +// theme value: auto | light | dark, stored in localStorage "iap.theme"; signed-in members also keep it on the +// account (accounts.theme) and the account value wins at sign-in (common.js IAP.themeSync). +// data-theme on is always resolved to light or dark (auto follows prefers-color-scheme and tracks changes). +// data-theme-choice carries the raw choice for the switch UI. window.IAPTheme = { get, set, apply, base }. +// +// Nothing stored => the page keeps its current look: data-theme-base on says what that is. Every InstantAdPay page +// is a site.css page, so the base is dark everywhere. AUTO_DEFAULT below is the one constant Marty decides later: set it +// to 1 and pages with nothing stored follow the device instead. After changing it, run `node tools/stamp-theme-head.cjs` +// so every static page carries the new copy (server-rendered pages read this module directly). +const AUTO_DEFAULT = 0; + +const BODY = '(function(){var A=' + AUTO_DEFAULT + ',h=document.documentElement,b=h.getAttribute("data-theme-base")||"dark",' + + 'm=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;' + + 'function g(){try{v=localStorage.getItem("iap.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}' + + 'function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}' + + 'ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);' + + 'window.IAPTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("iap.theme",c);else localStorage.removeItem("iap.theme")}catch(e){}' + + 'ap();if(!quiet)try{dispatchEvent(new CustomEvent("iap-theme",{detail:g()}))}catch(e){}}}})()'; +const SCRIPT = ''; +// The site CSP allows inline scripts by hash only (server.js CSP): one source, one hash. Changing BODY changes the hash, +// and the static pages must be re-stamped so they carry the same bytes. +const CSP_HASH = "'sha256-" + require('crypto').createHash('sha256').update(BODY).digest('base64') + "'"; + +// base: 'light' | 'dark' (the page's look when nothing is stored). Returns the attribute for the tag and the script. +function htmlAttr(base) { return ' data-theme-base="' + (base === 'light' ? 'light' : 'dark') + '"'; } +function tag() { return SCRIPT; } +// whole-head helper for server-rendered pages: '' + themehead.tag() + ... +module.exports = { AUTO_DEFAULT, SCRIPT, CSP_HASH, htmlAttr, tag }; diff --git a/tools/stamp-theme-head.cjs b/tools/stamp-theme-head.cjs new file mode 100644 index 0000000..9ca43f7 --- /dev/null +++ b/tools/stamp-theme-head.cjs @@ -0,0 +1,24 @@ +// Stamp the theme head script (themehead.js) into every static page under public/ that loads site.css, before the first +// stylesheet, and put data-theme-base on the tag (dark: every InstantAdPay page is a site.css page). Re-runnable: an +// existing copy between the markers is replaced. Run after changing AUTO_DEFAULT in themehead.js: +// node tools/stamp-theme-head.cjs +// Pages without site.css (door.html, plan-lab.html, the Google verification file) are skipped: they carry their own look. +const fs = require('fs'), path = require('path'); +const themehead = require(path.join(__dirname, '..', 'themehead.js')); +const dir = path.join(__dirname, '..', 'public'); +const OPEN = '', CLOSE = ''; +let n = 0; +for (const f of fs.readdirSync(dir).filter(f => f.endsWith('.html'))) { + const p = path.join(dir, f); + let html = fs.readFileSync(p, 'utf8'); + if (!//, (m, a) => ''); + const block = OPEN + themehead.tag() + CLOSE; + if (html.includes(OPEN)) html = html.replace(new RegExp(OPEN + '[\\s\\S]*?' + CLOSE), block); + else html = html.replace(/