Site invite module: email-check code mail for Video App Income's network gate (/api/partner/invite/code: fixed wording, no links, requested = transactional, 5 an hour per address, 2,000 a day; typo and throwaway domains refused); mailer.send opts.fromName = the site's name on the same authenticated address; chatbot answer extended (Marty 2026-11-21: every Video App Income member must be a network member, as frictionless as possible)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -876,7 +876,7 @@ async function boot() {
|
||||
// sponsor invite emails for other network sites (siteinvite.js, 2026-11-21): the same never-mail list the tank batches use
|
||||
{ let spamC = { at: 0, set: new Set() }; const spamSet = () => { if (Date.now() - spamC.at > 60000) { try { spamC = { at: Date.now(), set: new Set((((spamscan.view() || {}).last || {}).candidates || []).map(c => String(c.email || '').toLowerCase())) }; } catch (e) { spamC = { at: Date.now(), set: new Set() }; } } return spamC.set; };
|
||||
await siteinvite.init({ dataDir: DATA_DIR, accounts, mailer, siteConfig, prohibited,
|
||||
hooks: { excluded: em => fraud.excluded(em),
|
||||
hooks: { excluded: em => fraud.excluded(em), suggestDomain: d => require('./emailcheck').suggestDomain(d), erased: em => erase.isErased(em),
|
||||
excludedPerson: async em => { if (spamSet().has(em)) return 'spam scan'; const d = String(em).split('@')[1] || ''; const fix = require('./emailcheck').suggestDomain(d); if (fix && fix !== d) return 'mistyped email domain'; if (erase.isErased(em)) return 'erased'; if (await drip.isUnsubscribed(em).catch(() => false)) return 'unsubscribed from email'; return null; } } }).catch(e => console.error('siteinvite init', e.message)); }
|
||||
setTimeout(() => tankbatch.tick().catch(e => console.error('tankbatch', e.message)), 4 * 60 * 1000); // past the deploy overlap window
|
||||
setInterval(() => tankbatch.tick().catch(e => console.error('tankbatch', e.message)), 60 * 60 * 1000);
|
||||
@@ -3936,7 +3936,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const raw = await new Promise((ok, no) => { let d = ''; req.on('data', c => { d += c; if (d.length > 64000) { req.destroy(); no(new Error('too big')); } }); req.on('end', () => ok(d)); req.on('error', no); });
|
||||
const sg = siteinvite.verify(req.headers, raw); if (!sg.body) return json(res, sg.status, { error: sg.error });
|
||||
const op = p.slice('/api/partner/invite/'.length);
|
||||
if (!['eligible', 'send'].includes(op)) return json(res, 404, { error: 'unknown op' });
|
||||
if (!['eligible', 'send', 'code'].includes(op)) return json(res, 404, { error: 'unknown op' });
|
||||
const r = await siteinvite.handle(op, sg.body);
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user