diff --git a/mailer.js b/mailer.js index 58dfa8d..3dfc085 100644 --- a/mailer.js +++ b/mailer.js @@ -19,9 +19,15 @@ function key() { // present and every send site dutifully checked hasKey() and got a yes. const OUTBOUND = process.env.OUTBOUND === 'on'; function hasKey() { return OUTBOUND && !!key(); } +// Pre-launch mail gate (Marty, 2026-10-17: "no reminder emails or any kind of emails should be going out right now other +// than to let whitelisted testers log in"). LS_MAIL_MODE=codes-only (the default) lets ONLY sign-in codes through; every +// other send is dropped and logged. Set LS_MAIL_MODE=all at launch to open the rest. +const MAIL_MODE = String(process.env.LS_MAIL_MODE || 'codes-only').trim(); +let held = 0; -function send(to, subject, text) { +function send(to, subject, text, opts) { if (!OUTBOUND) return Promise.reject(new Error('outbound mail is off on this deployment (set OUTBOUND=on to allow it)')); + if (MAIL_MODE !== 'all' && !(opts && opts.code)) { held++; console.log('mail held (codes-only, #' + held + '): ' + String(subject).slice(0, 80)); return Promise.resolve(false); } return new Promise((resolve, reject) => { const body = JSON.stringify({ personalizations: [{ to: [{ email: to }] }], @@ -47,7 +53,7 @@ function sendCode(to, code) { return send(to, code + ' is your LinkSpin sign-in code', 'Your sign-in code is: ' + code + '\n\n' + 'It works for 15 minutes. If you did not request it, ignore this email.\n\n' - + 'LinkSpin\nAdvertise and earn instantly. Locked in code, not promises.\n' + SITE_URL); + + 'LinkSpin\nAdvertise and earn instantly. Locked in code, not promises.\n' + SITE_URL, { code: true }); } module.exports = { init, hasKey, send, sendCode }; diff --git a/tank.js b/tank.js index 5451334..91b6c93 100644 --- a/tank.js +++ b/tank.js @@ -221,6 +221,10 @@ async function markContacted(sponsorEmail, leadEmail) { return { ok: true }; } async function rescueSweep() { + // OFF unless TANK_RESCUE=on (Marty, 2026-10-17): carried-over members were never "contacted" on LinkSpin itself, so this + // warned 274 sponsors and would have started moving their referrals out of their lines. Clear tank.json marks first if it + // is ever switched on, or every old warning counts as already given. + if (String(process.env.TANK_RESCUE || '').trim() !== 'on') return { warned: 0, rescued: 0, dead: 0, off: true }; const now = Date.now(); let warned = 0, rescued = 0, dead = 0; for (const a of await accounts.listAll(5000)) {