Pre-launch: mail gate LS_MAIL_MODE (default codes-only: only sign-in codes go out, everything else held and logged); holding-tank rescue sweep OFF unless TANK_RESCUE=on (it warned 274 sponsors of carried-over members and would have moved their referrals)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-17 16:59:48 -05:00
parent df1b900f45
commit 3a7934df00
2 changed files with 12 additions and 2 deletions
+8 -2
View File
@@ -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 };
+4
View File
@@ -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)) {