' + AUTHOR + 'Founder of LinkSpin and the Crypto Team Build Network. Twenty-plus years of internet marketing, and a habit of writing down what actually worked.
';
diff --git a/db.js b/db.js
index eef7355..7bd37e2 100644
--- a/db.js
+++ b/db.js
@@ -90,7 +90,8 @@ async function bootstrap() {
await alterSafe('ALTER TABLE accounts ADD COLUMN socials VARCHAR(1200) NULL'); // JSON {platform:url}
await alterSafe('ALTER TABLE accounts ADD COLUMN line_banner_url VARCHAR(500) NULL');
await alterSafe('ALTER TABLE accounts ADD COLUMN line_target_url VARCHAR(500) NULL');
- 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 profile_quarantined TINYINT NOT NULL DEFAULT 0');
+ await alterSafe('ALTER TABLE accounts ADD COLUMN theme VARCHAR(8) NULL'); // 2026-11-01 appearance: auto | light | dark // 2026-10-30 link-farm rule: first profile save of a new free account carried a link (spamscan.js)
await q(`CREATE TABLE IF NOT EXISTS daily_views (
email VARCHAR(190) NOT NULL,
day CHAR(10) NOT NULL,
diff --git a/leaderboard.js b/leaderboard.js
index 734a12a..ecc3378 100644
--- a/leaderboard.js
+++ b/leaderboard.js
@@ -4,6 +4,7 @@
// on Central time: week = Monday 00:00 to Sunday 23:59, month = calendar month. Winners are recorded at
// rollover (checked hourly), announced to Telegram, and credit prizes are granted automatically.
const { SITE_HOST, SITE_URL } = require('./host');
+const themehead = require('./themehead'); // light/dark theme head script (2026-11-01)
const fs = require('fs');
const path = require('path');
let R = null; // { chain, accounts, ads, dataDir, siteConfig, notify(text), pushFeed(ev) }
@@ -131,8 +132,8 @@ 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 LinkSpin this week and this month. Weekly and monthly referral contest standings, read from the chain.';
- let h = 'Leaderboard | LinkSpin'
- + ''
+ let h = 'Leaderboard | LinkSpin'
+ + '' + 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.
Advertising services with a performance referral program. Not an investment product; no income guarantees.
-
+
diff --git a/public/help.html b/public/help.html
index 15d07c2..25a5230 100644
--- a/public/help.html
+++ b/public/help.html
@@ -1,12 +1,13 @@
-
+
Help · LinkSpin
+
-
+
-
+
+
+
@@ -590,7 +591,7 @@
campaigns just like purchased ones.
……
-
+
Press the button to open the first ad in a new tab.
@@ -609,7 +610,7 @@
can't be skipped — the timer runs on our server. You never see your own videos.
Prefer a feed? Open Shorts for a full-screen, swipe-to-next experience.
…
-
+
Press the button to load the first video.
@@ -631,7 +632,7 @@
Visit a member's site in a new tab, stay the required few seconds,
pass a quick check, and earn. Each site counts once for you — real, unique human visits.
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.
');
}
// -- public API
@@ -2015,7 +2016,7 @@ const server = http.createServer(async (req, res) => {
if (memberId && acct && acct.memberId !== memberId) accounts.setMemberId(acct.email, memberId).catch(() => {});
const out = { signedIn: true, sponsorBlocked, 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,
// 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,
@@ -3003,6 +3004,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())
@@ -4185,15 +4192,15 @@ const server = http.createServer(async (req, res) => {
const url = SITE_URL + '/b/' + un + '/' + key, img = SITE_URL + '/badge-img/' + un + '/' + key + '.jpg';
const title = '@' + un + ' unlocked ' + label + ' on LinkSpin';
const desc = label + ': ' + sub + '. LinkSpin pays sponsors in the same transaction, on-chain. Join @' + un + '\u2019s line free.';
- const html = '' + esc(title) + ''
+ const html = '' + esc(title) + ''
+ ''
+ ''
+ ''
- + ''
+ + '' + themehead.tag() + ''
+ ''
+ '
@' + esc(un) + ' unlocked ' + label + '
' + esc(sub.charAt(0).toUpperCase() + sub.slice(1)) + '. On LinkSpin every ad package that sells pays the sponsor in the same transaction, straight to their wallet, on-chain.
Advertising with a performance referral program. Not an investment; no income is guaranteed.
'
- + '';
+ + '';
res.writeHead(200, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'public, max-age=300' }));
return res.end(html);
}
@@ -4235,7 +4242,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 | LinkSpin
';
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..0fc1046
--- /dev/null
+++ b/themehead.js
@@ -0,0 +1,33 @@
+// Theme head script (2026-11-01). A member asked for light and dark themes: 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).
+//
+// theme value: auto | light | dark, stored in localStorage "ls.theme"; signed-in members also keep it on the
+// account (accounts.theme) and the account value wins at sign-in (cr-shell.js).
+// 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.LSTheme = { get, set, apply, base }.
+//
+// Nothing stored => the page keeps its current look: data-theme-base on says what that is (light for the
+// Control Room and public pages, dark for the sapphire site.css pages). 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")||"light",'
+ + 'm=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;'
+ + 'function g(){try{v=localStorage.getItem("ls.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.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}'
+ + 'ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-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 === 'dark' ? 'dark' : 'light') + '"'; }
+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..0b5c6b7
--- /dev/null
+++ b/tools/stamp-theme-head.cjs
@@ -0,0 +1,23 @@
+// Stamp the theme head script (themehead.js) into every static page under public/, before the first stylesheet, and
+// put data-theme-base on the tag (dark for site.css pages, light for cr.css / pub.css pages). Re-runnable: an
+// existing copy between the markers is replaced. Run after changing AUTO_DEFAULT in themehead.js:
+// node tools/stamp-theme-head.cjs
+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(/