Sponsor autopilot (sponsorpilot.js): writes to a named sponsor's free directs as the sponsor so they are contacted before the tank rule moves them; paced, 8 AM to 8 PM CT, four messages at most, a reply stops it and pings the owner; switch pilotOn default off (Marty 2026-11-25)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,7 @@ const lssync = require('./lssync');
|
||||
const lsconv = require('./lsconv'); // conversion tracking: ad click ids pushed to LinkSpin + the member's goals (2026-10-23)
|
||||
const lsreport = require('./lsreport'); // conversion linkage: the LinkSpin click on the account, sign-up / wallet / purchase reported, reporting only (2026-11-07)
|
||||
const lsinbound = require('./lsinbound'); // reverse registry sync: LinkSpin-first members arrive as waiting accounts (2026-10-15)
|
||||
const sponsorpilot = require('./sponsorpilot'); // sponsor autopilot (2026-11-25): switch pilotOn, default off
|
||||
const tankbatch = require('./tankbatch'); // holding tank batches (2026-11-15): switch tankBatches, default off
|
||||
const siteinvite = require('./siteinvite'); // sponsor invite emails for other network sites (Video App Income, Marty approved 2026-11-20): signed eligible / send, needs SITE_INVITE_SECRET
|
||||
const draftpartner = require('./draftpartner'); // 5xYourTeam The Draft: signed pool / adopt / release / status on the network tank (2026-11-15, needs DRAFT_PARTNER_SECRET)
|
||||
@@ -932,6 +933,13 @@ async function boot() {
|
||||
await siteinvite.init({ dataDir: DATA_DIR, accounts, mailer, siteConfig, prohibited,
|
||||
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)); }
|
||||
// sponsor autopilot (sponsorpilot.js, 2026-11-25): writes to the named sponsors' free directs as the sponsor, paced, 8 AM to 8 PM CT; nothing while pilotOn is off
|
||||
{ let spamP = { at: 0, set: new Set() }; const spamSetP = () => { if (Date.now() - spamP.at > 60000) { try { spamP = { at: Date.now(), set: new Set((((spamscan.view() || {}).last || {}).candidates || []).map(c => String(c.email || '').toLowerCase())) }; } catch (e) { spamP = { at: Date.now(), set: new Set() }; } } return spamP.set; };
|
||||
await sponsorpilot.init({ dataDir: DATA_DIR, db, accounts, messages, mailer, tank, siteConfig, brand: { name: 'InstantAdPay', url: 'https://instantadpay.com/my' }, online: ls => chatOnline(ls),
|
||||
hooks: { excluded: em => fraud.excluded(em), claim: key => marks.claim(key),
|
||||
excludedPerson: async em => { if (spamSetP().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'; return null; },
|
||||
notify: async text => { const sc = siteConfig(); const chat = String(sc.telegramAdminChatId || '1289244227').trim(); if (sc.telegramBotToken) return telegramSend(chat, text); } } }); }
|
||||
setInterval(() => sponsorpilot.tick().then(r => { if (r && r.sent) console.log('sponsorpilot sent', r.sent); }).catch(e => console.error('sponsorpilot', e.message)), 60 * 1000);
|
||||
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);
|
||||
setInterval(() => tankbatch.mailTick().catch(e => console.error('tankbatch mail', e.message)), 60 * 1000); // throttled batch emails (tankBatchEmailsPerDay, 8 AM to 8 PM CT) + spaced Telegram cards
|
||||
@@ -1011,6 +1019,7 @@ function siteConfig() {
|
||||
tankAdoptCap: 10, // holding tank: people one adopter may hold at one time (not yet switched on payouts), Marty 2026-11-11
|
||||
fiveXDraftCap: 10, // 5xYourTeam draft: open picks one coach may hold, its own cap (Marty 2026-11-15), never shared with tankAdoptCap or batches
|
||||
...siteinvite.DEFAULTS, // sponsor invite emails for other network sites (siteinvite.js): siteInvitesPaused '1' stops them; per-sender and all-senders daily caps
|
||||
...sponsorpilot.DEFAULTS, // sponsor autopilot (sponsorpilot.js, Marty 2026-11-25): master switch pilotOn '0', pilotSponsors = usernames
|
||||
...tankbatch.DEFAULTS, // holding tank batches (tankbatch.js, Marty 2026-11-15): master switch tankBatches '0'; every number of the ladder, cadence and follow-up
|
||||
legacyCreditsAdvertiser: 500, legacyCreditsEarner: 150, // welcome-back credits for listed Faucet Wave / Tier One Ads emails arriving via /from/<brand>
|
||||
geoTier1: '', // comma-separated ISO country codes; empty = built-in default (US, CA, GB, AU, NZ, IE, DE, FR, NL, SE, NO, DK, FI, CH, AT, BE)
|
||||
@@ -4035,6 +4044,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
return json(res, 200, await draftpartner.adminView());
|
||||
}
|
||||
if (p === '/api/admin/pilot' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, await sponsorpilot.view()); } // sponsor autopilot: read-only state + the messages
|
||||
if (p === '/api/admin/tank/batches/preview' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, await tankbatch.preview()); } // read-only: no writes, no mail
|
||||
if (p === '/api/admin/tank/batches/mail' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, await tankbatch.mailView()); } // queued, sent today, next send time
|
||||
if (p === '/api/admin/tank/batches/mail' && req.method === 'POST') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); const b = await readBody(req); return json(res, 200, await tankbatch.setPaused(!!(b && b.paused))); } // pause / resume
|
||||
@@ -5328,6 +5338,7 @@ const server = http.createServer(async (req, res) => {
|
||||
return json(res, 403, { error: 'They are not accepting messages from you right now.' });
|
||||
const memberId = s.memberId || await auth.refreshMemberId(s);
|
||||
const msg = await messages.sendChat(memberId, me, to, text);
|
||||
sponsorpilot.onChat(me, to, text).catch(() => {}); // a referral answering an automatic sponsor message: stop the automatics, ping the owner once
|
||||
// email only when they are offline AND I have not messaged them in ~10 min (no mid-chat spam)
|
||||
try {
|
||||
if (mailer.hasKey() && !chatOnline(target.lastSeen)) {
|
||||
|
||||
Reference in New Issue
Block a user