Link-farm hardening (2026-10-30 incident: 106 free accounts synced from InstantAdPay carried casino bios and website links; Google indexed the text through /wall pages)
Public walls: profile fields (bio, avatar, socials, intro video) render only for a paying member (memberId > 0 or a registered position), on /api/wall and in the OG image; a free account's wall shows the name, the line's ads and the join call. The meta/og description is a fixed site sentence with the handle, never the bio. Outbound profile links are rel="sponsored ugc noopener" target="_blank". A deleted or unknown name is a real 404 with X-Robots-Tag noindex (was a bare "Banner wall" page at 200, a soft 404 that stayed indexed).
Policy (prohibited.js, byte-for-byte copy of InstantAdPay's): bios may not carry a URL or a domain token ("Links go in the social fields, not the bio"); gambling, adult, pharma, weapons and link-selling terms (Unicode aware) are refused in bios, social URLs, line banner targets, wall offers and every campaign field, with the refusal logged. The registry ingest from InstantAdPay drops a bio with a link or a prohibited term instead of storing it; iapsync applies the same on the way out.
Quarantine rule: a brand-new free account (no wallet, no sponsor, under 24 h) whose first profile save plants a link is saved with profileQuarantined (JSON + MySQL column), never rendered publicly, and told "Your profile links will appear after your first ad package"; the admin member card shows the flag.
Daily link-farm scan (spamscan.js, same copy as InstantAdPay): in-app job at 06:30 Central, claimOnce per day, lists memberId-0 walletless accounts with a link plus a farm signal (prohibited term, sign-in over within 15 min, no sponsor), skips the spamScanAllow setting (seeded), writes DATA_DIR/wall-spam-scan.json and sends one "LinkSpin link-farm scan" Telegram to the private admin chat only when there are candidates. Admin > Members > Link-farm list: rows with "also on InstantAdPay" (local registry mirror), Delete selected (existing DELETE /api/admin/member, on-chain refused, no cascade) and Allow.
Terms section 9 "Prohibited content", bio hint in the profile editor, chatbot canned answer + kb-seed entry "What content is not allowed?", KNOWLEDGE_DATE 2026-10-30. Test: qa/profile-policy.test.cjs (unit + local copy, hash check against the InstantAdPay copies; runs in qa/run.sh member and policy).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,8 @@ const convtrack = require('./convtrack'); // conversion pixel: goals, ad click i
|
||||
const marks = require('./marks'); // one-time claims shared by both app copies during a deploy (event_marks or exclusive files), 2026-10-24
|
||||
const refill = require('./refill');
|
||||
const refuel = require('./refuel');
|
||||
const prohibited = require('./prohibited'); // prohibited-content policy shared with InstantAdPay (2026-10-30 link-farm incident)
|
||||
const spamscan = require('./spamscan'); // daily link-farm scan + quarantine rule, byte-for-byte copy of InstantAdPay's
|
||||
const kit = require('./kit');
|
||||
const engine = require('./engine'); // the Engine Room (same file as InstantAdPay), 2026-10-24
|
||||
const kitspin = require('./kitspin'); // Refuel Kit -> Banner Spin loader // the Refuel Kit: monthly members-only LinkSpin banner sets, personalized per member (2026-10-24) // Monthly Refuel streak, LinkSpin side: reports $25+ packages to InstantAdPay (the source of truth), applies its grants (2026-10-24) // refill notices: low / out / idle, one message per owner, conversions tracked (2026-10-24)
|
||||
@@ -174,6 +176,14 @@ const faucetHits = new Map(); // address -> last faucet ts (rehearsal test-POL f
|
||||
const visitTokens = persistedMap('visit'); // email -> verified-visit token (dwell + captcha floor)
|
||||
// walk the referral chain upward via sponsorRef (code/username/member id)
|
||||
const polUsdC = { at: 0, v: 0 }; // /api/public/polusd cache (2026-10-22)
|
||||
// A PAYING member (memberId > 0, or a registered linked position) gets their profile on public pages; a free account gets
|
||||
// nothing from the profile there (2026-10-30 link-farm incident: 106 free accounts used bios and socials as backlinks).
|
||||
async function hasBought(a) {
|
||||
if (!a) return false; if (Number(a.memberId) > 0) return true;
|
||||
try { return (await accounts.positions(a.email)).some(p => Number(p.memberId) > 0); } catch (e) { return false; }
|
||||
}
|
||||
// the wall's meta description is always this sentence, never profile text, so the indexed snippet is ours
|
||||
const wallDescription = nm => nm + '\u2019s ad wall on LinkSpin: the network\u2019s member ads, paid out on Polygon the moment a package clears.';
|
||||
async function uplineSlides(email, depth = 3) {
|
||||
const out = [];
|
||||
let cur = await accounts.byEmail(email);
|
||||
@@ -647,6 +657,13 @@ async function boot() {
|
||||
linkFor: async email => { const a = await accounts.byEmail(email); if (!a) return null; const tok = a.username || a.code; return tok ? { username: a.username || null, link: SITE_URL + '/join/' + tok } : null; } });
|
||||
setTimeout(() => refuel.tick().catch(e => console.error('refuel', e.message)), 75000);
|
||||
setInterval(() => refuel.tick().catch(e => console.error('refuel', e.message)), 60 * 1000);
|
||||
// link-farm scan (2026-10-30): 06:30 Central, once a day across app copies (marks), Telegram to the private admin chat only when there is something to review
|
||||
spamscan.init({ dataDir: DATA_DIR, site: 'LinkSpin', siteUrl: SITE_URL, otherSite: 'InstantAdPay', accounts, siteConfig, marks,
|
||||
saveSite: patch => { const cur = siteConfig(); fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(cur, patch), null, 2)); },
|
||||
notify: async text => { const sc = siteConfig(); const chat = String(sc.telegramAdminChatId || '1289244227').trim(); if (sc.telegramBotToken) return telegramSend(chat, text); if (ADMIN_EMAIL && mailer.hasKey()) return mailer.send(ADMIN_EMAIL, 'LinkSpin link-farm scan', text); },
|
||||
alsoOn: async (email, a) => (a && a.joinedVia === 'instantadpay') ? true : !!(await registry.get(email)) }); // the local registry mirror of InstantAdPay's rows, never a cascade
|
||||
setTimeout(() => spamscan.tick().catch(e => console.error('spamscan', e.message)), 150000);
|
||||
setInterval(() => spamscan.tick().catch(e => console.error('spamscan', e.message)), 5 * 60 * 1000);
|
||||
refill.init({ dataDir: DATA_DIR, siteConfig, ads, accounts, chain, mailer, drip, marks, siteUrl: SITE_URL, houseOwner: ads.HOUSE_OWNER, streakLine: email => refuel.streakLine(email),
|
||||
creditsFor: async email => { const v = await adminMember.view(email); return (v && v.credits && v.credits.available) || 0; },
|
||||
message: async (to, subject, html) => { await messages.deliver(1, ADMIN_EMAIL || 'house@' + SITE_HOST, [to], subject, html, 'notice'); } });
|
||||
@@ -783,6 +800,7 @@ function siteConfig() {
|
||||
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
|
||||
spamScanAllow: spamscan.DEFAULT_ALLOW.join(', '), // link-farm scan (2026-10-30): emails never listed as candidates; Admin > Members > Link-farm list > Allow adds here
|
||||
launchAt: '', // public launch moment, ISO 8601 with offset (e.g. 2026-09-18T19:00:00-05:00): countdown on /launch + dashboard mark
|
||||
aiCreditsPerGen: 10, aiFreeSurge: 20, aiFreeCircuit: 60, aiFreeNexus: 150, // AI Copy Engine: free generations per month by badge, then credits per generation
|
||||
carryClaimDays: '3',
|
||||
@@ -1644,7 +1662,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const t = nameTok.toLowerCase();
|
||||
let a = await accounts.byCode(t); if (!a) a = await accounts.byUsername(t);
|
||||
if (!a && /^\d+$/.test(nameTok)) a = await accounts.byMemberId(Number(nameTok));
|
||||
if (a) { name = a.username ? '@' + a.username : (a.memberId ? 'member #' + a.memberId : null); avatarUrl = a.avatarUrl || null; own = !!(acct && a.email === acct.email); var bio = null, cobrand = false; try { cobrand = (await ads.milestonesOf(a.email)).includes('level3'); if (cobrand) bio = a.bio ? String(a.bio).slice(0, 220) : null; } catch (e) {} }
|
||||
if (a) { name = a.username ? '@' + a.username : (a.memberId ? 'member #' + a.memberId : null); avatarUrl = a.avatarUrl || null; own = !!(acct && a.email === acct.email); var bio = null, cobrand = false; try { cobrand = (await ads.milestonesOf(a.email)).includes('level3'); if (cobrand && !a.profileQuarantined && await hasBought(a)) bio = a.bio ? String(a.bio).slice(0, 220) : null; } catch (e) {} }
|
||||
}
|
||||
return json(res, 200, { ref: tok, sponsorId, sponsorBlocked, sponsorRouted, tankHold: intentBuy ? null : tankHold, sponsorName: spd.name || null, invited: !!(tok || showTok), name, avatarUrl, own, bio: typeof bio === 'undefined' ? null : bio, cobrand: typeof cobrand === 'undefined' ? false : cobrand });
|
||||
}
|
||||
@@ -2193,6 +2211,15 @@ const server = http.createServer(async (req, res) => {
|
||||
}
|
||||
return json(res, 200, await adminMember.view(e));
|
||||
}
|
||||
// -- link-farm scan (2026-10-30): last result + allowlist, run now (no Telegram), allow / unallow an email
|
||||
if (p === '/api/admin/spamscan' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, spamscan.view()); }
|
||||
if (p === '/api/admin/spamscan/run' && req.method === 'POST') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); await spamscan.run({ manual: true, quiet: true }); return json(res, 200, spamscan.view()); }
|
||||
if (p === '/api/admin/spamscan/allow' && req.method === 'POST') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const b = await readBody(req); const e = String(b.email || '').trim().toLowerCase(); if (!e) return json(res, 400, { error: 'Which email?' });
|
||||
spamscan.setAllow(e, !b.remove); console.log('spamscan allowlist', b.remove ? 'removed' : 'added', e);
|
||||
return json(res, 200, spamscan.view());
|
||||
}
|
||||
if (p === '/api/admin/member' && req.method === 'DELETE') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const e = String(u.searchParams.get('email') || '').trim().toLowerCase(); const acct = e && await accounts.byEmail(e);
|
||||
@@ -2841,8 +2868,10 @@ const server = http.createServer(async (req, res) => {
|
||||
if (r.wallet && !a.address) wallets.push([e, r.wallet]);
|
||||
if (r.profile && typeof r.profile === 'object') { // the InstantAdPay profile fills only what is still empty here; the member can change it on this side any time (Marty 2026-10-11)
|
||||
const pf = r.profile, ok = v => /^https:[/][/][^ ]+$/i.test(v) && v.length <= 300;
|
||||
const av = String(pf.avatarUrl || '').trim(); const bio = String(pf.bio || '').trim().slice(0, 600); let soc = null;
|
||||
if (pf.socials && typeof pf.socials === 'object') { const c = {}; for (const k of ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video']) { const v = String(pf.socials[k] || '').trim(); if (ok(v)) c[k] = v; } if (Object.keys(c).length) soc = JSON.stringify(c); }
|
||||
// prohibited-content policy on ingest (2026-10-30): a bio with a link or a prohibited term, or a social carrying one, is dropped, not stored
|
||||
const cp = prohibited.cleanProfile(pf, 'LinkSpin'); if (cp.dropped.length) console.log('registry profile dropped', String(e).replace(/^(.).*(@.*)$/, '$1***$2'), cp.dropped.join(','));
|
||||
const av = String(pf.avatarUrl || '').trim(); const bio = cp.bio || ''; let soc = null;
|
||||
if (cp.socials) { const c = {}; for (const k of ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video']) { const v = String(cp.socials[k] || '').trim(); if (ok(v)) c[k] = v; } if (Object.keys(c).length) soc = JSON.stringify(c); }
|
||||
const upd = [!a.avatarUrl && ok(av) ? av : undefined, !a.bio && bio ? bio : undefined, !a.socials && soc ? soc : undefined];
|
||||
if (upd.some(x => x !== undefined)) { try { await accounts.setProfile(e, upd[0], upd[1], upd[2]); updated++; } catch (err) {} }
|
||||
}
|
||||
@@ -3358,7 +3387,7 @@ const server = http.createServer(async (req, res) => {
|
||||
return json(res, 400, { error: 'Avatar must be an uploaded image or an https image URL.' });
|
||||
const bio = b.bio === undefined ? undefined : String(b.bio || '').trim().slice(0, 600);
|
||||
// socials: {platform: url}; keep only known platforms with valid https urls
|
||||
let socials;
|
||||
let socials, cleanSoc = null;
|
||||
if (b.socials !== undefined) {
|
||||
const PLAT = ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video'];
|
||||
const clean = {};
|
||||
@@ -3370,8 +3399,17 @@ const server = http.createServer(async (req, res) => {
|
||||
if (clean.video && !/^https:\/\/((www\.|m\.)?youtube\.com\/(watch\?|shorts\/|embed\/)|youtu\.be\/|(www\.)?vimeo\.com\/\d+|player\.vimeo\.com\/video\/\d+|[^\s]+\.(mp4|webm)(\?|$))/i.test(clean.video))
|
||||
return json(res, 400, { error: 'The intro video needs to be a YouTube link, a Vimeo link, or a direct .mp4 link.' });
|
||||
socials = Object.keys(clean).length ? JSON.stringify(clean) : null;
|
||||
cleanSoc = clean;
|
||||
}
|
||||
const r = await accounts.setProfile(s.email, avatar, bio, socials);
|
||||
// prohibited-content policy (2026-10-30): gambling, adult, pharma, weapons and link-selling terms are refused in the bio and the social URLs
|
||||
{ const pr = prohibited.checkFields(Object.assign({ bio }, cleanSoc || {}), 'LinkSpin', { profile: true }); if (pr.error) { prohibited.logRefusal('profile-details', s.email, pr); return json(res, 400, { error: pr.error }); } }
|
||||
// a bio is not a backlink: links go in the social fields. Exception, the quarantine rule: a brand-new free account (no wallet,
|
||||
// no sponsor, under 24 h) whose first save plants a link is saved with profileQuarantined and never rendered publicly
|
||||
const acct = await accounts.byEmail(s.email);
|
||||
const quarantine = spamscan.shouldQuarantine(acct, bio, cleanSoc) ? true : undefined;
|
||||
if (bio && prohibited.hasUrl(bio) && !quarantine) { prohibited.logRefusal('profile-details', s.email, { field: 'bio', reason: 'url' }); return json(res, 400, { error: prohibited.BIO_LINK_MSG }); }
|
||||
const r = await accounts.setProfile(s.email, avatar, bio, socials, quarantine);
|
||||
if (quarantine && !r.error) { console.log('profile quarantined', String(s.email).replace(/^(.).*(@.*)$/, '$1***$2'), prohibited.hasUrl(bio) ? 'bio-url' : 'social-link'); r.quarantined = true; r.notice = spamscan.QUARANTINE_NOTICE; }
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
// -- wall positions 2 & 3: the member's own offers, unlocked at 2 / 5 qualifying buyers
|
||||
@@ -3388,6 +3426,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const title = String(o.title || '').trim().slice(0, 60);
|
||||
if (targetUrl && !/^https:\/\/[^\s]+$/i.test(targetUrl)) return json(res, 400, { error: 'Position ' + (i + 2) + ': the link must start with https://' });
|
||||
if (bannerUrl && !/^(\/uploads\/[a-z0-9]{24}\.(png|jpg|webp|gif)|https:\/\/[^\s]+)$/i.test(bannerUrl)) return json(res, 400, { error: 'Position ' + (i + 2) + ': banner must be an uploaded image or an https image URL.' });
|
||||
{ const pr = prohibited.checkFields({ title, targetUrl }, 'LinkSpin'); if (pr.error) { prohibited.logRefusal('wall-offers', s.email, pr); return json(res, 400, { error: pr.error }); } }
|
||||
out.push(targetUrl ? { title: title || null, bannerUrl: bannerUrl || null, targetUrl } : null);
|
||||
}
|
||||
const r = await accounts.setWallOffers(s.email, out.some(Boolean) ? JSON.stringify(out) : null);
|
||||
@@ -3400,6 +3439,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const b = await readBody(req);
|
||||
const target = String(b.targetUrl || '').trim();
|
||||
if (!/^https?:\/\/[^\s]+$/i.test(target)) return json(res, 400, { error: 'Destination URL must start with http(s)://' });
|
||||
{ const pr = prohibited.checkFields({ targetUrl: target }, 'LinkSpin'); if (pr.error) { prohibited.logRefusal('linebanner', s.email, pr); return json(res, 400, { error: pr.error }); } }
|
||||
const fc = await frameCheck(target); // welcome tours frame it full screen
|
||||
if (!fc.ok) return json(res, 400, { error: fc.reason });
|
||||
const banner = String(b.bannerUrl || '').trim();
|
||||
@@ -3465,9 +3505,11 @@ const server = http.createServer(async (req, res) => {
|
||||
badge = { img: '/badges/badge-' + t[0] + '.jpg?v=3', label: t[1] };
|
||||
}
|
||||
const joinPath = '/join/' + (a.username || a.code);
|
||||
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,
|
||||
// profile fields (bio, avatar, socials, intro video) only for a paying member; a free account's wall carries the name, the line's ads and the join call (2026-10-30)
|
||||
const bought = (await hasBought(a)) && !a.profileQuarantined;
|
||||
let socials = null; if (bought) { try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {} }
|
||||
return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0), bought,
|
||||
avatarUrl: bought ? (a.avatarUrl || null) : null, bio: bought ? (a.bio || null) : null, socials, badge,
|
||||
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
|
||||
@@ -4178,13 +4220,20 @@ const server = http.createServer(async (req, res) => {
|
||||
try {
|
||||
const tok = m[1].toLowerCase();
|
||||
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 = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>No wall under that name | LinkSpin</title><meta name="robots" content="noindex"><link rel="icon" type="image/png" href="/logo-icon.png"><link rel="stylesheet" href="/assets/site.css?v=ls20260916a"></head><body><section><div class="wrap" style="max-width:720px;text-align:center;padding:60px 0"><h1>No wall under that name</h1><p class="muted">This member page does not exist or was removed.</p><p><a class="btn" href="/">Go to LinkSpin</a></p></div></section></body></html>';
|
||||
res.writeHead(404, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-cache', 'X-Robots-Tag': 'noindex' }));
|
||||
return res.end(nf);
|
||||
}
|
||||
let html = fs.readFileSync(path.join(PUBLIC_DIR, 'wall.html'), 'utf8');
|
||||
if (a) {
|
||||
const nm = a.username ? '@' + a.username : 'member #' + (a.memberId || 0);
|
||||
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 : SITE_URL + '/banners/linkspin-og-1200x630.png';
|
||||
const bought = (await hasBought(a)) && !a.profileQuarantined; // only a paying member's avatar becomes the share image
|
||||
const title = nm + '\u2019s ad wall | LinkSpin';
|
||||
const desc = esc(wallDescription(nm)); // fixed site sentence, never the bio (indexed snippet stays ours)
|
||||
const img = bought && a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : SITE_URL + '/banners/linkspin-og-1200x630.png';
|
||||
const url = SITE_URL + '/wall/' + (a.username || a.code);
|
||||
const og = [
|
||||
'<meta property="og:type" content="profile">',
|
||||
|
||||
Reference in New Issue
Block a user