Legacy bridge pages, welcome-back credits, holding-tank alerts
- /from/faucetwave and /from/tieroneads (?seg=advertiser): the squeeze page with brand copy and no video, sponsor cookie cleared so arrivals land in the holding tank, angle + a legacy:<brand> source recorded on the account. - legacy.js: private list DATA_DIR/legacy.json (email -> brand, segment); listed emails get a one-time credit grant at account creation (legacyCreditsAdvertiser 500 / legacyCreditsEarner 150, admin-editable), recorded in legacy-grants.json. - Holding-tank alerts: dashboard payload carries who is waiting (Overview notice with usernames + adopt link), and a 15-minute tick posts new arrivals to the shared Telegram payments topic. - Chatbot prompt lines + admin setting labels. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// Legacy bridge: former Faucet Wave / Tier One Ads members (EvolutionScript sites Marty closed)
|
||||
// arrive via /from/<brand>; if their email is on the private legacy list (DATA_DIR/legacy.json,
|
||||
// email -> { b: 'faucetwave'|'tier1ads'|'both', s: 'a' (advertiser) | 'e' (earner) }) they get a
|
||||
// one-time welcome-back credit grant at account creation. Grants are recorded in
|
||||
// DATA_DIR/legacy-grants.json so a person is only ever credited once.
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
let DATA_DIR = null, list = null, grants = null;
|
||||
|
||||
function init(opts) { DATA_DIR = opts.dataDir; list = null; grants = null; }
|
||||
function load() {
|
||||
if (list === null) { try { list = JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'legacy.json'), 'utf8')); } catch (e) { list = {}; } }
|
||||
if (grants === null) { try { grants = JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'legacy-grants.json'), 'utf8')); } catch (e) { grants = {}; } }
|
||||
}
|
||||
function reload() { list = null; grants = null; load(); }
|
||||
function lookup(email) { load(); return list[String(email || '').trim().toLowerCase()] || null; }
|
||||
// credits for this email, or null when not listed / already granted. Records the grant.
|
||||
function grant(email, cfg) {
|
||||
load();
|
||||
const e = String(email || '').trim().toLowerCase();
|
||||
const rec = list[e];
|
||||
if (!rec || grants[e]) return null;
|
||||
const credits = rec.s === 'a' ? (Number(cfg.legacyCreditsAdvertiser) || 500) : (Number(cfg.legacyCreditsEarner) || 150);
|
||||
grants[e] = { credits, seg: rec.s, brand: rec.b, at: Date.now() };
|
||||
fs.writeFileSync(path.join(DATA_DIR, 'legacy-grants.json'), JSON.stringify(grants));
|
||||
return { credits, seg: rec.s, brand: rec.b };
|
||||
}
|
||||
function stats() {
|
||||
load();
|
||||
const g = Object.values(grants);
|
||||
return { listed: Object.keys(list).length, granted: g.length, credits: g.reduce((a, x) => a + (x.credits || 0), 0) };
|
||||
}
|
||||
module.exports = { init, reload, lookup, grant, stats };
|
||||
Reference in New Issue
Block a user