Site host from one module: host.js exports SITE_HOST/SITE_URL and every module, email, Telegram post, QR, ad click URL and OG tag reads it (no more hard-coded test hostname); public pages carry {{SITE_URL}} filled at serve time; frame check carries the curtain pass for our own hosts so a test ad can point at a spin link; stale IAP sitemap removed
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ const PUBLIC_DIR = path.join(ROOT, 'public');
|
||||
const DATA_DIR = process.env.DATA_DIR || path.join(ROOT, 'data');
|
||||
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD || 'changeme';
|
||||
const ADMIN_EMAIL = String(process.env.ADMIN_EMAIL || '').trim().toLowerCase();
|
||||
const SITE_HOST = String(process.env.SITE_HOST || 'linkspin-test.saasy.top').trim().toLowerCase();
|
||||
const { SITE_HOST, SITE_URL } = require('./host');
|
||||
// Admin portal sessions: email-code sign-in allowlisted to ADMIN_EMAIL, kept
|
||||
// in the volume so a restart doesn't log the admin out. Separate cookie and
|
||||
// store from member sessions; the Bearer ADMIN_PASSWORD API path still works.
|
||||
@@ -174,7 +174,7 @@ function parseWallOffers(a) {
|
||||
// Configurable by dropping data/admin-wall-ads.json ([{name,targetUrl,bannerUrl}]).
|
||||
function getAdminWallAds() {
|
||||
try { const j = JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'admin-wall-ads.json'), 'utf8')); if (Array.isArray(j) && j.length) return j; } catch (e) {}
|
||||
return [{ name: 'LinkSpin', targetUrl: 'https://linkspin-test.saasy.top/', bannerUrl: null }];
|
||||
return [{ name: 'LinkSpin', targetUrl: SITE_URL + '/', bannerUrl: null }];
|
||||
}
|
||||
const chatHits = new Map();
|
||||
function chatLimited(ip) {
|
||||
@@ -272,8 +272,12 @@ function frameFetch(url, depth) {
|
||||
if (de) return resolve({ error: 'that domain does not resolve' });
|
||||
if (PRIVATE_IP.test(addr)) return resolve({ error: 'that address is not reachable from here' });
|
||||
const mod = u.protocol === 'https:' ? https : http;
|
||||
const rq = mod.get(u.href, { timeout: 8000,
|
||||
headers: { 'User-Agent': 'Mozilla/5.0 (compatible; LinkSpin-FrameCheck/1.0)', Accept: 'text/html' } }, r => {
|
||||
// Our own hosts (the app and the link domains) answer the curtain's 503 to anonymous fetches while the
|
||||
// app is curtained, which made a test ad aimed at a spin link look dead (2026-10-07). Carry the pass.
|
||||
const own = [SITE_HOST].concat(String(siteConfig().linkDomains || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean));
|
||||
const hdrs = { 'User-Agent': 'Mozilla/5.0 (compatible; LinkSpin-FrameCheck/1.0)', Accept: 'text/html' };
|
||||
if (CURTAIN && own.includes(u.hostname.toLowerCase())) hdrs.Cookie = 'ls.pass=' + encodeURIComponent(CURTAIN);
|
||||
const rq = mod.get(u.href, { timeout: 8000, headers: hdrs }, r => {
|
||||
const loc = r.headers.location;
|
||||
r.resume(); // headers are all we need
|
||||
if ([301, 302, 303, 307, 308].includes(r.statusCode) && loc && depth < 4) {
|
||||
@@ -327,10 +331,10 @@ async function handleUpload(req, res, who) {
|
||||
const JOIN_ALIASES = { company: 'martbost', top: 'martbost' }; // neutral partner links -> the top position
|
||||
const JOIN_ANGLES = {
|
||||
// legacy bridge pages (/from/<brand>): former members of Marty's closed EvolutionScript sites
|
||||
'fw-adv': { t: 'Your next ad budget pays you back.', d: 'Faucet Wave closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/faucetwave?seg=advertiser' },
|
||||
'fw-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Faucet Wave. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/faucetwave' },
|
||||
't1-adv': { t: 'Your next ad budget pays you back.', d: 'Tier One Ads closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/tieroneads?seg=advertiser' },
|
||||
't1-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Tier One Ads. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: 'https://linkspin-test.saasy.top/from/tieroneads' },
|
||||
'fw-adv': { t: 'Your next ad budget pays you back.', d: 'Faucet Wave closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: SITE_URL + '/from/faucetwave?seg=advertiser' },
|
||||
'fw-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Faucet Wave. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: SITE_URL + '/from/faucetwave' },
|
||||
't1-adv': { t: 'Your next ad budget pays you back.', d: 'Tier One Ads closed. LinkSpin was built for the people who bought ads there: packages from $5, seven formats, every package in your line paid out on Polygon in the same transaction. Welcome-back credits waiting.', url: SITE_URL + '/from/tieroneads?seg=advertiser' },
|
||||
't1-earn': { t: 'Same daily habit. Real payouts on-chain.', d: 'You viewed ads on Tier One Ads. Here you view ads to earn credits, run your own campaign free, and get paid in POL to your own wallet when your line buys ads. Welcome-back credits waiting.', url: SITE_URL + '/from/tieroneads' },
|
||||
instant: { t: 'Paid before the page reloads.', d: 'A smart contract on Polygon splits every ad package the moment it sells. Same transaction, real wallets, public ledger. Join free by email.' },
|
||||
adspend: { t: 'You were buying ads anyway.', d: 'Here the ad spend in your line pays you, in the same transaction, on a public ledger. Seven formats, packages from $5. Join free.' },
|
||||
free: { t: 'Watch first. Spend never.', d: 'Join free, view a few ads, earn credits, run your first campaign for zero dollars. Every payout public on Polygon.' },
|
||||
@@ -340,7 +344,7 @@ const JOIN_ANGLES = {
|
||||
function serveJoinPage(res, tok, angle, ang, setCookies) {
|
||||
let html;
|
||||
try { html = fs.readFileSync(path.join(PUBLIC_DIR, 'join.html'), 'utf8'); } catch (e) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); }
|
||||
const base = 'https://linkspin-test.saasy.top';
|
||||
const base = SITE_URL;
|
||||
const url = (ang && ang.url) || (base + '/join/' + tok + (angle ? '?v=' + angle : ''));
|
||||
const title = ang ? ang.t : 'Advertise and earn. Paid on-chain, instantly.';
|
||||
const desc = ang ? ang.d : 'You are invited to LinkSpin: real ad packages with same-transaction payouts on Polygon, every payment public. Join free by email.';
|
||||
@@ -366,7 +370,7 @@ async function frameCheck(url) {
|
||||
const fa = /frame-ancestors\s+([^;]+)/i.exec(String(h.csp));
|
||||
if (fa && !fa[1].split(/\s+/).some(x => {
|
||||
const v = x.replace(/['"]/g, '').toLowerCase();
|
||||
return v === '*' || v === 'https:' || v.includes('linkspin-test.saasy.top');
|
||||
return v === '*' || v === 'https:' || v.includes(SITE_HOST);
|
||||
}))
|
||||
return { ok: false, reason: 'That site blocks framing (CSP frame-ancestors), so it would show members a blank page in the ad viewer. Use a landing page that allows framing.' };
|
||||
return { ok: true };
|
||||
@@ -375,13 +379,13 @@ async function boot() {
|
||||
await db.init({ dataDir: DATA_DIR }); // no-op without DATABASE_URL (JSON mode)
|
||||
chain.init({ onEvent: ev => { attachNames([ev]).then(a => pushFeed(a[0])).catch(() => pushFeed(ev)); emailOnEvent(ev).catch(() => {}); telegramOnEvent(ev).catch(() => {});
|
||||
if (ev && ev.type === 'Purchase' && ev.buyerId) accounts.byMemberId(Number(ev.buyerId)).then(a => { if (a) return postbacks.convertFor(a.email, 'purchase', { payout: (Number(ev.priceCents) || 0) / 100, currency: 'USD', txid: ev.tx || '' }); }).catch(() => {}); } });
|
||||
auth.init({ dataDir: DATA_DIR, chain, isProd: IS_PROD, site: 'linkspin-test.saasy.top' });
|
||||
auth.init({ dataDir: DATA_DIR, chain, isProd: IS_PROD, site: SITE_HOST });
|
||||
accounts.init({ dataDir: DATA_DIR });
|
||||
ads.init({ dataDir: DATA_DIR, chain });
|
||||
mailer.init({ dataDir: DATA_DIR });
|
||||
messages.init({ dataDir: DATA_DIR });
|
||||
reports.init({ dataDir: DATA_DIR });
|
||||
drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: 'https://linkspin-test.saasy.top' });
|
||||
drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: SITE_URL });
|
||||
chatbot.init({ dataDir: DATA_DIR, chain });
|
||||
setTimeout(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 1000);
|
||||
setInterval(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 60 * 1000);
|
||||
@@ -398,7 +402,7 @@ async function boot() {
|
||||
pages.init({ dataDir: DATA_DIR, ownHosts, openrouterKey: () => { if (process.env.OPENROUTER_API_KEY) return process.env.OPENROUTER_API_KEY.trim(); try { return fs.readFileSync(path.join(DATA_DIR, 'openrouter.key'), 'utf8').trim(); } catch (e) { return ''; } } });
|
||||
snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, send: async (c, t, th) => { await telegramSend(c, t, th); return true; } });
|
||||
setInterval(() => snapshot.tick().catch(e => console.error('snapshot', e.message)), 10 * 60 * 1000);
|
||||
tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: 'https://linkspin-test.saasy.top' });
|
||||
tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: SITE_URL });
|
||||
legacy.init({ dataDir: DATA_DIR });
|
||||
traffic.init({ dataDir: DATA_DIR });
|
||||
promos.init({ dataDir: DATA_DIR });
|
||||
@@ -449,7 +453,7 @@ function siteConfig() {
|
||||
tagline: 'Advertise and earn. Locked in code, not promises.',
|
||||
rehearsal: true, // shows the testnet banner; flipped off at mainnet launch
|
||||
// payment-proof Telegram feed (blank = off) and the P&L pane's fixed monthly cost
|
||||
telegramBotToken: '', telegramChatId: '', telegramTopicId: '', telegramEvents: 'payouts', telegramCtaUrl: 'https://linkspin-test.saasy.top/',
|
||||
telegramBotToken: '', telegramChatId: '', telegramTopicId: '', telegramEvents: 'payouts', telegramCtaUrl: SITE_URL + '/',
|
||||
telegramEchoChatId: '', telegramEchoTopicId: '', telegramEchoEvents: 'payouts', // shared cross-program payments topic
|
||||
telegramAdminChatId: '', // private chat for admin alerts (sign-up guard bursts); falls back to ADMIN_EMAIL
|
||||
launchAt: '', // public launch moment, ISO 8601 with offset (e.g. 2026-09-18T19:00:00-05:00): countdown on /launch + dashboard mark
|
||||
@@ -489,6 +493,9 @@ function sendFile(res, file) {
|
||||
fs.readFile(file, (err, data) => {
|
||||
if (err) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); }
|
||||
const ext = path.extname(file).toLowerCase();
|
||||
// Public pages carry {{SITE_URL}} / {{SITE_HOST}} in canonical, OG and sitemap lines so the same files
|
||||
// serve every deployment (test host today, linkspin.app at launch); filled here, per request.
|
||||
if (ext === '.html' || ext === '.txt' || ext === '.xml') data = Buffer.from(data.toString('utf8').split('{{SITE_URL}}').join(SITE_URL).split('{{SITE_HOST}}').join(SITE_HOST));
|
||||
res.writeHead(200, baseHeaders({ 'Content-Type': MIME[ext] || 'application/octet-stream',
|
||||
// HTML is never stored (so a fresh load always gets the current asset
|
||||
// versions — aggressive in-app wallet browsers were serving stale pages
|
||||
@@ -600,7 +607,7 @@ async function notifyNewReferral(ref, newAcct) {
|
||||
+ 'They count toward your qualification once they make a $20+ purchase.\n\n';
|
||||
if (!owner.address) body += 'Make sure payouts are switched on (one free wallet step) so you never miss a commission — '
|
||||
+ 'the contract locks each buyer to their sponsor at their first purchase.\n\n';
|
||||
body += 'See your team: https://linkspin-test.saasy.top/my\n\nLinkSpin';
|
||||
body += 'See your team: ' + SITE_URL + '/my\n\nLinkSpin';
|
||||
mailer.send(owner.email, 'You have a new referral on LinkSpin', body)
|
||||
.catch(e => console.error('referral notify failed', e.message));
|
||||
} catch (e) {}
|
||||
@@ -632,7 +639,7 @@ async function sendWelcome(email, ref) {
|
||||
+ '1. Pick your username and fill out your profile.\n'
|
||||
+ '2. Grab your invite link and start sharing to build your line.\n'
|
||||
+ '3. Explore the ad packages when you are ready. Every payout settles on-chain, straight to your wallet.\n\n'
|
||||
+ 'Sign in anytime: https://linkspin-test.saasy.top/my\n\nLinkSpin').catch(() => {});
|
||||
+ 'Sign in anytime: ' + SITE_URL + '/my\n\nLinkSpin').catch(() => {});
|
||||
} catch (e) {}
|
||||
}
|
||||
// on-chain event emails: a payout received, or a payout that passed you by
|
||||
@@ -642,7 +649,7 @@ async function emailOnEvent(ev) {
|
||||
const notify = async (memberId, subject, body) => {
|
||||
if (!memberId || !mailer.hasKey()) return;
|
||||
const a = await accounts.byMemberId(memberId);
|
||||
if (a && a.email) mailer.send(a.email, subject, body + '\n\nSee it on the live ledger: https://linkspin-test.saasy.top/ledger\n\nLinkSpin').catch(() => {});
|
||||
if (a && a.email) mailer.send(a.email, subject, body + '\n\nSee it on the live ledger: ' + SITE_URL + '/ledger\n\nLinkSpin').catch(() => {});
|
||||
};
|
||||
// Marty (2026-09-15): payment and missed-payment notices also land in the on-site inbox, so
|
||||
// they are waiting (login modal + Messages card) whether or not the email was read. Sent as
|
||||
@@ -654,7 +661,7 @@ async function emailOnEvent(ev) {
|
||||
if (!a || !a.email) return;
|
||||
const html = '<p>' + String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/(https:\/\/[^\s]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>').split('\n\n').join('</p><p>').replace(/\n/g, '<br>') + '</p>';
|
||||
await messages.deliver(1, ADMIN_EMAIL || 'house@linkspin-test.saasy.top', [a.email], subject, html);
|
||||
await messages.deliver(1, ADMIN_EMAIL || 'house@' + SITE_HOST, [a.email], subject, html);
|
||||
} catch (e) {}
|
||||
};
|
||||
const tell = async (memberId, subject, text) => { await notify(memberId, subject, text); await inboxNote(memberId, subject, text); };
|
||||
@@ -689,7 +696,7 @@ async function emailOnEvent(ev) {
|
||||
: ' (Purchases under $20 do not count toward qualification.)';
|
||||
mailer.send(sp.email, bn + ' just bought a ' + usd + ' ad package',
|
||||
'Your referral ' + bn + ' (member #' + ev.buyerId + ') just purchased a package (' + usd + ' — ' + ev.creditAmount + ' credits).' + qual + '\n\n' +
|
||||
'See your team and the live ledger: https://linkspin-test.saasy.top/my\n\nLinkSpin').catch(() => {});
|
||||
'See your team and the live ledger: ' + SITE_URL + '/my\n\nLinkSpin').catch(() => {});
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
@@ -700,9 +707,9 @@ async function emailOnEvent(ev) {
|
||||
const pol = weiToPol(ev.amountWei);
|
||||
await tell(ev.recipientId, 'You just got paid ' + pol + ' POL on LinkSpin',
|
||||
buyer + ' just bought an ad package on your level ' + ev.tier + (pur ? ' ($' + (pur.priceCents / 100).toFixed(2).replace(/\.00$/, '') + ')' : '') + '. Your ' + pct + ' percent share, ' + pol + ' POL' + usdShare(pur, pct) + ', landed in your wallet in the same transaction' + (ev.hops ? ', passed up to you because someone between you was not qualified for this level' : '') + '.\n\n' +
|
||||
'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://linkspin-test.saasy.top/my');
|
||||
'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: ' + SITE_URL + '/my');
|
||||
}
|
||||
else if (ev.type === 'AwardPaid') await tell(ev.toId, 'You just got paid ' + weiToPol(ev.amountWei) + ' POL on LinkSpin', weiToPol(ev.amountWei) + ' POL just landed in your wallet.\n\nTransaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://linkspin-test.saasy.top/my');
|
||||
else if (ev.type === 'AwardPaid') await tell(ev.toId, 'You just got paid ' + weiToPol(ev.amountWei) + ' POL on LinkSpin', weiToPol(ev.amountWei) + ' POL just landed in your wallet.\n\nTransaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: ' + SITE_URL + '/my');
|
||||
else if (ev.type === 'PassedUp' && ev.reason === 'send-failed') {
|
||||
// the member WAS qualified but their wallet rejected the POL (usually a smart-contract
|
||||
// wallet that needs more than the capped gas): tell them and the admin, loudly
|
||||
@@ -722,7 +729,7 @@ async function emailOnEvent(ev) {
|
||||
buyer + ' just bought an ad package on your level ' + ev.tier + '. Your share was ' + what + ', and it passed you by because level ' + ev.tier + ' is not open on your account yet. The contract paid it to the next qualified person above you.\n\n' +
|
||||
'Level ' + ev.tier + ' opens at ' + need + ' qualifying buyers (people you referred who bought a $20 or larger package). You have ' + bc + (short ? ', so you are ' + short + ' buyer' + (short === 1 ? '' : 's') + ' away.' : '.') + '\n\n' +
|
||||
'Two ways to close the gap: bring ' + (short || 1) + ' more buyer' + (short === 1 ? '' : 's') + ' from your My line page, or use Qualified Start under Buy packages to be your own buyer today. Every package on level ' + ev.tier + ' pays you ' + pct + ' percent once it is open, and the next one is coming whether you are ready or not.\n\n' +
|
||||
'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://linkspin-test.saasy.top/my');
|
||||
'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: ' + SITE_URL + '/my');
|
||||
}
|
||||
}
|
||||
// payment-proof Telegram feed (same pattern as the RM Circle proof channel): one compact
|
||||
@@ -767,7 +774,7 @@ async function tankNotifyTick() {
|
||||
const named = fresh.filter(w => w.username).map(w => '@' + w.username);
|
||||
const who = named.length ? ': ' + named.slice(0, 8).join(', ') + (named.length > 8 ? ' and ' + (named.length - 8) + ' more' : '') : '';
|
||||
const text = '\u{1FAA3} <b>LinkSpin</b> \u00b7 ' + fresh.length + ' new member' + (fresh.length === 1 ? '' : 's') + ' waiting for a sponsor in the holding tank' + who
|
||||
+ '\nAdopt from My line \u203a Holding tank: <a href="https://linkspin-test.saasy.top/my#line">linkspin-test.saasy.top/my</a>';
|
||||
+ '\nAdopt from My line \u203a Holding tank: <a href="' + SITE_URL + '/my#line">' + SITE_HOST + '/my</a>';
|
||||
await telegramSend(sc.telegramEchoChatId, text, sc.telegramEchoTopicId);
|
||||
}
|
||||
// one sendMessage call; never throws, never logs the token
|
||||
@@ -953,7 +960,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (m && (req.method === 'GET' || req.method === 'HEAD')) {
|
||||
// lead-capture page: email first, wallet later. ?v=<angle> picks the hook
|
||||
// copy and is remembered so the account records which angle converted.
|
||||
// partner placement: linkspin-test.saasy.top/join/company (or /top) places the visitor directly under
|
||||
// partner placement: <host>/join/company (or /top) places the visitor directly under
|
||||
// member #1, the company position, with no sponsor in between (Marty, 2026-09-12 partner kit)
|
||||
const tok = JOIN_ALIASES[m[1].toLowerCase()] || m[1].toLowerCase();
|
||||
const cookies = parseCookies(req);
|
||||
@@ -1699,7 +1706,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (u.searchParams.get('manual') === '1' && s.email !== ADMIN_EMAIL) return json(res, 403, { error: 'Badges post automatically when they unlock.' });
|
||||
const a = await accounts.byEmail(s.email);
|
||||
const who = a && a.username ? '@' + a.username : (a && a.memberId ? 'member #' + a.memberId : 'a member');
|
||||
const link = a && a.username ? 'linkspin-test.saasy.top/join/' + a.username : 'linkspin-test.saasy.top';
|
||||
const link = a && a.username ? SITE_HOST + '/join/' + a.username : SITE_HOST;
|
||||
const [label, sub] = BADGE_META[key];
|
||||
const caption = '\u{1F3C6} <b>LinkSpin</b> \u00b7 <b>' + who.replace(/[<>&]/g, '') + '</b> unlocked <b>' + label + '</b>: ' + sub + '\n' + link;
|
||||
const sc = siteConfig(); let sent = 0;
|
||||
@@ -1724,7 +1731,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const a = await accounts.byEmail(s.email);
|
||||
if (!a || !a.username) return json(res, 400, { error: 'Pick a username first; the share page carries it.' });
|
||||
fs.writeFileSync(path.join(UPLOADS_DIR, 'badge-' + a.username + '-' + key + '.jpg'), jpeg);
|
||||
return json(res, 200, { ok: true, page: 'https://linkspin-test.saasy.top/b/' + a.username + '/' + key, image: 'https://linkspin-test.saasy.top/badge-img/' + a.username + '/' + key + '.jpg' });
|
||||
return json(res, 200, { ok: true, page: SITE_URL + '/b/' + a.username + '/' + key, image: SITE_URL + '/badge-img/' + a.username + '/' + key + '.jpg' });
|
||||
}
|
||||
if (p === '/api/my/badge-posted' && req.method === 'GET') { // which of my badges are already on Telegram
|
||||
const s = await auth.fromRequest(req);
|
||||
@@ -2186,7 +2193,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const from = who && who.username ? '@' + who.username : 'your sponsor';
|
||||
for (const to of recipients) {
|
||||
mailer.send(to, 'Message from ' + from + ': ' + subject,
|
||||
plain + '\n\n— sent via your LinkSpin upline. Read it in your dashboard: https://linkspin-test.saasy.top/my#line')
|
||||
plain + '\n\n— sent via your LinkSpin upline. Read it in your dashboard: ' + SITE_URL + '/my#line')
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
@@ -2229,7 +2236,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const scT = siteConfig(); items = items.filter(it => !it.feature || (it.feature === 'pipeline' && pipeline.visible(scT.pipelineMode, s.email, ADMIN_EMAIL)));
|
||||
if (!items.length) items = [{ title: 'Getting started with LinkSpin',
|
||||
desc: 'How the platform works, how every payout splits on-chain to real wallets, and how to build your line.',
|
||||
docUrl: 'https://linkspin-test.saasy.top/' }];
|
||||
docUrl: SITE_URL + '/' }];
|
||||
return json(res, 200, { items });
|
||||
}
|
||||
// daily login bonus (once/day, gentle streak) — granted after the login flow
|
||||
@@ -2300,7 +2307,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const who = await accounts.byEmail(me);
|
||||
const from = who && who.username ? '@' + who.username : 'someone in your LinkSpin line';
|
||||
mailer.send(to, 'New message from ' + from,
|
||||
text.slice(0, 400) + '\n\n— reply in your dashboard: https://linkspin-test.saasy.top/my').catch(() => {});
|
||||
text.slice(0, 400) + '\n\n— reply in your dashboard: ' + SITE_URL + '/my').catch(() => {});
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
@@ -2481,7 +2488,7 @@ const server = http.createServer(async (req, res) => {
|
||||
.map(x => ({ name: x.username ? '@' + x.username : x.memberId ? 'member #' + x.memberId : 'a member',
|
||||
bannerUrl: x.lineBannerUrl || null, targetUrl: x.lineTargetUrl, upline: true }));
|
||||
const adAds = getAdminWallAds(); let ai = 0;
|
||||
const houseAd = () => { if (!adAds.length) return null; const ad = adAds[ai++ % adAds.length]; return { name: ad.name || 'LinkSpin', bannerUrl: ad.bannerUrl || null, targetUrl: ad.targetUrl || 'https://linkspin-test.saasy.top/', admin: true }; };
|
||||
const houseAd = () => { if (!adAds.length) return null; const ad = adAds[ai++ % adAds.length]; return { name: ad.name || 'LinkSpin', bannerUrl: ad.bannerUrl || null, targetUrl: ad.targetUrl || SITE_URL + '/', admin: true }; };
|
||||
const ladder = [{ name: ownName, bannerUrl: a.lineBannerUrl || null, targetUrl: a.lineTargetUrl || null, own: true }];
|
||||
for (let i = 1; i < 3; i++) {
|
||||
const o = offers[i - 1];
|
||||
@@ -2500,7 +2507,7 @@ const server = http.createServer(async (req, res) => {
|
||||
let socials = null; try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {}
|
||||
return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0),
|
||||
avatarUrl: a.avatarUrl || null, bio: a.bio || null, socials, badge,
|
||||
joinUrl: joinPath, qrUrl: '/api/qr?d=' + encodeURIComponent('https://linkspin-test.saasy.top' + joinPath), ladder: finalLadder, unlocked, buyerCount: bc });
|
||||
joinUrl: joinPath, qrUrl: '/api/qr?d=' + encodeURIComponent(SITE_URL + joinPath), ladder: finalLadder, unlocked, buyerCount: bc });
|
||||
}
|
||||
// -- watch-to-earn video ads: serve one, then reward a server-clock-verified watch
|
||||
if (p === '/api/my/videos' && req.method === 'GET') {
|
||||
@@ -2992,7 +2999,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!a || !fs.existsSync(file) || !(await ads.milestonesOf(a.email)).includes(key)) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); }
|
||||
const [label, sub] = BADGE_META[key];
|
||||
const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
const url = 'https://linkspin-test.saasy.top/b/' + un + '/' + key, img = 'https://linkspin-test.saasy.top/badge-img/' + un + '/' + key + '.jpg';
|
||||
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 = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>' + esc(title) + '</title>'
|
||||
@@ -3049,8 +3056,8 @@ const server = http.createServer(async (req, res) => {
|
||||
const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
const title = nm + ' on LinkSpin';
|
||||
const desc = a.bio ? esc(a.bio).slice(0, 200) : 'Join ' + nm + '’s line on LinkSpin — instant on-chain ad payouts, free to join.';
|
||||
const img = a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : 'https://linkspin-test.saasy.top/banners/iap-hero-1200x630.png';
|
||||
const url = 'https://linkspin-test.saasy.top/wall/' + (a.username || a.code);
|
||||
const img = a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : SITE_URL + '/banners/iap-hero-1200x630.png';
|
||||
const url = SITE_URL + '/wall/' + (a.username || a.code);
|
||||
const og = [
|
||||
'<meta property="og:type" content="profile">',
|
||||
'<meta property="og:site_name" content="LinkSpin">',
|
||||
|
||||
Reference in New Issue
Block a user