// Prohibited-content policy, one module shared by InstantAdPay and LinkSpin (keep the two copies identical). // 2026-10-30: an SEO backlink farm opened 106 free accounts, each with a casino or local-business bio and a // website link, and Google indexed that text under our domains through the public walls. Rules (Marty): // - profile fields are not a free backlink: a bio may not carry a URL or a domain-looking token; // - gambling, adult, pharma, weapons and link-selling terms are refused in every member-set text field // (bio, social links, line banner, wall offers, campaign names, headlines, copy and target URLs); // - case-insensitive and Unicode aware (NFC, lower-cased, letter/number boundaries, so "Essex" never hits "sex"). // Pure functions, no state, no dependencies. 'use strict'; // One entry per term or phrase; spaces match any run of whitespace. Grouped for the Terms page and the admin. const LIST = { gambling: ['casino', 'casinos', 'cassino', 'cassinos', 'slots', 'slot gacor', 'betting', 'sportsbook', 'sportsbooks', 'bookmaker', 'bookmakers', 'bookie', 'lottery', 'lotteries', 'lotto', 'poker', 'baccarat', 'roulette', 'blackjack', 'jackpot', 'togel', 'judi', 'judi online', 'apostas', 'apuestas', 'nổ hũ', 'cá cược', 'đổi thưởng', 'xổ số', 'kèo', 'nhà cái', 'soi kèo', 'game bài', 'tài xỉu', 'bắn cá'], adult: ['porn', 'porno', 'pornography', 'sex', 'sexy', 'escort', 'escorts', 'erotic', 'erotica', 'xxx', 'onlyfans', 'nude', 'nudes', 'hentai', 'cam girl', 'cam girls', 'sex cam', 'hookup', 'hookups'], pharma: ['viagra', 'cialis', 'levitra', 'pharmacy', 'pharmacies', 'prescription', 'prescriptions', 'steroids', 'anabolic', 'cannabis', 'marijuana', 'weed', 'cbd', 'kratom', 'opioid', 'opioids', 'xanax', 'adderall', 'tramadol', 'oxycodone', 'ketamine', 'cocaine', 'mdma', 'psilocybin', 'vape', 'vaping'], weapons: ['firearm', 'firearms', 'guns', 'gun shop', 'gun store', 'ammunition', 'ammo', 'rifle', 'rifles', 'pistol', 'pistols', 'handgun', 'handguns', 'silencer', 'suppressor', 'explosives'], linkfarm: ['backlink', 'backlinks', 'seo service', 'seo services', 'seo agency', 'link building', 'link-building', 'guest post', 'guest posts', 'guest posting', 'pbn', 'buy links', 'sell links', 'dofollow'] }; const ALL = Object.values(LIST).reduce((a, b) => a.concat(b), []); const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); const ZW = /[​-‏⁠]/g; // zero-width joiners hide nothing const strip = s => String(s == null ? '' : s).normalize('NFC').replace(ZW, ''); const norm = s => strip(s).toLowerCase(); // Boundary = anything that is not a letter or a number (works for every script, unlike \b). const TERM_RE = new RegExp('(? esc(norm(t)).replace(/\s+/g, '\\s+')).join('|') + ')(?![\\p{L}\\p{N}])', 'u'); // Common gTLDs plus the ccTLDs link farms actually use. A short two-letter list keeps "Mr.Li" style text out of it. const TLDS = 'com|net|org|info|biz|io|co|app|xyz|me|tv|us|uk|vn|de|fr|ru|in|id|br|es|it|nl|ca|au|eu|ch|at|be|pt|pl|cz|se|no|fi|dk|ie|nz|za|ng|ke|eg|tr|ua|il|ae|sa|pk|bd|lk|np|kh|la|mm|my|sg|ph|th|jp|kr|cn|tw|hk|mx|ar|cl|pe|to|ly|cc|gg|ai|pw|ws|tk|ml|ga|cf|gq|su|' + 'site|online|store|shop|club|top|pro|live|link|page|dev|fun|vip|one|tech|space|website|cloud|digital|agency|company|email|news|blog|life|world|today|zone|guru|ninja|game|games|team|network|money|cash|gold|bid|trade|win|bet|casino|poker|mobi|name|tel|travel|jobs|pics|photo|video|press|media|art|design|studio|capital|finance|exchange|solutions|services|systems|tools|works|center|group|global|international|institute|academy|school|education|university|church|community|social|chat|dating|love|wiki|review|reviews|directory|guide|help|support|rocks|ventures|holdings|partners|limited|ltd|llc|inc|asia|africa|london|nyc|tokyo|berlin|paris|best|buzz|click|host|hosting|lol|monster|wtf|ooo|icu|sbs|cfd|cyou|rest|bar|cam|surf|run|fit|health|care|dog|cat|pet|pets|wine|beer|vodka|bio|eco|green|energy|solar|car|cars|auto|bike|tires|taxi|limo|rent|rentals|house|homes|realty|estate|land|city|town|place|map|earth|fund|loans|credit|insure|legal|law|lawyer|attorney|tax|accountant|consulting|marketing|promo|sale|deals|discount|coupons|gift|gifts|toys|baby|kids|mom|family|wedding|party|events|tickets|show|theater|film|movie|music|band|dance|yoga|golf|football|soccer|hockey|tennis|racing'; // Schemes and www. are matched in any case; a bare domain token (or an email address) only with its TLD in lower case, so a // missed space after a period ("ads.One day") is not mistaken for a link while real spam domains (typed lower case) are caught. const SCHEME_RE = /(?:https?:\/\/|ftp:\/\/|(? 'That content is not allowed on ' + (site || 'InstantAdPay/LinkSpin') + ' profiles (see Terms).'; const blockedAdMsg = site => 'That content is not allowed on ' + (site || 'InstantAdPay/LinkSpin') + ' (see Terms, Prohibited content).'; // Bio rule: no links, no prohibited terms. Returns { ok: true } or { error, reason }. function checkBio(bio, site) { const t = String(bio || ''); if (!t.trim()) return { ok: true }; if (hasUrl(t)) return { error: BIO_LINK_MSG, reason: 'url' }; const term = match(t); if (term) return { error: blockedMsg(site), reason: 'term:' + term }; return { ok: true }; } // Any other member-set text (social URL, banner target, campaign name, headline, copy): prohibited terms only. // Pass profile: true for profile fields (the message names profiles), else the ad message is used. function checkText(text, site, opts) { const term = match(text); if (!term) return { ok: true }; return { error: (opts && opts.profile) ? blockedMsg(site) : blockedAdMsg(site), reason: 'term:' + term }; } // Several fields at once: { name: value, ... } -> first failure, with the field named in `field`. function checkFields(fields, site, opts) { for (const k of Object.keys(fields || {})) { const v = fields[k]; if (v == null || v === '') continue; const r = checkText(Array.isArray(v) ? v.join(' ') : String(v), site, opts); if (r.error) return Object.assign({ field: k }, r); } return { ok: true }; } // Profile ingest (registry sync from the other property, or a saved profile replayed): the parts of a profile that may be // stored. A bio with a link or a prohibited term is dropped (null); a social URL carrying a prohibited term is dropped. function cleanProfile(pf, site) { const out = { avatarUrl: null, bio: null, socials: null, dropped: [] }; if (!pf || typeof pf !== 'object') return out; const av = String(pf.avatarUrl || '').trim(); if (/^https:\/\/[^\s]+$/i.test(av) && av.length <= 300) out.avatarUrl = av; const bio = String(pf.bio || '').trim().slice(0, 600); if (bio) { const r = checkBio(bio, site); if (r.ok) out.bio = bio; else out.dropped.push('bio:' + r.reason); } const src = pf.socials && typeof pf.socials === 'object' ? pf.socials : (typeof pf.socials === 'string' ? safeJson(pf.socials) : null); if (src) { const c = {}; for (const k of Object.keys(src)) { const v = String(src[k] || '').trim(); if (!v) continue; const r = checkText(v, site, { profile: true }); if (r.ok) c[k] = v; else out.dropped.push('socials.' + k + ':' + r.reason); } if (Object.keys(c).length) out.socials = c; } return out; } function safeJson(s) { try { const o = JSON.parse(s); return o && typeof o === 'object' ? o : null; } catch (e) { return null; } } // Terms-page wording, one line per group (kept here so both sites say the same thing). const POLICY = [ 'gambling, casinos, betting, lotteries and sweepstakes', 'adult or sexual content', 'drugs and prescription pharmaceuticals', 'weapons', 'hate or harassment', 'malware, phishing and counterfeit goods', 'misleading financial promises', 'accounts created to place links in profile fields (link farming), which are removed without notice together with their profile text' ]; // One log line per refusal, with the email masked (never the text itself at full length). function logRefusal(where, email, r) { try { console.log('prohibited-content refused', where, String(email || '-').replace(/^(.).*(@.*)$/, '$1***$2'), r && r.field ? 'field=' + r.field : '', r && r.reason ? r.reason : ''); } catch (e) {} } module.exports = { LIST, ALL, POLICY, match, hasUrl, checkBio, checkText, checkFields, cleanProfile, logRefusal, BIO_LINK_MSG, blockedMsg, blockedAdMsg };