Compare commits
78 Commits
724dafd9be
...
theme
| Author | SHA1 | Date | |
|---|---|---|---|
| 68061284ef | |||
| b84eed3be5 | |||
| 7c8f204f5a | |||
| 4c0a68cbdd | |||
| 12788e799f | |||
| 58dcbf8cee | |||
| a24e90b590 | |||
| db4308c5fc | |||
| f69453648b | |||
| bdf1aab06c | |||
| be38f454ef | |||
| 86b60f493c | |||
| 1e8addc801 | |||
| 9ebbef2d21 | |||
| fd6f88cab7 | |||
| 2d0413037d | |||
| fd064b1db1 | |||
| c037923528 | |||
| 399a2bcc38 | |||
| 98e3ed36d8 | |||
| 28192b61e9 | |||
| 837d4b6569 | |||
| f38eec9a38 | |||
| db46fc4a2b | |||
| 93317d6ba0 | |||
| 9ce57ae1ff | |||
| e5fb985c6b | |||
| fee138bbc1 | |||
| fc92b09796 | |||
| 018101f011 | |||
| 4749d711f4 | |||
| 7bcde25116 | |||
| ab4f1693df | |||
| 7b3844b757 | |||
| b0f13e2a66 | |||
| 07379803d7 | |||
| dd2244272b | |||
| ff8b8abc77 | |||
| 010c3afdd9 | |||
| 1c2ef3780c | |||
| 7c96e59db7 | |||
| f6621a8e34 | |||
| a5c2c38106 | |||
| eedbd7280f | |||
| e2f79c79a5 | |||
| 05109bd392 | |||
| a0daf7925a | |||
| 33f3b9d337 | |||
| 08bfa2afd7 | |||
| 24814c9a41 | |||
| a736d68c30 | |||
| 32c85c4fae | |||
| f404749fb0 | |||
| d9342d8141 | |||
| f93bca81a7 | |||
| 541457bc24 | |||
| 693a539503 | |||
| a9994e708d | |||
| 2aef2c4b83 | |||
| d05d5527c5 | |||
| 7be213311f | |||
| 77c2037dee | |||
| c4d6cdfb3d | |||
| 4dae478902 | |||
| c963226703 | |||
| c2e5a0f6f1 | |||
| 29c24461dc | |||
| 1d1740c7f9 | |||
| 406113bc03 | |||
| e0e0bde1f9 | |||
| 7b63e75986 | |||
| afede88c4a | |||
| f4b3058a58 | |||
| a416f2f9c9 | |||
| 8a1a6b1f6d | |||
| 57b8eb4208 | |||
| 44d40863db | |||
| f875d94d51 |
+18
-5
@@ -36,9 +36,12 @@ const pub = a => a ? { email: a.email, sponsorRef: a.sponsorRef || '', code: a.c
|
||||
username: a.username || null, memberId: a.memberId || 0, joinedVia: a.joinedVia || null, joinedRef: a.joinedRef || null,
|
||||
lineBannerUrl: a.lineBannerUrl || null, lineTargetUrl: a.lineTargetUrl || null, wallOffers: a.wallOffers || null,
|
||||
avatarUrl: a.avatarUrl || null, bio: a.bio || null, socials: a.socials || null,
|
||||
profileQuarantined: !!a.profileQuarantined, // 2026-10-30: first profile save of a brand-new free account planted a link; stored, never rendered publicly (spamscan.js)
|
||||
chatAvailable: a.chatAvailable === false ? false : true, lastSeen: a.lastSeen || 0,
|
||||
theme: a.theme || null, // 2026-11-01 appearance: auto | light | dark, follows the member across browsers (cr-shell.js)
|
||||
address: a.address || null, created: a.created } : null;
|
||||
const USER_RE = /^[a-zA-Z0-9_]{3,20}$/;
|
||||
const THEMES = new Set(['auto', 'light', 'dark']);
|
||||
const normUser = u => String(u || '').trim().toLowerCase();
|
||||
|
||||
// ---- JSON fallback ----
|
||||
@@ -116,16 +119,18 @@ const J = {
|
||||
acct.wallOffers = json || null; this.save();
|
||||
return { ok: true, account: pub(acct) };
|
||||
},
|
||||
async setProfile(e, avatarUrl, bio, socials) {
|
||||
async setProfile(e, avatarUrl, bio, socials, quarantined) {
|
||||
const acct = this.db.byEmail[e];
|
||||
if (!acct) return { error: 'No such account.' };
|
||||
if (avatarUrl !== undefined) acct.avatarUrl = avatarUrl || null;
|
||||
if (bio !== undefined) acct.bio = bio || null;
|
||||
if (socials !== undefined) acct.socials = socials || null;
|
||||
if (quarantined !== undefined) acct.profileQuarantined = !!quarantined;
|
||||
this.save();
|
||||
return { ok: true, account: pub(acct) };
|
||||
},
|
||||
async touchSeen(e) { const a = this.db.byEmail[e]; if (a) { a.lastSeen = Date.now(); this.save(); } },
|
||||
async setTheme(e, t) { const a = this.db.byEmail[e]; if (!a) return { error: 'No such account.' }; a.theme = THEMES.has(t) ? t : null; this.save(); return { ok: true, account: pub(a) }; },
|
||||
async setChatAvailable(e, v) { const a = this.db.byEmail[e]; if (!a) return { error: 'No such account.' }; a.chatAvailable = !!v; this.save(); return { ok: true, available: !!v }; },
|
||||
async getMutes(e) { const a = this.db.byEmail[e]; return (a && Array.isArray(a.chatMutes)) ? a.chatMutes : []; },
|
||||
async setMute(owner, target, muted) {
|
||||
@@ -146,6 +151,11 @@ const J = {
|
||||
const out = {};
|
||||
for (const a of Object.values(this.db.byEmail))
|
||||
if (a.username && a.memberId && ids.includes(a.memberId)) out[a.memberId] = a.username;
|
||||
// linked positions (Qualified Start wallets) read as their owner (2026-10-18: the ledger showed "member #353")
|
||||
for (const p of Object.values(this.db.positions || {})) {
|
||||
if (!p.memberId || out[p.memberId] || !ids.includes(p.memberId)) continue;
|
||||
const o = this.db.byEmail[p.email]; if (o && o.username) out[p.memberId] = o.username + ' (position)';
|
||||
}
|
||||
return out;
|
||||
},
|
||||
async listByReferrer(refs) {
|
||||
@@ -224,8 +234,8 @@ const J = {
|
||||
const rowPub = r => r ? pub({ email: r.email, sponsorRef: r.sponsor_ref, code: r.code,
|
||||
username: r.username, memberId: r.member_id || 0, joinedVia: r.joined_via || null, joinedRef: r.joined_ref || null,
|
||||
lineBannerUrl: r.line_banner_url, lineTargetUrl: r.line_target_url, wallOffers: r.wall_offers || null,
|
||||
avatarUrl: r.avatar_url, bio: r.bio, socials: r.socials,
|
||||
chatAvailable: r.chat_available === 0 ? false : true, lastSeen: Number(r.last_seen || 0),
|
||||
avatarUrl: r.avatar_url, bio: r.bio, socials: r.socials, profileQuarantined: !!r.profile_quarantined,
|
||||
chatAvailable: r.chat_available === 0 ? false : true, lastSeen: Number(r.last_seen || 0), theme: r.theme || null,
|
||||
address: r.address, created: Number(r.created) }) : null;
|
||||
const D = {
|
||||
async signup(e, password, ref) {
|
||||
@@ -279,13 +289,15 @@ const D = {
|
||||
await db.q('UPDATE accounts SET wall_offers=? WHERE email=?', [json || null, e]);
|
||||
return { ok: true, account: await this.byEmail(e) };
|
||||
},
|
||||
async setProfile(e, avatarUrl, bio, socials) {
|
||||
async setProfile(e, avatarUrl, bio, socials, quarantined) {
|
||||
if (avatarUrl !== undefined) await db.q('UPDATE accounts SET avatar_url=? WHERE email=?', [avatarUrl || null, e]);
|
||||
if (bio !== undefined) await db.q('UPDATE accounts SET bio=? WHERE email=?', [bio || null, e]);
|
||||
if (socials !== undefined) await db.q('UPDATE accounts SET socials=? WHERE email=?', [socials || null, e]);
|
||||
if (quarantined !== undefined) await db.q('UPDATE accounts SET profile_quarantined=? WHERE email=?', [quarantined ? 1 : 0, e]);
|
||||
return { ok: true, account: await this.byEmail(e) };
|
||||
},
|
||||
async touchSeen(e) { await db.q('UPDATE accounts SET last_seen=? WHERE email=?', [Date.now(), e]); },
|
||||
async setTheme(e, t) { await db.q('UPDATE accounts SET theme=? WHERE email=?', [THEMES.has(t) ? t : null, e]); return { ok: true, account: await this.byEmail(e) }; },
|
||||
async setChatAvailable(e, v) { await db.q('UPDATE accounts SET chat_available=? WHERE email=?', [v ? 1 : 0, e]); return { ok: true, available: !!v }; },
|
||||
async getMutes(e) {
|
||||
const r = await db.q('SELECT chat_mutes FROM accounts WHERE email=?', [e]);
|
||||
@@ -483,8 +495,9 @@ module.exports = { init, signup, login, ensure, onChange, byEmail, byAddress, by
|
||||
setUsername, setMemberId, namesForMembers, listByReferrer, downline, linkWallet, onWalletLinked, count,
|
||||
setLineBanner: (e, b, t) => impl().setLineBanner(String(e || '').toLowerCase(), b, t),
|
||||
setWallOffers: (e, j) => impl().setWallOffers(String(e || '').toLowerCase(), j),
|
||||
setProfile: (e, a, bio, socials) => impl().setProfile(String(e || '').toLowerCase(), a, bio, socials).then(tap(String(e || '').toLowerCase())),
|
||||
setProfile: (e, a, bio, socials, quarantined) => impl().setProfile(String(e || '').toLowerCase(), a, bio, socials, quarantined).then(tap(String(e || '').toLowerCase())),
|
||||
touchSeen: e => impl().touchSeen(String(e || '').toLowerCase()),
|
||||
setTheme: (e, t) => impl().setTheme(String(e || '').toLowerCase(), t), // appearance only: no onChange tap, InstantAdPay does not mirror it
|
||||
adminSetAddress: (e, a) => impl().adminSetAddress(String(e || '').toLowerCase(), a ? normAddr(a) : null).then(tap(String(e || '').toLowerCase())),
|
||||
positionByAddress: a => impl().positionByAddress(normAddr(a)),
|
||||
removeAccount: e => impl().removeAccount(String(e || '').toLowerCase()),
|
||||
|
||||
+19
-11
@@ -5,7 +5,8 @@
|
||||
// run. Extra audiences come from the pixel tag (<script src=/p.js data-aud=la-xxxxxx>) pasted on any site.
|
||||
// - Membership lasts 30 days from the last hit. Nothing personal is stored: hashes, timestamps, an optional event name.
|
||||
// - Serving: ads.js asks opts.audienceHas(id) for each targeted campaign; the server builds that closure per request.
|
||||
// Storage: DATA_DIR/audiences.json { v, audiences: { id: {id, owner, name, auto, created} }, hits: { id: { key: lastTs } } }
|
||||
// Storage: DATA_DIR/audiences.json { v, audiences: { id: {id, owner, name, auto, created} }, hits: { id: { key: lastTs } },
|
||||
// ev: { id: { key: lastEventName } } } (2026-10-22: the pixel's e= name, a parallel map so old hits rows stay as they are)
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
@@ -13,7 +14,7 @@ const crypto = require('crypto');
|
||||
const DAY = 86400000, KEEP_MS = 30 * DAY, SOFT_MS = 24 * 3600000, MAX_PER_OWNER = 20;
|
||||
let FILE = null, S = null, dirty = false, hitsSincePrune = 0;
|
||||
|
||||
function load() { if (S) return S; try { S = JSON.parse(fs.readFileSync(FILE, 'utf8')); } catch (e) { S = { v: 1, audiences: {}, hits: {} }; } S.audiences = S.audiences || {}; S.hits = S.hits || {}; return S; }
|
||||
function load() { if (S) return S; try { S = JSON.parse(fs.readFileSync(FILE, 'utf8')); } catch (e) { S = { v: 1, audiences: {}, hits: {}, ev: {} }; } S.audiences = S.audiences || {}; S.hits = S.hits || {}; S.ev = S.ev || {}; return S; }
|
||||
function save() { dirty = true; }
|
||||
function flush() { if (!dirty || !S) return; dirty = false; try { fs.writeFileSync(FILE + '.tmp', JSON.stringify(S)); fs.renameSync(FILE + '.tmp', FILE); } catch (e) { console.error('audiences save', e.message); } }
|
||||
function init(opts) { FILE = path.join(opts.dataDir, 'audiences.json'); load(); setInterval(flush, 5000).unref(); setInterval(prune, 3600000).unref(); }
|
||||
@@ -29,9 +30,10 @@ function list(owner) {
|
||||
.map(a => Object.assign({}, a, sizes(a.id)));
|
||||
}
|
||||
function sizes(id) {
|
||||
const h = load().hits[id] || {}; const now = Date.now(); let s30 = 0, s7 = 0, soft = 0;
|
||||
for (const k in h) { const t = h[k]; if (k[0] === 's' && k[1] === ':') { if (now - t <= SOFT_MS) soft++; continue; } if (now - t <= KEEP_MS) s30++; if (now - t <= 7 * DAY) s7++; }
|
||||
return { size30: s30, size7: s7, soft };
|
||||
const h = load().hits[id] || {}; const ev = S.ev[id] || {}; const now = Date.now(); let s30 = 0, s7 = 0, soft = 0; const events = {}, eventsSoft = {};
|
||||
// events: last pixel event name per counted visitor, split like the sizes (cookie visitors 30 days, soft keys 24 h)
|
||||
for (const k in h) { const t = h[k]; if (k[0] === 's' && k[1] === ':') { if (now - t <= SOFT_MS) { soft++; if (ev[k]) eventsSoft[ev[k]] = (eventsSoft[ev[k]] || 0) + 1; } continue; } if (now - t <= KEEP_MS) { s30++; if (ev[k]) events[ev[k]] = (events[ev[k]] || 0) + 1; } if (now - t <= 7 * DAY) s7++; }
|
||||
return { size30: s30, size7: s7, soft, events, eventsSoft };
|
||||
}
|
||||
function owns(owner, id) { const a = load().audiences[String(id || '')]; return !!(a && a.owner === norm(owner)); }
|
||||
function get(id) { return load().audiences[String(id || '')] || null; }
|
||||
@@ -59,7 +61,7 @@ function rename(owner, id, name) {
|
||||
function remove(owner, id) {
|
||||
const a = get(id); if (!a || a.owner !== norm(owner)) return { error: 'No such audience.' };
|
||||
if (a.auto) return { error: 'The automatic audience cannot be removed. Campaigns that use it will keep working.' };
|
||||
delete load().audiences[id]; delete load().hits[id]; save(); return { ok: true };
|
||||
delete load().audiences[id]; delete load().hits[id]; delete load().ev[id]; save(); return { ok: true };
|
||||
}
|
||||
|
||||
// ---- visitor keys
|
||||
@@ -72,10 +74,13 @@ function newVid() { return crypto.randomBytes(10).toString('hex'); }
|
||||
function cookieHeader(vid, prod) { return 'ls.vid=' + vid + '; Path=/; Max-Age=31536000; ' + (prod ? 'SameSite=None; Secure' : 'SameSite=Lax'); }
|
||||
|
||||
// ---- hits + membership
|
||||
function hit(id, vid, soft) {
|
||||
// the pixel's optional event name: lowercase, [a-z0-9_-]{1,32}, anything else dropped
|
||||
function cleanEvent(e) { const v = String(e == null ? '' : e).trim().toLowerCase(); return /^[a-z0-9_-]{1,32}$/.test(v) ? v : ''; }
|
||||
function hit(id, vid, soft, event) {
|
||||
const st = load(); if (!st.audiences[id]) return false;
|
||||
const h = st.hits[id] = st.hits[id] || {}; const now = Date.now();
|
||||
if (vid) h[vid] = now; if (soft) h[soft] = now;
|
||||
const e = cleanEvent(event); if (e) { const ev = st.ev[id] = st.ev[id] || {}; if (vid) ev[vid] = e; if (soft) ev[soft] = e; }
|
||||
save(); if (++hitsSincePrune > 2000) { hitsSincePrune = 0; prune(); }
|
||||
return true;
|
||||
}
|
||||
@@ -88,13 +93,16 @@ function has(id, vid, soft) {
|
||||
function prune() {
|
||||
const st = load(); const now = Date.now(); let n = 0;
|
||||
for (const id in st.hits) {
|
||||
if (!st.audiences[id]) { delete st.hits[id]; continue; }
|
||||
const h = st.hits[id];
|
||||
for (const k in h) { const lim = (k[0] === 's' && k[1] === ':') ? SOFT_MS : KEEP_MS; if (now - h[k] > lim) { delete h[k]; n++; } }
|
||||
if (!st.audiences[id]) { delete st.hits[id]; delete st.ev[id]; continue; }
|
||||
const h = st.hits[id]; const ev = st.ev[id];
|
||||
for (const k in h) { const lim = (k[0] === 's' && k[1] === ':') ? SOFT_MS : KEEP_MS; if (now - h[k] > lim) { delete h[k]; if (ev) delete ev[k]; n++; } }
|
||||
}
|
||||
for (const id in st.ev) { const h = st.hits[id], ev = st.ev[id]; if (!h) { delete st.ev[id]; continue; } for (const k in ev) if (!(k in h)) delete ev[k]; }
|
||||
if (n) save(); flush(); return n;
|
||||
}
|
||||
// per-request closure for ads.js: opts.audienceHas(id)
|
||||
function matcher(req) { const vid = cookieVid(req), soft = softKey(req); return { vid, soft, audienceHas: id => has(id, vid, soft) }; }
|
||||
|
||||
module.exports = { init, list, create, rename, remove, owns, get, nameOf, defaultFor, hit, has, prune, flush, isId, cookieVid, newVid, cookieHeader, softKey, matcher };
|
||||
// admin Member content (2026-10-18): the audiences members made by hand (every member has an automatic one, not listed)
|
||||
function adminAll() { return Object.values(load().audiences).filter(a => !a.auto).map(a => Object.assign({}, a, sizes(a.id))); }
|
||||
module.exports = { init, adminAll, list, create, rename, remove, owns, get, nameOf, defaultFor, hit, has, prune, flush, isId, cleanEvent, cookieVid, newVid, cookieHeader, softKey, matcher };
|
||||
|
||||
@@ -12,7 +12,7 @@ function refunded() { const out = {}; try { for (const f of fs.readdirSync(R.dat
|
||||
async function run() {
|
||||
const out = { checkedAt: Date.now(), checks: [] };
|
||||
if (!db.enabled()) { out.checks.push({ name: 'Counters', ok: true, detail: 'JSON mode: not checked', issues: [] }); return out; }
|
||||
const camps = await db.q("SELECT id, name, type, status, imps, clicks, spent, accrued, budget, created, house FROM campaigns WHERE house=0 OR house IS NULL");
|
||||
const camps = await db.q("SELECT id, name, type, status, imps, clicks, spent, accrued, budget, created, house, expires FROM campaigns WHERE house=0 OR house IS NULL");
|
||||
const back = refunded(); for (const c of camps) if (back[c.id]) c.spent = Math.max(0, Number(c.spent) - back[c.id]); // already made right
|
||||
const logStart = (await db.q('SELECT MIN(day) d FROM camp_hours'))[0].d; const logStartMs = logStart ? Date.parse(logStart + 'T00:00:00Z') : 0;
|
||||
const byType = t => camps.filter(c => c.type === t);
|
||||
@@ -36,8 +36,8 @@ async function run() {
|
||||
{
|
||||
const rows = await db.q('SELECT campaign_id, COUNT(DISTINCT day) d FROM camp_hours WHERE n>0 GROUP BY campaign_id'); const shown = {}; for (const r of rows) shown[r.campaign_id] = Number(r.d);
|
||||
const issues = [];
|
||||
for (const c of byType('login')) { const charged = Math.round((Number(c.spent) + Number(c.accrued || 0)) / 100), s = shown[c.id] || 0; if (charged > s) issues.push('#' + c.id + ' ' + c.name.slice(0, 30) + ': charged ' + charged + ' day(s), shown on ' + s); }
|
||||
add('login ads: days charged vs days shown', issues, byType('login').length + ' campaigns compared');
|
||||
for (const c of byType('login').filter(c => !c.expires && !['queued', 'cancelled'].includes(c.status))) { const charged = Math.round((Number(c.spent) + Number(c.accrued || 0)) / 100), s = shown[c.id] || 0; if (charged > s) issues.push('#' + c.id + ' ' + c.name.slice(0, 30) + ': charged ' + charged + ' day(s), shown on ' + s); }
|
||||
add('login ads: days charged vs days shown', issues, byType('login').filter(c => !c.expires && !['queued', 'cancelled'].includes(c.status)).length + ' per-day campaigns compared (30-day slots are paid up front)');
|
||||
}
|
||||
// 4. featured: a live booking older than two hours must have views
|
||||
{
|
||||
|
||||
@@ -15,7 +15,14 @@ let IS_PROD = false;
|
||||
let SITE = SITE_HOST;
|
||||
|
||||
const CHALLENGE_TTL = 10 * 60 * 1000;
|
||||
const SESSION_TTL = 24 * 60 * 60 * 1000; // 24h — forces a daily re-login so the login ad shows each day
|
||||
// Marty 2026-10-26: same as InstantAdPay, a session lasts 4 hours (SESSION_TTL_HOURS), then sign in again.
|
||||
// Sessions minted under the old 24 h rule are cut back to issue time + the new length (cap below).
|
||||
const SESSION_TTL = Number(process.env.SESSION_TTL_HOURS || 4) * 60 * 60 * 1000;
|
||||
const LEGACY_TTL = 24 * 60 * 60 * 1000;
|
||||
// new sessions carry `issued`; a stored session without it is a legacy 24 h one: its real end is issue time + SESSION_TTL
|
||||
const sessEnd = s => (s.issued ? Number(s.expires) : Number(s.expires) - LEGACY_TTL + SESSION_TTL);
|
||||
// MySQL mode has no issued column: cap anything with more than SESSION_TTL left (best effort; production uses the JSON store)
|
||||
const capExp = exp => (Number(exp) - Date.now() > SESSION_TTL ? Number(exp) - LEGACY_TTL + SESSION_TTL : Number(exp));
|
||||
const challenges = new Map(); // addressLower -> {message, exp}
|
||||
|
||||
// ---- JSON session fallback ----
|
||||
@@ -38,13 +45,13 @@ const J = {
|
||||
async mint(fields) {
|
||||
const token = crypto.randomBytes(32).toString('hex');
|
||||
this.sessions.set(token, Object.assign({ email: null, address: null, memberId: 0 }, fields,
|
||||
{ expires: Date.now() + SESSION_TTL }));
|
||||
{ issued: Date.now(), expires: Date.now() + SESSION_TTL }));
|
||||
this.save();
|
||||
return token;
|
||||
},
|
||||
async get(token) {
|
||||
const s = this.sessions.get(token);
|
||||
if (!s || s.expires < Date.now()) return null;
|
||||
if (!s || sessEnd(s) < Date.now()) return null;
|
||||
return Object.assign({ token }, s);
|
||||
},
|
||||
async update(token, fields) {
|
||||
@@ -68,6 +75,7 @@ const D = {
|
||||
const rows = await db.q('SELECT * FROM sessions WHERE token=? AND expires>?', [token, Date.now()]);
|
||||
if (!rows.length) return null;
|
||||
const r = rows[0];
|
||||
if (capExp(r.expires) < Date.now()) return null;
|
||||
return { token, email: r.email, address: r.address, memberId: r.member_id, expires: Number(r.expires) };
|
||||
},
|
||||
async update(token, fields) {
|
||||
@@ -141,10 +149,15 @@ function sessionCookie(token) {
|
||||
return `iap.sid=${encodeURIComponent(token)}; Path=/; HttpOnly; SameSite=Lax; Max-Age=${SESSION_TTL / 1000}${IS_PROD ? '; Secure' : ''}`;
|
||||
}
|
||||
function clearCookie() { return 'iap.sid=; Path=/; HttpOnly; SameSite=Lax; Max-Age=0'; }
|
||||
// onSeen (2026-10-26): told the email + request of every resolved session (conversion tracking keeps the soft keys a member
|
||||
// signs in from, so their own clicks count as tests). Never throws into the caller.
|
||||
let seenFn = null; function onSeen(fn) { seenFn = fn; }
|
||||
async function fromRequest(req) {
|
||||
const m = /(?:^|;\s*)iap\.sid=([^;]+)/.exec(req.headers.cookie || '');
|
||||
if (!m) return null;
|
||||
return impl().get(decodeURIComponent(m[1]));
|
||||
const s = await impl().get(decodeURIComponent(m[1]));
|
||||
if (s && s.email && seenFn) { try { seenFn(s.email, req); } catch (e) {} }
|
||||
return s;
|
||||
}
|
||||
async function refreshMemberId(sess) {
|
||||
if (!sess) return 0;
|
||||
@@ -167,4 +180,4 @@ async function logout(req) {
|
||||
if (s) await impl().drop(s.token);
|
||||
}
|
||||
|
||||
module.exports = { init, makeChallenge, verifyChallenge, mintSession, updateSession, sessionCookie, clearCookie, fromRequest, refreshMemberId, logout };
|
||||
module.exports = { init, makeChallenge, verifyChallenge, mintSession, updateSession, sessionCookie, clearCookie, fromRequest, onSeen, refreshMemberId, logout };
|
||||
|
||||
+483
@@ -0,0 +1,483 @@
|
||||
// Banner Spin (LinkSpin, 2026-10-18, plan approved by Marty the same day): one image URL + one click URL that rotate up to
|
||||
// 25 banners, each with its own target. Phase 1 (engine) + phase 2 (builder) of "LinkSpin Banner Spin: plan".
|
||||
//
|
||||
// Serving. /i/<code>.gif picks a banner on every load (weighted pick, pause, dayparting, fallback: the rotator's own rules)
|
||||
// and answers with the image itself (uploaded files from DATA_DIR/uploads, hot ones cached in memory) or a no-store 302
|
||||
// to a pasted https image. Every image response is Cache-Control: no-store, private with a fresh ETag, so a browser asks
|
||||
// again on every page view. /s/<code>.js writes the banner AND its own click link in one go (exact match). /c/<code> is the
|
||||
// click. Paths are neutral on purpose: no size token and never the words banner or ads (EasyList), and codes never
|
||||
// contain "ad". Every link domain answers every code, like /r/.
|
||||
//
|
||||
// Click matching (the image and the click are two separate requests). On each image load the server keeps a note in
|
||||
// memory: visitor key + referring page host -> the banner it showed, for 15 minutes. The visitor key is the same
|
||||
// daily-salted hash spin links use (no IP stored). On a click the note for that key + host is looked up (the most recent
|
||||
// one when there are several) and the visitor goes to that banner's target; no note -> the fallback target, logged as
|
||||
// unmatched. /s/ clicks carry the banner (?x=) and match exactly. Rotation modes: random by weight (default) or one per
|
||||
// visitor (the same banner all day, a stable hash of the visitor key).
|
||||
//
|
||||
// Counting. Impressions are COUNTERS (per banner, per placement host, per Central day, plus a small uniques sample), kept
|
||||
// as pending deltas in memory and merged into DATA_DIR/bannerspin-counts.json every few seconds (read, add, atomic
|
||||
// write, so two app copies during a deploy overlap both land). Bots and prefetchers are not counted; one visitor's
|
||||
// reloads count once per minute per banner. Clicks are rows like spin-link clicks, with the usual lsid click id
|
||||
// ('k' + 11 hex, never valid hex so it can never collide with a rotator id), so joins / wallets / purchases and partner
|
||||
// postbacks credit the banner (rotator.convert falls through to convert() here), and a traffic source's postback fires.
|
||||
// Since 2026-10-26 a click that goes straight to a page also gets ?lsclk=<click id> when the owner tracks goals, so the
|
||||
// conversion pixel (convtrack.js, clickById below) counts goals from Banner Spin banners that skip a spin link.
|
||||
//
|
||||
// Access. Members with at least one own package of $25 or more. Starter 2 Banner Spins x 5 banners; Builder (level 2
|
||||
// open, 2 qualifying buyers) 5 x 15; Leader (level 3 open, 5 qualifying buyers) 10 x 25. Facts come from server.js
|
||||
// (chain + positions); once seen they are remembered here so a rolling chain window never takes a tier away. Dropping
|
||||
// below a tier keeps everything serving; it only stops new ones.
|
||||
//
|
||||
// Moderation. Admin can take one banner or a whole Banner Spin offline (a neutral blank image + the fallback link), or
|
||||
// switch the whole feature off (a button in Admin > Member content since phase 3). Store: DATA_DIR/bannerspin.json (atomic writes).
|
||||
//
|
||||
// Phase 3 (2026-10-20, "Reports and health"): every image load is also counted raw per placement (bots, prefetches and
|
||||
// servers / mail image proxies kept apart from views), which feeds the "caches banners" flag; stats() and summary() share
|
||||
// one aggregation (per banner, per placement, by Central day, country and device, a winner once two banners have 1,000
|
||||
// views each); health.js checks each live banner's image and target every 30 minutes (b.health, b.autoPaused).
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
let DATA_DIR = null, UPLOADS_DIR = null, rotator = null, geo = null, SOURCES = null, OWN_HOSTS = () => [], FACTS = async () => ({ ownBuy: false, buyers: 0 }), ADMIN = '';
|
||||
const DAY = 86400000;
|
||||
const SIZES = { '468x60': [468, 60], '728x90': [728, 90], '300x250': [300, 250], '125x125': [125, 125], '160x600': [160, 600], '120x600': [120, 600], '336x280': [336, 280], '250x250': [250, 250], '320x50': [320, 50] };
|
||||
const TIERS = {
|
||||
starter: { key: 'starter', label: 'Starter', spins: 2, banners: 5, need: 'your own package of $25 or more' },
|
||||
builder: { key: 'builder', label: 'Builder', spins: 5, banners: 15, need: 'level 2 open, 2 qualifying buyers' },
|
||||
leader: { key: 'leader', label: 'Leader', spins: 10, banners: 25, need: 'level 3 open, 5 qualifying buyers' }
|
||||
};
|
||||
const ORDER = ['starter', 'builder', 'leader'];
|
||||
const MAX_BYTES = 150 * 1024, MAX_BANNERS = 25;
|
||||
const NOTE_TTL = 15 * 60000, DEDUPE_MS = 60000, FLUSH_MS = 5000, UNIQ_CAP = 500, HOSTS_CAP = 200;
|
||||
const BOT = /bot|crawl|spider|slurp|facebookexternalhit|preview|telegrambot|whatsapp|curl|wget|python-requests|headless/i;
|
||||
const norm = e => String(e || '').trim().toLowerCase();
|
||||
const CT_FMT = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit' });
|
||||
const ctDay = ts => CT_FMT.format(new Date(ts || Date.now()));
|
||||
const LOCAL_IMG = /^\/uploads\/([a-f0-9]{24}\.(png|jpg|gif))$/;
|
||||
const MIME = { png: 'image/png', jpg: 'image/jpeg', gif: 'image/gif' };
|
||||
const httpsUrl = u => { let s = String(u || '').trim(); if (s && !/^[a-z][a-z0-9+.-]*:\/\//i.test(s) && /^[^\s\/]+\.[^\s]+/.test(s)) s = 'https://' + s; return /^https:\/\/[^\s"'<>]+$/i.test(s) && s.length <= 500 ? s : null; };
|
||||
|
||||
function writeAtomic(file, data) { try { const tmp = file + '.' + process.pid + '.tmp'; fs.writeFileSync(tmp, data); fs.renameSync(tmp, file); } catch (e) { console.error('bannerspin save', e.message); } }
|
||||
const J = { db: null, FILE: () => path.join(DATA_DIR, 'bannerspin.json'),
|
||||
load() { try { this.db = JSON.parse(fs.readFileSync(this.FILE(), 'utf8')); } catch (e) { this.db = null; } if (!this.db || typeof this.db !== 'object') this.db = { v: 1 };
|
||||
for (const k of ['spins', 'clicks', 'conv']) if (!Array.isArray(this.db[k])) this.db[k] = [];
|
||||
for (const k of ['images', 'grants', 'qual', 'settings']) if (!this.db[k] || typeof this.db[k] !== 'object') this.db[k] = {}; },
|
||||
save() { writeAtomic(this.FILE(), JSON.stringify(this.db)); } };
|
||||
// impression counters: d[spinId][day] = { b: { bid: n }, h: { host: { bid: n } }, u: { bid: [visitor prefixes] } }
|
||||
const C = { db: { v: 1, d: {} }, FILE: () => path.join(DATA_DIR, 'bannerspin-counts.json'),
|
||||
read() { try { const x = JSON.parse(fs.readFileSync(this.FILE(), 'utf8')); return x && x.d ? x : { v: 1, d: {} }; } catch (e) { return { v: 1, d: {} }; } } };
|
||||
let PENDING = { d: {} }, DIRTY = false, timer = null, lastPrune = 0;
|
||||
// conversion pixel (2026-10-26): a click that goes straight to a page (not a spin link) gets ?lsclk=<this click id> when
|
||||
// the owner tracks goals, the same rule spin links follow. server.js hands in the goal check and convtrack's string insert.
|
||||
let WANTS_CLICK_ID = () => false, WITH_CLICK_ID = (u) => u;
|
||||
|
||||
function init(opts) {
|
||||
DATA_DIR = opts.dataDir; UPLOADS_DIR = opts.uploadsDir || path.join(DATA_DIR, 'uploads'); rotator = opts.rotator || null; geo = opts.geo || null; SOURCES = opts.sources || null;
|
||||
OWN_HOSTS = opts.ownHosts || OWN_HOSTS; FACTS = opts.facts || FACTS; ADMIN = norm(opts.adminEmail);
|
||||
if (opts.wantsClickId) WANTS_CLICK_ID = opts.wantsClickId; if (opts.withClickId) WITH_CLICK_ID = opts.withClickId;
|
||||
J.load(); C.db = C.read();
|
||||
if (opts.schedule !== false) { timer = setInterval(() => { flush(); sweep(); }, FLUSH_MS); if (timer.unref) timer.unref(); }
|
||||
}
|
||||
|
||||
// ── codes: 7 chars, no 0/1/i/l/o, never containing "ad" or digit-x-digit (EasyList), unique among Banner Spins ──
|
||||
const ALPHA = 'abcdefghjkmnpqrstuvwxyz23456789';
|
||||
const BAD_CODE = /ad|banner|\dx\d/; // no digit-x-digit run either, so nothing reads like a size
|
||||
function newCode() { for (;;) { let s = ''; for (let i = 0; i < 7; i++) s += ALPHA[crypto.randomInt(ALPHA.length)]; if (!BAD_CODE.test(s) && !J.db.spins.some(x => x.code === s)) return s; } }
|
||||
|
||||
// ── visitor key: the rotator's daily-salted hash (UTC day | ip | ua), nothing stored but the hash ──
|
||||
const ipOf = req => String(req.headers['x-forwarded-for'] || (req.socket && req.socket.remoteAddress) || '').split(',')[0].trim();
|
||||
const vkey = (req, ts) => crypto.createHash('sha256').update(new Date(ts || Date.now()).toISOString().slice(0, 10) + '|' + ipOf(req) + '|' + String(req.headers['user-agent'] || '')).digest('hex').slice(0, 16);
|
||||
// keys to try for a click: today's, and yesterday's for the first 15 minutes after UTC midnight (a note made at 23:59 still matches)
|
||||
function vkeys(req) { const now = Date.now(); const k = [vkey(req, now)]; if (now % DAY < NOTE_TTL) k.push(vkey(req, now - DAY)); return k; }
|
||||
const isBot = req => { const ua = String(req.headers['user-agent'] || ''); return !ua || BOT.test(ua); };
|
||||
const isPrefetch = req => /prefetch|prerender|preview/i.test([req.headers.purpose, req.headers['sec-purpose'], req.headers['x-purpose'], req.headers['x-moz']].filter(Boolean).join(' '));
|
||||
// a server fetching the image, not a browser (phase 3, 2026-10-20): mail image proxies and plain HTTP libraries. Kept out of
|
||||
// impressions like bots, but counted per placement, because a site that copies banners to its own server shows up this way.
|
||||
const PROXY = /GoogleImageProxy|ggpht\.com|YahooMailProxy|ImageProxy|^(php|java|go-http-client|okhttp|axios|node-fetch|undici|libwww-perl|apache-httpclient|guzzlehttp|ruby)\b/i;
|
||||
// '' = a browser view (counted), 'pre' = prefetch, 'bot' = bot or no UA, 'srv' = a server or image proxy
|
||||
const loaderKind = req => isPrefetch(req) ? 'pre' : isBot(req) ? 'bot' : PROXY.test(String(req.headers['user-agent'] || '')) ? 'srv' : '';
|
||||
// the placement: the page the banner sits on (the browser's referrer, else its origin), www stripped
|
||||
function hostOf(req) { try { return new URL(String(req.headers.referer || req.headers.origin || '')).hostname.toLowerCase().replace(/^www\./, '').slice(0, 80); } catch (e) { return ''; } }
|
||||
|
||||
// ── in-memory notes: visitor key -> [{ s, h, b, ts }] (newest last), 15 min ──
|
||||
const NOTES = new Map(); const SEEN = new Map(); // SEEN: v|spin|bid -> ts of the last counted impression
|
||||
function note(v, s, h, b) { let a = NOTES.get(v); if (!a) { if (NOTES.size > 200000) return; a = []; NOTES.set(v, a); } a.push({ s, h, b, ts: Date.now() }); if (a.length > 12) a.splice(0, a.length - 12); }
|
||||
function findNote(keys, s, h) {
|
||||
const now = Date.now(); let best = null, any = null;
|
||||
for (const v of keys) for (const n of (NOTES.get(v) || [])) { if (n.s !== s || now - n.ts > NOTE_TTL) continue; if (!any || n.ts >= any.ts) any = n; if (n.h === h && (!best || n.ts >= best.ts)) best = n; }
|
||||
// a click with no referrer (strict privacy settings) takes the visitor's most recent note on this Banner Spin
|
||||
return best || (!h ? any : null);
|
||||
}
|
||||
function sweep() { const now = Date.now(); for (const [k, a] of NOTES) { const keep = a.filter(n => now - n.ts <= NOTE_TTL); if (keep.length) NOTES.set(k, keep); else NOTES.delete(k); } for (const [k, t] of SEEN) if (now - t > DEDUPE_MS) SEEN.delete(k); }
|
||||
|
||||
// ── counters ──
|
||||
// a day record: b = counted views per banner, h = per placement host per banner, u = uniques sample per banner,
|
||||
// bt = bot + prefetch loads, sv = server / image-proxy loads, z = per placement host { r: every load, s: loads with no browser, k: top loaders sample }
|
||||
const dayRec = sid => { const day = ctDay(); const s = PENDING.d[sid] = PENDING.d[sid] || {}; return s[day] = s[day] || { b: {}, h: {}, u: {}, z: {} }; };
|
||||
function bump(sid, bid, host, v) {
|
||||
const d = dayRec(sid);
|
||||
d.b[bid] = (d.b[bid] || 0) + 1; const hk = host || '(none)'; const hh = d.h[hk] = d.h[hk] || {}; hh[bid] = (hh[bid] || 0) + 1;
|
||||
const u = d.u[bid] = d.u[bid] || []; const p = v.slice(0, 8); if (u.length < UNIQ_CAP && !u.includes(p)) u.push(p);
|
||||
DIRTY = true;
|
||||
}
|
||||
// every image load (counted or not), for bots shown separately and the "caches banners" flag
|
||||
const LOADERS_CAP = 10;
|
||||
function rawLoad(sid, host, v, kind) {
|
||||
const d = dayRec(sid); const hk = host || '(none)'; const z = d.z[hk] = d.z[hk] || { r: 0, s: 0, k: {} };
|
||||
z.r++; if (kind === 'bot' || kind === 'srv') z.s++;
|
||||
const p = v.slice(0, 8); if (z.k[p] != null || Object.keys(z.k).length < LOADERS_CAP) z.k[p] = (z.k[p] || 0) + 1;
|
||||
if (kind === 'bot' || kind === 'pre') d.bt = (d.bt || 0) + 1; else if (kind === 'srv') d.sv = (d.sv || 0) + 1;
|
||||
DIRTY = true;
|
||||
}
|
||||
function mergeInto(base, add) {
|
||||
for (const [sid, days] of Object.entries(add.d)) { const s = base.d[sid] = base.d[sid] || {};
|
||||
for (const [day, x] of Object.entries(days)) { const d = s[day] = s[day] || { b: {}, h: {}, u: {} };
|
||||
for (const [b, n] of Object.entries(x.b || {})) d.b[b] = (d.b[b] || 0) + n;
|
||||
for (const [h, m] of Object.entries(x.h || {})) { let hh = d.h[h]; if (!hh) { if (Object.keys(d.h).length >= HOSTS_CAP) { hh = d.h['(other)'] = d.h['(other)'] || {}; } else hh = d.h[h] = {}; } for (const [b, n] of Object.entries(m)) hh[b] = (hh[b] || 0) + n; }
|
||||
for (const [b, arr] of Object.entries(x.u || {})) { const u = d.u[b] = d.u[b] || []; for (const p of arr) if (u.length < UNIQ_CAP && !u.includes(p)) u.push(p); }
|
||||
if (x.bt) d.bt = (d.bt || 0) + x.bt; if (x.sv) d.sv = (d.sv || 0) + x.sv;
|
||||
if (x.z) { d.z = d.z || {}; for (const [h, zz] of Object.entries(x.z)) { let z = d.z[h]; if (!z) { const key = Object.keys(d.z).length >= HOSTS_CAP ? '(other)' : h; z = d.z[key] = d.z[key] || { r: 0, s: 0, k: {} }; }
|
||||
z.r += zz.r || 0; z.s += zz.s || 0; for (const [p, n] of Object.entries(zz.k || {})) if (z.k[p] != null || Object.keys(z.k).length < LOADERS_CAP) z.k[p] = (z.k[p] || 0) + n; } } } }
|
||||
return base;
|
||||
}
|
||||
function flush() {
|
||||
if (!DIRTY || !DATA_DIR) return; const add = PENDING; PENDING = { d: {} }; DIRTY = false;
|
||||
const base = mergeInto(C.read(), add); // read-add-write: another app copy's deltas (deploy overlap) are kept
|
||||
if (Date.now() - lastPrune > 3600000) { lastPrune = Date.now(); const cut = ctDay(Date.now() - 400 * DAY); const live = new Set(J.db.spins.map(s => String(s.id))); for (const sid of Object.keys(base.d)) { if (!live.has(sid)) { delete base.d[sid]; continue; } for (const day of Object.keys(base.d[sid])) if (day < cut) delete base.d[sid][day]; } }
|
||||
writeAtomic(C.FILE(), JSON.stringify(base)); C.db = base;
|
||||
}
|
||||
// counted impressions for one spin, flushed + pending, as { day: { b, h, u } }
|
||||
function countsOf(sid) { const out = {}; for (const src of [C.db.d[sid] || {}, PENDING.d[sid] || {}]) mergeInto({ d: { x: out } }, { d: { x: src } }); return out; }
|
||||
|
||||
// ── tiers ──
|
||||
async function tierFor(email) {
|
||||
const e = norm(email); if (!e) return none('Sign in first.');
|
||||
const grant = J.db.grants[e];
|
||||
let f = { ownBuy: false, buyers: 0 }; try { f = Object.assign(f, await FACTS(e)); } catch (er) {}
|
||||
const q = J.db.qual[e] || {}; const own = !!(f.ownBuy || q.own); const buyers = Math.max(Number(f.buyers) || 0, Number(q.buyers) || 0);
|
||||
if ((own && !q.own) || buyers > (Number(q.buyers) || 0)) { J.db.qual[e] = { own, buyers, ts: Date.now() }; J.save(); } // once seen, kept
|
||||
let key = !own ? null : buyers >= 5 ? 'leader' : buyers >= 2 ? 'builder' : 'starter';
|
||||
if (e === ADMIN) key = 'leader';
|
||||
if (grant && TIERS[grant] && (!key || ORDER.indexOf(grant) > ORDER.indexOf(key))) key = grant;
|
||||
if (!key) return Object.assign(none('Banner Spin opens with your own package of $25 or more. Buy one under Credits and it unlocks right away.'), { buyers, ownBuy: own });
|
||||
const t = TIERS[key]; const nx = TIERS[ORDER[ORDER.indexOf(key) + 1]];
|
||||
return { ok: true, key, label: t.label, spins: t.spins, banners: t.banners, ownBuy: own, buyers, granted: !!grant, next: nx ? { label: nx.label, spins: nx.spins, banners: nx.banners, need: nx.need } : null };
|
||||
}
|
||||
const none = reason => ({ ok: false, key: '', label: 'Locked', spins: 0, banners: 0, reason, next: { label: TIERS.starter.label, spins: TIERS.starter.spins, banners: TIERS.starter.banners, need: TIERS.starter.need } });
|
||||
|
||||
// ── member CRUD ──
|
||||
const mine = owner => J.db.spins.filter(s => s.owner === norm(owner));
|
||||
const findMine = (owner, id) => J.db.spins.find(s => s.id === Number(id) && s.owner === norm(owner)) || null;
|
||||
function cleanImage(owner, img) {
|
||||
const s = String(img || '').trim(); if (!s) return { error: 'Add the banner image: upload one or paste an https image address.' };
|
||||
const m = LOCAL_IMG.exec(s);
|
||||
if (m) { const rec = J.db.images[m[1]]; if (!rec || rec.owner !== norm(owner)) return { error: 'Upload that image again from this screen.' }; return { image: s, w: rec.w, h: rec.h, bytes: rec.bytes }; }
|
||||
const u = httpsUrl(s); if (!u) return { error: 'An image address must start with https://' };
|
||||
return { image: u, w: 0, h: 0, bytes: 0 };
|
||||
}
|
||||
function cleanTarget(owner, body) {
|
||||
if (body.link != null && String(body.link) !== '') { const rid = Number(body.link); const r = rotator && rotator.findMine ? rotator.findMine(owner, rid) : null; if (!r) return { error: 'Pick one of your own spin links.' }; return { target: '', link: rid }; }
|
||||
const u = httpsUrl(body.target); if (!u) return { error: 'Where should a click go? Paste an https:// address or pick one of your spin links.' };
|
||||
return { target: u, link: 0 };
|
||||
}
|
||||
const sizeWarn = (spin, w, h) => { const [W, H] = SIZES[spin.size]; return w && h && (w !== W || h !== H) ? 'This image is ' + w + 'x' + h + ' and this Banner Spin is ' + spin.size + '. It will be stretched to fit.' : ''; };
|
||||
function pub(s, extra) {
|
||||
const cl = {}; for (const c of J.db.clicks) if (c.s === s.id && !c.bot) { const o = cl[c.b] = cl[c.b] || { n: 0, m: 0 }; o.n++; if (c.m !== 'none' && c.m !== 'off') o.m++; }
|
||||
const cnt = countsOf(s.id); const imps = {}; const since = ctDay(Date.now() - 30 * DAY); const imps30 = {};
|
||||
for (const [day, d] of Object.entries(cnt)) for (const [b, n] of Object.entries(d.b)) { imps[b] = (imps[b] || 0) + n; if (day >= since) imps30[b] = (imps30[b] || 0) + n; }
|
||||
const sum = o => Object.values(o).reduce((a, b) => a + (typeof b === 'number' ? b : b.n), 0);
|
||||
const conv = J.db.conv.filter(c => c.s === s.id).length;
|
||||
return Object.assign({ id: s.id, code: s.code, name: s.name, size: s.size, mode: s.mode || 'weight', owner: s.owner, created: s.created, paused: !!s.paused, adminOff: !!s.adminOff, adminNote: s.adminNote || '',
|
||||
fallback: s.fallback || '', fallbackImage: s.fallbackImage || '', hours: s.hours || null, tz: s.tz || 'visitor', sourceId: s.sourceId || '',
|
||||
banners: s.banners.map(b => ({ id: b.id, label: b.label || '', image: b.image, w: b.w || 0, h: b.h || 0, bytes: b.bytes || 0, target: b.target || '', link: b.link || 0, weight: b.weight, active: !!b.active, adminOff: !!b.adminOff, hours: b.hours || null, added: b.added,
|
||||
imps: imps[b.id] || 0, imps30: imps30[b.id] || 0, clicks: (cl[b.id] || {}).n || 0, matched: (cl[b.id] || {}).m || 0, warn: sizeWarn(s, b.w, b.h),
|
||||
autoPaused: b.autoPaused || 0, health: b.health ? { state: b.health.state, note: b.health.note || '', checkedAt: b.health.checkedAt || 0, fails: b.health.fails || 0, image: b.health.image || null, target: b.health.target || null } : null })),
|
||||
imps: sum(imps), imps30: sum(imps30), fallbackImps: imps[0] || 0, clicks: sum(cl), matched: Object.values(cl).reduce((a, o) => a + o.m, 0), conversions: conv }, extra || {});
|
||||
}
|
||||
async function list(owner) { return mine(owner).map(s => pub(s)); }
|
||||
async function create(owner, body) {
|
||||
const t = await tierFor(owner); if (!t.ok) return { error: t.reason, tier: t };
|
||||
if (mine(owner).length >= t.spins) return { error: 'Your ' + t.label + ' tier holds ' + t.spins + ' Banner Spins.' + (t.next ? ' ' + t.next.label + ' (' + t.next.need + ') holds ' + t.next.spins + '.' : ''), tier: t };
|
||||
const name = String(body.name || '').trim().slice(0, 80); if (!name) return { error: 'Give the Banner Spin a name.' };
|
||||
const size = String(body.size || ''); if (!SIZES[size]) return { error: 'Pick one of the sizes: ' + Object.keys(SIZES).join(', ') + '.' };
|
||||
const s = { id: J.db.spins.reduce((m, x) => Math.max(m, x.id), 0) + 1, owner: norm(owner), name, code: newCode(), size, mode: body.mode === 'visitor' ? 'visitor' : 'weight', fallback: httpsUrl(body.fallback) || '', fallbackImage: '', banners: [], nextBanner: 1, paused: false, created: Date.now() };
|
||||
J.db.spins.push(s); J.save(); return { ok: true, spin: pub(s) };
|
||||
}
|
||||
async function update(owner, id, body) {
|
||||
const s = findMine(owner, id); if (!s) return { error: 'No such Banner Spin.' };
|
||||
if (body.remove) { J.db.spins = J.db.spins.filter(x => x !== s); J.save(); return { ok: true, removed: true }; }
|
||||
if (body.name != null) { const n = String(body.name).trim().slice(0, 80); if (n) s.name = n; }
|
||||
if (body.paused != null) s.paused = !!body.paused;
|
||||
if (body.mode != null) s.mode = body.mode === 'visitor' ? 'visitor' : 'weight';
|
||||
if (body.fallback != null) { const f = String(body.fallback).trim(); if (f && !httpsUrl(f)) return { error: 'The fallback must be an https:// address.' }; s.fallback = f ? httpsUrl(f) : ''; }
|
||||
if (body.fallbackImage != null) { const f = String(body.fallbackImage).trim(); if (!f) s.fallbackImage = ''; else { const im = cleanImage(owner, f); if (im.error) return im; s.fallbackImage = im.image; } }
|
||||
if (body.hours !== undefined) { const h = rotator.cleanHours(body.hours); if (h.error) return h; if (h.hours) s.hours = h.hours; else delete s.hours; }
|
||||
if (body.tz !== undefined) { const t = rotator.cleanTz(body.tz); if (t.error) return t; if (t.tz === 'visitor') delete s.tz; else s.tz = t.tz; }
|
||||
if (body.sourceId !== undefined) { const sid = String(body.sourceId || '').trim(); if (!sid) delete s.sourceId; else { if (!/^[a-f0-9]{10}$/.test(sid) || !SOURCES || !SOURCES.find(owner, sid)) return { error: 'No such source.' }; s.sourceId = sid; } }
|
||||
J.save(); return { ok: true, spin: pub(s) };
|
||||
}
|
||||
async function addBanner(owner, id, body) {
|
||||
const s = findMine(owner, id); if (!s) return { error: 'No such Banner Spin.' };
|
||||
const t = await tierFor(owner); const cap = Math.min(MAX_BANNERS, t.ok ? t.banners : 0);
|
||||
if (!t.ok) return { error: t.reason, tier: t };
|
||||
if (s.banners.length >= cap) return { error: 'Your ' + t.label + ' tier holds ' + cap + ' banners per Banner Spin.' + (t.next ? ' ' + t.next.label + ' (' + t.next.need + ') holds ' + t.next.banners + '.' : ''), tier: t };
|
||||
const im = cleanImage(owner, body.image); if (im.error) return im;
|
||||
const tg = cleanTarget(owner, body); if (tg.error) return tg;
|
||||
if (!im.w && body.w && body.h) { im.w = Math.min(4000, Math.max(0, Math.round(Number(body.w) || 0))); im.h = Math.min(4000, Math.max(0, Math.round(Number(body.h) || 0))); } // pasted image: the size the builder measured, for the warning only
|
||||
const b = { id: s.nextBanner++, label: String(body.label || '').trim().slice(0, 60), image: im.image, w: im.w, h: im.h, bytes: im.bytes, target: tg.target, link: tg.link, weight: Math.max(1, Math.min(100, Math.round(Number(body.weight) || 10))), active: true, added: Date.now() };
|
||||
s.banners.push(b); J.save(); return { ok: true, spin: pub(s), warn: sizeWarn(s, b.w, b.h) };
|
||||
}
|
||||
async function updateBanner(owner, id, bid, body) {
|
||||
const s = findMine(owner, id); if (!s) return { error: 'No such Banner Spin.' };
|
||||
const b = s.banners.find(x => x.id === Number(bid)); if (!b) return { error: 'No such banner.' };
|
||||
if (body.remove) { s.banners = s.banners.filter(x => x !== b); J.save(); return { ok: true, spin: pub(s) }; }
|
||||
if (body.weight != null) b.weight = Math.max(1, Math.min(100, Math.round(Number(body.weight) || 1)));
|
||||
if (body.active != null) { b.active = !!body.active; delete b.autoPaused; } // the owner's own pause / resume wins over the health checker
|
||||
if (body.label != null) b.label = String(body.label).trim().slice(0, 60);
|
||||
if (body.image != null) { const im = cleanImage(owner, body.image); if (im.error) return im; Object.assign(b, { image: im.image, w: im.w, h: im.h, bytes: im.bytes }); delete b.health; }
|
||||
if (body.target != null || body.link != null) { const tg = cleanTarget(owner, body); if (tg.error) return tg; b.target = tg.target; b.link = tg.link; delete b.health; }
|
||||
if (body.hours !== undefined) { const h = rotator.cleanHours(body.hours); if (h.error) return h; if (h.hours) b.hours = h.hours; else delete b.hours; }
|
||||
J.save(); return { ok: true, spin: pub(s) };
|
||||
}
|
||||
// an uploaded image (server.js checked type, magic and the 150 KB limit, and wrote the file): remember owner + size
|
||||
function noteImage(owner, name, w, h, bytes, mime) { J.db.images[name] = { owner: norm(owner), w, h, bytes, mime, ts: Date.now() }; J.save(); }
|
||||
|
||||
// image dimensions from the header bytes: PNG IHDR, GIF logical screen, JPEG SOFn
|
||||
function dims(buf, mime) {
|
||||
try {
|
||||
if (mime === 'image/png' && buf.length > 24) return { w: buf.readUInt32BE(16), h: buf.readUInt32BE(20) };
|
||||
if (mime === 'image/gif' && buf.length > 10) return { w: buf.readUInt16LE(6), h: buf.readUInt16LE(8) };
|
||||
if (mime === 'image/jpeg') { let i = 2; while (i + 9 < buf.length) { if (buf[i] !== 0xff) { i++; continue; } const mk = buf[i + 1]; const len = buf.readUInt16BE(i + 2);
|
||||
if (mk >= 0xc0 && mk <= 0xcf && mk !== 0xc4 && mk !== 0xc8 && mk !== 0xcc) return { h: buf.readUInt16BE(i + 5), w: buf.readUInt16BE(i + 7) }; i += 2 + len; } }
|
||||
} catch (e) {}
|
||||
return { w: 0, h: 0 };
|
||||
}
|
||||
|
||||
// ── serving ──
|
||||
const live = () => !J.db.settings.off;
|
||||
const byCode = code => J.db.spins.find(s => s.code === norm(code)) || null;
|
||||
function cellFor(s, req) { let country = ''; try { country = geo && geo.countryOf ? (geo.countryOf(ipOf(req)) || '') : ''; } catch (e) {} return { cell: rotator.cellAt(rotator.zoneFor(s, country)), country }; }
|
||||
function pick(s, cell, v) {
|
||||
const lv = s.banners.filter(b => b.active && !b.adminOff && rotator.isOn(b.hours, cell)); if (!lv.length) return null;
|
||||
const total = lv.reduce((n, b) => n + b.weight, 0);
|
||||
let x = s.mode === 'visitor' ? parseInt(crypto.createHash('sha256').update(v + '|' + s.id).digest('hex').slice(0, 8), 16) % total : crypto.randomInt(total);
|
||||
for (const b of lv) { x -= b.weight; if (x < 0) return b; } return lv[lv.length - 1];
|
||||
}
|
||||
// what to show right now: { banner, fallback, blank } plus the note/count side effects (count = false for an exact ?x= fetch)
|
||||
function choose(s, req, opts) {
|
||||
opts = opts || {};
|
||||
if (!live() || s.adminOff) return { blank: true };
|
||||
if (opts.x != null) { const b = s.banners.find(q => q.id === Number(opts.x) && !q.adminOff); return b ? { banner: b } : { blank: true }; }
|
||||
const v = vkey(req); const { cell } = cellFor(s, req);
|
||||
const off = s.paused || !rotator.isOn(s.hours, cell);
|
||||
const b = off ? null : pick(s, cell, v);
|
||||
const out = b ? { banner: b } : (s.fallbackImage ? { fallback: true } : { blank: true, fallback: true });
|
||||
const kind = loaderKind(req); rawLoad(String(s.id), hostOf(req), v, kind);
|
||||
if (!kind) {
|
||||
const bid = b ? b.id : 0; const host = hostOf(req);
|
||||
note(v, s.id, host, bid);
|
||||
const k = v + '|' + s.id + '|' + bid; const last = SEEN.get(k);
|
||||
if (!last || Date.now() - last >= DEDUPE_MS) { SEEN.set(k, Date.now()); bump(String(s.id), bid, host, v); }
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// the image source for a choice: { local: name } | { url } | { blank: [w, h] }
|
||||
function sourceOf(s, ch) {
|
||||
const img = ch.banner ? ch.banner.image : ch.fallback && s.fallbackImage ? s.fallbackImage : '';
|
||||
if (!img) return { blank: SIZES[s.size] };
|
||||
const m = LOCAL_IMG.exec(img); return m ? { local: m[1] } : { url: img };
|
||||
}
|
||||
async function image(code, req, x) { const s = byCode(code); if (!s) return null; const ch = choose(s, req, { x }); return Object.assign({ size: SIZES[s.size] }, sourceOf(s, ch)); }
|
||||
|
||||
// the script embed: picks, counts and writes the banner with its own click link (exact match)
|
||||
async function script(code, req, base) {
|
||||
const s = byCode(code); if (!s) return null;
|
||||
const ch = choose(s, req); const [w, h] = SIZES[s.size];
|
||||
const x = ch.banner ? ch.banner.id : 0;
|
||||
const src = ch.banner && !LOCAL_IMG.test(ch.banner.image) ? ch.banner.image : base + '/i/' + s.code + '.gif' + (x ? '?x=' + x : '?x=0');
|
||||
const href = base + '/c/' + s.code + '?x=' + x;
|
||||
const html = '<a href="' + href.replace(/"/g, '"') + '" target="_blank" rel="noopener"><img src="' + src.replace(/"/g, '"') + '" width="' + w + '" height="' + h + '" alt="" style="border:0;max-width:100%;height:auto"></a>';
|
||||
const js = JSON.stringify(html).replace(/</g, '\\u003c');
|
||||
return '(function(){var h=' + js + ',s=document.currentScript;if(!s){var a=document.getElementsByTagName("script");for(var i=a.length-1;i>=0;i--){if((a[i].src||"").indexOf("/s/' + s.code + '.js")>-1){s=a[i];break;}}}var d=document.createElement("span");d.innerHTML=h;if(s&&s.parentNode){s.parentNode.insertBefore(d.firstChild,s.nextSibling);}else{document.write(h);}})();';
|
||||
}
|
||||
|
||||
// the click: { url, lsid } or null (unknown code). reqHost = the link domain the click came in on (spin-link targets stay on it).
|
||||
async function click(code, req, reqHost) {
|
||||
const s = byCode(code); if (!s) return null;
|
||||
const bot = isBot(req) ? 1 : 0; const h = hostOf(req); const keys = vkeys(req);
|
||||
const u = new URL(req.url, 'http://x'); const xs = u.searchParams.get('x');
|
||||
let b = null, m = 'none';
|
||||
if (!live() || s.adminOff) m = 'off';
|
||||
else if (xs != null && /^\d{1,4}$/.test(xs)) { b = Number(xs) ? s.banners.find(q => q.id === Number(xs) && !q.adminOff) || null : null; m = 'exact'; }
|
||||
else { const n = findNote(keys, s.id, h); if (n) { b = n.b ? s.banners.find(q => q.id === n.b && !q.adminOff) || null : null; m = 'note'; } }
|
||||
// where to: the banner's target (its spin link, on the same link domain), else the fallback
|
||||
let url = null;
|
||||
if (b) { if (b.link) { const r = rotator && rotator.rawRotations ? rotator.rawRotations().find(x => x.id === b.link && x.owner === s.owner) : null; url = r ? 'https://' + (reqHost || 'linkspin.app') + '/r/' + r.code : null; } else url = b.target; }
|
||||
if (!url) { url = s.fallback || null; if (b) b = null; }
|
||||
if (!url) { const first = s.banners.find(q => q.active && !q.adminOff && q.target); url = first ? first.target : null; } // no fallback set: the first live banner beats a dead end
|
||||
let country = ''; try { country = geo && geo.countryOf ? (geo.countryOf(ipOf(req)) || '') : ''; } catch (e) {}
|
||||
const ua = String(req.headers['user-agent'] || ''); const device = /mobile|android|iphone|ipad/i.test(ua) ? 'mobile' : 'desktop';
|
||||
const q = {}; { let n = 0; for (const [k, val] of u.searchParams) { const key = String(k).toLowerCase(); if (n >= 20) break; if (/^(clickid|click_id|cid|subid|sub_id|s[1-5]|sub[1-5]|t[1-5]|aff_sub[1-5]?|utm_(source|medium|campaign|term|content)|src|source|campaign|zone|placement|cost|creative|site|banner|keyword|geo|os|browser|device|carrier|format|external_id|visitor_id)$/.test(key)) { q[key] = String(val).slice(0, 200); n++; } } }
|
||||
const id = 'k' + crypto.randomBytes(6).toString('hex').slice(0, 11);
|
||||
J.db.clicks.push({ id, s: s.id, b: b ? b.id : 0, ts: Date.now(), v: keys[0], h: h || undefined, m, bot, c: country || undefined, dv: device, q: Object.keys(q).length ? q : undefined, sr: s.sourceId || undefined });
|
||||
if (J.db.clicks.length > 200000) J.db.clicks = J.db.clicks.slice(-150000);
|
||||
J.save();
|
||||
if (url) {
|
||||
const vals = { clickid: q.clickid || q.cid || q.click_id || '', subid: q.subid || q.sub_id || q.s1 || '', s1: q.s1 || q.sub1 || '', s2: q.s2 || q.sub2 || '', s3: q.s3 || q.sub3 || '', s4: q.s4 || q.sub4 || '', s5: q.s5 || q.sub5 || '', source: h || 'direct', country, device, lsid: id, code: s.code };
|
||||
for (const [k, val] of Object.entries(q)) if (vals[k] == null) vals[k] = val;
|
||||
url = url.replace(/\{([a-z0-9_]{1,24})\}/gi, (mm, k) => encodeURIComponent(vals[k.toLowerCase()] == null ? '' : vals[k.toLowerCase()]));
|
||||
try { const t = new URL(url); if (OWN_HOSTS().includes(t.hostname.toLowerCase()) && !t.searchParams.has('lsid') && !/^\/r\//.test(t.pathname)) { t.searchParams.set('lsid', id); url = t.toString(); } } catch (e) {}
|
||||
// straight to a page: the click id rides along for the landing tag (a spin-link target adds its own on the /r/ hop)
|
||||
if (!bot) { let spinHop = false; try { spinHop = /^\/r\/[a-z0-9]{4,12}$/i.test(new URL(url).pathname); } catch (e) {} if (!spinHop) { try { if (WANTS_CLICK_ID(s.owner)) url = WITH_CLICK_ID(url, id); } catch (e) {} } }
|
||||
}
|
||||
return { url, lsid: id, banner: b, matched: m, owner: s.owner };
|
||||
}
|
||||
// conversion pixel (2026-10-26): a Banner Spin click by id, with its Banner Spin, banner and where it went
|
||||
function clickById(id) {
|
||||
id = String(id || ''); if (!/^k[a-f0-9]{11}$/.test(id)) return null;
|
||||
const list = J.db.clicks; let c = null; for (let i = list.length - 1; i >= 0; i--) if (list[i].id === id) { c = list[i]; break; }
|
||||
if (!c) return null;
|
||||
const s = J.db.spins.find(x => x.id === c.s); if (!s) return null;
|
||||
const b = c.b ? s.banners.find(x => x.id === c.b) || null : null;
|
||||
return { click: c, owner: s.owner, spin: { id: s.id, code: s.code, name: s.name || '' }, banner: b ? { id: b.id, label: b.label || '' } : null, destUrl: b && !b.link ? (b.target || '') : (b ? '' : (s.fallback || '')) };
|
||||
}
|
||||
// conversions (rotator.convert falls through to here for a 'k' click id): dedupe per click + event
|
||||
async function convert(lsid, ev, facts) {
|
||||
const c = J.db.clicks.find(x => x.id === String(lsid)); if (!c) return null;
|
||||
const s = J.db.spins.find(x => x.id === c.s); if (!s) return null;
|
||||
if (!J.db.conv.some(x => x.lsid === c.id && x.ev === ev)) { J.db.conv.push({ lsid: c.id, s: s.id, b: c.b, ev, ts: Date.now(), value: Number(facts && facts.payout || 0) || 0, label: facts && facts.label ? String(facts.label).slice(0, 40) : undefined, sr: c.sr || undefined }); if (J.db.conv.length > 100000) J.db.conv = J.db.conv.slice(-80000); J.save(); }
|
||||
return { owner: s.owner, code: s.code, rotationId: 0, bannerSpinId: s.id, bannerId: c.b, q: c.q || {}, s: c.h || 'direct', c: c.c || '', dv: c.dv, sourceId: c.sr || '' };
|
||||
}
|
||||
|
||||
// ── stats (phase 3, 2026-10-20): one aggregation for the builder's Stats tab and the Reports screen ──
|
||||
// Views are the counted impressions (bots, prefetches and servers left out); bots and server loads are reported beside
|
||||
// them. Clicks are rows (bots flagged), so day / country / device come from human clicks, the same way spin links report.
|
||||
// sinceTs = 0 means all time (the builder); Reports passes its range. Day keys are Central time.
|
||||
const WIN_MIN = 1000; // a winner needs this many views on every banner it is compared with
|
||||
const ctrOf = o => o.imps ? Math.round(o.clicks / o.imps * 10000) / 100 : null;
|
||||
const mrOf = o => o.clicks ? Math.round(o.matched / o.clicks * 100) : null;
|
||||
function agg(spins, sinceTs) {
|
||||
const sinceDay = sinceTs ? ctDay(sinceTs) : '';
|
||||
const ids = new Set(spins.map(s => s.id));
|
||||
const blank = () => ({ imps: 0, clicks: 0, matched: 0, unmatched: 0, uniq: 0, conv: 0, bots: 0, botClicks: 0, srv: 0, raw: 0, top: {} });
|
||||
const at = (o, k) => (o[k] = o[k] || blank());
|
||||
const per = {}, hosts = {}, days = {}, T = blank();
|
||||
for (const s of spins) for (const [day, d] of Object.entries(countsOf(s.id))) {
|
||||
if (sinceDay && day < sinceDay) continue;
|
||||
const dd = at(days, day);
|
||||
for (const [b, n] of Object.entries(d.b || {})) { at(per, s.id + ':' + b).imps += n; dd.imps += n; T.imps += n; }
|
||||
for (const [b, arr] of Object.entries(d.u || {})) { at(per, s.id + ':' + b).uniq += arr.length; dd.uniq += arr.length; T.uniq += arr.length; }
|
||||
for (const [h, m] of Object.entries(d.h || {})) for (const n of Object.values(m)) at(hosts, h).imps += n;
|
||||
dd.bots += d.bt || 0; T.bots += d.bt || 0; dd.srv += d.sv || 0; T.srv += d.sv || 0;
|
||||
for (const [h, z] of Object.entries(d.z || {})) { const o = at(hosts, h); o.raw += z.r || 0; o.srv += z.s || 0; for (const [k, n] of Object.entries(z.k || {})) o.top[k] = (o.top[k] || 0) + n; }
|
||||
}
|
||||
const country = {}, device = {};
|
||||
for (const c of J.db.clicks) {
|
||||
if (!ids.has(c.s) || (sinceTs && c.ts < sinceTs)) continue;
|
||||
const dd = at(days, ctDay(c.ts));
|
||||
if (c.bot) { T.botClicks++; dd.botClicks++; continue; }
|
||||
const ok = c.m === 'exact' || c.m === 'note';
|
||||
for (const o of [at(per, c.s + ':' + c.b), at(hosts, c.h || '(none)'), dd, T]) { o.clicks++; if (ok) o.matched++; else if (c.m === 'none') o.unmatched++; }
|
||||
const k = c.c || '(none)'; country[k] = (country[k] || 0) + 1; const dv = c.dv || '(none)'; device[dv] = (device[dv] || 0) + 1;
|
||||
}
|
||||
const convBy = {};
|
||||
for (const c of J.db.conv) { if (!ids.has(c.s) || (sinceTs && c.ts < sinceTs)) continue; at(per, c.s + ':' + c.b).conv++; T.conv++; at(days, ctDay(c.ts)).conv++; const k = c.ev + (c.label ? ' · ' + c.label : ''); convBy[k] = (convBy[k] || 0) + 1; }
|
||||
return { per, hosts, days, T, country, device, convBy };
|
||||
}
|
||||
// the "caches banners" flag: a placement whose image loads come from a server instead of browsers, or whose clicks
|
||||
// cannot be tied to a view (a copied image never asks us, so the click arrives with no note). '' when it looks normal.
|
||||
function cacheFlag(o) {
|
||||
if (o.srv >= 5 && o.srv >= o.raw * 0.5) return 'Most image loads here come from a server, not a browser (' + o.srv + ' of ' + o.raw + '). This site most likely copies banners to its own server, so the rotation is frozen there.';
|
||||
const top = Math.max(0, ...Object.values(o.top || {}));
|
||||
if (o.raw >= 50 && top >= o.raw * 0.8 && o.clicks <= o.raw * 0.01) return 'One loader made ' + Math.round(top / o.raw * 100) + '% of the ' + o.raw + ' image loads here and almost nobody clicks. This site most likely caches banners, so the rotation is frozen there.';
|
||||
// more clicks than views alone is not enough (one visitor's reloads count once a minute, clicks are not deduped): a copy also leaves the clicks unmatched
|
||||
if (o.clicks >= 10 && o.clicks > o.imps && o.matched / o.clicks < 0.5) return 'More clicks (' + o.clicks + ') than views we served (' + o.imps + '). This site shows a copy of the banner, so the rotation is frozen there and clicks go to the fallback.';
|
||||
if (o.clicks >= 10 && o.matched / o.clicks < 0.3) return 'Only ' + Math.round(o.matched / o.clicks * 100) + '% of clicks here match a view. This site most likely caches banners, so the rotation is frozen there.';
|
||||
return '';
|
||||
}
|
||||
// winner: among the live banners of one Banner Spin with at least WIN_MIN views each, the one with the best CTR (strictly ahead)
|
||||
function winnerOf(rows) {
|
||||
const q = rows.filter(r => r.imps >= WIN_MIN && r.ctr != null).sort((a, b) => b.ctr - a.ctr);
|
||||
return q.length >= 2 && q[0].ctr > q[1].ctr ? q[0].id : 0;
|
||||
}
|
||||
const listOf = m => Object.entries(m).sort((a, b) => b[1] - a[1]).slice(0, 12).map(([k, n]) => ({ k, n }));
|
||||
const dayRows = (days, sinceDay) => Object.entries(days).filter(([d]) => !sinceDay || d >= sinceDay).sort().map(([day, o]) => ({ day, imps: o.imps, clicks: o.clicks, bots: o.bots, botClicks: o.botClicks, servers: o.srv, conv: o.conv }));
|
||||
const placementRows = hosts => Object.entries(hosts).map(([host, o]) => ({ host, imps: o.imps, clicks: o.clicks, ctr: ctrOf(o), matchRate: mrOf(o), loads: o.raw, serverLoads: o.srv, caches: cacheFlag(o) }))
|
||||
.filter(p => p.imps || p.clicks || p.loads).sort((a, b) => b.imps - a.imps || b.clicks - a.clicks).slice(0, 30);
|
||||
|
||||
async function stats(owner, id) {
|
||||
const s = findMine(owner, id); if (!s) return null;
|
||||
const A = agg([s], 0); const z = blank0();
|
||||
const banners = s.banners.map(b => { const o = A.per[s.id + ':' + b.id] || z; return { id: b.id, label: b.label || '', image: b.image, active: !!b.active, imps: o.imps, uniques: o.uniq, clicks: o.clicks, matched: o.matched, ctr: ctrOf(o), matchRate: mrOf(o), conversions: o.conv }; });
|
||||
const win = winnerOf(banners.filter(b => b.active)); for (const b of banners) b.winner = b.id === win;
|
||||
const fb = A.per[s.id + ':0'] || z;
|
||||
return { spin: pub(s), totals: { imps: A.T.imps, clicks: A.T.clicks, ctr: ctrOf(A.T), matchRate: mrOf(A.T), matched: A.T.matched, unmatched: A.T.unmatched, uniquesSampled: A.T.uniq, conversions: A.T.conv, bots: A.T.botClicks, botLoads: A.T.bots, serverLoads: A.T.srv },
|
||||
banners, winner: win, winMin: WIN_MIN, fallback: { imps: fb.imps, clicks: fb.clicks, ctr: ctrOf(fb) },
|
||||
placements: placementRows(A.hosts), days: dayRows(A.days, ctDay(Date.now() - 30 * DAY)), country: listOf(A.country), device: listOf(A.device),
|
||||
conversions: Object.entries(A.convBy).sort((a, b) => b[1] - a[1]).map(([k, n]) => ({ k, n })) };
|
||||
}
|
||||
const blank0 = () => ({ imps: 0, clicks: 0, matched: 0, unmatched: 0, uniq: 0, conv: 0 });
|
||||
// Reports screen: every Banner Spin the member owns over the last `days`, totals + per banner + per placement + day / country / device
|
||||
async function summary(owner, days) {
|
||||
const list = mine(owner); const n = Math.max(1, Math.min(365, Number(days) || 30)); const since = Date.now() - n * DAY;
|
||||
const A = agg(list, since); const z = blank0(); const banners = [];
|
||||
for (const s of list) {
|
||||
const rows = s.banners.map(b => { const o = A.per[s.id + ':' + b.id] || z; return { spinId: s.id, spin: s.name, code: s.code, size: s.size, id: b.id, label: b.label || 'Banner ' + b.id, image: b.image, active: !!b.active, autoPaused: !!b.autoPaused, imps: o.imps, uniques: o.uniq, clicks: o.clicks, ctr: ctrOf(o), matchRate: mrOf(o), conversions: o.conv }; });
|
||||
const win = winnerOf(rows.filter(r => r.active)); for (const r of rows) { r.winner = r.id === win; banners.push(r); }
|
||||
}
|
||||
banners.sort((a, b) => b.imps - a.imps || b.clicks - a.clicks);
|
||||
const spins = list.map(s => { let imps = 0, clicks = 0, conv = 0; for (const b of s.banners.concat([{ id: 0 }])) { const o = A.per[s.id + ':' + b.id]; if (o) { imps += o.imps; clicks += o.clicks; conv += o.conv; } } return { id: s.id, name: s.name, code: s.code, size: s.size, imps, clicks, ctr: imps ? Math.round(clicks / imps * 10000) / 100 : null, conversions: conv }; }).sort((a, b) => b.imps - a.imps);
|
||||
return { count: list.length, totals: { imps: A.T.imps, uniques: A.T.uniq, clicks: A.T.clicks, ctr: ctrOf(A.T), matchRate: mrOf(A.T), matched: A.T.matched, unmatched: A.T.unmatched, conversions: A.T.conv, bots: A.T.bots, botClicks: A.T.botClicks, serverLoads: A.T.srv },
|
||||
days: dayRows(A.days, ctDay(since)), country: listOf(A.country), device: listOf(A.device), banners: banners.slice(0, 50), placements: placementRows(A.hosts), spins, winMin: WIN_MIN,
|
||||
conversions: Object.entries(A.convBy).sort((a, b) => b[1] - a[1]).map(([k, c]) => ({ k, n: c })) };
|
||||
}
|
||||
|
||||
// ── admin ──
|
||||
function adminAll() {
|
||||
const cl = {}; for (const c of J.db.clicks) if (!c.bot) cl[c.s] = (cl[c.s] || 0) + 1;
|
||||
return J.db.spins.map(s => { let imps = 0; for (const d of Object.values(countsOf(s.id))) for (const n of Object.values(d.b)) imps += n;
|
||||
return { id: s.id, code: s.code, name: s.name, owner: s.owner, size: s.size, mode: s.mode || 'weight', created: s.created, paused: !!s.paused, adminOff: !!s.adminOff, adminNote: s.adminNote || '', fallback: s.fallback || '', fallbackImage: s.fallbackImage || '', sourceId: s.sourceId || '', dayparted: !!s.hours,
|
||||
banners: s.banners.map(b => ({ id: b.id, label: b.label || '', image: b.image, target: b.target || '', link: b.link || 0, weight: b.weight, active: !!b.active, adminOff: !!b.adminOff })), imps, clicks: cl[s.id] || 0, conversions: J.db.conv.filter(c => c.s === s.id).length }; });
|
||||
}
|
||||
function adminSet(id, body) {
|
||||
const s = J.db.spins.find(x => x.id === Number(id)); if (!s) return { error: 'No such Banner Spin.' };
|
||||
const nt = body.note != null ? String(body.note).slice(0, 200) : null;
|
||||
if (body.bannerId != null) { const b = s.banners.find(x => x.id === Number(body.bannerId)); if (!b) return { error: 'No such banner.' }; if (body.off != null) b.adminOff = !!body.off; if (nt != null) b.adminNote = nt; }
|
||||
else { if (body.off != null) s.adminOff = !!body.off; if (nt != null) s.adminNote = nt; }
|
||||
J.save(); return { ok: true, spin: adminAll().find(x => x.id === s.id) };
|
||||
}
|
||||
function setGlobal(body) { if (body.off != null) J.db.settings.off = !!body.off; if (body.grant && body.email) { const e = norm(body.email); if (body.grant === 'none') delete J.db.grants[e]; else if (TIERS[body.grant]) J.db.grants[e] = body.grant; else return { error: 'Grant is starter, builder, leader or none.' }; } J.save(); return { ok: true, off: !!J.db.settings.off, grants: J.db.grants }; }
|
||||
function settings() { return { off: !!J.db.settings.off, grants: J.db.grants }; }
|
||||
// image files Banner Spins use, for the admin upload list (file name -> owner + where)
|
||||
function imageRefs() { const out = {}; for (const s of J.db.spins) for (const im of s.banners.map(b => b.image).concat(s.fallbackImage || [])) { const m = LOCAL_IMG.exec(im || ''); if (m) out[m[1]] = { email: s.owner, where: 'Banner Spin ' + s.code }; } for (const [n, r] of Object.entries(J.db.images)) if (!out[n]) out[n] = { email: r.owner, where: '' }; return out; }
|
||||
function totals() { return { spins: J.db.spins.length, banners: J.db.spins.reduce((n, s) => n + s.banners.length, 0), clicks: J.db.clicks.length }; }
|
||||
|
||||
// a transparent PNG at the exact banner size, for the blank image (admin off, nothing to show); cached per size
|
||||
const BLANK = new Map();
|
||||
function crc32(buf) { let c, crc = 0xffffffff; for (let n = 0; n < buf.length; n++) { c = (crc ^ buf[n]) & 0xff; for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; crc = (crc >>> 8) ^ c; } return (crc ^ 0xffffffff) >>> 0; }
|
||||
function blankPng(w, h) {
|
||||
const key = w + 'x' + h; if (BLANK.has(key)) return BLANK.get(key);
|
||||
const zlib = require('zlib'); const chunk = (type, data) => { const len = Buffer.alloc(4); len.writeUInt32BE(data.length); const td = Buffer.concat([Buffer.from(type), data]); const crc = Buffer.alloc(4); crc.writeUInt32BE(crc32(td)); return Buffer.concat([len, td, crc]); };
|
||||
const ihdr = Buffer.alloc(13); ihdr.writeUInt32BE(w, 0); ihdr.writeUInt32BE(h, 4); ihdr[8] = 8; ihdr[9] = 6; ihdr[10] = 0; ihdr[11] = 0; ihdr[12] = 0; // 8-bit RGBA, all zero = transparent
|
||||
const raw = Buffer.alloc((w * 4 + 1) * h); // filter byte 0 + transparent pixels per row
|
||||
const png = Buffer.concat([Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]), chunk('IHDR', ihdr), chunk('IDAT', zlib.deflateSync(raw, { level: 9 })), chunk('IEND', Buffer.alloc(0))]);
|
||||
BLANK.set(key, png); return png;
|
||||
}
|
||||
// hot uploaded images in memory (each at most 150 KB, 32 MB in all)
|
||||
const IMG = new Map(); let IMG_BYTES = 0;
|
||||
function readImage(name) {
|
||||
const hit = IMG.get(name); if (hit) { IMG.delete(name); IMG.set(name, hit); return hit; }
|
||||
let buf; try { buf = fs.readFileSync(path.join(UPLOADS_DIR, name)); } catch (e) { return null; }
|
||||
const rec = { buf, mime: MIME[name.split('.').pop()] || 'application/octet-stream' };
|
||||
if (buf.length <= MAX_BYTES) { IMG.set(name, rec); IMG_BYTES += buf.length; while (IMG_BYTES > 32 * 1024 * 1024) { const [k, v] = IMG.entries().next().value; IMG.delete(k); IMG_BYTES -= v.buf.length; } }
|
||||
return rec;
|
||||
}
|
||||
// raw access for health.js (phase 3): the same store and save, and where a banner image lives ({ file } on disk or { url })
|
||||
const rawSpins = () => J.db.spins;
|
||||
const save = () => J.save();
|
||||
function imageSource(img) { const m = LOCAL_IMG.exec(String(img || '')); return m ? { file: path.join(UPLOADS_DIR, m[1]) } : /^https:\/\//i.test(String(img || '')) ? { url: String(img) } : null; }
|
||||
const _test = { notes: () => NOTES, flush, vkey, cacheFlag, winnerOf };
|
||||
module.exports = { init, SIZES, TIERS, MAX_BYTES, tierFor, list, create, update, addBanner, updateBanner, noteImage, dims, image, script, click, clickById, convert, stats, summary, adminAll, adminSet, setGlobal, settings, imageRefs, totals, blankPng, readImage, flush, findMine, rawSpins, save, imageSource, live, _test };
|
||||
@@ -4,6 +4,7 @@
|
||||
// /sitemap.xml, /robots.txt. SEO per post: title, description, canonical, Open Graph, Twitter
|
||||
// card, article dates, BlogPosting JSON-LD, breadcrumb JSON-LD, internal links, related posts.
|
||||
const { SITE_URL } = require('./host');
|
||||
const themehead = require('./themehead'); // light/dark theme head script (2026-11-01)
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const db = require('./db');
|
||||
@@ -97,19 +98,19 @@ async function bumpViews(slug) { try { await impl().bumpViews(slug); } catch (e)
|
||||
function head(o) {
|
||||
const url = SITE + o.path;
|
||||
const img = o.image ? (o.image.startsWith('http') ? o.image : SITE + o.image) : SITE + '/banners/iap-hero-1200x630.png';
|
||||
return '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">'
|
||||
return '<!doctype html><html lang="en"' + themehead.htmlAttr('dark') + '><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">'
|
||||
+ '<title>' + esc(o.title) + '</title><meta name="description" content="' + esc(o.desc) + '"><link rel="canonical" href="' + esc(url) + '">'
|
||||
+ '<meta name="robots" content="index,follow,max-image-preview:large"><meta name="theme-color" content="#043b2f">'
|
||||
+ '<meta property="og:type" content="' + (o.article ? 'article' : 'website') + '"><meta property="og:site_name" content="LinkSpin"><meta property="og:title" content="' + esc(o.title) + '"><meta property="og:description" content="' + esc(o.desc) + '"><meta property="og:url" content="' + esc(url) + '"><meta property="og:image" content="' + esc(img) + '">'
|
||||
+ (o.article ? '<meta property="article:published_time" content="' + new Date(o.article.publishedAt || o.article.created).toISOString() + '"><meta property="article:modified_time" content="' + new Date(o.article.updated).toISOString() + '"><meta property="article:author" content="' + esc(AUTHOR) + '">' + (o.article.tags || []).map(t => '<meta property="article:tag" content="' + esc(t) + '">').join('') : '')
|
||||
+ '<meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="' + esc(o.title) + '"><meta name="twitter:description" content="' + esc(o.desc) + '"><meta name="twitter:image" content="' + esc(img) + '">'
|
||||
+ '<link rel="alternate" type="application/rss+xml" title="LinkSpin blog" href="' + SITE + '/blog/feed.xml"><link rel="icon" type="image/png" href="/logo-icon.png">'
|
||||
+ '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap"><link rel="stylesheet" href="/assets/site.css?v=20260912b">'
|
||||
+ '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">' + themehead.tag() + '<link rel="stylesheet" href="/assets/site.css?v=ls20261101t">'
|
||||
+ '<style>.bl{max-width:760px}.bl h1{font-size:clamp(30px,4.6vw,44px);line-height:1.12;margin:10px 0 12px}.bl .meta{color:var(--muted);font-size:14px;margin:0 0 22px}.bl .cover{width:100%;border-radius:14px;border:1px solid var(--line);margin:0 0 26px;display:block}.bl article{font-size:17.5px;line-height:1.7}.bl article p{margin:0 0 18px;max-width:68ch}.bl article h2{font-size:26px;margin:36px 0 12px}.bl article h3{font-size:20px;margin:28px 0 10px}.bl article ul,.bl article ol{margin:0 0 18px 22px;max-width:66ch}.bl article li{margin:6px 0}.bl article blockquote{border-left:4px solid var(--mint);margin:0 0 18px;padding:8px 18px;color:var(--muted);font-style:italic}.bl article img{max-width:100%;border-radius:12px;border:1px solid var(--line)}.bl article a{color:var(--mint)}.bl article pre{background:rgba(4,8,7,.6);border:1px solid var(--line);border-radius:10px;padding:14px;overflow:auto;font-size:14px}.bl article table{border-collapse:collapse;width:100%;font-size:15px}.bl article th,.bl article td{border-bottom:1px solid var(--line);padding:8px 10px;text-align:left}.tags a{display:inline-block;font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--mint);border:1px solid rgba(67,232,195,.4);border-radius:999px;padding:3px 10px;margin:0 6px 6px 0;text-decoration:none}.post-card{display:block;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:20px 22px;margin:0 0 14px;color:inherit;text-decoration:none}.post-card:hover{border-color:var(--mint)}.post-card h2{font-size:22px;margin:0 0 6px}.post-card p{margin:0;color:var(--muted);font-size:15px;max-width:70ch}.post-card .meta{margin:8px 0 0;font-size:13px}.author{display:flex;gap:14px;align-items:center;border:1px solid var(--line);border-radius:14px;padding:16px 18px;margin:36px 0 0;background:var(--panel)}.author img{width:56px;height:56px;border-radius:50%;object-fit:cover}.author b{display:block}.author span{color:var(--muted);font-size:14px}.share a{margin-right:14px;font-size:14px}.pager{display:flex;justify-content:space-between;margin:26px 0}.related{margin-top:40px}.related h3{margin-bottom:10px}</style>'
|
||||
+ '</head><body><div class="wrap bl">';
|
||||
}
|
||||
function tail() {
|
||||
return '</div><script src="/assets/common.js?v=20260914a"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
|
||||
return '</div><script src="/assets/common.js?v=20261101t"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
|
||||
}
|
||||
const authorBox = () => '<div class="author"><img src="/logo-icon.png" alt="LinkSpin"><div><b>' + AUTHOR + '</b><span>Founder of LinkSpin and the Crypto Team Build Network. Twenty-plus years of internet marketing, and a habit of writing down what actually worked.</span></div></div>';
|
||||
const cardHtml = p => '<a class="post-card" href="/blog/' + esc(p.slug) + '">' + (p.cover ? '<img src="' + esc(p.cover) + '" alt="" loading="lazy" style="width:100%;border-radius:10px;margin:0 0 12px">' : '') + '<h2>' + esc(p.title) + '</h2><p>' + esc(p.excerpt) + '</p><p class="meta">' + fmtDate(p.publishedAt || p.created) + ' · ' + readMinutes(p.body) + ' min read' + (p.tags.length ? ' · ' + p.tags.map(esc).join(', ') : '') + '</p></a>';
|
||||
@@ -153,7 +154,7 @@ function rss(posts) {
|
||||
return '<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>LinkSpin blog</title><link>' + SITE + '/blog</link><description>Coaching and teaching articles from Marty Bostick.</description>' + items + '</channel></rss>';
|
||||
}
|
||||
function sitemap(posts) {
|
||||
const pages = ['/', '/blog', '/whats-new', '/leaderboard', '/ledger', '/contract', '/plays', '/wallets', '/earning', '/partners', '/publishers'];
|
||||
const pages = ['/', '/blog', '/whats-new', '/leaderboard', '/ledger', '/contract', '/plays', '/wallets', '/earning', '/partners', '/publishers', '/refuel', '/conversion-tracking'];
|
||||
const u = pages.map(p => '<url><loc>' + SITE + p + '</loc><changefreq>weekly</changefreq></url>').join('')
|
||||
+ posts.map(p => '<url><loc>' + SITE + '/blog/' + p.slug + '</loc><lastmod>' + new Date(p.updated).toISOString().slice(0, 10) + '</lastmod><changefreq>monthly</changefreq></url>').join('');
|
||||
return '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' + u + '</urlset>';
|
||||
|
||||
@@ -15,12 +15,24 @@ let ethers = null; try { ethers = require('ethers'); } catch (e) {}
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
let X = {}; // { dataDir, accounts, registry, chain, mailer, messages, siteConfig, adminEmail }
|
||||
let X = {}; // { dataDir, accounts, registry, chain, mailer, messages, siteConfig, adminEmail, tankGate, claim, payoutBlocked, sendActivate + now (tests) }
|
||||
const DAY = 86400000;
|
||||
const ABI = ['function activateFor(address account, uint32 sponsorId) returns (uint32)', 'function engineSigner() view returns (address)'];
|
||||
const norm = e => String(e || '').trim().toLowerCase();
|
||||
|
||||
function init(opts) { X = opts; }
|
||||
|
||||
// ---- sponsor-follow guards (2026-10-22, sponsorfollow.js) ----
|
||||
// hold(emails): an InstantAdPay registry batch is being applied for these people; an activation that starts meanwhile
|
||||
// (a wallet arriving in the same batch fires onWalletLinked) waits until the batch is done and then re-reads the account,
|
||||
// so it binds the sponsor the batch settled on, never the one from before it.
|
||||
// isBinding(email): an engine activation for this person is in flight; the follow rule treats them as binding (bound).
|
||||
const holds = new Map(); const inflight = new Set();
|
||||
function hold(emails) { for (const e of emails || []) { const k = norm(e); if (k) holds.set(k, (holds.get(k) || 0) + 1); } }
|
||||
function unhold(emails) { for (const e of emails || []) { const k = norm(e); const c = (holds.get(k) || 0) - 1; if (c > 0) holds.set(k, c); else holds.delete(k); } }
|
||||
const isHeld = email => holds.has(norm(email));
|
||||
const isBinding = email => inflight.has(norm(email));
|
||||
async function waitUnheld(email, maxMs) { const t0 = Date.now(); while (isHeld(email) && Date.now() - t0 < (maxMs || 20000)) await sleep(250); }
|
||||
function claimDays() { const n = Number((X.siteConfig && X.siteConfig().carryClaimDays) || 3); return n > 0 ? n : 3; }
|
||||
const STATE = () => path.join(X.dataDir, 'carry-state.json');
|
||||
function state() { try { return JSON.parse(fs.readFileSync(STATE(), 'utf8')); } catch (e) { return { claims: {}, log: [] }; } }
|
||||
@@ -129,30 +141,86 @@ async function nearestWithWallet(email) {
|
||||
// activate `acct` on this contract via the engine, after its own sponsor is there (recursive, bounded)
|
||||
async function ensureOnChain(acct, depth, why) {
|
||||
if (!acct || !acct.address) return 0;
|
||||
try { const id = await X.chain.memberIdByAccount(acct.address); if (id) return id; } catch (e) {}
|
||||
if (!engineReady() || depth > 25) return 0;
|
||||
let sponsorId = 0;
|
||||
// a registry batch is still settling this person's sponsor: wait for it, then use the account as it is NOW
|
||||
if (acct.email && isHeld(acct.email)) await waitUnheld(acct.email);
|
||||
if (acct.email) { try { const fresh = await X.accounts.byEmail(acct.email); if (fresh && fresh.address) acct = fresh; } catch (e) {} }
|
||||
try { const id = await X.chain.memberIdByAccount(acct.address); if (id) { if (Number(acct.memberId) !== Number(id)) await X.accounts.setMemberId(acct.email, id).catch(() => {}); return id; } } catch (e) {}
|
||||
// holding tank (2026-10-27, tank.gate): no sponsor here -> align to the network sponsor first (InstantAdPay knows one);
|
||||
// nobody known and this is the member's OWN plain activation (wallet linked, admin seeding) -> held for an adopter, never
|
||||
// bound under the fallback. A sponsor placed on the contract because someone below them is buying is never held.
|
||||
if (!acct.sponsorRef && !(Number(acct.memberId) > 0) && X.tankGate) {
|
||||
let g = null; try { g = await X.tankGate(acct, { own: depth === 0 && (why === 'wallet' || !!X.seeding) }); } catch (e) { g = null; }
|
||||
if (g && g.aligned) { try { const fresh = await X.accounts.byEmail(acct.email); if (fresh) acct = fresh; } catch (e) {} }
|
||||
else if (g && g.hold) { logEvent({ type: 'tankHold', email: acct.email, until: g.hold.until || null }); return 0; }
|
||||
}
|
||||
if (!sendReady() || depth > 25) return 0;
|
||||
const me = norm(acct.email); inflight.add(me); let id = 0; // binding from here: the sponsor read below is the one the contract gets
|
||||
let sponsorId = 0, txHash = null, lastErr = null; // read after the finally below, so declared out here (inside the try they were not defined there, 2026-10-22..27)
|
||||
try {
|
||||
if (acct.sponsorRef) {
|
||||
let sp = await X.accounts.byCode(acct.sponsorRef); if (!sp) sp = await X.accounts.byUsername(acct.sponsorRef);
|
||||
if (sp && sp.address) sponsorId = await ensureOnChain(sp, depth + 1);
|
||||
}
|
||||
if (!sponsorId) sponsorId = Number((X.siteConfig && X.siteConfig().defaultSponsorId) || 1) || 1;
|
||||
try { if (sponsorId > await X.chain.memberCount()) sponsorId = 0; } catch (e) {} // first member on a fresh contract: no catch position exists yet
|
||||
// send with provider rotation; after ANY error re-read the chain first (2026-10-15 seed: six activations
|
||||
// mined while a 403 on the follow-up read logged them as failures and skipped their notices)
|
||||
const sent = await (X.sendActivate || sendActivateFor)(acct.address, sponsorId); id = sent.id; txHash = sent.txHash; lastErr = sent.lastErr;
|
||||
} finally { if (!id) inflight.delete(me); } // on success the flag stays until the member number is saved below
|
||||
if (!id) { logEvent({ type: 'activateFailed', email: acct.email, error: String((lastErr && (lastErr.shortMessage || lastErr.message)) || 'not on-chain after send').slice(0, 160) }); return 0; }
|
||||
logEvent({ type: 'activated', email: acct.email, id, sponsorId, tx: txHash });
|
||||
// keep the member number on the account: the ledger and every name lookup go by it (2026-10-18: 340 engine
|
||||
// activations had none, so the live ledger showed "member #352" instead of the username)
|
||||
await X.accounts.setMemberId(acct.email, id).catch(() => {});
|
||||
inflight.delete(me);
|
||||
await noticeActivated(acct, why);
|
||||
return id;
|
||||
}
|
||||
// send with provider rotation; after ANY error re-read the chain first (2026-10-15 seed: six activations
|
||||
// mined while a 403 on the follow-up read logged them as failures and skipped their notices)
|
||||
async function sendActivateFor(address, sponsorId) {
|
||||
let id = 0, txHash = null, lastErr = null;
|
||||
for (let attempt = 0; attempt < 3 && !id; attempt++) {
|
||||
try {
|
||||
const w = signer(attempt); const ctr = new ethers.Contract(X.chain.getConfig().contract, ABI, w);
|
||||
const tx = await ctr.activateFor(acct.address, sponsorId, { gasLimit: 160000n }); txHash = tx.hash;
|
||||
const tx = await ctr.activateFor(address, sponsorId, { gasLimit: 160000n }); txHash = tx.hash;
|
||||
await tx.wait(1);
|
||||
} catch (e) { lastErr = e; }
|
||||
for (let k = 0; k < 4 && !id; k++) { try { id = Number(await X.chain.memberIdByAccount(acct.address)) || 0; } catch (e) {} if (!id) await sleep(3000); }
|
||||
for (let k = 0; k < 4 && !id; k++) { try { id = Number(await X.chain.memberIdByAccount(address)) || 0; } catch (e) {} if (!id) await sleep(3000); }
|
||||
}
|
||||
if (!id) { logEvent({ type: 'activateFailed', email: acct.email, error: String((lastErr && (lastErr.shortMessage || lastErr.message)) || 'not on-chain after send').slice(0, 160) }); return 0; }
|
||||
logEvent({ type: 'activated', email: acct.email, id, sponsorId, tx: txHash });
|
||||
await noticeActivated(acct, why);
|
||||
return id;
|
||||
return { id, txHash, lastErr };
|
||||
}
|
||||
const sendReady = () => !!X.sendActivate || engineReady();
|
||||
|
||||
// ---- holding tank: switch payouts on the moment a tank member gets a sponsor (Marty approved 2026-10-27) ----
|
||||
// An adoption (manual or the 24-hour rotation) or a network alignment gives a held member a sponsor; with a wallet linked,
|
||||
// the engine activates them right away UNDER THAT SPONSOR. Strict, unlike ensureOnChain: never the fallback position.
|
||||
// - already on the contract: nothing sent ({ id, already })
|
||||
// - the sponsor must be on the contract (the engine places a sponsor who has a wallet first, as ensureOnChain does) and not
|
||||
// on a no-payout chain; otherwise nothing is sent and the caller retries on its next tick ({ error, retry })
|
||||
// - one sender across app copies: a marks claim per member per 10-minute window (deploy overlap), plus the in-process flag
|
||||
// Returns { id, tx, sponsorId, sponsorEmail } when this call activated them.
|
||||
async function activateAssigned(email) {
|
||||
let a = await X.accounts.byEmail(email); if (!a || !a.address) return { error: 'no wallet linked', retry: false };
|
||||
if (isHeld(a.email)) { await waitUnheld(a.email); a = (await X.accounts.byEmail(email)) || a; }
|
||||
let onId = 0; try { onId = Number(await X.chain.memberIdByAccount(a.address)) || 0; } catch (e) { return { error: 'chain read failed', retry: true }; }
|
||||
if (onId) { if (Number(a.memberId) !== onId) await X.accounts.setMemberId(a.email, onId).catch(() => {}); return { id: onId, already: true }; }
|
||||
if (!a.sponsorRef) return { error: 'no sponsor yet', retry: false };
|
||||
let sp = await X.accounts.byCode(a.sponsorRef); if (!sp) sp = await X.accounts.byUsername(a.sponsorRef);
|
||||
if (!sp) return { error: 'sponsor ' + a.sponsorRef + ' not found', retry: true };
|
||||
if (!sp.address) return { error: 'sponsor has no wallet yet', retry: true };
|
||||
if (!sendReady()) return { error: 'engine not configured', retry: true };
|
||||
const me = norm(a.email); if (inflight.has(me)) return { error: 'activation already in flight', retry: true };
|
||||
const sponsorId = await ensureOnChain(sp, 1);
|
||||
if (!sponsorId) return { error: 'sponsor not on the contract yet', retry: true };
|
||||
if (X.payoutBlocked && await Promise.resolve(X.payoutBlocked(sponsorId)).catch(() => true)) return { error: 'sponsor #' + sponsorId + ' is on a no-payout chain', retry: false };
|
||||
if (X.claim && !(await Promise.resolve(X.claim('tankact:' + me + ':' + Math.floor((X.now ? X.now() : Date.now()) / 600000))).catch(() => false))) return { error: 'another app copy is sending it', retry: true };
|
||||
inflight.add(me); let sent = { id: 0 };
|
||||
try { sent = await (X.sendActivate || sendActivateFor)(a.address, sponsorId); }
|
||||
finally { if (!sent.id) inflight.delete(me); }
|
||||
if (!sent.id) { logEvent({ type: 'activateFailed', email: a.email, why: 'assigned', sponsorId, error: String((sent.lastErr && (sent.lastErr.shortMessage || sent.lastErr.message)) || 'not on-chain after send').slice(0, 160) }); return { error: 'activation failed', retry: true }; }
|
||||
logEvent({ type: 'activated', email: a.email, id: sent.id, sponsorId, tx: sent.txHash, why: 'assigned' });
|
||||
await X.accounts.setMemberId(a.email, sent.id).catch(() => {});
|
||||
inflight.delete(me);
|
||||
return { id: sent.id, tx: sent.txHash || null, sponsorId, sponsorEmail: sp.email };
|
||||
}
|
||||
async function noticeActivated(acct, why) {
|
||||
const own = X.seeding || why === 'wallet'; // switched on because their own wallet arrived, not because someone below them bought
|
||||
@@ -162,6 +230,20 @@ async function noticeActivated(acct, why) {
|
||||
+ '\n\nSee your line: https://' + (X.host || 'linkspin.co') + '/my');
|
||||
}
|
||||
|
||||
// backfill: every account with a wallet that is on the contract but has no member number gets it, read from the chain.
|
||||
// Runs once at boot (and is safe to repeat); 4 reads a second so the shared RPC pool is not hammered.
|
||||
async function backfillMemberIds() {
|
||||
const all = await X.accounts.listAll(5000); let fixed = 0, missing = 0;
|
||||
for (const a of all) {
|
||||
if (!a.address || Number(a.memberId) > 0) continue;
|
||||
let id = 0; try { id = Number(await X.chain.memberIdByAccount(a.address)) || 0; } catch (e) {}
|
||||
if (id) { await X.accounts.setMemberId(a.email, id).catch(() => {}); fixed++; } else missing++;
|
||||
await sleep(250);
|
||||
}
|
||||
logEvent({ type: 'memberIdBackfill', fixed, notOnChain: missing });
|
||||
return { fixed, notOnChain: missing };
|
||||
}
|
||||
|
||||
// pre-seed: activate every account with a wallet, sponsors before their downline
|
||||
async function seedAll(limit) {
|
||||
const all = await X.accounts.listAll(5000);
|
||||
@@ -188,4 +270,4 @@ async function seedAll(limit) {
|
||||
}
|
||||
function status() { const s = state(); return { engine: engineReady(), claims: Object.values(s.claims || {}), log: (s.log || []).slice(-50).reverse(), claimDays: claimDays() }; }
|
||||
|
||||
module.exports = { init, onJoin, resolveForChain, ensureOnChain, seedAll, status, engineReady };
|
||||
module.exports = { init, onJoin, resolveForChain, ensureOnChain, activateAssigned, seedAll, status, engineReady, backfillMemberIds, hold, unhold, isHeld, isBinding };
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
[
|
||||
{
|
||||
"id": "banner-spin",
|
||||
"group": "Banner Spin",
|
||||
"title": "Banner Spin: one banner slot, a whole campaign",
|
||||
"desc": "Banner Spin gives you one image address and one click address that rotate up to 25 banners, each with its own target page or spin link. Put it in one banner slot on a traffic exchange, a safelist, a forum signature or your own site once, then change the banners from your Control Room whenever you like. Nobody has to update anything on their side.\n\nWho gets it. It is a free add-on that opens with your own package of $25 or more. Starter holds 2 Banner Spins with 5 banners each. Builder (level 2 open, 2 qualifying buyers) holds 5 with 15 each. Leader (level 3 open, 5 qualifying buyers) holds 10 with 25 each. If you drop below a tier, everything you built keeps serving; you just cannot add more until you are back.\n\nStep 1, name and size. Open Links, switch to Banner Spins and press New Banner Spin. Pick one size: a slot on an exchange has one size, so every banner in a Banner Spin should be that exact size (468x60, 728x90, 300x250, 125x125, 160x600, 120x600, 336x280, 250x250 or 320x50). Set a fallback page: that is where a click goes when we cannot tell which banner the visitor saw.\n\nStep 2, add banners. Upload a JPG, PNG or GIF (animated is fine, 150 KB at most) or paste an https image address. The builder previews it at real size and warns you when it is the wrong size. Pick where a click goes: any page, or one of your own spin links, so a banner can rotate pages behind it too.\n\nStep 3, weights and mode. A banner with weight 20 shows twice as often as one with 10. Random by weight picks again on every view. One per visitor shows the same person the same banner all day, which keeps a split test clean on exchanges that reload pages. You can also give the whole Banner Spin, or one banner, its own hours.\n\nStep 4, get the code. Open Get the code and copy the embed that fits the place: the image address plus click address for exchanges, safelists and downline builders; the HTML snippet for your own site or blog; the script tag wherever scripts are allowed (it writes the banner and its own link together, so every click lands on the right target); the forum code for signatures. Every link domain answers every code, so if one domain ever has trouble you swap only the domain.\n\nWhere it will not rotate. Paid ad networks copy your image to their own servers when you upload a creative, so it freezes on one banner there: upload real banners to them instead. Gmail and some mail apps fetch images once through their own proxy, so most email readers see one banner and their clicks go to the fallback. For email, use a Banner Spin with a single banner (still tracked) and swap it when you want a change.\n\nReading the numbers. The Stats tab and the Reports screen show views, unique viewers, clicks, click rate, match rate and conversions for every banner and every placement (the page your banner sits on), by day, country and device. Bots, link previews and servers are never counted as views; they are shown on their own line. A WINNER badge appears once two or more live banners have 1,000 views each and one leads on click rate. LinkSpin never changes your weights for you: raise the winner or pause the rest when you are ready. A placement marked CACHED copies banners to its own server, so the rotation is frozen there; spend your credits elsewhere.\n\nHealth checks. Every 30 minutes LinkSpin checks each live banner: the image must load as an image of the right size, and its target must not be dead or parked. Three failures in a row pause that banner and it comes back on its own after two clean checks. The last live banner in a Banner Spin is never paused. You see the status on every banner row.\n\nTeach it forward. When someone in your line buys their first $25 package, show them this lesson and help them build their first Banner Spin with two banners for the same offer. Two weeks of numbers tell them which banner to keep.",
|
||||
"docUrl": "/links#b"
|
||||
},
|
||||
{
|
||||
"id": "refuel-guide",
|
||||
"group": "Fuel Your Offers",
|
||||
"title": "Fuel Your Offers: how the Monthly Refuel streak works",
|
||||
"desc": "Refuel your ads every month and the bonus climbs. A new package of $25 or more under Credits (or $20 or more on InstantAdPay) starts your streak and sets your own refuel day. Each monthly refuel inside your window (5 days before to 5 days after your refuel day) adds bonus ad credits: +10%, +15%, +20%, then +25% from month 4. Refuel both sites in the same cycle and both get +15%, +20%, +30%, then +40%. Either site alone keeps the streak going.\n\nThe guide walks through the whole flow with a diagram: Pit Stops, the one free miss a year, the Refuel Kit that loads into your Banner Spin, the Engine Room on Ads, and the reminders. Bonus credits buy ad delivery only; they are never cash.",
|
||||
"docUrl": "/refuel",
|
||||
"docLabel": "Read the guide",
|
||||
"videoUrl": "https://coolify-saasytop.nyc3.digitaloceanspaces.com/training/refuel-ls.mp4?v=20261024",
|
||||
"posterUrl": "https://coolify-saasytop.nyc3.digitaloceanspaces.com/training/refuel-ls.jpg?v=20261024"
|
||||
},
|
||||
{
|
||||
"id": "conversion-guide",
|
||||
"group": "Track your results",
|
||||
"title": "Conversion tracking: see which ad, link and page bring sign-ups",
|
||||
"desc": "Clicks tell you who looked. The conversion pixel tells you which ad, spin link, page and traffic source brought a subscriber or a sale, with a cost per goal in credits. It is free for every member.\n\nFour steps, one time: create a goal under Conversions (subscriber, sale), paste the landing tag on the page your traffic lands on, paste the goal pixel on your thank-you page, and send a test conversion. The guide has copy-paste examples for a plain HTML page, WordPress, page builders and Aweber or GetResponse thank-you pages, what to do when you cannot put code on the thank-you page, how to read the report (match methods, cost per goal, the 30-day window) and a troubleshooting checklist.",
|
||||
"docUrl": "/conversion-tracking",
|
||||
"docLabel": "Read the guide",
|
||||
"videoUrl": "https://coolify-saasytop.nyc3.digitaloceanspaces.com/training/conversion-tracking-ls.mp4?v=20261026",
|
||||
"posterUrl": "https://coolify-saasytop.nyc3.digitaloceanspaces.com/training/conversion-tracking-ls.jpg?v=20261026"
|
||||
}
|
||||
]
|
||||
@@ -46,7 +46,7 @@ const SEL = {
|
||||
|
||||
const CHUNK = 9000;
|
||||
const POLL_MS = 30000;
|
||||
const KEEP_EVENTS = 600;
|
||||
const KEEP_EVENTS = 250000; // full history: tank own-buy, Banner Spin tiers, earnings and the ledger all read it as "all events" (IAP lesson 2026-09-16; was 600)
|
||||
|
||||
let cfg = null;
|
||||
let state = null;
|
||||
@@ -138,7 +138,16 @@ async function memberIdByAccount(addr) {
|
||||
}
|
||||
async function memberCount() { return toNum(word(await call(SEL.memberCount), 0)); }
|
||||
async function productCount() { return toNum(word(await call(SEL.productCount), 0)); }
|
||||
// member reads are cached 15 s (2026-10-20): dashboards ask for the same members many times a minute and every read is
|
||||
// an RPC round trip; sponsor never changes and a buyer count up to 15 s old is fine for display
|
||||
const memberCache = new Map();
|
||||
async function member(id) {
|
||||
const hit = memberCache.get(Number(id)); if (hit && Date.now() - hit.at < 15000) return hit.v;
|
||||
const v = await memberRead(id); memberCache.set(Number(id), { at: Date.now(), v });
|
||||
if (memberCache.size > 5000) memberCache.clear();
|
||||
return v;
|
||||
}
|
||||
async function memberRead(id) {
|
||||
const r = await call(SEL.members, [id]);
|
||||
return { account: toAddr(word(r, 0)), sponsorId: toNum(word(r, 1)), buyerCount: toNum(word(r, 2)),
|
||||
activated: toNum(word(r, 3)) === 1, countedAsBuyer: toNum(word(r, 4)) === 1 };
|
||||
@@ -151,15 +160,15 @@ async function product(id) {
|
||||
async function quoteWei(id) { try { return toBig(word(await call(SEL.quoteWei, [id]), 0)); } catch (e) { return null; } }
|
||||
async function creditBalance(id, type) { return Number(toBig(word(await call(SEL.creditBalance, [id, type || 0]), 0))); }
|
||||
async function catalog() {
|
||||
// products and quotes are read side by side, not one after another (2026-10-20, same fix as InstantAdPay)
|
||||
const n = await productCount();
|
||||
const out = [];
|
||||
for (let i = 1; i <= n; i++) {
|
||||
const p = await product(i);
|
||||
if (!p.exists || !p.active) continue;
|
||||
const q = await quoteWei(i);
|
||||
out.push(Object.assign(p, { costWei: q === null ? null : q.toString() }));
|
||||
}
|
||||
return out;
|
||||
const ids = Array.from({ length: n }, (_, k) => k + 1);
|
||||
const rows = await Promise.all(ids.map(async i => {
|
||||
const [p, q] = await Promise.all([product(i), quoteWei(i)]);
|
||||
if (!p.exists || !p.active) return null;
|
||||
return Object.assign(p, { costWei: q === null ? null : q.toString() });
|
||||
}));
|
||||
return rows.filter(Boolean);
|
||||
}
|
||||
|
||||
// ---- event decode ----
|
||||
@@ -231,7 +240,7 @@ async function tail() {
|
||||
const ev = decodeLog(lg);
|
||||
if (!ev) continue;
|
||||
ev.ts = Date.now(); // indexed-at time: powers honest time-series charts
|
||||
state.events.push(ev);
|
||||
state.events.push(ev); memberCache.clear(); // a new chain event can change any member: drop the 15 s read cache
|
||||
tally(ev);
|
||||
if (onEvent) { try { onEvent(ev); } catch (e) { console.error('chain onEvent', e.message); } }
|
||||
}
|
||||
|
||||
+166
-49
File diff suppressed because one or more lines are too long
@@ -18,15 +18,15 @@ const RUNGS = [
|
||||
{ n: 1, key: 'wallet', label: 'Wallet linked', next: 'Switch on payouts',
|
||||
say: 'Wallet is linked, nice. Next is Switch on payouts (Wallet tab, one free transaction). Do it before anyone under you buys, so nothing passes you by.',
|
||||
mail: ['One free step left: switch on payouts', 'Your wallet is linked. One free transaction on the Wallet tab switches on payouts, and from then on every purchase in your line can pay you in the same transaction it happens. Do it before your people start buying: the contract locks each buyer to their sponsor at their first purchase.'] },
|
||||
{ n: 2, key: 'payouts', label: 'Payouts on', next: 'Buy a first package ($20+ counts)',
|
||||
say: 'You are set to earn. Fastest way to see it work: the $20 Activation package. It counts as a qualifying buy for your sponsor and gives you 2,000 credits to run your first ad.',
|
||||
mail: ['See a payout land: your first package', 'Payouts are on. The fastest way to see the whole thing work is the $20 Activation package on Buy packages: 2,000 credits for your own ads, and your sponsor gets paid the second it settles, on a public ledger you can open yourself.'] },
|
||||
{ n: 3, key: 'bought', label: 'Bought $20+', next: 'Share the link with one person',
|
||||
{ n: 2, key: 'payouts', label: 'Payouts on', next: 'Buy a first package ($25+ counts)',
|
||||
say: 'You are set to earn. Fastest way to see it work: the $25 package. It counts as a qualifying buy for your sponsor and gives you 2,500 credits to run your first ad.',
|
||||
mail: ['See a payout land: your first package', 'Payouts are on. The fastest way to see the whole thing work is the $25 package on Buy packages: 2,500 credits for your own ads, and your sponsor gets paid the second it settles, on a public ledger you can open yourself.'] },
|
||||
{ n: 3, key: 'bought', label: 'Bought $25+', next: 'Share the link with one person',
|
||||
say: 'Everything is on. Now send your invite link to one person today. Promo tools has a ready-to-send message. Who is the first person you thought of?',
|
||||
mail: ['Send your link to one person today', 'Everything on your account is switched on. Nobody has joined your link yet. Open Promo tools, copy the ready-to-send message, and send it to one person today. One conversation a day is the whole job.'] },
|
||||
{ n: 4, key: 'first', label: 'First buyer', next: 'One more buyer opens level 2',
|
||||
say: 'First buyer, congrats. One more $20+ buyer opens level 2 for you. Want a shortcut? Qualified Start under Buy packages lets you be your own second buyer.',
|
||||
mail: ['One more buyer opens level 2', 'You have your first qualifying buyer. One more $20+ buyer opens level 2 (20% on every package your directs\' people buy). If you would rather not wait, Qualified Start on Buy packages lets you be your own second buyer with a wallet you own.'] },
|
||||
say: 'First buyer, congrats. One more $25+ buyer opens level 2 for you. Want a shortcut? Qualified Start under Buy packages lets you be your own second buyer.',
|
||||
mail: ['One more buyer opens level 2', 'You have your first qualifying buyer. One more $25+ buyer opens level 2 (20% on every package your directs\' people buy). If you would rather not wait, Qualified Start on Buy packages lets you be your own second buyer with a wallet you own.'] },
|
||||
{ n: 5, key: 'level2', label: 'Level 2 open', next: 'Three more buyers open level 3',
|
||||
say: 'Level 2 is open. Three more qualifying buyers open level 3 and the Nexus badge. Which of your people is closest?',
|
||||
mail: ['Three more buyers open level 3', 'Level 2 is open on your account. Five qualifying buyers open level 3 and the Nexus badge, and every package on all three levels pays you. Which of your people is closest? Message them from My line.'] },
|
||||
@@ -56,12 +56,16 @@ async function member(id) {
|
||||
const STALL_DAYS = 3;
|
||||
async function describe(acct, now = Date.now()) {
|
||||
const mm = await member(acct.memberId);
|
||||
// unknown = the member is on chain but the read failed just now (member() swallows RPC errors and caches null for a
|
||||
// minute); rungFor would call them "payouts on, no purchase" and the coach would mail a buyer the first-package nudge
|
||||
// (2026-10-31: Marty, 4 purchases and 7 buyers, got "See a payout land"). Callers that mail must skip unknown.
|
||||
const unknown = !!(acct.memberId && !mm);
|
||||
const rung = rungFor(acct, mm);
|
||||
const last = Math.max(acct.created || 0, acct.lastSeen || 0);
|
||||
const quietDays = Math.floor((now - last) / DAY);
|
||||
const stalled = rung < 6 && quietDays >= STALL_DAYS;
|
||||
const stalled = !unknown && rung < 6 && quietDays >= STALL_DAYS;
|
||||
const R = RUNGS[rung];
|
||||
return { rung, label: R.label, next: R.next, say: R.say, quietDays, stalled, buyerCount: mm ? mm.buyerCount : 0,
|
||||
return { rung, label: R.label, next: R.next, say: R.say, quietDays, stalled, unknown, buyerCount: mm ? mm.buyerCount : 0,
|
||||
counted: !!(mm && mm.countedAsBuyer), joined: acct.created, lastSeen: acct.lastSeen || 0, onchainSponsorId: mm ? mm.sponsorId : null };
|
||||
}
|
||||
// coaching view for a sponsor: every direct, ladder rung, stalled flag, what to say
|
||||
@@ -177,6 +181,8 @@ function clickSource(referer) {
|
||||
} catch (e) { return 'unknown'; }
|
||||
}
|
||||
async function recordClick(campaignId, referer) { try { await impl().addClick(Number(campaignId), clickSource(referer), Date.now()); } catch (e) {} }
|
||||
// clicks on these campaigns since a moment (the Engine Room's clicks-this-week dial, 2026-10-24)
|
||||
async function clicksSince(campaignIds, since) { if (!campaignIds.length) return 0; const rows = await impl().clicksFor(campaignIds.map(Number)); return rows.filter(r => Number(r.ts) >= since).length; }
|
||||
async function clickSources(campaignIds) {
|
||||
const rows = await impl().clicksFor(campaignIds.map(Number));
|
||||
const out = {};
|
||||
@@ -219,6 +225,7 @@ async function nudgeTick() {
|
||||
const all = await accounts.listAll(5000);
|
||||
for (const acct of all) {
|
||||
if (!acct.email || !acct.created || now - acct.created < STALL_DAYS * DAY) continue;
|
||||
if (X.adminEmail && String(acct.email).toLowerCase() === String(X.adminEmail).toLowerCase()) continue; // the site owner is never coached (2026-10-31)
|
||||
if (!acct.lastSeen || acct.joinedVia === 'carried' && !acct.lastSeen) continue; // never signed in here (carried-over shells from InstantAdPay): no coaching mail, ever (2026-10-11: Harvey got a nudge for a site he never joined)
|
||||
const c = await describe(acct, now);
|
||||
if (!c.stalled) continue;
|
||||
@@ -265,7 +272,7 @@ async function nudgeTick() {
|
||||
const me = lbWeek.top.find(r => r.name === '@' + acct.username) || null;
|
||||
let mine = me; if (!mine) { try { mine = (await X.lb().view('week', acct.email)).me; } catch (e) {} }
|
||||
parts.push('- Referral contest this week (' + (lbWeek.prize || 'credits to the top 3') + '): ' + (lbWeek.top.length ? lbWeek.top.slice(0, 3).map(r => r.rank + '. ' + r.name + ' (' + r.sales + ' sold)').join(', ') : 'no sales yet, first sale takes the top spot') + '.'
|
||||
+ (mine ? ' You are #' + mine.rank + ' with ' + mine.sales + ' sold.' : ' You are not on the board yet; one $20 package bought by someone you sponsor puts you there.') + ' ' + SITE_URL + '/leaderboard');
|
||||
+ (mine ? ' You are #' + mine.rank + ' with ' + mine.sales + ' sold.' : ' You are not on the board yet; one $25 package bought by someone you sponsor puts you there.') + ' ' + SITE_URL + '/leaderboard');
|
||||
}
|
||||
// tank
|
||||
if (tankN > 0 && acct.memberId) parts.push('- ' + tankN + ' member' + (tankN === 1 ? ' is' : 's are') + ' waiting for a sponsor in the holding tank. Adopt one from My line: ' + SITE_URL + '/my#line');
|
||||
@@ -292,4 +299,4 @@ function init(opts) { X = arguments[0] || {};
|
||||
J.load();
|
||||
}
|
||||
async function viewsSince(since) { return impl().viewsSince(since); }
|
||||
module.exports = { init, RUNGS, rungFor, describe, coachView, prospects, saveProspect, removeProspect, STATUSES, recordView, linkStats, nudgeTick, recordClick, clickSources, refHost, viewsSince };
|
||||
module.exports = { init, RUNGS, rungFor, describe, coachView, prospects, saveProspect, removeProspect, STATUSES, recordView, linkStats, nudgeTick, recordClick, clickSources, clicksSince, refHost, viewsSince };
|
||||
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
// Member content (admin, Marty 2026-10-18): "in the admin view, I need to be able to see all the pages that are created
|
||||
// and anything else that's created by a member." One read-only list across every module that stores member-made things:
|
||||
// pages, links (rotations + destinations), traffic sources, zones, ad campaigns, postbacks, uploads, profiles (bio, avatar,
|
||||
// line banner, wall offers), sponsor broadcasts, hand-made audiences and Video Maker renders. Each module hands over its
|
||||
// own records (adminAll and friends); this file only turns them into one row shape, flags what looks wrong, and filters /
|
||||
// pages the result for GET /api/admin/content. Moderation stays where it already lives (campaign pause/resume, zone
|
||||
// pause/resume); a row only points at those routes.
|
||||
// Uploads in /uploads had no owner record before 2026-10-18: the owner is inferred from whatever references the file
|
||||
// (a campaign creative, a profile avatar or line banner, a wall offer). New uploads are noted in DATA_DIR/uploads-index.json.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
let R = null; // { dataDir, uploadsDir, accounts, pages, rotator, bannerspin, sources, zones, ads, postbacks, audiences, messages, videomaker, reports, domains, adminEmail, houseOwner, linkHost(), pagesHost(), siteHost }
|
||||
function init(refs) { R = refs; }
|
||||
|
||||
const TYPES = [
|
||||
{ key: 'page', label: 'Pages' }, { key: 'link', label: 'Links' }, { key: 'bannerspin', label: 'Banner Spins' }, { key: 'source', label: 'Sources' }, { key: 'zone', label: 'Zones' },
|
||||
{ key: 'ad', label: 'Ads' }, { key: 'postback', label: 'Postbacks' }, { key: 'upload', label: 'Uploads' }, { key: 'profile', label: 'Profiles' },
|
||||
{ key: 'message', label: 'Broadcasts' }, { key: 'audience', label: 'Audiences' }, { key: 'video', label: 'Videos' }
|
||||
];
|
||||
const CT_FMT = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit' });
|
||||
const ctDay = ts => ts ? CT_FMT.format(new Date(Number(ts))) : '';
|
||||
const hostOf = u => { try { return new URL(String(u || '')).hostname.toLowerCase().replace(/^www\./, ''); } catch (e) { return ''; } };
|
||||
const strip = s => String(s || '').replace(/<style[\s\S]*?<\/style>|<script[\s\S]*?<\/script>/gi, ' ').replace(/<[^>]+>/g, ' ').replace(/ /g, ' ').replace(/&/g, '&').replace(/\s+/g, ' ').trim();
|
||||
const urlsIn = s => (String(s || '').match(/https?:\/\/[^\s"'<>)]+/gi) || []).slice(0, 20);
|
||||
const UP_RE = /\/uploads\/([a-z0-9]{24}\.(?:png|jpg|webp|gif|mp4|webm))/gi;
|
||||
const parse = s => { if (!s) return null; if (typeof s === 'object') return s; try { return JSON.parse(s); } catch (e) { return null; } };
|
||||
|
||||
// -- upload index (who uploaded which /uploads file), written by server.js handleUpload from 2026-10-18 on
|
||||
const IDX = () => path.join(R.dataDir, 'uploads-index.json');
|
||||
function readIdx() { try { return JSON.parse(fs.readFileSync(IDX(), 'utf8')) || {}; } catch (e) { return {}; } }
|
||||
function noteUpload(name, who, size, type, url) {
|
||||
try { const i = readIdx(); i[String(name)] = { who: String(who || '').toLowerCase(), size: Number(size) || 0, type: type || '', url: url || '', ts: Date.now() }; fs.writeFileSync(IDX(), JSON.stringify(i)); } catch (e) {}
|
||||
}
|
||||
|
||||
// -- collect: every row, cached briefly so paging and typing in the search box stay quick
|
||||
let cache = null;
|
||||
async function collect(fresh) {
|
||||
if (!fresh && cache && Date.now() - cache.ts < 15000) return cache.rows;
|
||||
const accts = await R.accounts.listAll(1000000);
|
||||
const byEmail = {}; for (const a of accts) byEmail[String(a.email || '').toLowerCase()] = a;
|
||||
const admin = String(R.adminEmail || '').toLowerCase(), house = String(R.houseOwner || '').toLowerCase();
|
||||
const ownerOf = email => {
|
||||
const e = String(email || '').toLowerCase();
|
||||
if (e.startsWith('demo:')) return { email: '', username: '', memberId: 0, demo: true };
|
||||
const a = byEmail[e]; return { email: e, username: a && a.username || '', memberId: a && a.memberId || 0 };
|
||||
};
|
||||
const burned = h => { try { return !!h && !!R.domains.isBurned(h); } catch (e) { return false; } };
|
||||
const linkHost = R.linkHost() || R.siteHost; const pagesHost = R.pagesHost();
|
||||
const rows = [];
|
||||
const add = r => {
|
||||
r.owner = ownerOf(r.ownerEmail); delete r.ownerEmail;
|
||||
r.flags = r.flags || []; r.actions = r.actions || []; r.counts = r.counts || {};
|
||||
r.hosts = Array.from(new Set((r.hosts || []).filter(Boolean)));
|
||||
for (const h of r.hosts) if (burned(h)) r.flags.push({ k: 'burned', t: h + ' is a burned link domain' });
|
||||
r.day = ctDay(r.created);
|
||||
r.text = [r.type, r.id, r.owner.email, r.owner.username, r.owner.username ? '@' + r.owner.username : '', r.owner.memberId ? '#' + r.owner.memberId : '', r.title, r.url, r.status].concat(r.hosts, r.search || []).join(' ').toLowerCase();
|
||||
delete r.search; rows.push(r);
|
||||
};
|
||||
|
||||
// pages
|
||||
for (const p of R.pages.adminAll()) add({ type: 'page', id: p.id, ownerEmail: p.owner, title: p.title, created: p.created, updated: p.updated,
|
||||
status: p.status === 'published' ? 'live' : 'draft', live: p.status === 'published',
|
||||
url: pagesHost ? 'https://' + pagesHost + '/' + p.slug : 'https://' + linkHost + '/p/' + p.slug, open: '/p/' + p.slug + '?preview=1',
|
||||
detail: { kind: p.type, slug: p.slug, headline: p.headline, sub: p.sub, ctaUrl: p.ctaUrl, ctaText: p.ctaText, image: p.image, formProvider: p.formProvider, scanUrl: p.scanUrl, body: p.body.slice(0, 280) },
|
||||
counts: { views: p.views, uniques: p.uniques, clicks: p.clicks, leads: p.leads }, hosts: [hostOf(p.ctaUrl), hostOf(p.scanUrl)],
|
||||
search: [p.slug, p.headline, p.sub, p.body, p.bonus, p.angle, p.ctaUrl, p.scanUrl, p.image] });
|
||||
|
||||
// links (rotations)
|
||||
for (const r of R.rotator.adminAll()) {
|
||||
const flags = [];
|
||||
const sick = r.destinations.filter(d => d.autoPaused || (d.health && (d.health.state === 'dead' || d.health.state === 'parked')));
|
||||
if (sick.length) flags.push({ k: 'health', t: sick.length + ' destination' + (sick.length > 1 ? 's' : '') + ' dead or parked' });
|
||||
if (r.demo) flags.push({ k: 'demo', t: 'Home-page demo spin (no account yet)' });
|
||||
const live = !r.paused && (r.destinations.some(d => d.active) || !!r.fallback);
|
||||
add({ type: 'link', id: String(r.id), ownerEmail: r.owner, title: r.name, created: r.created, status: r.paused ? 'paused' : live ? 'live' : 'empty', live,
|
||||
url: 'https://' + linkHost + '/r/' + r.code, open: null,
|
||||
detail: { code: r.code, fallback: r.fallback, dayparted: r.dayparted, sourceId: r.sourceId, expires: r.expires, destinations: r.destinations.map(d => ({ url: d.url, label: d.label, weight: d.weight, active: d.active, autoPaused: !!d.autoPaused, health: d.health ? d.health.state : '' })) },
|
||||
counts: { clicks7: r.hits7, clicks: r.hits, bots: r.bots, conversions: r.conversions }, hosts: r.destinations.map(d => hostOf(d.url)).concat(hostOf(r.fallback)), flags,
|
||||
search: [r.code].concat(r.destinations.map(d => d.url + ' ' + (d.label || '')), r.fallback) });
|
||||
}
|
||||
|
||||
// Banner Spins (2026-10-18): one image URL + one click URL rotating the member's banners; admin can take a banner or the whole thing offline
|
||||
if (R.bannerspin) for (const b of R.bannerspin.adminAll()) {
|
||||
const flags = [];
|
||||
if (b.adminOff) flags.push({ k: 'off', t: 'Taken offline by admin' + (b.adminNote ? ': ' + b.adminNote : '') });
|
||||
const offB = b.banners.filter(x => x.adminOff); if (offB.length) flags.push({ k: 'off', t: offB.length + ' banner' + (offB.length > 1 ? 's' : '') + ' taken offline by admin' });
|
||||
const live = !b.adminOff && !b.paused && b.banners.some(x => x.active && !x.adminOff);
|
||||
const stamp = 'Taken offline from Member content ' + ctDay(Date.now());
|
||||
const actions = [b.adminOff ? { label: 'Put Banner Spin back online', path: '/api/admin/bannerspins/' + b.id, body: { off: false, note: '' } } : { label: 'Take Banner Spin offline', path: '/api/admin/bannerspins/' + b.id, body: { off: true, note: stamp }, warn: 'Take this Banner Spin offline? Every placement shows a blank image and clicks go to its fallback.' }]
|
||||
.concat(b.banners.map(x => x.adminOff ? { label: 'Banner ' + x.id + ' back online', path: '/api/admin/bannerspins/' + b.id, body: { bannerId: x.id, off: false, note: '' } } : { label: 'Banner ' + x.id + ' offline', path: '/api/admin/bannerspins/' + b.id, body: { bannerId: x.id, off: true, note: stamp }, warn: 'Take banner ' + x.id + ' offline? The Banner Spin keeps rotating the others.' }));
|
||||
add({ type: 'bannerspin', id: String(b.id), ownerEmail: b.owner, title: b.name, created: b.created, status: b.adminOff ? 'offline' : b.paused ? 'paused' : live ? 'live' : 'empty', live,
|
||||
url: 'https://' + linkHost + '/i/' + b.code + '.gif', open: null,
|
||||
detail: { code: b.code, size: b.size, mode: b.mode, image: 'https://' + linkHost + '/i/' + b.code + '.gif', click: 'https://' + linkHost + '/c/' + b.code, fallback: b.fallback, fallbackImage: b.fallbackImage, dayparted: b.dayparted, sourceId: b.sourceId,
|
||||
banners: b.banners.map(x => ({ id: x.id, label: x.label, image: x.image, target: x.target, link: x.link, weight: x.weight, active: x.active, adminOff: x.adminOff })) },
|
||||
counts: { imps: b.imps, clicks: b.clicks, conversions: b.conversions }, hosts: b.banners.map(x => hostOf(x.target)).concat(hostOf(b.fallback), b.banners.map(x => hostOf(x.image))), flags, actions,
|
||||
search: [b.code, b.size, b.fallback].concat(b.banners.map(x => x.image + ' ' + x.target + ' ' + (x.label || ''))) });
|
||||
}
|
||||
|
||||
// traffic sources
|
||||
for (const s of R.sources.adminAll()) add({ type: 'source', id: s.id, ownerEmail: s.owner, title: s.name, created: s.created, status: s.enabled ? 'live' : 'off', live: !!s.enabled, url: s.site ? 'https://' + s.site : '', open: null,
|
||||
detail: { template: s.template, site: s.site, costModel: s.costModel, postbackUrl: s.postbackUrl, method: s.method, events: s.events, params: (s.params || []).length, lastStatus: s.lastStatus },
|
||||
counts: { sent: s.sent, fails: s.fails }, hosts: [hostOf(s.postbackUrl)], search: [s.template, s.site, s.postbackUrl] });
|
||||
|
||||
// zones (moderation: the existing admin pause / resume)
|
||||
for (const z of R.zones.adminAll()) add({ type: 'zone', id: z.id, ownerEmail: z.owner, title: z.name, created: z.created, status: z.paused ? 'paused' : !z.active ? 'off' : z.status, live: z.active && !z.paused,
|
||||
url: 'https://' + z.site, open: 'https://' + z.site,
|
||||
detail: { site: z.site, size: z.size, tier: z.tier, statusLabel: z.statusLabel, note: z.note, lastSeen: z.lastSeen },
|
||||
counts: { views30: z.views30, viewablePct: z.viewablePct, clicks30: z.clicks30, offsite30: z.offsite30, credits: z.credits }, hosts: [z.site],
|
||||
flags: z.paused ? [{ k: 'paused', t: 'Paused by admin' + (z.note ? ': ' + z.note : '') }] : [],
|
||||
actions: [z.paused ? { label: 'Resume zone', path: '/api/admin/zones/' + z.id, body: { paused: false, note: '' } } : { label: 'Pause zone', path: '/api/admin/zones/' + z.id, body: { paused: true, note: 'Paused from Member content ' + ctDay(Date.now()) }, warn: 'Pause this zone? It will serve the house banner only and earn nothing.' }],
|
||||
search: [z.site, z.size, z.note] });
|
||||
|
||||
// ad campaigns (member campaigns only; house ads are the admin's own); open member reports flag the row
|
||||
const open = {}; try { for (const x of await R.reports.list(5000)) if (!x.resolved) (open[x.campaignId] = open[x.campaignId] || []).push(x); } catch (e) {}
|
||||
for (const c of await R.ads.adminList(1000000)) {
|
||||
if (c.house || String(c.owner || '').toLowerCase() === house) continue;
|
||||
const reps = open[c.id] || []; const flags = reps.length ? [{ k: 'reported', t: reps.length + ' open report' + (reps.length > 1 ? 's' : '') + ': ' + Array.from(new Set(reps.map(x => x.reason))).join(', ') }] : [];
|
||||
const body = strip(c.body).slice(0, 300);
|
||||
add({ type: 'ad', id: String(c.id), ownerEmail: c.owner, title: c.name, created: c.created, status: c.scheduled ? 'scheduled' : c.status, live: c.status === 'active' && !c.scheduled, url: c.targetUrl, open: c.targetUrl,
|
||||
detail: { adType: c.type, imageUrl: c.imageUrl, title: c.title, body, width: c.width, height: c.height, budget: c.budget, spent: c.spent, starts: c.starts, expires: c.expires, geo: c.geo, dailyCap: c.dailyCap, audience: c.audience, name: c.name,
|
||||
edits: c.edits || 0, editLog: (c.editLog || []).slice(-5).map(e => ({ ts: e.ts, by: e.by, fields: e.fields, from: e.from, to: e.to, fee: e.fee || 0 })) }, // member edits (first free) + the last few changes
|
||||
counts: { imps: c.imps, impsNas: c.impsNas, clicks: c.clicks }, hosts: [hostOf(c.targetUrl)].concat(urlsIn(c.body).map(hostOf)), flags,
|
||||
actions: (c.status === 'active' ? [{ label: 'Pause ad', path: '/api/admin/campaigns/' + c.id + '/pause', body: {}, warn: 'Pause campaign #' + c.id + '? It stops serving until resumed.' }] : c.status === 'paused' ? [{ label: 'Resume ad', path: '/api/admin/campaigns/' + c.id + '/resume', body: {} }]
|
||||
: c.status === 'queued' ? [{ label: 'Cancel + refund', path: '/api/admin/campaigns/' + c.id + '/cancel-reservation', body: {}, warn: 'Cancel login-slot reservation #' + c.id + '? The ' + c.budget + ' credits paid come back to the member in full and they leave the line.' }] : [])
|
||||
.concat(!['done', 'cancelled'].includes(c.status) ? [{ label: 'Edit ad', edit: true, path: '/api/admin/campaigns/' + c.id + '/edit' }] : []), // free for the admin, the member's free edit untouched
|
||||
search: [c.type, c.targetUrl, c.imageUrl, c.title, body] });
|
||||
}
|
||||
|
||||
// postbacks
|
||||
for (const p of R.postbacks.adminAll()) add({ type: 'postback', id: p.id, ownerEmail: p.owner, title: p.name, created: p.created, status: p.enabled ? 'live' : 'off', live: !!p.enabled, url: '', open: null,
|
||||
detail: { postbackUrl: p.url, method: p.method, events: p.events, lastStatus: p.lastStatus, lastAt: p.lastAt },
|
||||
counts: { sent: p.sent, fails: p.fails }, hosts: [hostOf(p.url)], flags: p.fails >= 5 ? [{ k: 'failing', t: p.fails + ' failed deliveries in a row' }] : [], search: [p.url] });
|
||||
|
||||
// profiles: bio, avatar, socials, line banner, wall offers (public on the member's wall and welcome tours)
|
||||
const refs = {}; const ref = (name, email, where) => { const k = name.toLowerCase(); const o = refs[k] = refs[k] || { email, where: [] }; if (!o.email) o.email = email; if (o.where.length < 6) o.where.push(where); };
|
||||
for (const a of accts) {
|
||||
const socials = parse(a.socials) || {}; const offers = (parse(a.wallOffers) || []).filter(Boolean);
|
||||
const blob = JSON.stringify([a.avatarUrl, a.lineBannerUrl, offers]); let m; UP_RE.lastIndex = 0; while ((m = UP_RE.exec(blob))) ref(m[1], a.email, 'profile of ' + (a.username ? '@' + a.username : a.email));
|
||||
if (!(a.bio || a.avatarUrl || Object.keys(socials).length || a.lineBannerUrl || a.lineTargetUrl || offers.length)) continue;
|
||||
const who = a.username || a.code || '';
|
||||
add({ type: 'profile', id: a.email, ownerEmail: a.email, title: (a.username ? '@' + a.username : a.email) + ' profile', created: a.created, status: 'live', live: true, url: who ? 'https://' + R.siteHost + '/wall/' + who : '', open: who ? '/wall/' + who : null,
|
||||
detail: { bio: String(a.bio || '').slice(0, 600), avatarUrl: a.avatarUrl, socials, lineBannerUrl: a.lineBannerUrl, lineTargetUrl: a.lineTargetUrl, wallOffers: offers },
|
||||
hosts: [hostOf(a.lineTargetUrl), socials.website ? hostOf(socials.website) : ''].concat(offers.map(o => hostOf(o.targetUrl))),
|
||||
search: [a.bio, a.lineTargetUrl, a.lineBannerUrl].concat(Object.values(socials), offers.map(o => (o.title || '') + ' ' + o.targetUrl)) });
|
||||
}
|
||||
|
||||
// uploads: page images (pages index knows the owner) + /uploads files (owner from the upload index or from what uses them)
|
||||
for (const i of R.pages.adminImages()) add({ type: 'upload', id: i.id, ownerEmail: i.owner, title: 'Page image ' + i.id, created: i.ts, status: 'stored', live: true, url: i.path, open: i.path,
|
||||
detail: { file: i.path, size: i.size, mime: i.type, store: 'Page images', image: true }, search: [i.path] });
|
||||
try {
|
||||
const camps = await R.ads.adminList(1000000);
|
||||
for (const c of camps) { if (c.house) continue; const blob = JSON.stringify([c.imageUrl, c.body]); let m; UP_RE.lastIndex = 0; while ((m = UP_RE.exec(blob))) ref(m[1], c.owner, 'campaign #' + c.id + ' (' + c.type + ')'); }
|
||||
} catch (e) {}
|
||||
try { if (R.bannerspin) for (const [f, x] of Object.entries(R.bannerspin.imageRefs())) if (x.where) ref(f, x.email, x.where); } catch (e) {}
|
||||
const idx = readIdx();
|
||||
let files = []; try { files = fs.readdirSync(R.uploadsDir).filter(f => /^[a-z0-9]{24}\.(png|jpg|webp|gif|mp4|webm)$/i.test(f)); } catch (e) {}
|
||||
const seenUp = new Set();
|
||||
for (const f of files) {
|
||||
let st = null; try { st = fs.statSync(path.join(R.uploadsDir, f)); } catch (e) { continue; }
|
||||
const k = f.toLowerCase(); seenUp.add(k); const ix = idx[f] || {}; const rf = refs[k];
|
||||
if (ix.who === 'admin' && !rf) continue; // house-ad creative the admin uploaded
|
||||
const owner = ix.who && ix.who !== 'admin' ? ix.who : rf ? rf.email : '';
|
||||
const isVid = /\.(mp4|webm)$/i.test(f);
|
||||
add({ type: 'upload', id: f, ownerEmail: owner, title: (isVid ? 'Video ' : 'Image ') + f, created: ix.ts || st.mtimeMs, status: rf ? 'in use' : 'unused', live: !!rf, url: '/uploads/' + f, open: '/uploads/' + f,
|
||||
detail: { file: '/uploads/' + f, size: st.size, mime: isVid ? 'video' : 'image', store: 'Uploads', image: !isVid, usedBy: rf ? rf.where : [], ownerGuess: !ix.who && !!rf },
|
||||
search: [f].concat(rf ? rf.where : []) });
|
||||
}
|
||||
for (const [f, ix] of Object.entries(idx)) { // videos that went to Spaces (no local file)
|
||||
if (seenUp.has(f.toLowerCase()) || !ix.url || !/^https?:/i.test(ix.url) || ix.who === 'admin') continue;
|
||||
add({ type: 'upload', id: f, ownerEmail: ix.who, title: 'Video ' + f, created: ix.ts, status: 'stored', live: true, url: ix.url, open: ix.url, detail: { file: ix.url, size: ix.size, mime: 'video', store: 'Spaces', image: false }, search: [ix.url] });
|
||||
}
|
||||
|
||||
// sponsor broadcasts (members writing to their line); system senders left out
|
||||
try {
|
||||
for (const b of await R.messages.adminBroadcasts(3000)) {
|
||||
if (!b.fromEmail || b.fromEmail === admin || b.fromEmail === house) continue;
|
||||
const body = strip(b.body);
|
||||
add({ type: 'message', id: b.fromEmail + ':' + b.sent, ownerEmail: b.fromEmail, title: b.subject || '(no subject)', created: b.sent, status: 'sent', live: true, url: '', open: null,
|
||||
detail: { body: body.slice(0, 600), recipients: b.recipients }, counts: { recipients: b.recipients }, hosts: urlsIn(b.body).map(hostOf), search: [body] });
|
||||
}
|
||||
} catch (e) { console.error('content broadcasts', e.message); }
|
||||
|
||||
// audiences made by hand
|
||||
for (const a of R.audiences.adminAll()) add({ type: 'audience', id: a.id, ownerEmail: a.owner, title: a.name, created: a.created, status: 'live', live: true, url: '', open: null,
|
||||
detail: { audienceId: a.id, pixel: '<script src="https://' + R.siteHost + '/p.js" data-aud="' + a.id + '"></script>' }, counts: { size30: a.size30, size7: a.size7 }, search: [a.id] });
|
||||
|
||||
// Video Maker renders (the company promo with the member's own end card)
|
||||
for (const j of R.videomaker.adminJobs()) add({ type: 'video', id: j.id, ownerEmail: j.email, title: j.title, created: j.at, status: j.status, live: j.status === 'done', url: j.url || '', open: j.url || null,
|
||||
detail: { slug: j.slug, username: j.username, error: j.error || '', doneAt: j.doneAt || 0 }, search: [j.slug, j.username] });
|
||||
|
||||
cache = { ts: Date.now(), rows }; return rows;
|
||||
}
|
||||
|
||||
// -- the API: GET /api/admin/content?type=&q=&from=&to=&flagged=1&page=&per=&fresh=1
|
||||
async function query(o) {
|
||||
o = o || {};
|
||||
const rows = await collect(!!o.fresh);
|
||||
const totals = {}; for (const t of TYPES) totals[t.key] = { n: 0, live: 0, flagged: 0 };
|
||||
let flaggedAll = 0; for (const r of rows) { const t = totals[r.type]; if (!t) continue; t.n++; if (r.live) t.live++; if (r.flags.length) { t.flagged++; flaggedAll++; } }
|
||||
const type = TYPES.some(t => t.key === o.type) ? o.type : 'all';
|
||||
const day = s => /^\d{4}-\d{2}-\d{2}$/.test(String(s || '')) ? String(s) : '';
|
||||
const from = day(o.from), to = day(o.to);
|
||||
const terms = String(o.q || '').toLowerCase().split(/\s+/).filter(Boolean).slice(0, 8);
|
||||
let list = rows.filter(r => (type === 'all' || r.type === type) && (!o.flagged || r.flags.length) && (!from || (r.day && r.day >= from)) && (!to || (r.day && r.day <= to)) && terms.every(t => r.text.includes(t)));
|
||||
list.sort((a, b) => (Number(b.created) || 0) - (Number(a.created) || 0));
|
||||
const hc = {}; for (const r of list) for (const h of r.hosts) hc[h] = (hc[h] || 0) + 1;
|
||||
const hosts = Object.entries(hc).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([host, n]) => ({ host, n, burned: (() => { try { return !!R.domains.isBurned(host); } catch (e) { return false; } })() }));
|
||||
const per = Math.max(10, Math.min(200, Number(o.per) || 50)); const pages = Math.max(1, Math.ceil(list.length / per));
|
||||
const page = Math.max(1, Math.min(pages, Number(o.page) || 1));
|
||||
const items = list.slice((page - 1) * per, page * per).map(r => { const x = Object.assign({}, r); delete x.text; return x; });
|
||||
return { types: TYPES, type, totals, all: rows.length, flaggedAll, matched: list.length, page, pages, per, items, hosts, denyList: false, generated: cache ? cache.ts : Date.now() };
|
||||
}
|
||||
function invalidate() { cache = null; }
|
||||
module.exports = { init, TYPES, query, collect, invalidate, noteUpload };
|
||||
+308
@@ -0,0 +1,308 @@
|
||||
// Conversion pixel (Marty approved 2026-10-23, "Go with the conversion pixel"). LinkSpin is the single source of truth
|
||||
// for goals and goal conversions, for its own members AND for InstantAdPay members (their LinkSpin shell account, same
|
||||
// email, holds the goals; InstantAdPay reads and edits them over the signed partner call).
|
||||
//
|
||||
// - Goals: a member names a goal ("subscriber", "sale", optional default value). Each goal has a PUBLIC pixel id
|
||||
// (px + 10 hex). It is not a secret: it can only ever count conversions for clicks its owner owns.
|
||||
// - Ad clicks: every LinkSpin ad click (/api/ads/click, zone clicks) gets a click id 'a' + 11 hex; every InstantAdPay
|
||||
// ad click is pushed here with its own id 'i' + 11 hex (/api/partner/clicks). Spin-link clicks keep the rotator's
|
||||
// 10-hex lsid; a spin-link click that arrived through an ad carries that ad click as `ac` (rotator.js).
|
||||
// - Landing tag (/t.js) stores the click id on the member's own site; the goal pixel (/cv.gif, /cv.js) reports it.
|
||||
// Matching order: the click id in the URL > the landing tag's stored id > LinkSpin's cookie > the 24 h IP+UA soft key.
|
||||
// The method that matched is kept on the conversion so Reports can say how solid each count is.
|
||||
// - Rules: each goal counts once per click (per ROOT click: an ad click and the spin-link click it led to are one
|
||||
// click), only within 30 days of a real click, only for clicks the pixel's owner owns (the ad's owner or the spin
|
||||
// link's owner), per-pixel and per-IP rate limits. A test conversion is recorded apart and never counted. The goal
|
||||
// owner's own click (any type: ad, spin link, Banner Spin) is kept as a test, never counted (2026-10-26).
|
||||
// - Banner Spin clicks ('k' + 11 hex) that go straight to a page carry lsclk too since 2026-10-26 (bannerspin.js).
|
||||
// Storage: DATA_DIR/convtrack.json (JSON in both modes, like rotator.json / postbacks.json), debounced writes.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const DAY = 86400000, WINDOW_MS = 30 * DAY, SOFT_MS = 24 * 3600000, MAX_GOALS = 20;
|
||||
const MAX_CLICKS = 300000, MAX_CONV = 100000;
|
||||
let FILE = null, S = null, dirty = false, rotator = null, bannerspin = null, campaignOf = async () => null;
|
||||
|
||||
function load() {
|
||||
if (S) return S;
|
||||
try { S = JSON.parse(fs.readFileSync(FILE, 'utf8')); } catch (e) { S = null; }
|
||||
if (!S || typeof S !== 'object') S = {};
|
||||
S.v = 1; S.goals = S.goals || {}; S.clicks = S.clicks || {}; S.soft = S.soft || {}; S.conv = Array.isArray(S.conv) ? S.conv : []; S.camps = S.camps || {}; S.tests = S.tests || {};
|
||||
S.own = S.own || {}; S.selfIds = S.selfIds || {}; // own-click tests (2026-10-26): soft key -> { owner email: last seen }, click id -> marked at
|
||||
return S;
|
||||
}
|
||||
function save() { dirty = true; }
|
||||
function flush() { if (!dirty || !S || !FILE) return; dirty = false; try { fs.writeFileSync(FILE + '.tmp', JSON.stringify(S)); fs.renameSync(FILE + '.tmp', FILE); } catch (e) { console.error('convtrack save', e.message); } }
|
||||
function init(opts) {
|
||||
FILE = path.join(opts.dataDir, 'convtrack.json'); rotator = opts.rotator || null; bannerspin = opts.bannerspin || null; if (opts.campaignOf) campaignOf = opts.campaignOf;
|
||||
S = null; load();
|
||||
if (!opts.noTimers) { setInterval(flush, 3000).unref(); setInterval(prune, 3600000).unref(); }
|
||||
}
|
||||
|
||||
const norm = e => String(e || '').trim().toLowerCase();
|
||||
const isPx = v => /^px[a-f0-9]{10}$/.test(String(v || ''));
|
||||
const isClickId = v => /^[a-z0-9]{6,24}$/i.test(String(v || ''));
|
||||
const isAdId = v => /^[ai][a-f0-9]{11}$/.test(String(v || ''));
|
||||
const cleanName = v => { const s = String(v == null ? '' : v).trim().toLowerCase().replace(/\s+/g, '_'); return /^[a-z0-9_-]{1,32}$/.test(s) ? s : ''; };
|
||||
const cleanValue = v => { if (v === '' || v == null) return 0; const n = Number(v); return Number.isFinite(n) && n >= 0 ? Math.min(Math.round(n * 100) / 100, 100000) : 0; };
|
||||
const newPx = () => { for (;;) { const id = 'px' + crypto.randomBytes(5).toString('hex'); if (!load().goals[id]) return id; } };
|
||||
const newAdClickId = () => 'a' + crypto.randomBytes(6).toString('hex').slice(0, 11);
|
||||
function ipOf(req) { return String(req.headers['x-forwarded-for'] || (req.socket && req.socket.remoteAddress) || '').split(',')[0].trim(); }
|
||||
// the soft key: InstantAdPay computes exactly the same thing for its ad clicks (contract 2026-10-23)
|
||||
function softKey(req) { return 's:' + crypto.createHash('sha256').update(ipOf(req) + '|' + String(req.headers['user-agent'] || '')).digest('hex').slice(0, 20); }
|
||||
|
||||
// ── own clicks are tests, on every click type (Marty approved 2026-10-26) ───────────────────────────────────────
|
||||
// A member clicking their OWN ad, spin link or Banner Spin and converting is a test, never a count. Known by: the click
|
||||
// was made while signed in as the owner (ads), or the clicking / converting browser's soft key is one the owner has been
|
||||
// seen signed in from (LinkSpin sessions, noted by auth.js; InstantAdPay sessions, pushed with its clicks). Linked
|
||||
// positions sit on the owner's own email, so they are the owner here too. Soft keys kept 31 days (the click window).
|
||||
const OWN_MS = WINDOW_MS + DAY, ownNoted = new Map();
|
||||
const isSk = sk => /^s:[a-f0-9]{20}$/.test(String(sk || ''));
|
||||
function noteOwner(email, sk, ts) {
|
||||
const e = norm(email); if (!e || e.length > 190 || !isSk(sk)) return false;
|
||||
const at = Math.min(Number(ts) || Date.now(), Date.now()); const k = e + '|' + sk;
|
||||
if ((ownNoted.get(k) || 0) > at - 600000) return false; ownNoted.set(k, at); if (ownNoted.size > 20000) ownNoted.clear();
|
||||
const st = load(); const m = st.own[sk] = st.own[sk] || {};
|
||||
if (!(m[e] >= at)) m[e] = at;
|
||||
const keys = Object.keys(m); if (keys.length > 8) { keys.sort((a, b) => m[a] - m[b]); for (const x of keys.slice(0, keys.length - 8)) delete m[x]; }
|
||||
save(); return true;
|
||||
}
|
||||
function noteSession(email, req) { try { return noteOwner(email, softKey(req)); } catch (e) { return false; } }
|
||||
// InstantAdPay's pushed rows: [{ owner, sk, ts }] (its members' own sessions)
|
||||
function importOwners(rows) { let n = 0; for (const r of (Array.isArray(rows) ? rows.slice(0, 2000) : [])) if (r && noteOwner(r.owner, r.sk, r.ts)) n++; return n; }
|
||||
function isOwnerSk(owner, sk) { const m = isSk(sk) && load().own[sk]; const t = m && m[norm(owner)]; return !!(t && Date.now() - t <= OWN_MS); }
|
||||
// spin-link and Banner Spin clicks: marked when the owner made them (signed in on this host, or from an owner soft key)
|
||||
function markSelfClick(id, owner, req, sessionEmail) {
|
||||
if (!isClickId(id) || !owner) return false;
|
||||
const mine = (sessionEmail && norm(sessionEmail) === norm(owner)) || isOwnerSk(owner, softKey(req));
|
||||
if (mine) { load().selfIds[id] = Date.now(); save(); }
|
||||
return !!mine;
|
||||
}
|
||||
|
||||
// ── goals ───────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
function pubGoal(g) { return { px: g.px, name: g.name, value: g.value || 0, created: g.created, lastTest: (load().tests[g.px] || 0) || null }; }
|
||||
function goalsOf(owner) { const o = norm(owner); return Object.values(load().goals).filter(g => g.owner === o).sort((a, b) => a.created - b.created); }
|
||||
function goal(px) { return load().goals[String(px || '')] || null; }
|
||||
function createGoal(owner, body) {
|
||||
const o = norm(owner); if (!o) return { error: 'Sign in first.' };
|
||||
const name = cleanName(body && body.name); if (!name) return { error: 'Name the goal with letters, numbers, - or _ (for example subscriber or sale), up to 32.' };
|
||||
const mine = goalsOf(o);
|
||||
if (mine.length >= MAX_GOALS) return { error: 'Up to ' + MAX_GOALS + ' goals per account. Remove one first.' };
|
||||
if (mine.some(g => g.name === name)) return { error: 'You already have a goal called ' + name + '.' };
|
||||
const g = { px: newPx(), owner: o, name, value: cleanValue(body && body.value), created: Date.now() };
|
||||
load().goals[g.px] = g; save(); flush(); return { ok: true, goal: pubGoal(g) };
|
||||
}
|
||||
function updateGoal(owner, px, body) {
|
||||
const g = goal(px); if (!g || g.owner !== norm(owner)) return { error: 'No such goal.' };
|
||||
if (body.remove) { delete load().goals[g.px]; delete load().tests[g.px]; save(); flush(); return { ok: true, removed: true }; } // its past conversions stay in the log (the reports show them under the name)
|
||||
if (body.name != null) { const n = cleanName(body.name); if (!n) return { error: 'Name the goal with letters, numbers, - or _ , up to 32.' }; if (goalsOf(g.owner).some(x => x.px !== g.px && x.name === n)) return { error: 'You already have a goal called ' + n + '.' }; g.name = n; }
|
||||
if (body.value != null) g.value = cleanValue(body.value);
|
||||
save(); flush(); return { ok: true, goal: pubGoal(g) };
|
||||
}
|
||||
|
||||
// ── clicks ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
function noteSoft(sk, id, owner, ts) {
|
||||
if (!sk || !/^s:[a-f0-9]{20}$/.test(sk) || !id) return;
|
||||
const st = load(); const now = ts || Date.now();
|
||||
const list = (st.soft[sk] || []).filter(x => now - x[1] <= SOFT_MS && x[0] !== id);
|
||||
list.push([id, now, norm(owner)]); st.soft[sk] = list.slice(-6); save();
|
||||
}
|
||||
// a LinkSpin ad click (banner, text, zone). Returns the click id to append to the target.
|
||||
function recordAdClick(camp, req, extra) {
|
||||
if (!camp || !camp.id) return null;
|
||||
const st = load(); const id = newAdClickId(); const ua = String(req.headers['user-agent'] || '');
|
||||
const sk = softKey(req);
|
||||
let pl = String((extra && extra.placement) || ''); if (!pl) { try { const r = new URL(String(req.headers.referer || '')); pl = (r.hostname.replace(/^www\./, '') + r.pathname).slice(0, 80); } catch (e) {} }
|
||||
st.clicks[id] = { id, k: 'ad', camp: Number(camp.id), cname: String(camp.name || camp.title || '').slice(0, 80), type: camp.type || '', owner: norm(camp.owner), ts: Date.now(), sk,
|
||||
c: (extra && extra.country) || '', dv: /mobile|android|iphone|ipad/i.test(ua) ? 'mobile' : 'desktop', pl, self: (extra && extra.self) || isOwnerSk(camp.owner, sk) ? 1 : undefined, target: String(camp.targetUrl || '').slice(0, 300) };
|
||||
noteSoft(sk, id, camp.owner); trimClicks(); save();
|
||||
return id;
|
||||
}
|
||||
// InstantAdPay pushes its ad clicks (signed partner call); an upsert by id, so a row sent twice is harmless
|
||||
function importClicks(rows) {
|
||||
const st = load(); let n = 0;
|
||||
for (const r of (Array.isArray(rows) ? rows.slice(0, 500) : [])) {
|
||||
const id = String(r && r.id || ''); if (!/^i[a-f0-9]{11}$/.test(id)) continue;
|
||||
const owner = norm(r.owner); if (!owner || owner.length > 190) continue;
|
||||
const ts = Number(r.ts) || Date.now(); if (ts > Date.now() + 600000 || Date.now() - ts > WINDOW_MS) continue;
|
||||
const sk = /^s:[a-f0-9]{20}$/.test(String(r.sk || '')) ? String(r.sk) : '';
|
||||
const had = !!st.clicks[id];
|
||||
st.clicks[id] = { id, k: 'iap', camp: Number(r.camp) || 0, cname: String(r.cname || '').slice(0, 80), type: String(r.type || '').slice(0, 12), owner, ts, sk,
|
||||
c: String(r.c || '').toUpperCase().replace(/[^A-Z]/g, '').slice(0, 2), dv: r.dv === 'mobile' ? 'mobile' : 'desktop', pl: String(r.pl || '').slice(0, 80), self: r.self || isOwnerSk(owner, sk) ? 1 : undefined, target: String(r.target || '').slice(0, 300) };
|
||||
if (r.camp) { const key = 'iap:' + Number(r.camp); const cur = st.camps[key] || {}; if (!cur.ts || ts >= cur.ts) st.camps[key] = { owner, name: String(r.cname || '').slice(0, 80), spent: Math.max(0, Number(r.spent) || 0), ts }; }
|
||||
if (!had && sk) noteSoft(sk, id, owner, ts);
|
||||
n++;
|
||||
}
|
||||
if (n) { trimClicks(); save(); }
|
||||
return n;
|
||||
}
|
||||
function trimClicks() {
|
||||
const st = load(); const keys = Object.keys(st.clicks); if (keys.length <= MAX_CLICKS) return;
|
||||
keys.sort((a, b) => st.clicks[a].ts - st.clicks[b].ts); for (const k of keys.slice(0, keys.length - Math.floor(MAX_CLICKS * 0.8))) delete st.clicks[k];
|
||||
}
|
||||
function prune() {
|
||||
const st = load(); const now = Date.now();
|
||||
for (const k in st.clicks) if (now - st.clicks[k].ts > WINDOW_MS + DAY) delete st.clicks[k];
|
||||
for (const k in st.soft) { const l = st.soft[k].filter(x => now - x[1] <= SOFT_MS); if (l.length) st.soft[k] = l; else delete st.soft[k]; }
|
||||
for (const k in st.camps) if (now - st.camps[k].ts > 400 * DAY) delete st.camps[k];
|
||||
for (const k in st.selfIds) if (now - st.selfIds[k] > OWN_MS) delete st.selfIds[k];
|
||||
for (const k in st.own) { const m = st.own[k]; for (const e in m) if (now - m[e] > OWN_MS) delete m[e]; if (!Object.keys(m).length) delete st.own[k]; }
|
||||
if (st.conv.length > MAX_CONV) st.conv = st.conv.slice(-Math.floor(MAX_CONV * 0.8));
|
||||
save(); flush();
|
||||
}
|
||||
|
||||
// What a click id is, who owns it, where it came from. Spin-link clicks live in rotator.json.
|
||||
function lookup(id) {
|
||||
id = String(id || ''); if (!isClickId(id)) return null;
|
||||
const st = load();
|
||||
const ad = st.clicks[id];
|
||||
if (ad) return { id, root: id, ts: ad.ts, owners: [ad.owner], ad };
|
||||
if (rotator && rotator.hitById && id[0] !== 'k') { // spin-link ids are 10 hex, never 'k' (that is Banner Spin's)
|
||||
const h = rotator.hitById(id); if (!h || !h.hit || h.hit.bot) return null;
|
||||
const via = h.hit.ac && st.clicks[h.hit.ac] ? st.clicks[h.hit.ac] : null;
|
||||
return { id, root: via ? via.id : id, ts: via ? Math.min(via.ts, h.hit.ts) : h.hit.ts, owners: [h.owner].concat(via ? [via.owner] : []), ad: via, spin: h };
|
||||
}
|
||||
// a Banner Spin click ('k' + 11 hex) that went straight to a page (2026-10-26: those now carry lsclk too)
|
||||
if (bannerspin && bannerspin.clickById && id[0] === 'k') {
|
||||
const b = bannerspin.clickById(id); if (!b || !b.click || b.click.bot) return null;
|
||||
return { id, root: id, ts: b.click.ts, owners: [b.owner], bspin: b };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ── the goal pixel ─────────────────────────────────────────────────────────────────────────────────────────────
|
||||
const RL = { px: new Map(), ip: new Map() };
|
||||
function rateOk(map, key, max, ms) { const now = Date.now(); const a = (map.get(key) || []).filter(t => now - t < ms); if (a.length >= max) { map.set(key, a); return false; } a.push(now); map.set(key, a); if (map.size > 50000) map.clear(); return true; }
|
||||
setInterval(() => { const now = Date.now(); for (const m of [RL.px, RL.ip]) for (const [k, a] of m) if (!a.some(t => now - t < 3600000)) m.delete(k); }, 600000).unref();
|
||||
const LIMITS = { pxPerMin: 60, pxPerHour: 1000, ipPerMin: 20 };
|
||||
|
||||
// q: { px, goal, value, c (click id from the page), m ('url'|'stored', who found it), test }
|
||||
// cookies: { 'ls.clk', 'ls.click' }. Returns { result, method?, conv? } where result is counted | dup | nomatch | unknown | limited | test | refused
|
||||
function record(q, req, cookies) {
|
||||
const g = goal(q.px); if (!g) return { result: 'unknown' };
|
||||
const sk = softKey(req); const ip = sk; // the soft key doubles as the per-visitor rate key (no raw IP held)
|
||||
if (!rateOk(RL.ip, ip, LIMITS.ipPerMin, 60000)) return { result: 'limited' };
|
||||
if (!rateOk(RL.px, g.px + ':m', LIMITS.pxPerMin, 60000) || !rateOk(RL.px, g.px + ':h', LIMITS.pxPerHour, 3600000)) return { result: 'limited' };
|
||||
if (q.test) { load().tests[g.px] = Date.now(); save(); return { result: 'test', at: load().tests[g.px] }; }
|
||||
const now = Date.now(); let refused = 0;
|
||||
const tryId = (id, method) => {
|
||||
const L = lookup(id); if (!L) return null;
|
||||
if (!L.owners.includes(g.owner)) { refused++; return null; } // someone else's click: never counted for this pixel
|
||||
if (now - L.ts > WINDOW_MS) return null;
|
||||
return Object.assign(L, { method });
|
||||
};
|
||||
let hit = null;
|
||||
if (isClickId(q.c)) hit = tryId(q.c, q.m === 'stored' ? 'stored' : 'url');
|
||||
if (!hit) for (const ck of ['ls.clk', 'ls.click']) { const v = cookies && cookies[ck]; if (!hit && isClickId(v)) hit = tryId(v, 'cookie'); }
|
||||
if (!hit) { const list = (load().soft[sk] || []).filter(x => x[2] === g.owner && now - x[1] <= SOFT_MS).sort((a, b) => b[1] - a[1]); for (const x of list) { hit = tryId(x[0], 'soft'); if (hit) break; } }
|
||||
if (!hit) return { result: refused ? 'refused' : 'nomatch' };
|
||||
const st = load();
|
||||
if (st.conv.some(c => c.px === g.px && (c.root === hit.root || c.click === hit.id || c.root === hit.id))) return { result: 'dup', method: hit.method };
|
||||
const ad = hit.ad, sp = hit.spin, bs = hit.bspin;
|
||||
const value = q.value != null && q.value !== '' ? cleanValue(q.value) : (g.value || 0);
|
||||
// the goal owner's own click, on ANY click type (ad, spin link, Banner Spin): kept as a test, never in the counts.
|
||||
// Own = the ad click was flagged self for this owner, the spin / Banner Spin click was marked at click time, or the
|
||||
// clicking or converting browser is one the owner has been seen signed in from (2026-10-26).
|
||||
const self = (ad && ad.self && ad.owner === g.owner) || st.selfIds[hit.id] || st.selfIds[hit.root] || isOwnerSk(g.owner, sk) || (ad && ad.sk && isOwnerSk(g.owner, ad.sk)) ? 1 : undefined;
|
||||
const conv = { id: crypto.randomBytes(6).toString('hex'), ts: now, px: g.px, goal: g.name, owner: g.owner, click: hit.id, root: hit.root, method: hit.method, value,
|
||||
k: ad ? ad.k : (bs ? 'bspin' : 'spin'), camp: ad ? ad.camp : undefined, cname: ad ? ad.cname : undefined, ctype: ad ? ad.type : undefined,
|
||||
rot: sp ? sp.rotation.id : undefined, rcode: sp ? sp.rotation.code : undefined, rname: sp ? sp.rotation.name : undefined,
|
||||
bs: bs ? bs.spin.id : undefined, bcode: bs ? bs.spin.code : undefined, bname: bs ? bs.spin.name : undefined, bban: bs && bs.banner ? bs.banner.id : undefined,
|
||||
dest: sp ? sp.destUrl : (bs ? bs.destUrl : (ad ? ad.target : undefined)), sr: sp ? (sp.hit.sr || undefined) : (bs ? (bs.click.sr || undefined) : undefined), src: sp ? sp.hit.s : (bs ? (bs.click.h || 'direct') : (ad ? ad.pl : undefined)),
|
||||
c: (sp ? sp.hit.c : (bs ? bs.click.c : ad && ad.c)) || '', dv: (sp ? sp.hit.dv : (bs ? bs.click.dv : ad && ad.dv)) || '', self };
|
||||
for (const k of Object.keys(conv)) if (conv[k] === undefined) delete conv[k];
|
||||
st.conv.push(conv); save();
|
||||
return { result: 'counted', method: hit.method, conv, hit };
|
||||
}
|
||||
// the postback context for a counted conversion (postbacks.fire)
|
||||
function postbackCtx(r) {
|
||||
const c = r.conv, sp = r.hit && r.hit.spin, bs = r.hit && r.hit.bspin;
|
||||
return { q: sp ? (sp.hit.q || {}) : (bs ? (bs.click.q || {}) : {}), source: c.src || '', country: c.c || '', device: c.dv || '', lsid: c.click, code: c.rcode || c.bcode || '', sourceId: c.sr || '', payout: c.value || 0, currency: 'USD', label: c.goal };
|
||||
}
|
||||
// the landing tag's beacon: it saw a click id on the member's page. Returns the id when it is a real click of the pixel's owner.
|
||||
function landing(px, id, req) {
|
||||
const g = goal(px); if (!g || !isClickId(id)) return null;
|
||||
if (!rateOk(RL.ip, softKey(req) + ':t', 60, 60000)) return null;
|
||||
const L = lookup(id); if (!L || !L.owners.includes(g.owner) || Date.now() - L.ts > WINDOW_MS) return null;
|
||||
noteSoft(softKey(req), id, g.owner); return id;
|
||||
}
|
||||
|
||||
// ── reports ─────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
// per goal: totals, match methods, and breakdowns by ad campaign (LinkSpin + InstantAdPay), spin link, destination
|
||||
// and traffic source. Cost per goal on ad campaigns = the campaign's credits spent / its conversions of that goal.
|
||||
async function report(owner, days, opts) {
|
||||
const o = norm(owner); const since = Date.now() - (Math.max(1, Math.min(400, Number(days) || 30))) * DAY;
|
||||
const goals = goalsOf(o); const st = load();
|
||||
const conv = st.conv.filter(c => c.owner === o && c.ts >= since && !c.self);
|
||||
const selfTests = st.conv.filter(c => c.owner === o && c.ts >= since && c.self).length;
|
||||
const methods = { url: 0, stored: 0, cookie: 0, soft: 0 };
|
||||
const byGoal = {};
|
||||
const at = (gname) => (byGoal[gname] = byGoal[gname] || { goal: gname, n: 0, value: 0, methods: { url: 0, stored: 0, cookie: 0, soft: 0 }, campaigns: {}, links: {}, banners: {}, dests: {}, sources: {} });
|
||||
for (const c of conv) {
|
||||
const G = at(c.goal); G.n++; G.value += c.value || 0; G.methods[c.method] = (G.methods[c.method] || 0) + 1; methods[c.method] = (methods[c.method] || 0) + 1;
|
||||
if (c.camp) { const key = (c.k === 'iap' ? 'iap:' : 'ls:') + c.camp; const x = G.campaigns[key] = G.campaigns[key] || { key, site: c.k === 'iap' ? 'InstantAdPay' : 'LinkSpin', id: c.camp, name: c.cname || '', n: 0, value: 0 }; x.n++; x.value += c.value || 0; }
|
||||
if (c.rot) { const x = G.links[c.rot] = G.links[c.rot] || { id: c.rot, code: c.rcode, name: c.rname || '', n: 0, value: 0 }; x.n++; x.value += c.value || 0; }
|
||||
if (c.bs) { const x = G.banners[c.bs] = G.banners[c.bs] || { id: c.bs, code: c.bcode, name: c.bname || '', n: 0, value: 0 }; x.n++; x.value += c.value || 0; }
|
||||
if (c.dest) { let d = c.dest; try { const u = new URL(c.dest); d = u.hostname.replace(/^www\./, '') + u.pathname.replace(/\/$/, ''); } catch (e) {} const x = G.dests[d] = G.dests[d] || { k: d, n: 0 }; x.n++; }
|
||||
{ const key = c.sr ? 'src:' + c.sr : (c.src || '(direct)'); const x = G.sources[key] = G.sources[key] || { k: key, sourceId: c.sr || '', n: 0 }; x.n++; }
|
||||
}
|
||||
// clicks per ad campaign in the same window, and the cost basis
|
||||
const clicksBy = {}; for (const k in st.clicks) { const a = st.clicks[k]; if (a.owner !== o || a.ts < since || a.self) continue; const key = (a.k === 'iap' ? 'iap:' : 'ls:') + a.camp; clicksBy[key] = (clicksBy[key] || 0) + 1; }
|
||||
const meta = (opts && opts.sourceMeta) || {};
|
||||
const out = [];
|
||||
for (const gname of new Set(goals.map(g => g.name).concat(Object.keys(byGoal)))) {
|
||||
const G = byGoal[gname] || at(gname);
|
||||
const campaigns = [];
|
||||
for (const x of Object.values(G.campaigns)) {
|
||||
let spent = null, asOf = null;
|
||||
if (x.site === 'LinkSpin') { try { const cp = await campaignOf(x.id); if (cp && norm(cp.owner) === o) { spent = Number(cp.spent || 0) + Number(cp.accrued || 0); if (!x.name) x.name = cp.name || ''; } } catch (e) {} }
|
||||
else { const cm = st.camps['iap:' + x.id]; if (cm && cm.owner === o) { spent = cm.spent; asOf = cm.ts; if (!x.name) x.name = cm.name; } }
|
||||
campaigns.push(Object.assign(x, { clicks: clicksBy[x.key] || 0, spent, spentAsOf: asOf, costPer: spent != null && x.n ? Math.round(spent / x.n * 100) / 100 : null, rate: clicksBy[x.key] ? Math.round(x.n / clicksBy[x.key] * 1000) / 10 : null }));
|
||||
}
|
||||
campaigns.sort((a, b) => b.n - a.n);
|
||||
const sources = Object.values(G.sources).map(x => Object.assign(x, { name: x.sourceId ? ((meta[x.sourceId] || {}).name || 'Deleted source') : x.k })).sort((a, b) => b.n - a.n).slice(0, 15);
|
||||
const g = goals.find(y => y.name === gname);
|
||||
out.push({ goal: gname, px: g ? g.px : null, removed: !g, n: G.n, value: Math.round(G.value * 100) / 100, methods: G.methods, campaigns,
|
||||
links: Object.values(G.links).sort((a, b) => b.n - a.n).slice(0, 15), banners: Object.values(G.banners).sort((a, b) => b.n - a.n).slice(0, 15), dests: Object.values(G.dests).sort((a, b) => b.n - a.n).slice(0, 15), sources });
|
||||
}
|
||||
return { days: Number(days) || 30, goals: goals.map(g => Object.assign(pubGoal(g), { conv: conv.filter(c => c.px === g.px).length, lastAt: (conv.filter(c => c.px === g.px).pop() || {}).ts || null })),
|
||||
byGoal: out, methods, total: conv.length, selfTests };
|
||||
}
|
||||
// InstantAdPay's view: goals + per IAP campaign conversions (and clicks) for this owner
|
||||
// goal conversions (not the owner's own tests) since a moment, for the Engine Room's goals dial (2026-10-24)
|
||||
function countSince(owner, since) { const o = norm(owner); return load().conv.filter(c => c.owner === o && c.ts >= since && !c.self).length; }
|
||||
function partnerSummary(owner, days) {
|
||||
const o = norm(owner); const since = Date.now() - (Math.max(1, Math.min(90, Number(days) || 30))) * DAY; const st = load();
|
||||
const conv = st.conv.filter(c => c.owner === o && c.ts >= since && !c.self);
|
||||
const byCampaign = {};
|
||||
for (const k in st.clicks) { const a = st.clicks[k]; if (a.k !== 'iap' || a.owner !== o || a.ts < since || a.self) continue; const b = byCampaign[a.camp] = byCampaign[a.camp] || { clicks: 0, conv: {}, value: {} }; b.clicks++; }
|
||||
for (const c of conv) if (c.k === 'iap' && c.camp) { const b = byCampaign[c.camp] = byCampaign[c.camp] || { clicks: 0, conv: {}, value: {} }; b.conv[c.px] = (b.conv[c.px] || 0) + 1; b.value[c.px] = Math.round(((b.value[c.px] || 0) + (c.value || 0)) * 100) / 100; }
|
||||
const methods = { url: 0, stored: 0, cookie: 0, soft: 0 }; for (const c of conv) methods[c.method] = (methods[c.method] || 0) + 1;
|
||||
const goals = goalsOf(o).map(g => { const mine = conv.filter(c => c.px === g.px); return Object.assign(pubGoal(g), { conv: mine.length, convDays: Number(days) || 30, lastAt: mine.length ? mine[mine.length - 1].ts : null }); });
|
||||
const selfTests = st.conv.filter(c => c.owner === o && c.ts >= since && c.self).length; // own clicks, kept as tests (InstantAdPay shows "N from your own clicks")
|
||||
return { ok: true, goals, byCampaign, methods, selfTests };
|
||||
}
|
||||
function csv(owner, days) {
|
||||
const o = norm(owner); const since = Date.now() - (Math.max(1, Math.min(400, Number(days) || 30))) * DAY;
|
||||
const esc = v => { const s = v == null ? '' : String(v); return /[",\n]/.test(s) || /^[=+\-@]/.test(s) ? '"' + (/^[=+\-@]/.test(s) ? "'" : '') + s.replace(/"/g, '""') + '"' : s; };
|
||||
const ctFmt = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false });
|
||||
const lines = ['time_central,goal,value,match_method,site,campaign_id,campaign,spin_link,destination,source,country,device,click_id'];
|
||||
for (const c of load().conv) if (c.owner === o && c.ts >= since && !c.self) lines.push([ctFmt.format(new Date(c.ts)).replace(',', ''), c.goal, c.value || 0, c.method, c.k === 'iap' ? 'InstantAdPay' : (c.k === 'ad' ? 'LinkSpin ad' : (c.k === 'bspin' ? 'Banner Spin' : 'Spin link')), c.camp || '', c.cname || '', c.rcode || (c.bcode ? 'c/' + c.bcode : ''), c.dest || '', c.src || '', c.c || '', c.dv || '', c.click].map(esc).join(','));
|
||||
return lines.join('\n') + '\n';
|
||||
}
|
||||
// "Send a test conversion" from a screen (InstantAdPay's partner call, or the Control Room when it cannot load the image)
|
||||
function testGoal(owner, px) { const g = goal(px); if (!g || g.owner !== norm(owner)) return { error: 'No such goal.' }; load().tests[g.px] = Date.now(); save(); flush(); return { ok: true, at: load().tests[g.px] }; }
|
||||
function adminCounts() { const st = load(); return { goals: Object.keys(st.goals).length, clicks: Object.keys(st.clicks).length, conversions: st.conv.length }; }
|
||||
// append lsclk=<id> the way InstantAdPay's lsconv.withClickId does: string insert (every existing param keeps its exact
|
||||
// encoding), before any #hash, an lsclk already there never replaced, a URL that does not parse goes out unchanged
|
||||
function withClickId(target, id) {
|
||||
const t = String(target || '');
|
||||
let u; try { u = new URL(t); } catch (e) { return t; }
|
||||
if (!/^https?:$/.test(u.protocol) || u.searchParams.has('lsclk') || !isClickId(id)) return t;
|
||||
const hashAt = t.indexOf('#'); const base = hashAt >= 0 ? t.slice(0, hashAt) : t; const hash = hashAt >= 0 ? t.slice(hashAt) : '';
|
||||
const sep = base.includes('?') ? (/[?&]$/.test(base) ? '' : '&') : '?';
|
||||
return base + sep + 'lsclk=' + encodeURIComponent(id) + hash;
|
||||
}
|
||||
module.exports = { noteOwner, noteSession, importOwners, isOwnerSk, markSelfClick, withClickId, countSince, init, flush, prune, softKey, isPx, isClickId, isAdId, cleanName, cleanValue, goalsOf, goal, createGoal, updateGoal, recordAdClick, importClicks, lookup, record, postbackCtx, landing, report, partnerSummary, csv, adminCounts, testGoal, LIMITS, WINDOW_MS, SOFT_MS };
|
||||
@@ -90,6 +90,8 @@ async function bootstrap() {
|
||||
await alterSafe('ALTER TABLE accounts ADD COLUMN socials VARCHAR(1200) NULL'); // JSON {platform:url}
|
||||
await alterSafe('ALTER TABLE accounts ADD COLUMN line_banner_url VARCHAR(500) NULL');
|
||||
await alterSafe('ALTER TABLE accounts ADD COLUMN line_target_url VARCHAR(500) NULL');
|
||||
await alterSafe('ALTER TABLE accounts ADD COLUMN profile_quarantined TINYINT NOT NULL DEFAULT 0');
|
||||
await alterSafe('ALTER TABLE accounts ADD COLUMN theme VARCHAR(8) NULL'); // 2026-11-01 appearance: auto | light | dark // 2026-10-30 link-farm rule: first profile save of a new free account carried a link (spamscan.js)
|
||||
await q(`CREATE TABLE IF NOT EXISTS daily_views (
|
||||
email VARCHAR(190) NOT NULL,
|
||||
day CHAR(10) NOT NULL,
|
||||
@@ -120,6 +122,8 @@ async function bootstrap() {
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN height INT NULL'); // banner size (IAB) → also NAS height
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN nas_ad_id INT NULL'); // syndicated NAS sponsorads.ID
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN nas_served INT NOT NULL DEFAULT 0'); // NAS impressions already reconciled into spend
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN syn_imps INT NOT NULL DEFAULT 0'); // views in other members' zones (charged at 1/synRateDivisor)
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN syn_batch INT NOT NULL DEFAULT 0'); // partner-zone views toward the next 1/N batch
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN expires BIGINT NULL'); // featured rotation end time
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN starts BIGINT NULL'); // featured run start (booked day); any type: scheduled start
|
||||
await q(`CREATE TABLE IF NOT EXISTS camp_hours (
|
||||
@@ -135,6 +139,21 @@ async function bootstrap() {
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); // on-site serves per viewer country
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN day_spent INT NOT NULL DEFAULT 0');
|
||||
await alterSafe("ALTER TABLE campaigns ADD COLUMN day_key CHAR(10) NULL");
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN edits INT NOT NULL DEFAULT 0'); // member edits so far (the first is free), 2026-10-18
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN edit_log MEDIUMTEXT NULL'); // JSON [{ts, by, fields, from, to, fee, paidFrom}], last 50
|
||||
// prepaid login-slot queue (Marty, 2026-10-23): paid at reserve time, status 'queued' until a slot frees
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN queued_at BIGINT NULL'); // when the place in line was paid for (first paid, first served)
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN promoted_at BIGINT NULL'); // when it left the line and its 30 days started
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN refunded INT NOT NULL DEFAULT 0'); // credits handed back on a cancel before start
|
||||
await q(`CREATE TABLE IF NOT EXISTS credit_log (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
email VARCHAR(190) NOT NULL,
|
||||
ts BIGINT NOT NULL,
|
||||
delta INT NOT NULL,
|
||||
reason VARCHAR(160) NOT NULL,
|
||||
campaign_id INT NULL,
|
||||
INDEX (email, ts)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`);
|
||||
// linked positions: extra wallets owned by one email account (Qualified Start).
|
||||
// Each is its own on-chain member sponsored by the account's main member.
|
||||
await q(`CREATE TABLE IF NOT EXISTS positions (
|
||||
|
||||
+5
-5
@@ -22,14 +22,14 @@ An advertising platform where the ad spend in your line pays you. Members join f
|
||||
|
||||
## How the money moves
|
||||
|
||||
Every package splits the same way, in the same transaction: 50% direct sponsor, 20% level 2, 10% level 3, 20% platform. On a $20 package: $10, $4, $2, $4. A level with no qualified member passes its share up to the next qualified person above.
|
||||
Every package splits the same way, in the same transaction: 50% direct sponsor, 20% level 2, 10% level 3, 20% platform. On a $25 package: $12.50, $5, $2.50, $5. A level with no qualified member passes its share up to the next qualified person above.
|
||||
|
||||
Qualification is earned, never bought. Every direct buyer pays their sponsor 50% from their first package. Two qualifying buyers ($20 or larger) open level 2, five open level 3.
|
||||
Qualification is earned, never bought. Every direct buyer pays their sponsor 50% from their first package. Two qualifying buyers ($25 or larger) open level 2, five open level 3.
|
||||
|
||||
| Package | Price | Credits |
|
||||
|---|---|---|
|
||||
| Micro | $5 | 500 |
|
||||
| Activation (the qualifying buy) | $20 | 2,000 |
|
||||
| The qualifying buy | $25 | 2,500 |
|
||||
| Builder | $50 | 5,500 |
|
||||
| Growth | $100 | 12,000 |
|
||||
| Leader | $250 | 32,500 |
|
||||
@@ -46,7 +46,7 @@ Qualification is earned, never bought. Every direct buyer pays their sponsor 50%
|
||||
|
||||
## What you get for listing it in your builder
|
||||
|
||||
- Your spot at the top: you join directly under the company at the top, no sponsor in between, via the company link Marty sends you. Claim it by activating your account with at least the $20 package.
|
||||
- Your spot at the top: you join directly under the company at the top, no sponsor in between, via the company link Marty sends you. Claim it by activating your account with at least the $25 package.
|
||||
- Your own promo code: reusable, adds free ad credits per redemption, optional cap and expiry, one use per account, every redemption logged and visible.
|
||||
- Your own line: your join link in your builder puts every member under you; each buyer pays you 50% of their first package and every one after, and their buyers open your level 2 and 3 shares.
|
||||
- Ready-made creatives: banners in 468x60, 728x90, 300x250, 160x600, 120x600, 1200x630, text ad copy, email swipes, a program description.
|
||||
@@ -59,7 +59,7 @@ Qualification is earned, never bought. Every direct buyer pays their sponsor 50%
|
||||
2. Send Marty your username and the site. He mints your code (for example YOURSITE) with the agreed credits.
|
||||
3. Add LinkSpin to your builder with https://linkspin-test.saasy.top/join/yourname?promo=YOURSITE
|
||||
4. Use the banners and text ads from the kit. Existing members type the code into "Have a promo code?" on their Overview.
|
||||
5. Link a wallet, switch on payouts, and activate with at least the $20 package to claim your spot at the top.
|
||||
5. Link a wallet, switch on payouts, and activate with at least the $25 package to claim your spot at the top.
|
||||
|
||||
## The honest part
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ built yet except what "Already in place" lists.
|
||||
|
||||
## Contract facts every script must stay inside
|
||||
|
||||
- Packages: $5 / $20 / $50 / $100 / $250 mint 500 / 2,000 / 5,500 / 12,000 / 32,500 credits. One credit = one cent of ad delivery.
|
||||
- Packages: $10 / $25 / $50 / $100 / $250 / $500 mint 1,000 / 2,500 / 5,000 / 10,000 / 25,000 / 50,000 credits. One credit = one cent of ad delivery.
|
||||
- Split on every purchase, in the same Polygon transaction: 50% direct sponsor, 20% level 2, 10% level 3, 20% platform. Paid to wallets, nothing to claim.
|
||||
- Qualification to receive: level 1 pays any activated sponsor; level 2 needs 2 qualifying buyers ($20+); level 3 needs 5.
|
||||
- Qualification to receive: level 1 pays any activated sponsor; level 2 needs 2 qualifying buyers ($25+); level 3 needs 5.
|
||||
- Seven ad formats: banner, text, login, solo, video, featured link, verified visits. Members earn credits by viewing.
|
||||
- Join is free by email. Wallet comes out at purchase or when switching payouts on.
|
||||
- Dollar package prices are fixed constants and may be spoken. POL amounts and POL/USD are never baked into audio or frames (evergreen rule).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# LinkSpin team-building plays
|
||||
|
||||
Working doc, 2026-09-09. Three ways to build a line, written so a member can pick one and run it. Every number below comes from the live contract and rate table (50 / 20 / 10 / 20 split; qualifying buyer = a direct who buys a $20+ package; level 2 opens at 2 qualifying, level 3 at 5; milestone credits 10 / 25 / 50 / 100; featured strip 40 credits a day; one broadcast a day; wall position 2 at 2 qualifying, position 3 at 5).
|
||||
Working doc, 2026-09-09. Three ways to build a line, written so a member can pick one and run it. Every number below comes from the live contract and rate table (50 / 20 / 10 / 20 split; qualifying buyer = a direct who buys a $25+ package; level 2 opens at 2 qualifying, level 3 at 5; milestone credits 10 / 25 / 50 / 100; featured strip 40 credits a day; one broadcast a day; wall position 2 at 2 qualifying, position 3 at 5).
|
||||
|
||||
## The one rule under all three plays
|
||||
|
||||
@@ -29,7 +29,7 @@ Who it fits: someone with a small circle who would rather coach two people well
|
||||
Why it works: two qualifying buyers open level 2 (20%), position 2 on your wall, the Circuit badge, and 50 bonus credits. From there, every person your two bring in pays you 20%, and every person those people bring in pays you 10% (once you reach 5). Your effort goes into two relationships instead of a funnel.
|
||||
|
||||
The move:
|
||||
1. Get two directs to a $20+ package. Sit with them on the buy if you have to (Trust Wallet needs a POL cushion; SafePal or MetaMask are smoother).
|
||||
1. Get two directs to a $25+ package. Sit with them on the buy if you have to (Trust Wallet needs a POL cushion; SafePal or MetaMask are smoother).
|
||||
2. Coach them to their two. Sponsor chat daily for the first week. One broadcast a day to your directs with a single ask each time.
|
||||
3. Set your line banner to your team's meeting place (Telegram group, a training page). Every new member three levels down meets it on their welcome tour. That is how your coaching reaches people you never directly recruited.
|
||||
4. Keep adding directs until you have five. This is the catch in the depth play: level 3 only opens on five qualifying directs of your own. Two deep, coached well, gets you a healthy 20% level. It does not get you the 10% level.
|
||||
@@ -52,7 +52,7 @@ Scoreboard: all four tiles, plus Earning levels on the Overview (buyers referred
|
||||
|
||||
## Opening move: Qualified Start (works with any play)
|
||||
|
||||
Qualification is earned by buyers, never bought, but you can be your own first buyers, openly. Under Buy packages, link a second wallet you own as a position. When it buys a $20 package the contract counts it as a qualifying buyer, half the purchase returns to your main wallet, and its credits pool with yours. Two positions open level 2 the same day (about $20 net for $40 of credits); five open level 3 (about $50 net for $100). Say it plainly: your own money, your own wallets, a faster start, never an income promise.
|
||||
Qualification is earned by buyers, never bought, but you can be your own first buyers, openly. Under Buy packages, link a second wallet you own as a position. When it buys a $25 package the contract counts it as a qualifying buyer, half the purchase returns to your main wallet, and its credits pool with yours. Two positions open level 2 the same day (about $25 net for $50 of credits); five open level 3 (about $62.50 net for $100). Say it plainly: your own money, your own wallets, a faster start, never an income promise.
|
||||
|
||||
## Which play fits you
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"_draft": "NOT PUBLISHED. Release note in the releases.json note shape (releases.saveNote: date, title, body, tags). To publish: Admin > Releases > New note, paste title + body, tags new. Saving a note there publishes it on /whats-new at once, and Releases > Email an update can mail members, so Marty decides when.",
|
||||
"date": "2026-10-20",
|
||||
"title": "Banner Spin: one banner slot, up to 25 banners",
|
||||
"tags": "new",
|
||||
"body": "Banner Spin is live on the Links screen. It gives you one image address and one click address that rotate up to 25 banners, each with its own target page or spin link. Paste it once into a banner slot on a traffic exchange, a safelist, a forum signature or your own site, and change the banners from your Control Room whenever you like.\n\n- Four embeds: the image + click pair, an HTML snippet, a script tag that matches every click exactly, and forum code\n- A click goes to the page of the banner that visitor saw; one we cannot match goes to your fallback\n- Weights, one banner per visitor per day, hours, pause and a fallback banner\n- Stats per banner and per placement: views, unique viewers, clicks, click rate, match rate and conversions, by day, country and device, on the Stats tab and on Reports\n- A WINNER badge once two banners have 1,000 views each, and a CACHED flag on sites that copy banners to their own server\n- Health checks every 30 minutes: a banner whose image or target breaks three times in a row is paused, and comes back after two clean checks. Your last live banner is never paused\n- Conversions from a traffic source fire that network's postback, same as spin links\n\nWho gets it: a free add-on with your own package of $25 or more. Starter holds 2 Banner Spins with 5 banners each, Builder (2 qualifying buyers) 5 with 15, Leader (5 qualifying buyers) 10 with 25.\n\nGood to know: paid ad networks copy your image when you upload a creative, and Gmail keeps its own copy of email images, so the rotation does not run there. For email, use a Banner Spin with a single banner.\n\nThe new Training lesson walks through it step by step."
|
||||
}
|
||||
+2
-2
@@ -27,11 +27,11 @@
|
||||
{
|
||||
"hours": 264,
|
||||
"subject": "Your link is live (and already loaded)",
|
||||
"body": "That link of yours? It pays the moment someone buys.\n\n{{paid:You already know the feeling. Someone buys, the smart contract runs, and 50 percent lands in your wallet. In seconds.|It works like this: someone clicks your link, buys any package, and 50 percent of it lands in your wallet in the same transaction. In seconds.}}\n\nNobody has to wait. No holding period. No withdraw button, because nothing was ever held.\n\nThe money splits in the same transaction the buyer makes. It lands in real wallets. And every payment is public on the live ledger.\n\nBut here is what most people do not use right away. The Promo tools tab in your dashboard.\n\nOpen it and you will find social posts, text messages, email swipes, and banners. All carrying your link. All ready to copy and paste.\n\nPlus an objection bank with honest answers for when someone asks how it works.\n\nTwo qualifying buyers ($20 or more) open level two for you: 20 percent of what their people buy. Five open level three.\n\n{{paid:You are already in motion. Now use the tools to keep going.|You have not bought a package yet. That is fine. The tools work either way. Your link is live whether you buy or not.}}\n\nOne text from Promo tools today. That is all it takes to get your first buyer moving.\n\n{{site}}/my\n\nMarty\n\n{{footer}}"
|
||||
"body": "That link of yours? It pays the moment someone buys.\n\n{{paid:You already know the feeling. Someone buys, the smart contract runs, and 50 percent lands in your wallet. In seconds.|It works like this: someone clicks your link, buys any package, and 50 percent of it lands in your wallet in the same transaction. In seconds.}}\n\nNobody has to wait. No holding period. No withdraw button, because nothing was ever held.\n\nThe money splits in the same transaction the buyer makes. It lands in real wallets. And every payment is public on the live ledger.\n\nBut here is what most people do not use right away. The Promo tools tab in your dashboard.\n\nOpen it and you will find social posts, text messages, email swipes, and banners. All carrying your link. All ready to copy and paste.\n\nPlus an objection bank with honest answers for when someone asks how it works.\n\nTwo qualifying buyers ($25 or more) open level two for you: 20 percent of what their people buy. Five open level three.\n\n{{paid:You are already in motion. Now use the tools to keep going.|You have not bought a package yet. That is fine. The tools work either way. Your link is live whether you buy or not.}}\n\nOne text from Promo tools today. That is all it takes to get your first buyer moving.\n\n{{site}}/my\n\nMarty\n\n{{footer}}"
|
||||
},
|
||||
{
|
||||
"hours": 336,
|
||||
"subject": "Two weeks in. Here is where you are at.",
|
||||
"body": "Two weeks since you joined LinkSpin. Thought it was time for a quick recap of where things stand.\n\nYou have a free account that is already working for you. Your invite link is live. Anyone who joins through it is in your line, and locks to you as their sponsor at their first purchase.\n\n{{paid:You grabbed a package and have credits to advertise with. Every ad you run reaches real people with dwell-timed views across banners, text ads, solo inbox ads, video ads and more. Your budget delivers exactly what you paid for.|You have not picked up an ad package yet, and that is fine. Your free account is ready when you are. Packages start at $5.}}\n\nHere is the referral side, exactly as the contract has it. When someone in your line buys a package, a smart contract splits their payment instantly, and 50 percent goes to you as their direct sponsor. No waiting, no withdrawal step.\n\nTwo qualifying buyers (people you referred who bought $20 or more) open level two: 20 percent of what the people they refer buy. Five qualifying buyers open level three: 10 percent from one level deeper.\n\nEvery payment lands in real wallets in seconds and is public on the ledger. Nothing held, nothing to withdraw.\n\nOne more thing those buyers unlock: your public wall. Two qualifying buyers make the second ad position on your wall yours, five make the third. At that point the whole page runs your links and nobody else's.\n\nYour sponsor {{sponsor}} is right there in your dashboard. Open Messages any time.\n\nAnd the Promo tools are loaded: social posts, text messages, email swipes, banners, an objection bank, all with your invite link baked in.\n\nFrom here, the LinkSpin newsletter takes over with updates and new features.\n\nYou know where your dashboard is: {{site}}/my\nYour link: {{link}}\n\nMarty\n\n{{footer}}"
|
||||
"body": "Two weeks since you joined LinkSpin. Thought it was time for a quick recap of where things stand.\n\nYou have a free account that is already working for you. Your invite link is live. Anyone who joins through it is in your line, and locks to you as their sponsor at their first purchase.\n\n{{paid:You grabbed a package and have credits to advertise with. Every ad you run reaches real people with dwell-timed views across banners, text ads, solo inbox ads, video ads and more. Your budget delivers exactly what you paid for.|You have not picked up an ad package yet, and that is fine. Your free account is ready when you are. Packages start at $5.}}\n\nHere is the referral side, exactly as the contract has it. When someone in your line buys a package, a smart contract splits their payment instantly, and 50 percent goes to you as their direct sponsor. No waiting, no withdrawal step.\n\nTwo qualifying buyers (people you referred who bought $25 or more) open level two: 20 percent of what the people they refer buy. Five qualifying buyers open level three: 10 percent from one level deeper.\n\nEvery payment lands in real wallets in seconds and is public on the ledger. Nothing held, nothing to withdraw.\n\nOne more thing those buyers unlock: your public wall. Two qualifying buyers make the second ad position on your wall yours, five make the third. At that point the whole page runs your links and nobody else's.\n\nYour sponsor {{sponsor}} is right there in your dashboard. Open Messages any time.\n\nAnd the Promo tools are loaded: social posts, text messages, email swipes, banners, an objection bank, all with your invite link baked in.\n\nFrom here, the LinkSpin newsletter takes over with updates and new features.\n\nYou know where your dashboard is: {{site}}/my\nYour link: {{link}}\n\nMarty\n\n{{footer}}"
|
||||
}
|
||||
]
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
// Email typo check for NEW addresses (2026-10-22, after SendGrid bounces to gmai.com / outlook.comz).
|
||||
// Same file lives in InstantAdPay and LinkSpin. Catches:
|
||||
// 1. near-misses of the big mailbox providers (gmai.com, gmial.com, hotmial.com, yaho.com) -> "Did you mean ...?"
|
||||
// 2. mistyped endings (.con, .cmo, .comz, .nett) -> "Did you mean ...?"
|
||||
// 3. domains that cannot receive mail at all (no MX and no A/AAAA record)
|
||||
// A DNS timeout or server error never blocks anyone (fails open). Only call it where an address enters for the
|
||||
// first time - existing accounts must always be able to sign in with the address they already have.
|
||||
const dns = require('dns').promises;
|
||||
|
||||
const POPULAR = ['gmail.com', 'googlemail.com', 'yahoo.com', 'ymail.com', 'hotmail.com', 'outlook.com', 'live.com',
|
||||
'msn.com', 'icloud.com', 'me.com', 'mac.com', 'aol.com', 'protonmail.com', 'proton.me', 'mail.com', 'gmx.com',
|
||||
'gmx.de', 'yandex.com', 'yandex.ru', 'zoho.com', 'comcast.net', 'att.net', 'verizon.net', 'sbcglobal.net',
|
||||
'bellsouth.net', 'cox.net', 'charter.net', 'yahoo.co.uk', 'hotmail.co.uk', 'btinternet.com', 'yahoo.fr',
|
||||
'hotmail.fr', 'orange.fr', 'web.de', 't-online.de', 'libero.it', 'yahoo.com.br', 'outlook.com.br', 'rediffmail.com',
|
||||
'qq.com', '163.com', 'naver.com', 'seznam.cz', 'wp.pl', 'mail.ru'];
|
||||
const POP = new Set(POPULAR);
|
||||
// endings that are typos of .com/.net/.org (real TLDs like .co, .cm, .om are deliberately NOT here)
|
||||
const BAD_TLD = { con: 'com', cmo: 'com', comm: 'com', comz: 'com', coom: 'com', cpm: 'com', vom: 'com', xom: 'com',
|
||||
ocm: 'com', cmon: 'com', 'com.com': 'com', nett: 'net', nte: 'net', ent: 'net', ogr: 'org', orgg: 'org', rog: 'org' };
|
||||
|
||||
// optimal string alignment distance (Damerau-Levenshtein with adjacent swaps), capped
|
||||
function dist(a, b) {
|
||||
if (Math.abs(a.length - b.length) > 2) return 9;
|
||||
const d = [];
|
||||
for (let i = 0; i <= a.length; i++) { d[i] = [i]; }
|
||||
for (let j = 0; j <= b.length; j++) d[0][j] = j;
|
||||
for (let i = 1; i <= a.length; i++) {
|
||||
for (let j = 1; j <= b.length; j++) {
|
||||
const c = a[i - 1] === b[j - 1] ? 0 : 1;
|
||||
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + c);
|
||||
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
|
||||
}
|
||||
}
|
||||
return d[a.length][b.length];
|
||||
}
|
||||
|
||||
// providers that only ever use ONE domain, so gmail.co / gmail.cm / icloud.net are always typos.
|
||||
// (outlook, hotmail, yahoo, live have real national domains like hotmail.it, so they are not listed.)
|
||||
const SINGLE = { gmail: 'gmail.com', googlemail: 'googlemail.com', icloud: 'icloud.com', aol: 'aol.com',
|
||||
protonmail: 'protonmail.com', ymail: 'ymail.com' };
|
||||
const split = d => { const i = d.indexOf('.'); return i < 0 ? [d, ''] : [d.slice(0, i), d.slice(i + 1)]; };
|
||||
|
||||
function suggestDomain(domain) {
|
||||
if (POP.has(domain)) return null;
|
||||
const labels = domain.split('.');
|
||||
const two = labels.slice(-2).join('.'), last = labels[labels.length - 1];
|
||||
let d = domain;
|
||||
if (BAD_TLD[two]) d = labels.slice(0, -2).concat(BAD_TLD[two]).join('.');
|
||||
else if (BAD_TLD[last]) d = labels.slice(0, -1).concat(BAD_TLD[last]).join('.');
|
||||
if (POP.has(d)) return d;
|
||||
const near = nearestPopular(d);
|
||||
if (near) return near;
|
||||
return d !== domain ? d : null; // ending fixed but not a known provider: still suggest the fixed ending
|
||||
}
|
||||
|
||||
function nearestPopular(domain) {
|
||||
const [name, suffix] = split(domain);
|
||||
if (SINGLE[name] && domain !== SINGLE[name]) return SINGLE[name];
|
||||
let best = null, bestD = 9;
|
||||
for (const p of POPULAR) {
|
||||
const [pn, ps] = split(p);
|
||||
if (ps !== suffix) continue; // only compare names that share the same ending
|
||||
const dd = dist(name, pn);
|
||||
if (dd < bestD) { best = p; bestD = dd; }
|
||||
}
|
||||
// 1 edit always counts; 2 edits only for longer names, so short real domains are left alone
|
||||
return (bestD === 1 || (bestD === 2 && name.length >= 6)) ? best : null;
|
||||
}
|
||||
|
||||
function withTimeout(promise, ms) {
|
||||
return Promise.race([promise, new Promise((_, rej) => setTimeout(() => rej(Object.assign(new Error('timeout'), { code: 'ETIMEOUT' })), ms))]);
|
||||
}
|
||||
|
||||
// true = has somewhere to deliver, false = definitely cannot receive mail, null = could not tell (fail open)
|
||||
async function domainReceives(domain) {
|
||||
const gone = c => c === 'ENOTFOUND' || c === 'ENODATA' || c === 'ESERVFAIL_NXDOMAIN';
|
||||
try {
|
||||
const mx = await withTimeout(dns.resolveMx(domain), 3000);
|
||||
if (mx && mx.length && !(mx.length === 1 && mx[0].exchange === '')) return true; // RFC 7505 null MX = no mail
|
||||
if (mx && mx.length) return false;
|
||||
} catch (e) { if (!gone(e.code)) return null; }
|
||||
try { await withTimeout(dns.resolve4(domain), 3000); return true; } catch (e) { if (!gone(e.code)) return null; }
|
||||
try { await withTimeout(dns.resolve6(domain), 3000); return true; } catch (e) { if (!gone(e.code)) return null; }
|
||||
return false;
|
||||
}
|
||||
|
||||
// -> null when the address is fine, or { error, suggestion } to show the person
|
||||
async function emailIssue(email) {
|
||||
const e = String(email || '').trim().toLowerCase();
|
||||
const at = e.lastIndexOf('@');
|
||||
if (at < 1) return null; // the caller's own format check handles this
|
||||
const local = e.slice(0, at), domain = e.slice(at + 1);
|
||||
const fix = suggestDomain(domain);
|
||||
if (fix && fix !== domain) {
|
||||
const suggestion = local + '@' + fix;
|
||||
return { error: 'Did you mean ' + suggestion + '? Please check the email address.', suggestion };
|
||||
}
|
||||
if (POP.has(domain)) return null;
|
||||
const ok = await domainReceives(domain);
|
||||
if (ok === false) return { error: 'The email domain "' + domain + '" cannot receive mail. Please check the address.', suggestion: null };
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = { emailIssue, suggestDomain, domainReceives };
|
||||
@@ -0,0 +1,158 @@
|
||||
// The Engine Room (Fuel Your Offers stage 4, Marty approved the build 2026-10-24). The SAME file ships in InstantAdPay and
|
||||
// LinkSpin. Each site gathers its OWN facts (facts shape below) and answers the other's signed /api/partner/engine call
|
||||
// with them; build() turns both sites' facts + the refuel streak (InstantAdPay is its source of truth) + the member's goal
|
||||
// into one plain dashboard: three dials, the streak panel, warning lights, six part lights and one "next move".
|
||||
//
|
||||
// facts (per site): { site: 'iap'|'linkspin', ok, credits: { available, inCampaigns }, campaigns: [{ id, name, type, status,
|
||||
// budget, delivered, clicks, created }], clicksWeek, loginFree, buyUrl, adsUrl,
|
||||
// LinkSpin only: goalsMonth, goalsCount, conv30, parts: { bannerSpin, spinLink, page, testing } each { state, note } }
|
||||
// Everything is credits and counts. Nothing here is money or a promise.
|
||||
'use strict';
|
||||
const DAY = 86400000;
|
||||
const n0 = v => (typeof v === 'number' && isFinite(v) ? v : Number(v) || 0);
|
||||
const LINKS = {
|
||||
iapBuy: 'https://instantadpay.com/my#buy', iapCampaigns: 'https://instantadpay.com/my#campaigns', iapTracking: 'https://instantadpay.com/my#conversions',
|
||||
lsBuy: 'https://linkspin.app/credits#buy', lsAds: 'https://linkspin.app/ads', lsLinks: 'https://linkspin.app/links', lsBanner: 'https://linkspin.app/links#b', lsPages: 'https://linkspin.app/pages', lsConv: 'https://linkspin.app/conversions',
|
||||
};
|
||||
// 2026-10-25 (Marty: "the flow from InstantAdPay to LinkSpin is confusing"): every link points at the screen on the site the
|
||||
// member is ON when that site can do the job (buy, campaigns, conversion goals: InstantAdPay's Campaigns > Conversion
|
||||
// tracking card writes the same LinkSpin goals). Only LinkSpin-only tools (Banner Spin, spin links, pages) cross over, and
|
||||
// engine-room.js tags those links with ?from=<site>&task=<key> so LinkSpin shows an arrival strip with the first step.
|
||||
const linksFor = site => site === 'linkspin'
|
||||
? { buy: LINKS.lsBuy, campaigns: LINKS.lsAds, tracking: LINKS.lsConv }
|
||||
: { buy: LINKS.iapBuy, campaigns: LINKS.iapCampaigns, tracking: LINKS.iapTracking };
|
||||
const ACTIVE = new Set(['active', 'paused']);
|
||||
|
||||
// credits a day across recent campaigns: what each delivered over the days it has run (30 at most), summed
|
||||
function burnPerDay(camps, now) {
|
||||
let b = 0;
|
||||
for (const c of camps) {
|
||||
const age = Math.max(1, Math.min(30, (now - n0(c.created)) / DAY));
|
||||
if (c.status !== 'active' && now - n0(c.created) > 30 * DAY) continue;
|
||||
b += n0(c.delivered) / age;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
function part(state, label, note, link, key) { return { state, label, note, link, key }; }
|
||||
|
||||
function build(o) {
|
||||
const now = o.now || Date.now();
|
||||
const rf = o.refuel || { on: false };
|
||||
if (!rf.on) return { on: false };
|
||||
const sites = [o.iap, o.ls].filter(f => f && f.ok);
|
||||
const camps = sites.flatMap(f => (f.campaigns || []).map(c => Object.assign({ site: f.site }, c)));
|
||||
const recent = camps.filter(c => ACTIVE.has(c.status) || now - n0(c.created) <= 30 * DAY || c.status === 'out');
|
||||
const locked = !rf.started;
|
||||
const here = o.site === 'linkspin' ? 'linkspin' : 'iap', L = linksFor(here);
|
||||
// ---- dial 1: fuel left vs this cycle's refuel ----
|
||||
const left = sites.reduce((s, f) => s + n0(f.credits && f.credits.available) + n0(f.credits && f.credits.inCampaigns), 0);
|
||||
const cy = rf.cycle || null;
|
||||
const refuelCredits = cy ? ['iap', 'linkspin'].reduce((s, k) => s + (cy[k] && cy[k].refueled ? n0(cy[k].credits) + n0(cy[k].bonus) : 0), 0) : 0;
|
||||
const burn = burnPerDay(recent, now);
|
||||
const daysLeft = burn > 0 ? Math.floor(left / burn) : null;
|
||||
const fuel = { left: Math.round(left), refuelCredits: Math.round(refuelCredits), pct: refuelCredits > 0 ? Math.max(0, Math.min(100, Math.round(left / refuelCredits * 100))) : null,
|
||||
burnPerDay: Math.round(burn), daysLeft, label: 'Fuel left' };
|
||||
// ---- dial 2: clicks this week, and per 1,000 credits on recent campaigns ----
|
||||
const clicksWeek = sites.reduce((s, f) => s + n0(f.clicksWeek), 0), clicksPrev = sites.reduce((s, f) => s + n0(f.clicksPrevWeek), 0);
|
||||
const del = recent.reduce((s, c) => s + n0(c.delivered), 0), clk = recent.reduce((s, c) => s + n0(c.clicks), 0);
|
||||
// the dial reads this week against last week: half way = the same as last week
|
||||
const clicks = { week: clicksWeek, prevWeek: clicksPrev, pct: clicksPrev > 0 ? Math.min(100, Math.round(clicksWeek / (2 * clicksPrev) * 100)) : null, per1000: del >= 100 ? Math.round(clk / del * 1000 * 10) / 10 : null, label: 'Clicks this week' };
|
||||
// ---- dial 3: goals this month (conversion pixel, LinkSpin keeps it for both sites) vs the member's own goal ----
|
||||
const lsF = o.ls && o.ls.ok ? o.ls : null;
|
||||
const goalTarget = Math.max(0, Math.round(n0(o.goal))) || null;
|
||||
const goals = { month: lsF ? n0(lsF.goalsMonth) : null, target: goalTarget, pct: goalTarget && lsF ? Math.min(100, Math.round(n0(lsF.goalsMonth) / goalTarget * 100)) : null, tracking: lsF ? n0(lsF.goalsCount) > 0 : null, label: 'Goals this month' };
|
||||
// ---- warning lights ----
|
||||
const low = camps.filter(c => c.status === 'active' && n0(c.budget) > 0 && n0(c.delivered) >= n0(c.budget) * 0.8);
|
||||
const out = camps.filter(c => c.status === 'out' && now - n0(c.created) <= 60 * DAY);
|
||||
const running = camps.filter(c => c.status === 'active');
|
||||
const refuelSoon = rf.active && rf.daysToRefuel != null && rf.daysToRefuel <= 5;
|
||||
const loginFree = sites.filter(f => n0(f.loginFree) > 0).map(f => f.site);
|
||||
const warnings = [
|
||||
{ key: 'low', on: low.length > 0, label: 'Ads at 80%', note: low.length ? low.length + ' ad' + (low.length === 1 ? ' is' : 's are') + ' past 80% of budget' : 'none running low' },
|
||||
{ key: 'out', on: out.length > 0, label: 'Ads out', note: out.length ? out.length + ' ad' + (out.length === 1 ? '' : 's') + ' finished delivering' + (running.length ? '' : ', nothing running now') : 'none out' },
|
||||
{ key: 'refuel', on: !!refuelSoon, label: 'Refuel day coming', note: rf.active ? (rf.windowOpen ? 'window open: refuel day ' + rf.refuelDayLabel : 'refuel day ' + rf.refuelDayLabel) : 'no refuel day yet' },
|
||||
{ key: 'login', on: loginFree.length > 0, label: 'Login slot open', note: loginFree.length ? 'a login-ad slot is free on ' + loginFree.map(s => s === 'iap' ? 'InstantAdPay' : 'LinkSpin').join(' and ') : 'all login slots taken' },
|
||||
];
|
||||
// ---- the six parts ----
|
||||
const P = (lsF && lsF.parts) || {};
|
||||
const pFuel = !camps.length ? part('grey', 'Fuel', 'no ads yet', L.campaigns, 'ads')
|
||||
: out.length && !running.length ? part('amber', 'Fuel', 'nothing running', L.campaigns, 'ads')
|
||||
: low.length || (daysLeft != null && daysLeft < 5) ? part('amber', 'Fuel', daysLeft != null && daysLeft < 5 ? 'about ' + daysLeft + ' days left at your burn' : 'an ad is running low', L.buy, 'refuel')
|
||||
: running.length ? part('green', 'Fuel', running.length + ' ad' + (running.length === 1 ? '' : 's') + ' running', L.campaigns, 'ads') : part('amber', 'Fuel', 'nothing running', L.campaigns, 'ads');
|
||||
const pick = (k, label, link, key) => { const x = P[k]; return x ? part(x.state, label, x.note, link, key) : part('grey', label, lsF ? 'not set up' : 'LinkSpin did not answer', link, key); };
|
||||
const parts = [pFuel, pick('bannerSpin', 'Banner spin', LINKS.lsBanner, 'bannerspin'), pick('spinLink', 'Spin link', LINKS.lsLinks, 'spinlink'), pick('page', 'Page', LINKS.lsPages, 'page'), pick('testing', 'Testing', LINKS.lsLinks, 'testing'),
|
||||
lsF ? (n0(lsF.goalsCount) === 0 ? part('grey', 'Conversion tracking', 'no goal set', L.tracking, 'conversions') : n0(lsF.conv30) === 0 ? part('amber', 'Conversion tracking', 'no conversions tracked yet', L.tracking, 'conversions') : part('green', 'Conversion tracking', n0(lsF.conv30) + ' in 30 days', L.tracking, 'conversions'))
|
||||
: part('grey', 'Conversion tracking', 'LinkSpin did not answer', L.tracking, 'conversions')];
|
||||
// ---- one next move ----
|
||||
const per1000 = c => n0(c.delivered) >= 200 ? n0(c.clicks) / n0(c.delivered) * 1000 : null;
|
||||
const ranked = running.filter(c => per1000(c) != null).sort((a, b) => per1000(b) - per1000(a));
|
||||
const linkFor = c => c.site === 'linkspin' ? LINKS.lsAds : LINKS.iapCampaigns;
|
||||
const availAll = sites.reduce((s, f) => s + n0(f.credits && f.credits.available), 0);
|
||||
let next;
|
||||
const mIap = rf.minUsd ? rf.minUsd.iap : 20, mLs = rf.minUsd ? rf.minUsd.linkspin : 25;
|
||||
const firstWhy = here === 'linkspin' ? 'A package of $' + mLs + ' or more here (or $' + mIap + '+ on InstantAdPay) starts the streak and lights this room.' : 'A package of $' + mIap + ' or more here (or $' + mLs + '+ on LinkSpin) starts the streak and lights this room.';
|
||||
if (locked) next = { key: 'start', label: 'Refuel to start your engine', why: firstWhy, link: L.buy, guide: '/refuel' };
|
||||
else if (rf.windowOpen) next = { key: 'refuel', label: 'Refuel now', why: 'Your refuel window is open: +' + rf.next.single + '% on one site, +' + rf.next.both + '% on each with both. A $' + (here === 'linkspin' ? mLs : mIap) + '+ package here counts.', link: L.buy, guide: '/refuel' };
|
||||
else if (out.length && !running.length && availAll >= 100) next = { key: 'relaunch', label: 'Relaunch an ad', why: 'Nothing is running and you have ' + Math.round(availAll).toLocaleString('en-US') + ' credits free.', link: linkFor(out[0]) };
|
||||
else if (daysLeft != null && daysLeft < 5) next = { key: 'pitstop', label: 'Top up' + (rf.pitStop && (rf.pitStop.iap || rf.pitStop.linkspin) ? ' (Pit Stop +' + rf.pitStop.pct + '%)' : ''), why: 'About ' + daysLeft + ' days of fuel left at your current burn.', link: L.buy };
|
||||
else if (low.length) { const best = low.slice().sort((a, b) => (per1000(b) || 0) - (per1000(a) || 0))[0]; next = { key: 'topup', label: 'Top up the winner', why: '"' + (best.name || 'your ad') + '" is past 80% of its budget.', link: linkFor(best) }; }
|
||||
else if (parts[5].state === 'grey') next = { key: 'tracking', label: 'Set up conversion tracking', why: here === 'linkspin' ? 'Count signups and sales back to the ad that sent them. Step 1: add a goal, then paste its two snippets on your pages.' : 'Count signups and sales back to the ad that sent them. Step 1: add a goal under Campaigns > Conversion tracking, then paste its two snippets on your pages.', link: parts[5].link, guide: '/conversion-tracking' };
|
||||
else if (parts[1].state === 'grey') next = { key: 'bannerspin', label: 'Make a Banner Spin', why: 'Test up to 5 banners in one ad slot and let the winner show.' + (here === 'linkspin' ? '' : ' Banner Spin is a LinkSpin tool: the same email signs you in there.'), link: LINKS.lsBanner };
|
||||
else if (parts[4].state !== 'green') next = { key: 'testing', label: 'Test A against B', why: 'Add a second page to your spin link so the rotation can pick a winner.' + (here === 'linkspin' ? '' : ' Spin links live on LinkSpin: the same email signs you in there.'), link: LINKS.lsLinks };
|
||||
else if (ranked.length >= 2 && per1000(ranked[0]) > per1000(ranked[ranked.length - 1]) * 1.5) { const worst = ranked[ranked.length - 1]; next = { key: 'cut', label: 'Cut the loser', why: '"' + (worst.name || 'an ad') + '" brings the fewest clicks per 1,000 credits. Pause it and move the credits to "' + (ranked[0].name || 'your best ad') + '".', link: linkFor(worst) }; }
|
||||
else next = { key: 'cruise', label: 'Keep it running', why: 'Every part is lit. Check again on your refuel day.', link: L.campaigns };
|
||||
return {
|
||||
on: true, locked, fuel, clicks, goals,
|
||||
streak: { active: !!rf.active, months: rf.streak || 0, best: rf.best || 0, refuelDay: rf.refuelDayLabel || null, graceEnd: rf.graceLabel || null, windowOpen: !!rf.windowOpen, next: rf.next || null, pitStop: rf.pitStop || null, freeMiss: rf.freeMiss || null, both: !!(cy && cy.both), note: streakNote(rf, cy) },
|
||||
warnings, parts, next, site: here, sites: { iap: !!(o.iap && o.iap.ok), linkspin: !!(o.ls && o.ls.ok) }, at: now,
|
||||
};
|
||||
}
|
||||
|
||||
// this site's own facts for one member. d: { site, adminMember, ads, coach, now?, bannerspin?, rotator?, pages?, convtrack? }
|
||||
const monthStartCT = now => { const day = new Date(now).toLocaleDateString('en-CA', { timeZone: 'America/Chicago' }); const [y, m] = day.split('-').map(Number);
|
||||
for (const off of [5, 6]) { const ts = Date.UTC(y, m - 1, 1, off); const t = new Date(ts); if (t.toLocaleDateString('en-CA', { timeZone: 'America/Chicago' }) === day.slice(0, 8) + '01' && Number(t.toLocaleString('en-US', { timeZone: 'America/Chicago', hour: 'numeric', hour12: false })) % 24 === 0) return ts; } return Date.UTC(y, m - 1, 1, 6); };
|
||||
async function facts(d, email) {
|
||||
const now = d.now || Date.now(); const e = String(email || '').toLowerCase();
|
||||
const out = { site: d.site, ok: true, credits: { available: 0, inCampaigns: 0 }, campaigns: [], clicksWeek: 0, loginFree: 0 };
|
||||
try { const v = await d.adminMember.view(e); if (v && v.credits) out.credits = { available: n0(v.credits.available), inCampaigns: n0(v.credits.inCampaigns) }; } catch (er) {}
|
||||
let list = []; try { list = (await d.ads.listCampaigns(e)).filter(c => !c.house && c.type !== 'game'); } catch (er) {}
|
||||
out.campaigns = list.map(c => ({ id: c.id, name: c.name || null, type: c.type, status: c.status, budget: n0(c.budget), delivered: n0(c.spent), clicks: n0(c.clicks), created: n0(c.created) }));
|
||||
try { out.clicksWeek = await d.coach.clicksSince(list.map(c => c.id), now - 7 * DAY); out.clicksPrevWeek = Math.max(0, (await d.coach.clicksSince(list.map(c => c.id), now - 14 * DAY)) - out.clicksWeek); } catch (er) {}
|
||||
try { out.loginFree = n0((await d.ads.loginSlots()).free); } catch (er) {}
|
||||
if (d.site === 'linkspin') {
|
||||
const since30 = now - 30 * DAY;
|
||||
try { out.goalsCount = d.convtrack.goalsOf(e).length; out.goalsMonth = d.convtrack.countSince(e, monthStartCT(now)); out.conv30 = d.convtrack.countSince(e, since30); } catch (er) { out.goalsCount = 0; out.goalsMonth = 0; out.conv30 = 0; }
|
||||
const parts = {};
|
||||
let spins = [], rots = [], pgs = [];
|
||||
try { spins = await d.bannerspin.list(e); } catch (er) {}
|
||||
try { rots = await d.rotator.list(e); } catch (er) {}
|
||||
try { pgs = await d.pages.list(e); } catch (er) {}
|
||||
const liveB = s => s.banners.filter(b => b.active && !b.adminOff);
|
||||
if (!spins.length) parts.bannerSpin = { state: 'grey', note: 'not set up' };
|
||||
else { const seen = spins.filter(s => !s.paused && s.imps30 > 0); parts.bannerSpin = seen.length ? { state: 'green', note: seen.reduce((n, s) => n + s.imps30, 0).toLocaleString('en-US') + ' views in 30 days' } : { state: 'amber', note: 'no views yet' }; }
|
||||
if (!rots.length) parts.spinLink = { state: 'grey', note: 'not set up' };
|
||||
else { const w = rots.reduce((n, r) => n + n0(r.hits7), 0); parts.spinLink = w > 0 ? { state: 'green', note: w.toLocaleString('en-US') + ' clicks this week' } : { state: 'amber', note: 'no clicks this week' }; }
|
||||
const pub = pgs.filter(p => p.status === 'published');
|
||||
parts.page = !pgs.length ? { state: 'grey', note: 'not set up' } : !pub.length ? { state: 'amber', note: 'draft only, not published' } : pub.some(p => n0(p.views) > 0) ? { state: 'green', note: pub.length + ' published' } : { state: 'amber', note: 'published, no views yet' };
|
||||
const rotTest = rots.some(r => !r.paused && r.destinations.filter(x => x.active).length >= 2);
|
||||
const rotTraffic = rots.some(r => !r.paused && r.destinations.filter(x => x.active && x.hits7 > 0).length >= 2);
|
||||
const bsTest = spins.some(s => !s.paused && liveB(s).length >= 2);
|
||||
const bsTraffic = spins.some(s => !s.paused && liveB(s).filter(b => b.imps30 > 0).length >= 2);
|
||||
parts.testing = rotTraffic || bsTraffic ? { state: 'green', note: 'two or more versions getting traffic' } : rotTest || bsTest ? { state: 'amber', note: 'two versions set up, waiting for traffic' } : (rots.length || spins.length) ? { state: 'amber', note: 'only one version: add a second to test' } : { state: 'grey', note: 'not set up' };
|
||||
out.parts = parts;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// the streak panel's one line about the next refuel (2026-10-24): once BOTH sites are refueled this cycle it says so,
|
||||
// and only a cycle with one site done asks for the other one, by name
|
||||
function streakNote(rf, cy) {
|
||||
const nx = rf && rf.next; if (!rf || !rf.active || !nx) return '';
|
||||
if (rf.windowOpen) return 'Window open: next refuel +' + nx.single + '% (+' + nx.both + '% on each with both).';
|
||||
const iapDone = !!(cy && cy.iap && cy.iap.refueled), lsDone = !!(cy && cy.linkspin && cy.linkspin.refueled);
|
||||
if ((cy && cy.both) || (iapDone && lsDone)) return 'Both engines fueled this cycle: +' + (nx.secondEngine || (cy.iap && cy.iap.pct) || 0) + '% on each.';
|
||||
if (nx.secondEngine) return 'Refuel ' + (iapDone ? 'LinkSpin' : 'InstantAdPay') + ' this cycle for +' + nx.secondEngine + '% on both.';
|
||||
return '';
|
||||
}
|
||||
|
||||
module.exports = { streakNote, build, facts, burnPerDay, monthStartCT, LINKS };
|
||||
@@ -10,7 +10,12 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
let rotator = null, DATA_DIR = null, notify = null;
|
||||
// Banner Spin (phase 3, 2026-10-20): the same pass also checks every live banner. Its IMAGE must load as an image
|
||||
// (PNG / GIF / JPEG / WebP by magic bytes, an uploaded file read from disk, a pasted one fetched) at the Banner Spin's size,
|
||||
// and its TARGET must pass check() above (a spin-link target only has to exist: its destinations are checked as spin
|
||||
// links). Same counters: three failing checks pause the banner (b.active = false, b.autoPaused), two clean passes resume
|
||||
// it, auto-paused ones are re-checked every 6 hours, and the last live banner of a Banner Spin is NEVER auto-paused.
|
||||
let rotator = null, DATA_DIR = null, notify = null, bannerspin = null;
|
||||
const UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36 LinkSpinHealth/1.0';
|
||||
const TIMEOUT = 10000, SLOW = 6000, MAX_REDIRECTS = 5, PARALLEL = 4, FAILS_TO_PAUSE = 3, PASSES_TO_RESUME = 2;
|
||||
const RECHECK_PAUSED = 6 * 3600 * 1000, MANUAL_GAP = 60 * 1000;
|
||||
@@ -20,7 +25,7 @@ const L = { file: () => path.join(DATA_DIR, 'health-log.json'), db: null,
|
||||
load() { try { this.db = JSON.parse(fs.readFileSync(this.file(), 'utf8')); } catch (e) { this.db = { events: [] }; } },
|
||||
add(ev) { if (!this.db) this.load(); this.db.events.push(Object.assign({ ts: Date.now(), day: ctDay(Date.now()) }, ev)); if (this.db.events.length > 500) this.db.events = this.db.events.slice(-400); try { fs.writeFileSync(this.file(), JSON.stringify(this.db)); } catch (e) {} } };
|
||||
|
||||
function init(opts) { rotator = opts.rotator; DATA_DIR = opts.dataDir; notify = opts.notify || null; L.load(); }
|
||||
function init(opts) { rotator = opts.rotator; DATA_DIR = opts.dataDir; notify = opts.notify || null; bannerspin = opts.bannerspin || null; L.load(); }
|
||||
|
||||
// one request with a hard timeout; returns the Response or throws
|
||||
async function req(url, method, signalMs) {
|
||||
@@ -116,12 +121,106 @@ async function runAll(jobs) {
|
||||
let i = 0; const workers = new Array(Math.min(PARALLEL, jobs.length)).fill(0).map(async () => { while (i < jobs.length) { const j = jobs[i++]; try { await j(); } catch (e) {} } });
|
||||
if (workers.length) await Promise.all(workers);
|
||||
}
|
||||
// ── Banner Spin banners ──
|
||||
const MAGIC = buf => buf.length >= 12 && buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47 ? 'image/png' : buf.length >= 6 && buf.slice(0, 4).toString('latin1') === 'GIF8' ? 'image/gif'
|
||||
: buf.length >= 3 && buf[0] === 0xff && buf[1] === 0xd8 && buf[2] === 0xff ? 'image/jpeg' : buf.length >= 12 && buf.slice(0, 4).toString('latin1') === 'RIFF' && buf.slice(8, 12).toString('latin1') === 'WEBP' ? 'image/webp' : '';
|
||||
async function headBytes(res, max) {
|
||||
if (!res.body) return Buffer.alloc(0);
|
||||
const reader = res.body.getReader(); const chunks = []; let n = 0;
|
||||
try { while (n < max) { const { done, value } = await reader.read(); if (done) break; chunks.push(Buffer.from(value)); n += value.length; } } catch (e) {}
|
||||
try { reader.cancel().catch(() => {}); } catch (e) {}
|
||||
return Buffer.concat(chunks);
|
||||
}
|
||||
// one banner image -> { state: ok | broken | size, note, w, h, ms }
|
||||
async function checkImage(src, size) {
|
||||
const t0 = Date.now(); const [W, H] = size || [0, 0];
|
||||
const where = bannerspin && bannerspin.imageSource ? bannerspin.imageSource(src) : null;
|
||||
if (!where) return { state: 'broken', note: 'No image address', w: 0, h: 0, ms: 0 };
|
||||
let buf, type = '';
|
||||
if (where.file) {
|
||||
try { buf = fs.readFileSync(where.file); } catch (e) { return { state: 'broken', note: 'The uploaded image file is missing', w: 0, h: 0, ms: Date.now() - t0 }; }
|
||||
} else {
|
||||
try {
|
||||
const { res } = await follow(where.url, 'GET');
|
||||
if (res.status >= 400 || res.status < 200) { try { res.body && res.body.cancel && res.body.cancel().catch(() => {}); } catch (e) {} return { state: 'broken', note: 'The image address answers HTTP ' + res.status, w: 0, h: 0, ms: Date.now() - t0 }; }
|
||||
type = String(res.headers.get('content-type') || '').toLowerCase();
|
||||
buf = await headBytes(res, 65536);
|
||||
} catch (e) { return { state: 'broken', note: (e && e.name === 'AbortError') ? 'The image did not load in 10 s' : 'The image address could not be reached', w: 0, h: 0, ms: Date.now() - t0 }; }
|
||||
}
|
||||
const mime = MAGIC(buf); const ms = Date.now() - t0;
|
||||
if (!mime) return { state: 'broken', note: /^text\/html/.test(type) ? 'The image address returns a web page, not an image' : 'The file is not a readable image', w: 0, h: 0, ms };
|
||||
const d = mime === 'image/webp' ? { w: 0, h: 0 } : bannerspin.dims(buf, mime);
|
||||
// a size mismatch is a warning, not a failure (2026-10-20): the builder allows it with a warning, so live banners must not be auto-paused for it
|
||||
if (d.w && d.h && W && (d.w !== W || d.h !== H)) return { state: 'ok', warn: 'size', note: 'The image is ' + d.w + 'x' + d.h + '; this Banner Spin is ' + W + 'x' + H, w: d.w, h: d.h, ms };
|
||||
return { state: 'ok', note: d.w ? '' : 'Loads as an image (size not readable)', w: d.w, h: d.h, ms };
|
||||
}
|
||||
// one banner target -> the spin-link check shape. A spin link only has to still exist.
|
||||
async function checkTarget(s, b) {
|
||||
if (b.link) { const r = rotator && rotator.rawRotations ? rotator.rawRotations().find(x => x.id === b.link && x.owner === s.owner) : null; return r ? { state: 'ok', code: 0, ms: 0, note: 'Spin link /r/' + r.code + ' (its pages are checked as spin links)' } : { state: 'dead', code: 0, ms: 0, note: 'The spin link this banner points at was deleted' }; }
|
||||
if (!b.target) return { state: 'dead', code: 0, ms: 0, note: 'No target set' };
|
||||
return check(String(b.target).replace(/\{[a-z0-9_]{1,24}\}/gi, 'x')); // macros filled with a placeholder, like a real click would
|
||||
}
|
||||
// apply both results to the banner: counters, auto-pause (never the last live banner), auto-resume
|
||||
function applyBanner(s, b, img, tgt) {
|
||||
const prev = b.health || {}; const now = Date.now();
|
||||
const bad = img.state !== 'ok' || failing(tgt.state);
|
||||
const fails = bad ? (prev.fails || 0) + 1 : 0, passes = bad ? 0 : (prev.passes || 0) + 1;
|
||||
const note = img.state !== 'ok' ? img.note : failing(tgt.state) ? (tgt.state === 'parked' ? 'Target is a parked page' : 'Target page is down') + (tgt.note ? ' (' + tgt.note + ')' : '') : tgt.state === 'slow' ? 'Target is slow' + (tgt.note ? ' (' + tgt.note + ')' : '') : '';
|
||||
b.health = { state: img.state !== 'ok' ? 'image' : tgt.state, note, checkedAt: now, fails, passes,
|
||||
image: { state: img.state, note: img.note || '', w: img.w || 0, h: img.h || 0 }, target: { state: tgt.state, code: tgt.code || 0, ms: tgt.ms || 0, note: tgt.note || '' } };
|
||||
if (b.active && !b.adminOff && fails >= FAILS_TO_PAUSE) {
|
||||
const others = s.banners.filter(x => x !== b && x.active && !x.adminOff);
|
||||
if (!others.length) { b.health.note = note + '. Kept live: it is the last live banner in this Banner Spin.'; return null; }
|
||||
b.active = false; b.autoPaused = now; b.health.passes = 0;
|
||||
L.add({ ev: 'pause', bs: s.id, b: b.id, url: b.image, state: b.health.state, note });
|
||||
return { kind: 'paused', text: note + ', auto-paused ' + when(now) };
|
||||
}
|
||||
if (!b.active && b.autoPaused && passes >= PASSES_TO_RESUME) {
|
||||
b.active = true; delete b.autoPaused; b.health.fails = 0;
|
||||
L.add({ ev: 'resume', bs: s.id, b: b.id, url: b.image, state: b.health.state });
|
||||
return { kind: 'resumed', text: 'Back up, resumed ' + when(now) };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async function tellBanner(s, b, change) {
|
||||
if (!notify || !change || change.kind !== 'paused') return;
|
||||
const esc = x => String(x).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
const html = '<p>LinkSpin paused one banner in your Banner Spin <b>' + esc(s.name) + '</b> because it failed three checks in a row.</p>'
|
||||
+ '<p>' + esc(b.label || 'Banner ' + b.id) + '<br>' + esc((b.health && b.health.note) || '') + '</p>'
|
||||
+ '<p>Your other banners keep rotating. If it comes back, LinkSpin resumes it on its own after two clean checks. You can also fix the image or the target, or resume it yourself, under Links, Banner Spins.</p>';
|
||||
try { await notify(s.owner, 'A banner in ' + s.name + ' was paused', html); } catch (e) {}
|
||||
}
|
||||
// the banner jobs for one pass. force = check auto-paused ones now too (admin "run checks"); onlyId = one Banner Spin
|
||||
function bannerJobs(force, onlyId, onChange) {
|
||||
if (!bannerspin || !bannerspin.rawSpins || (bannerspin.live && !bannerspin.live())) return [];
|
||||
const now = Date.now(); const jobs = [];
|
||||
for (const s of bannerspin.rawSpins()) {
|
||||
if (s.adminOff || (onlyId && s.id !== Number(onlyId))) continue;
|
||||
const size = bannerspin.SIZES[s.size];
|
||||
for (const b of s.banners) {
|
||||
if (b.adminOff) continue;
|
||||
const due = (b.active) || (b.autoPaused && (force || !b.health || now - (b.health.checkedAt || 0) >= RECHECK_PAUSED));
|
||||
if (!due) continue;
|
||||
jobs.push(async () => { const [img, tgt] = await Promise.all([checkImage(b.image, size), checkTarget(s, b)]); const ch = applyBanner(s, b, img, tgt); onChange(); if (ch) await tellBanner(s, b, ch); });
|
||||
}
|
||||
}
|
||||
return jobs;
|
||||
}
|
||||
// admin "run the checks now" for Banner Spins (no once-a-minute limit; auto-paused banners are re-checked at once)
|
||||
let bannerRunning = false;
|
||||
async function checkBannerSpins(opts) {
|
||||
opts = opts || {}; if (bannerRunning) return { error: 'A check is already running.' }; bannerRunning = true;
|
||||
let n = 0; try { const jobs = bannerJobs(true, opts.id, () => { n++; }); await runAll(jobs); } finally { bannerRunning = false; if (n && bannerspin) bannerspin.save(); }
|
||||
return { ok: true, checked: n };
|
||||
}
|
||||
|
||||
let running = false;
|
||||
// the scheduled pass: active destinations + fallbacks every time; auto-paused destinations when 6 h have gone by
|
||||
async function tick() {
|
||||
if (running || !rotator) return { skipped: true }; running = true;
|
||||
const now = Date.now(); const jobs = []; let changed = false, n = 0;
|
||||
const now = Date.now(); const jobs = []; let changed = false, n = 0, bn = 0;
|
||||
try {
|
||||
jobs.push(...bannerJobs(false, 0, () => { bn++; })); // Banner Spin banners, same pass, same 4-at-once limit
|
||||
for (const r of rotator.rawRotations()) {
|
||||
for (const d of r.destinations) {
|
||||
const due = d.active || (d.autoPaused && (!d.health || now - (d.health.checkedAt || 0) >= RECHECK_PAUSED));
|
||||
@@ -131,8 +230,8 @@ async function tick() {
|
||||
if (r.fallback) jobs.push(async () => { const c = await check(r.fallback); r.fallbackHealth = { state: c.state, code: c.code, ms: c.ms, checkedAt: Date.now(), note: c.note, frameBlocked: !!c.frameBlocked }; changed = true; });
|
||||
}
|
||||
await runAll(jobs);
|
||||
} finally { running = false; if (changed) rotator.save(); }
|
||||
return { checked: n };
|
||||
} finally { running = false; if (changed) rotator.save(); if (bn && bannerspin) bannerspin.save(); }
|
||||
return { checked: n, banners: bn };
|
||||
}
|
||||
// "Check now" for one rotation (owner-scoped, once a minute): every destination, paused ones too, plus the fallback
|
||||
const lastManual = new Map();
|
||||
@@ -146,4 +245,4 @@ async function checkRotation(owner, id) {
|
||||
return { ok: true, rotation: rotator.pub(r) };
|
||||
}
|
||||
function recent() { if (!L.db) L.load(); return L.db.events.slice(-50).reverse(); }
|
||||
module.exports = { init, tick, check, checkRotation, recent };
|
||||
module.exports = { init, tick, check, checkRotation, recent, checkImage, checkBannerSpins };
|
||||
|
||||
+28
-8
@@ -22,7 +22,15 @@
|
||||
// 4. InstantAdPay ignores no-op rows, records its own lssync hash for rows whose result equals what we sent (so it does
|
||||
// not echo them), and at most echoes ONCE where its facts differ (kept sponsor, skipped wallet). LinkSpin's inbound
|
||||
// handler only fills empty fields, so that echo changes no LinkSpin account, and rule 1 stops a resend.
|
||||
//
|
||||
// SPONSOR FOLLOW (2026-10-22, sponsorfollow.js): a row also carries sponsorSetAt / sponsorSetBy / sponsorPrevEmail /
|
||||
// sponsorSetOrigin while the sponsor is the result of a deliberate change (tank adoption, rescue, release, window expiry,
|
||||
// admin edit), and `tank` (LinkSpin's own adoptions of the person, or null). Rows without them hash as before (no resend
|
||||
// on deploy). Rule 2 also compares the follow facts, so a change InstantAdPay made and we applied is not sent back.
|
||||
// Until InstantAdPay answers proto 2, the hash of a row carrying the new facts is not recorded (sent again later).
|
||||
'use strict';
|
||||
const SF = require('./sponsorfollow');
|
||||
const prohibited = require('./prohibited'); // 2026-10-30: a profile that fails the policy never leaves this site
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -42,23 +50,30 @@ function load() {
|
||||
}
|
||||
function save() { try { fs.writeFileSync(FILE(), JSON.stringify(load())); } catch (e) {} }
|
||||
|
||||
function init(deps) { R = deps; load(); } // { dataDir, accounts, registry, host }
|
||||
function init(deps) { R = deps; load(); } // { dataDir, accounts, registry, host, follow (sponsorfollow store), tank: () => tank }
|
||||
const PUBLIC = () => String(process.env.PUBLIC_URL || ('https://' + (R.host || 'linkspin.app'))).replace(/\/+$/, '');
|
||||
function profileOf(a) {
|
||||
let socials = null; try { socials = a.socials ? (typeof a.socials === 'string' ? JSON.parse(a.socials) : a.socials) : null; } catch (e) { socials = null; }
|
||||
if (a.profileQuarantined) return null; // quarantined (link planted on a brand-new free account): stays here, unseen, until Marty decides
|
||||
const cp = prohibited.cleanProfile({ avatarUrl: a.avatarUrl, bio: a.bio, socials: a.socials }, 'LinkSpin'); // policy applied on the way out too
|
||||
const socials = cp.socials;
|
||||
const av = String(a.avatarUrl || '').trim();
|
||||
const avatarUrl = !av ? null : /^https:\/\//i.test(av) ? av : av.startsWith('/') ? PUBLIC() + av : null;
|
||||
const bio = String(a.bio || '').trim().slice(0, 600) || null;
|
||||
const bio = cp.bio;
|
||||
if (!avatarUrl && !bio && !(socials && Object.keys(socials).length)) return null;
|
||||
return { avatarUrl, bio, socials: socials && Object.keys(socials).length ? socials : null };
|
||||
}
|
||||
async function rowFor(acct, byRef) {
|
||||
async function rowFor(acct, byRef, tankMap) {
|
||||
const ref = norm(acct.sponsorRef); let sponsorEmail = null;
|
||||
if (ref) { const sp = byRef ? byRef.get(ref) : (await R.accounts.byUsername(ref) || await R.accounts.byCode(ref)); if (sp && sp.email !== acct.email) sponsorEmail = sp.email; }
|
||||
return { email: norm(acct.email), username: acct.username || null, wallet: acct.address ? norm(acct.address) : null, sponsorEmail, joinedAt: Number(acct.created) || null, profile: profileOf(acct) };
|
||||
const row = { email: norm(acct.email), username: acct.username || null, wallet: acct.address ? norm(acct.address) : null, sponsorEmail, joinedAt: Number(acct.created) || null, profile: profileOf(acct) };
|
||||
if (R.follow) Object.assign(row, SF.rowFields(R.follow.get(acct.email), sponsorEmail) || {});
|
||||
const T = R.tank && R.tank();
|
||||
if (T) { try { row.tank = (tankMap ? tankMap.get(norm(acct.email)) : await T.summaryFor(acct.email)) || null; } catch (e) {} }
|
||||
return row;
|
||||
}
|
||||
const carriesNew = r => !!(r.sponsorSetBy || r.tank);
|
||||
const canon = o => { if (!o || typeof o !== 'object') return JSON.stringify(o == null ? null : o); return '{' + Object.keys(o).sort().filter(k => o[k] != null).map(k => JSON.stringify(k) + ':' + canon(o[k])).join(',') + '}'; };
|
||||
const hashOf = r => crypto.createHash('sha1').update([r.username || '', r.wallet || '', r.sponsorEmail || '', r.joinedAt || '', r.profile ? canon(r.profile) : ''].join('|')).digest('hex').slice(0, 16);
|
||||
const hashOf = r => crypto.createHash('sha1').update([r.username || '', r.wallet || '', r.sponsorEmail || '', r.joinedAt || '', r.profile ? canon(r.profile) : ''].join('|') + SF.hashExtra(r)).digest('hex').slice(0, 16);
|
||||
// does the registry (= what InstantAdPay told us) already say everything this row says?
|
||||
function sameAsRegistry(r, reg) {
|
||||
if (!reg) return false;
|
||||
@@ -66,6 +81,9 @@ function sameAsRegistry(r, reg) {
|
||||
if (r.wallet && norm(r.wallet) !== norm(reg.wallet)) return false;
|
||||
if (r.sponsorEmail && norm(r.sponsorEmail) !== norm(reg.sponsorEmail)) return false;
|
||||
if (r.profile && canon(r.profile) !== canon(reg.profile)) return false;
|
||||
// a deliberate change travels unless the registry (= InstantAdPay) already holds that very change
|
||||
if (r.sponsorSetBy && (Number(r.sponsorSetAt) !== Number(reg.sponsorSetAt) || norm(r.sponsorEmail) !== norm(reg.sponsorEmail))) return false;
|
||||
if (r.tank) return false; // our own adoptions are news to InstantAdPay (the registry holds only its side); the hash stops a resend
|
||||
return true;
|
||||
}
|
||||
// rows worth sending: changed since our last push and not just InstantAdPay's own facts coming back
|
||||
@@ -91,8 +109,9 @@ async function push(rows) {
|
||||
const st = load(); let sent = 0; let result = null;
|
||||
for (let i = 0; i < rows.length; i += 100) {
|
||||
const chunk = rows.slice(i, i + 100); result = await post(chunk); sent += chunk.length;
|
||||
const peerNew = Number(result && result.proto) >= SF.PROTO; if (R.follow) R.follow.setPeer(peerNew ? SF.PROTO : 1);
|
||||
for (const r of chunk) {
|
||||
st.hashes[r.email] = hashOf(r);
|
||||
if (peerNew || !carriesNew(r)) st.hashes[r.email] = hashOf(r); // an old InstantAdPay ignored the new facts: send again later
|
||||
// a LinkSpin-first member becomes part of the network registry, labelled as such (rule 3 above)
|
||||
if (!(await R.registry.get(r.email))) { try { await R.registry.upsert({ email: r.email, username: r.username, wallet: r.wallet, sponsorEmail: r.sponsorEmail, joinedAt: r.joinedAt, profile: r.profile, firstProperty: 'linkspin' }); } catch (e) {} }
|
||||
}
|
||||
@@ -114,7 +133,8 @@ async function tick(force) {
|
||||
try {
|
||||
const all = await R.accounts.listAll(50000); const st = load();
|
||||
const byRef = new Map(); for (const a of all) { if (a.username) byRef.set(norm(a.username), a); if (a.code) byRef.set(norm(a.code), a); }
|
||||
const rows = []; for (const a of all) { if (!a.email) continue; rows.push(await rowFor(a, byRef)); }
|
||||
const T = R.tank && R.tank(); let tankMap = null; if (T) { try { tankMap = await T.summaryMap(); } catch (e) { tankMap = null; } }
|
||||
const rows = []; for (const a of all) { if (!a.email) continue; rows.push(await rowFor(a, byRef, tankMap || (T ? new Map() : null))); }
|
||||
if (force) for (const r of rows) delete st.hashes[r.email];
|
||||
const go = await select(rows);
|
||||
const sent = go.length ? await push(go) : 0;
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// Knowledge-base seeds that are not CANNED fast-path answers (kb.js): the home page's network notes, the
|
||||
// wallets guide's Common questions, the earning guide, and support replies worth keeping. An entry here
|
||||
// that nobody has edited in Admin > Knowledge base is refreshed when its text changes in this file; edit
|
||||
// it in the admin pane and it becomes the admin's own.
|
||||
// House rules: plain words, no em dashes, never a promise of income.
|
||||
const { SITE_HOST, SITE_URL } = require('./host');
|
||||
const FAQ = [
|
||||
{ id: 'f-coinbase', title: 'Can I use my regular Coinbase account?', source: 'ticket',
|
||||
questions: ['Can I use my regular Coinbase account?', 'Can I use Coinbase?', 'Can I connect my Coinbase exchange account?', 'How do I connect Coinbase?', 'Can I pay from my exchange account?'],
|
||||
tags: ['coinbase', 'exchange account', 'connect coinbase', 'wallet', 'safepal'],
|
||||
answer: 'Your regular Coinbase account won\'t connect here. Coinbase is an exchange: they hold the crypto for you, which works for buying and selling. LinkSpin runs on a smart contract on Polygon, and to buy a package or receive payouts you sign that contract yourself, which only a wallet you control can do. You don\'t need Coinbase Wallet; we recommend SafePal (free, phone app or desktop browser extension). Install it, write down your recovery phrase, add Polygon (POL) and copy your address, send POL from Coinbase choosing the Polygon network (send a small test first), then open ' + SITE_HOST + ' in SafePal\'s browser (or the browser with the extension), sign in with your email, open Credits in your Control Room and tap Link a wallet (one free signature). You only need a wallet to buy a package or receive payouts.' },
|
||||
{ id: 'f-team-here', title: 'Already on InstantAdPay? Your team is already here', source: 'faq',
|
||||
questions: ['I am already on InstantAdPay, do I start over?', 'Will my InstantAdPay sponsor be my sponsor here?', 'Can I sign in with my InstantAdPay email?'],
|
||||
tags: ['instantadpay', 'sponsor', 'carry-over', 'team', 'network'],
|
||||
answer: 'Sign in with the email you use on InstantAdPay and your sponsor is placed for you before you buy anything: the same people above you, the same people below you, the same wallet. LinkSpin is a second property to build on, with tools you will use every day.' },
|
||||
{ id: 'f-conversion-pixel', title: 'How do I count sign-ups and sales from my ads?', source: 'faq',
|
||||
questions: ['How do I count sign-ups from my ads?', 'How do I see cost per lead?', 'Where do I put the conversion pixel?', 'My autoresponder has its own thank-you page, can I still track?'],
|
||||
tags: ['conversion pixel', 'goal', 'cost per goal', 'thank-you page', 'aweber', 'getresponse'],
|
||||
answer: 'Open Conversions in your Control Room (' + SITE_URL + '/conversions) and add a goal, for example subscriber. Paste the landing tag once on your landing page and the goal pixel on your thank-you page, then press Send a test conversion. From then on each click on your ads and spin links that reaches the goal counts once, within 30 days of the click, with its cost per goal by campaign. If Aweber, GetResponse or another provider shows its own thank-you page, set its thank-you redirect to a page on your own site that carries the pixel. InstantAdPay members find the same goals under Campaigns > Conversion tracking.' },
|
||||
{ id: 'f-new-here', title: 'New here: where to start', source: 'faq',
|
||||
questions: ['I am new, where do I start?', 'What should I do first?', 'How do I get started?'],
|
||||
tags: ['getting started', 'new member', 'first steps'],
|
||||
answer: 'Make a spin link on the home page at ' + SITE_URL + ', promote it anywhere, and watch the clicks in your Control Room. Create your free account at ' + SITE_URL + '/join with just your email. Buy a package when you want your own ads in front of the network. Email first, wallet only when you are ready to be paid.' },
|
||||
{ id: 'f-how-much-pol', title: 'How much POL do I need?', source: 'faq',
|
||||
questions: ['How much POL do I need?', 'How much POL for fees?', 'What does a package cost in POL?'],
|
||||
tags: ['pol', 'fees', 'gas', 'buy packages'],
|
||||
answer: 'The Credits screen shows the live POL cost of each package. Have that plus 2 or 3 POL for network fees; there is no other cost. Trust Wallet users should keep about double, because Trust blocks a purchase that spends most of the wallet.' },
|
||||
{ id: 'f-card-declined', title: 'My card was declined buying POL', source: 'faq',
|
||||
questions: ['Why was my card declined buying POL?', 'My card was refused buying POL', 'The on-ramp will not take my payment'],
|
||||
tags: ['card', 'declined', 'buy pol', 'on-ramp'],
|
||||
answer: 'Some banks block crypto purchases. Try a different card, Apple Pay or Google Pay, or another major exchange or on-ramp, then send the POL to your own wallet on the Polygon network. Whichever provider you use has its own ID checks, fees and limits; LinkSpin is never in the middle of that payment.' },
|
||||
{ id: 'f-same-wallet-positions', title: 'One wallet, one position', source: 'faq',
|
||||
questions: ['Can I use the same wallet for more than one position?', 'How do I add positions for Qualified Start?'],
|
||||
tags: ['wallet', 'position', 'qualified start', 'metamask'],
|
||||
answer: 'One address is one position on the contract. For Qualified Start, add extra accounts inside MetaMask, each with its own address, and link them as positions under your main wallet. The Qualified Start videos in Training walk through it.' },
|
||||
{ id: 'f-payouts-where', title: 'Where do my payouts go?', source: 'faq',
|
||||
questions: ['Where do my payouts go?', 'Which wallet gets paid?', 'Does the site hold my earnings?'],
|
||||
tags: ['payout', 'wallet', 'custody'],
|
||||
answer: 'To the wallet address you switched payouts on with, in the same transaction as the purchase that earned them. Nothing is held on the site. The Wallet screen in your Control Room shows what was paid to that wallet.' },
|
||||
{ id: 'f-exchange-withdraw', title: 'Sending POL from an exchange', source: 'faq',
|
||||
questions: ['How do I send POL from Binance or Kraken?', 'Which network do I pick when withdrawing from an exchange?', 'I sent POL on the wrong network'],
|
||||
tags: ['exchange', 'withdraw', 'network', 'polygon', 'binance', 'kraken'],
|
||||
answer: 'Coinbase, Kraken, Binance and most exchanges sell POL. Withdraw it to your own wallet address and pick the Polygon network on the withdrawal screen, never MATIC on Ethereum or another chain. Sending on the wrong network can lose the funds, so send a small test first.' },
|
||||
{ id: 'f-claim-streak', title: 'The daily set and the claim streak', source: 'faq',
|
||||
questions: ['How does the daily claim streak work?', 'How much does the daily claim pay?', 'When does the daily ad set reset?'],
|
||||
tags: ['daily set', 'claim streak', 'earn credits', 'reset'],
|
||||
answer: 'Earn credits > Watch ads gives five ads a day: each opens full screen, a 10-second countdown runs, you pass a quick click-the-icon check and earn 1 credit. Finish all five and Claim appears. The claim pays 5 credits on day 1, 7 on day 2, 10 from day 3, and 25 on every 7th day in a row; miss a day and it restarts. Days are counted in UTC, so the set resets at 7 PM Central (6 PM in winter time). Credits are ad delivery, never money.' },
|
||||
{ id: 'f-visits-videos', title: 'Verified visits, videos and inbox ads', source: 'faq',
|
||||
questions: ['How do verified visits pay?', 'How many videos can I watch a day?', 'How do inbox solo ads pay?'],
|
||||
tags: ['verified visits', 'videos', 'inbox', 'earn credits'],
|
||||
answer: 'After the daily set is claimed you can make up to 20 verified visits a day, 1 credit each: open a member\'s site in a new tab and stay for the dwell; each is a different site. Videos credit only when they play to the end, up to 6 a day, paying by length. Inbox solo ads: open the message, visit the advertiser\'s link, then claim 2 credits, once per message. Signing in also pays 5 credits a day, rising by one per day in a row up to 10.' },
|
||||
{ id: 'f-spend-credits', title: 'What to do with earned credits', source: 'faq',
|
||||
questions: ['What do I do with my credits?', 'How do I spend my credits?', 'My credits are just sitting there'],
|
||||
tags: ['credits', 'campaign', 'spend'],
|
||||
answer: 'Credits sitting in your balance do nothing. Open Ads in your Control Room, start a new banner or text campaign, give it a budget in credits and point it at your own invite link or wall. Banner and text ads also push out to the partner network. A campaign reserves its whole budget the moment it starts, and login ads are the one format that needs purchased credits.' },
|
||||
{ id: 'f-recovery-phrase', title: 'Recovery phrase and scam safety', source: 'faq',
|
||||
questions: ['Someone asked for my recovery phrase', 'Will support ever ask for my private key?', 'Someone messaged me asking for money'],
|
||||
tags: ['recovery phrase', 'private key', 'scam', 'security'],
|
||||
answer: 'Never share your recovery phrase (the 12 or 24 words) or private key with anyone: whoever has them has your money. Nobody from LinkSpin will ever ask for them, and the site never sees them. If someone does ask, do not reply, and tell support through Help at ' + SITE_URL + '/help.' },
|
||||
{ id: 'f-prohibited-content', title: 'What content is not allowed?', source: 'faq',
|
||||
questions: ['What content is not allowed?', 'Can I put a link in my bio?', 'Why was my bio refused?', 'Can I promote a casino or CBD offer?', 'What is link farming?'],
|
||||
tags: ['prohibited content', 'rules', 'bio', 'links', 'gambling', 'adult', 'link farm', 'terms'],
|
||||
answer: 'Not allowed anywhere on LinkSpin, in ads, campaigns, line banners, wall offers, bios and social links: gambling, casinos, betting, lotteries and sweepstakes; adult or sexual content; drugs and prescription pharmaceuticals; weapons; hate or harassment; malware, phishing and counterfeit goods; misleading financial promises. The bio is text only, no links and no domain names; links go in the social fields of your profile. Your bio, avatar and social links show on your public wall once you have bought a package; a free account\'s wall shows the name, the line\'s ads and the join button. Accounts created to place links in profile fields (link farming) are removed without notice, with their profile text. Full list: ' + SITE_URL + '/terms#prohibited' },
|
||||
];
|
||||
module.exports = { FAQ };
|
||||
@@ -0,0 +1,245 @@
|
||||
// Knowledge base behind the site assistant (Marty's support-desk plan, 2026-10-20).
|
||||
// The chatbot answers from maintained entries, and good support replies become entries.
|
||||
//
|
||||
// An entry: { id, title, questions[], answer, tags[], pattern, handoff, order, source, ticketRef,
|
||||
// updated, created, edited, deleted, seedHash }
|
||||
// pattern optional regex (case-insensitive). Entries with one are the instant CANNED fast path:
|
||||
// the first pattern that matches (lowest order) is the reply, no AI call. The CANNED list
|
||||
// in chatbot.js seeds these, so there is ONE source: edit the answer here and the fast
|
||||
// path serves the new text.
|
||||
// source canned | faq | ticket | admin
|
||||
//
|
||||
// Retrieval: BM25 over title, question variants and tags, plus the answer text at a low weight, with
|
||||
// word bigrams so phrase overlap counts more than scattered words. No embeddings, no external calls.
|
||||
// The top hits go into the AI system prompt as "Knowledge base" context (chatbot.js).
|
||||
//
|
||||
// Seeds stay in step with the code: an entry that came from a seed and was never edited in the admin
|
||||
// pane is refreshed when the seed text changes; an edited one is left alone; a deleted seed stays
|
||||
// deleted (tombstone row), and a seed dropped from the code is retired unless an admin edited it.
|
||||
//
|
||||
// Store: one JSON file on the volume, DATA_DIR/kb.json (written to a temp file and renamed). Ported from
|
||||
// InstantAdPay's kb.js, which also has a MySQL store; keep the scoring and seed rules of the two in step.
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const { SITE_URL } = require('./host');
|
||||
|
||||
let DATA_DIR = null, SEEDS = [], ready = null;
|
||||
let cache = null, cacheAt = 0, index = null;
|
||||
const TTL = 30000; // two app copies share the volume for about 30 s during a deploy: re-read now and then
|
||||
|
||||
// ---------------------------------------------------------------- text + scoring (pure, unit-tested)
|
||||
const STOP = new Set(('a an and are as at be been being but by can could do does did doing for from has have having how i if in into is it its '
|
||||
+ 'me my of on or our ours so than that the their them then there these they this those to too us was we were what when where which who whom why '
|
||||
+ 'will with would you your yours im ive id am just also any about please hi hello hey thanks thank ok okay really very much some there here '
|
||||
+ 'should shall may might must anyone someone something thing things want wanted like know tell').split(' '));
|
||||
const SYN = { paid: 'pay', payment: 'pay', payments: 'pay', paying: 'pay', withdrawal: 'withdraw', withdrawals: 'withdraw', cashout: 'withdraw',
|
||||
signup: 'join', register: 'join', registration: 'join', joining: 'join', joined: 'join', login: 'log', logged: 'log', logout: 'log', signin: 'log',
|
||||
wallets: 'wallet', email: 'email', mail: 'email', pol: 'pol', matic: 'pol', prices: 'price', pricing: 'price', cost: 'price', costs: 'price',
|
||||
ads: 'ad', advert: 'ad', adverts: 'ad', advertising: 'ad', referrals: 'referral', refer: 'referral', referring: 'referral', referred: 'referral' };
|
||||
function stem(w) {
|
||||
if (SYN[w]) return SYN[w];
|
||||
if (w.length > 6 && w.endsWith('able')) return w.slice(0, -4);
|
||||
if (w.length > 5 && w.endsWith('ing')) return w.slice(0, -3);
|
||||
if (w.length > 4 && w.endsWith('ies')) return w.slice(0, -3) + 'y';
|
||||
if (w.length > 4 && w.endsWith('ed') && !w.endsWith('eed')) return w.slice(0, -2);
|
||||
if (w.length > 3 && w.endsWith('s') && !w.endsWith('ss') && !w.endsWith('us')) return w.slice(0, -1);
|
||||
return w;
|
||||
}
|
||||
function words(text) {
|
||||
return String(text || '').toLowerCase().replace(/['’]/g, '').replace(/[^a-z0-9$]+/g, ' ').split(' ')
|
||||
.filter(w => w && !STOP.has(w) && (w.length > 1 || /\d/.test(w))).map(stem);
|
||||
}
|
||||
// unigrams + bigrams of the content words: "coinbase account" scores as a phrase, not two loose words
|
||||
function terms(text) {
|
||||
const w = words(text), out = w.slice();
|
||||
for (let i = 0; i + 1 < w.length; i++) out.push(w[i] + '_' + w[i + 1]);
|
||||
return out;
|
||||
}
|
||||
const FIELDS = { title: 2.0, questions: 2.5, tags: 2.0, answer: 0.35 };
|
||||
const K1 = 1.2, B = 0.75;
|
||||
function fieldText(e, f) {
|
||||
if (f === 'questions') return (e.questions || []).join(' . ');
|
||||
if (f === 'tags') return (e.tags || []).join(' . ');
|
||||
return e[f] || '';
|
||||
}
|
||||
function buildIndex(entries) {
|
||||
const docs = entries.map(e => {
|
||||
const d = { e, f: {} };
|
||||
for (const f of Object.keys(FIELDS)) {
|
||||
const t = terms(fieldText(e, f)), tf = new Map();
|
||||
for (const x of t) tf.set(x, (tf.get(x) || 0) + 1);
|
||||
d.f[f] = { tf, len: t.length };
|
||||
}
|
||||
return d;
|
||||
});
|
||||
const df = new Map(), avg = {};
|
||||
for (const f of Object.keys(FIELDS)) avg[f] = docs.reduce((s, d) => s + d.f[f].len, 0) / Math.max(1, docs.length) || 1;
|
||||
for (const d of docs) {
|
||||
const seen = new Set();
|
||||
for (const f of Object.keys(FIELDS)) for (const t of d.f[f].tf.keys()) seen.add(t);
|
||||
for (const t of seen) df.set(t, (df.get(t) || 0) + 1);
|
||||
}
|
||||
return { docs, df, avg, n: docs.length };
|
||||
}
|
||||
function rank(idx, query, k) {
|
||||
if (!idx || !idx.n) return [];
|
||||
const qt = [...new Set(terms(query))];
|
||||
if (!qt.length) return [];
|
||||
const out = [];
|
||||
for (const d of idx.docs) {
|
||||
let s = 0;
|
||||
for (const t of qt) {
|
||||
const n = idx.df.get(t); if (!n) continue;
|
||||
const idf = Math.log(1 + (idx.n - n + 0.5) / (n + 0.5)) * (t.includes('_') ? 1.5 : 1);
|
||||
for (const f of Object.keys(FIELDS)) {
|
||||
const tf = d.f[f].tf.get(t); if (!tf) continue;
|
||||
s += FIELDS[f] * idf * (tf * (K1 + 1)) / (tf + K1 * (1 - B + B * d.f[f].len / idx.avg[f]));
|
||||
}
|
||||
}
|
||||
if (s > 0) out.push({ entry: d.e, score: Math.round(s * 100) / 100 });
|
||||
}
|
||||
out.sort((a, b) => b.score - a.score);
|
||||
return out.slice(0, k || 5);
|
||||
}
|
||||
// keep hits that are close to the best one, and only when the best is a real match
|
||||
const MIN_SCORE = 3;
|
||||
function relevant(hits) {
|
||||
if (!hits.length || hits[0].score < MIN_SCORE) return [];
|
||||
const floor = Math.max(MIN_SCORE, hits[0].score * 0.3);
|
||||
return hits.filter(h => h.score >= floor);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- store
|
||||
const J = {
|
||||
file: () => path.join(DATA_DIR, 'kb.json'),
|
||||
async ensure() {},
|
||||
async all() { try { const d = JSON.parse(fs.readFileSync(J.file(), 'utf8')); return Array.isArray(d.entries) ? d.entries : []; } catch (e) { return []; } },
|
||||
async put(e) {
|
||||
const all = await J.all(), i = all.findIndex(x => x.id === e.id);
|
||||
if (i >= 0) all[i] = e; else all.push(e);
|
||||
const tmp = J.file() + '.tmp';
|
||||
fs.writeFileSync(tmp, JSON.stringify({ entries: all }));
|
||||
fs.renameSync(tmp, J.file());
|
||||
}
|
||||
};
|
||||
const store = () => J;
|
||||
|
||||
// ---------------------------------------------------------------- seeds
|
||||
const SEED_FIELDS = ['title', 'questions', 'answer', 'tags', 'pattern', 'handoff', 'order', 'source'];
|
||||
const seedHash = s => crypto.createHash('sha1').update(JSON.stringify(SEED_FIELDS.map(f => s[f] == null ? null : s[f]))).digest('hex');
|
||||
function seedEntry(s) {
|
||||
return { id: s.id, title: s.title, questions: s.questions || [], answer: s.answer, tags: s.tags || [], pattern: s.pattern || '', handoff: !!s.handoff,
|
||||
order: s.order == null ? null : s.order, source: s.source || 'faq' };
|
||||
}
|
||||
async function syncSeeds() {
|
||||
const all = await store().all(), byId = new Map(all.map(e => [e.id, e])), now = Date.now();
|
||||
const seedIds = new Set(SEEDS.map(s => s.id));
|
||||
let added = 0, refreshed = 0, retired = 0;
|
||||
for (const s of SEEDS) {
|
||||
const h = seedHash(seedEntry(s)), cur = byId.get(s.id);
|
||||
if (!cur) { await store().put(Object.assign(seedEntry(s), { ticketRef: '', seedHash: h, edited: false, deleted: false, created: now, updated: now })); added++; }
|
||||
else if (!cur.deleted && !cur.edited && cur.seedHash !== h) { await store().put(Object.assign({}, cur, seedEntry(s), { seedHash: h, updated: now })); refreshed++; }
|
||||
}
|
||||
// a seed taken out of the code goes with it, unless an admin has made the entry their own (guard: a broken seed list retires nothing)
|
||||
if (SEEDS.length >= 10) for (const e of all) if (e.seedHash && !e.edited && !e.deleted && !seedIds.has(e.id)) { await store().put(Object.assign({}, e, { deleted: true, updated: now })); retired++; }
|
||||
if (added || refreshed || retired) console.log('kb: seeds synced, ' + added + ' added, ' + refreshed + ' refreshed, ' + retired + ' retired');
|
||||
}
|
||||
|
||||
function init(opts) {
|
||||
DATA_DIR = opts.dataDir; SEEDS = opts.seeds || []; cache = null; index = null;
|
||||
ready = (async () => { await store().ensure(); await syncSeeds(); })().catch(e => { console.error('kb init', e.message); });
|
||||
return ready;
|
||||
}
|
||||
async function load(force) {
|
||||
if (ready) await ready;
|
||||
if (!force && cache && Date.now() - cacheAt < TTL) return cache;
|
||||
const all = await store().all();
|
||||
cache = all.filter(e => !e.deleted); cacheAt = Date.now(); index = buildIndex(cache); rx.clear();
|
||||
return cache;
|
||||
}
|
||||
const rx = new Map();
|
||||
function compiled(src) {
|
||||
if (!rx.has(src)) { let r = null; try { r = new RegExp(src, 'i'); } catch (e) {} rx.set(src, r); }
|
||||
return rx.get(src);
|
||||
}
|
||||
const byOrder = (a, b) => (a.order == null ? 1e9 : a.order) - (b.order == null ? 1e9 : b.order) || a.updated - b.updated;
|
||||
|
||||
// ---------------------------------------------------------------- the chatbot side
|
||||
async function fastPath(msg) {
|
||||
const list = (await load()).filter(e => e.pattern).sort(byOrder);
|
||||
for (const e of list) { const r = compiled(e.pattern); if (r && r.test(msg)) return e; }
|
||||
return null;
|
||||
}
|
||||
async function search(query, k) { await load(); return rank(index, query, k || 5); }
|
||||
async function context(query, k) { return relevant(await search(query, k || 5)); }
|
||||
const HELP = 'Help (' + SITE_URL + '/help, or ' + SITE_URL + '/support when signed out)';
|
||||
function promptBlock(hits) {
|
||||
const unsure = 'say "I\'m not sure, ask support" and point to ' + HELP + '.';
|
||||
if (!hits.length) return 'KNOWLEDGE BASE: no entry matches this question. If the FACTS above do not answer it either, ' + unsure + ' Do not guess.';
|
||||
return 'KNOWLEDGE BASE (maintained answers, most relevant first). Answer from these when one fits: keep its facts, numbers and links exactly, in your own short words. '
|
||||
+ 'If none of them and none of the FACTS answer the question, ' + unsure + ' Never guess.\n'
|
||||
+ hits.map((h, i) => '[' + (i + 1) + '] ' + h.entry.title + '\nAsked as: ' + (h.entry.questions || []).slice(0, 4).join(' | ') + '\nAnswer: ' + h.entry.answer).join('\n\n');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- the admin side
|
||||
const clean = s => String(s == null ? '' : s).replace(/\s*[—―]\s*/g, ', ').replace(/(\d)\s*–\s*(\d)/g, '$1-$2').replace(/\s*–\s*/g, ', ').replace(/\r\n/g, '\n').trim(); // house rule: no em dashes in member-facing text
|
||||
function validate(o, cur) {
|
||||
o = o || {};
|
||||
const questions = (Array.isArray(o.questions) ? o.questions : String(o.questions || '').split('\n')).map(clean).filter(Boolean).map(q => q.slice(0, 300)).slice(0, 15);
|
||||
const tags = (Array.isArray(o.tags) ? o.tags : String(o.tags || '').split(',')).map(t => clean(t).toLowerCase().slice(0, 40)).filter(Boolean).slice(0, 15);
|
||||
const answer = clean(o.answer).slice(0, 4000);
|
||||
const title = (clean(o.title) || questions[0] || '').slice(0, 200);
|
||||
const pattern = String(o.pattern == null ? (cur ? cur.pattern : '') : o.pattern).trim().slice(0, 2000);
|
||||
if (!title) return { error: 'Give the entry a title or at least one question.' };
|
||||
if (!answer) return { error: 'The answer is empty.' };
|
||||
if (pattern) { try { new RegExp(pattern, 'i'); } catch (e) { return { error: 'The instant-answer pattern is not a valid regular expression: ' + e.message }; } }
|
||||
const order = o.order === '' || o.order == null ? (cur ? cur.order : null) : Number(o.order);
|
||||
return { title, questions, tags, answer, pattern, handoff: o.handoff == null ? !!(cur && cur.handoff) : !!o.handoff, order: Number.isFinite(order) ? Math.round(order) : null };
|
||||
}
|
||||
async function list(q) {
|
||||
const all = (await load(true)).slice();
|
||||
if (!q) return all.sort((a, b) => b.updated - a.updated);
|
||||
const ranked = rank(index, q, 50).map(h => Object.assign({ score: h.score }, h.entry));
|
||||
const lc = String(q).toLowerCase(), seen = new Set(ranked.map(e => e.id));
|
||||
const plain = all.filter(e => !seen.has(e.id) && (e.id.includes(lc) || (e.title + ' ' + e.answer + ' ' + (e.ticketRef || '')).toLowerCase().includes(lc)));
|
||||
return ranked.concat(plain);
|
||||
}
|
||||
async function get(id) { return (await load(true)).find(e => e.id === String(id)) || null; }
|
||||
async function create(o) {
|
||||
const v = validate(o); if (v.error) return v;
|
||||
const now = Date.now(), id = 'kb-' + now.toString(36) + crypto.randomBytes(2).toString('hex');
|
||||
const src = ['ticket', 'admin'].includes(o.source) ? o.source : 'admin';
|
||||
const e = Object.assign(v, { id, source: src, ticketRef: String(o.ticketRef || '').slice(0, 20), seedHash: '', edited: true, deleted: false, created: now, updated: now });
|
||||
await store().put(e); await load(true);
|
||||
return { ok: true, entry: e };
|
||||
}
|
||||
async function update(id, o) {
|
||||
const cur = await get(id); if (!cur) return { error: 'Entry not found.' };
|
||||
const v = validate(o, cur); if (v.error) return v;
|
||||
const e = Object.assign({}, cur, v, { edited: true, updated: Date.now() });
|
||||
await store().put(e); await load(true);
|
||||
return { ok: true, entry: e };
|
||||
}
|
||||
async function remove(id) {
|
||||
const cur = await get(id); if (!cur) return { error: 'Entry not found.' };
|
||||
await store().put(Object.assign({}, cur, { deleted: true, updated: Date.now() })); await load(true);
|
||||
return { ok: true };
|
||||
}
|
||||
// newest change made by a person (admin pane or a saved ticket reply), as a Central-time day. The chatbot-sync
|
||||
// guard compares it with release-note dates. Seed refreshes do not count: those follow chatbot.js, whose
|
||||
// KNOWLEDGE_DATE already speaks for the code.
|
||||
const ctDay = ts => new Date(ts).toLocaleDateString('en-CA', { timeZone: 'America/Chicago' });
|
||||
async function stamp() {
|
||||
const all = await load();
|
||||
const max = all.reduce((m, e) => e.edited ? Math.max(m, e.updated || 0) : m, 0);
|
||||
return { updated: max ? ctDay(max) : '', count: all.length };
|
||||
}
|
||||
async function test(question) {
|
||||
const fast = await fastPath(String(question || ''));
|
||||
const hits = await search(String(question || ''), 8), used = new Set(relevant(hits).map(h => h.entry.id));
|
||||
return { fast: fast ? { id: fast.id, title: fast.title } : null, ranked: hits.map(h => ({ id: h.entry.id, title: h.entry.title, score: h.score, used: used.has(h.entry.id) })) };
|
||||
}
|
||||
|
||||
module.exports = { init, load, fastPath, search, context, promptBlock, list, get, create, update, remove, stamp, test,
|
||||
_pure: { words, terms, buildIndex, rank, relevant, validate, seedHash, MIN_SCORE } };
|
||||
@@ -0,0 +1,218 @@
|
||||
// The Refuel Kit (Fuel Your Offers stage 3, Marty approved the build 2026-10-24). The SAME file ships in InstantAdPay and
|
||||
// LinkSpin; each site keeps ITS OWN program's kits (InstantAdPay art promotes InstantAdPay, LinkSpin art promotes
|
||||
// LinkSpin, never mixed).
|
||||
//
|
||||
// A kit is one month's members-only banner set: { month 'YYYY-MM', theme, released, sizes 728x90 300x250 468x60 160x600
|
||||
// 1200x630 } with one base image per size, stored as data in DATA_DIR/kits/ (kits.json + <month>/<size>.<ext>).
|
||||
// Admin uploads the base art and previews the personalization; nothing here generates art (real art is Marty's).
|
||||
//
|
||||
// Who gets which kit: a counted refuel (the streak in refuel.js, InstantAdPay is the source of truth) unlocks the kit
|
||||
// of the Central-time month it landed in. The entitlement arrives as { months: { 'YYYY-MM': streakMonthAtUnlock } }
|
||||
// from opts.entitled(email). Kits stay usable after their month; missing a refuel only stops NEW kits.
|
||||
// streak month 3+ at unlock an animated GIF version of each banner size
|
||||
// streak month 6+ at unlock a "custom banners" credit for BannerKitAI: the entitlement and a note only, no integration
|
||||
//
|
||||
// Personalized on the server per member: their @username and a QR code to their own link are drawn onto each banner
|
||||
// with ffmpeg (the badge renderer's approach). Rendered files are cached in DATA_DIR/kits/out/<hash>.<ext> and served
|
||||
// publicly at /kitimg/<hash>.<ext> (ad networks and IAP banner campaigns load them by URL); the hash is an HMAC of
|
||||
// member + kit + size + variant + base-art version, so it cannot be guessed and changes when the art changes.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
const SIZES = { '728x90': [728, 90], '300x250': [300, 250], '468x60': [468, 60], '160x600': [160, 600], '1200x630': [1200, 630] };
|
||||
const ORDER = ['728x90', '300x250', '468x60', '160x600', '1200x630'];
|
||||
// where the QR and the name go on each size: q = QR box (x, y, side), t = name (x expr, y expr, font px)
|
||||
const LAYOUT = {
|
||||
'728x90': { q: ['W-84', 6, 78], t: ['W-96-tw', 'H-30', 18] },
|
||||
'468x60': { q: ['W-58', 4, 52], t: ['W-68-tw', 'H-24', 14] },
|
||||
'300x250': { q: ['W-82', 'H-82', 76], t: ['8', 'H-30', 16] },
|
||||
'160x600': { q: ['(W-120)/2', 'H-128', 120], t: ['(W-tw)/2', 'H-160', 16] },
|
||||
'1200x630': { q: ['W-212', 'H-212', 182], t: ['32', 'H-66', 34] },
|
||||
};
|
||||
let X = {}, DIR = null, OUT = null, FILE = null, SALT = null;
|
||||
const MONTH_RE = /^\d{4}-(0[1-9]|1[0-2])$/;
|
||||
const norm = e => String(e || '').trim().toLowerCase();
|
||||
|
||||
function init(opts) {
|
||||
X = opts || {}; DIR = path.join(X.dataDir, 'kits'); OUT = path.join(DIR, 'out'); FILE = path.join(DIR, 'kits.json');
|
||||
try { fs.mkdirSync(OUT, { recursive: true }); } catch (e) {}
|
||||
const sf = path.join(DIR, 'salt'); try { SALT = fs.readFileSync(sf, 'utf8').trim(); } catch (e) {}
|
||||
if (!SALT) { SALT = crypto.randomBytes(16).toString('hex'); try { fs.writeFileSync(sf, SALT, { flag: 'wx' }); } catch (e) { try { SALT = fs.readFileSync(sf, 'utf8').trim(); } catch (er) {} } }
|
||||
}
|
||||
const program = () => X.program === 'linkspin' ? 'linkspin' : 'iap';
|
||||
const brand = () => program() === 'linkspin' ? 'LinkSpin' : 'InstantAdPay';
|
||||
function load() { try { const s = JSON.parse(fs.readFileSync(FILE, 'utf8')); s.kits = s.kits || {}; s.credits = s.credits || {}; return s; } catch (e) { return { kits: {}, credits: {} }; } }
|
||||
function save(s) { const tmp = FILE + '.' + process.pid + '.tmp'; fs.writeFileSync(tmp, JSON.stringify(s, null, 1)); fs.renameSync(tmp, FILE); }
|
||||
const ctMonth = ts => new Date(ts || Date.now()).toLocaleDateString('en-CA', { timeZone: 'America/Chicago' }).slice(0, 7);
|
||||
const monthLabel = m => new Date(Date.UTC(Number(m.slice(0, 4)), Number(m.slice(5, 7)) - 1, 15)).toLocaleDateString('en-US', { month: 'long', year: 'numeric', timeZone: 'UTC' });
|
||||
|
||||
// ---- admin: the kits ---------------------------------------------------------------------------------
|
||||
function baseFile(month, size) {
|
||||
const d = path.join(DIR, month);
|
||||
for (const ext of ['png', 'jpg', 'gif']) { const f = path.join(d, size + '.' + ext); if (fs.existsSync(f)) return f; }
|
||||
return null;
|
||||
}
|
||||
function kitView(k) {
|
||||
const sizes = ORDER.map(s => { const f = baseFile(k.month, s); return { size: s, ready: !!f, v: f ? Math.round(fs.statSync(f).mtimeMs) : 0 }; });
|
||||
return { month: k.month, label: monthLabel(k.month), theme: k.theme || '', released: !!k.released, program: program(), sizes, complete: sizes.every(x => x.ready), updated: k.updated || 0 };
|
||||
}
|
||||
function listKits() { const s = load(); return Object.values(s.kits).sort((a, b) => b.month.localeCompare(a.month)).map(kitView); }
|
||||
function saveKit(b) {
|
||||
const month = String(b.month || ''); if (!MONTH_RE.test(month)) return { error: 'Month as YYYY-MM.' };
|
||||
const s = load(); const k = s.kits[month] || { month, theme: '', released: false, created: Date.now() };
|
||||
if (b.theme != null) k.theme = String(b.theme).trim().slice(0, 80);
|
||||
if (b.released != null) {
|
||||
if (b.released && !kitView(k).complete) return { error: 'Upload all five sizes before releasing the kit.' };
|
||||
k.released = !!b.released;
|
||||
}
|
||||
if (b.remove) { delete s.kits[month]; save(s); return { ok: true, removed: true }; }
|
||||
k.updated = Date.now(); s.kits[month] = k; save(s);
|
||||
return { ok: true, kit: kitView(k) };
|
||||
}
|
||||
const MAGIC = { png: b => b[0] === 0x89 && b[1] === 0x50, jpg: b => b[0] === 0xff && b[1] === 0xd8, gif: b => b.slice(0, 3).toString() === 'GIF' };
|
||||
function uploadBase(month, size, buf, mime) {
|
||||
if (!MONTH_RE.test(String(month))) return { error: 'Month as YYYY-MM.' };
|
||||
if (!SIZES[size]) return { error: 'Size must be one of ' + ORDER.join(', ') + '.' };
|
||||
const ext = { 'image/png': 'png', 'image/jpeg': 'jpg', 'image/gif': 'gif' }[String(mime || '').split(';')[0].trim()];
|
||||
if (!ext || !buf || buf.length < 32 || !MAGIC[ext](buf)) return { error: 'Use a PNG, JPG or GIF file.' };
|
||||
const d = path.join(DIR, month); fs.mkdirSync(d, { recursive: true });
|
||||
for (const e of ['png', 'jpg', 'gif']) { try { fs.unlinkSync(path.join(d, size + '.' + e)); } catch (er) {} }
|
||||
fs.writeFileSync(path.join(d, size + '.' + ext), buf);
|
||||
const s = load(); if (!s.kits[month]) s.kits[month] = { month, theme: '', released: false, created: Date.now() }; s.kits[month].updated = Date.now(); save(s);
|
||||
return { ok: true, kit: kitView(s.kits[month]) };
|
||||
}
|
||||
// placeholder art for tests and previews: the program's existing banners from public/banners (no paid image APIs)
|
||||
function usePlaceholder(month) {
|
||||
const pre = program() === 'linkspin' ? 'linkspin-' : 'iap-';
|
||||
const pick = { '728x90': [pre + '728x90.png'], '300x250': [pre + '300x250.png'], '468x60': [pre + '468x60.png'], '160x600': [pre + '160x600.png'],
|
||||
'1200x630': program() === 'linkspin' ? ['linkspin-og-1200x630.png'] : ['iap-hero-1200x630.png', 'iap-advertise-earn-1200x630.jpg'] };
|
||||
const done = [];
|
||||
for (const size of ORDER) {
|
||||
const f = pick[size].map(n => path.join(X.publicDir, 'banners', n)).find(p => fs.existsSync(p)); if (!f) continue;
|
||||
const buf = fs.readFileSync(f); const r = uploadBase(month, size, buf, /\.jpg$/.test(f) ? 'image/jpeg' : 'image/png'); if (r.ok) done.push(size);
|
||||
}
|
||||
return { ok: true, sizes: done, kit: kitView(load().kits[month] || { month }) };
|
||||
}
|
||||
|
||||
// ---- the renderer ---------------------------------------------------------------------------------------
|
||||
let FONT;
|
||||
function font() {
|
||||
if (FONT !== undefined) return FONT;
|
||||
FONT = process.env.BADGE_FONT || null; if (FONT) return FONT;
|
||||
const walk = d => { let ents = []; try { ents = fs.readdirSync(d, { withFileTypes: true }); } catch (e) { return null; } for (const e of ents) { const f = path.join(d, e.name); if (e.isDirectory()) { const r = walk(f); if (r) return r; } else if (/bold\.ttf$/i.test(e.name) || /DejaVuSans-Bold\.ttf$/.test(e.name)) return f; } return null; };
|
||||
for (const d of ['/usr/share/fonts', '/usr/local/share/fonts']) { const r = walk(d); if (r) { FONT = r; break; } }
|
||||
if (!FONT && process.platform === 'win32' && fs.existsSync('C:/Windows/Fonts/arialbd.ttf')) FONT = 'C:/Windows/Fonts/arialbd.ttf';
|
||||
return FONT;
|
||||
}
|
||||
const ffText = t => String(t).replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/:/g, '\\:').replace(/%/g, '%%');
|
||||
function run(args, cwd) {
|
||||
return new Promise(resolve => {
|
||||
const p = spawn(X.ffmpeg || 'ffmpeg', args, { stdio: ['ignore', 'pipe', 'pipe'], cwd });
|
||||
const out = []; let err = '';
|
||||
p.stdout.on('data', c => out.push(c)); p.stderr.on('data', c => { err += c; });
|
||||
p.on('error', e => resolve({ code: -1, err: e.message })); p.on('close', code => resolve({ code, out: Buffer.concat(out), err }));
|
||||
});
|
||||
}
|
||||
// one personalized banner: base scaled to the exact size, QR (white quiet zone) and @name on a dark box
|
||||
async function renderStill(base, size, name, link, stage, outFile) {
|
||||
const [W, H] = SIZES[size]; const L = LAYOUT[size]; const F = font();
|
||||
if (!F) return { error: 'No font for the renderer.' };
|
||||
const qr = X.qrcode || require('qrcode'); // opts.qrcode: a test copy without node_modules
|
||||
const qrFile = outFile + '.qr.png';
|
||||
await qr.toFile(qrFile, link, { margin: 1, width: L.q[2], errorCorrectionLevel: 'M', color: { dark: '#000000', light: '#ffffff' } });
|
||||
const winPath = /:/.test(F); const fontFile = winPath ? path.basename(F) : F;
|
||||
const ex = v => String(v).replace(/W/g, String(W)).replace(/H/g, String(H));
|
||||
const tx = String(L.t[0]).replace(/W/g, String(W)).replace(/tw/g, 'text_w'); const ty = ex(L.t[1]);
|
||||
const showName = stage !== 0, showQr = stage === undefined || stage === 2;
|
||||
const chain = ['[0:v]scale=' + W + ':' + H + ':flags=lanczos,setsar=1[b]'];
|
||||
let last = 'b';
|
||||
if (showQr) { chain.push('[1:v]scale=' + L.q[2] + ':' + L.q[2] + '[q]'); chain.push('[' + last + '][q]overlay=x=' + ex(L.q[0]) + ':y=' + ex(L.q[1]) + '[o]'); last = 'o'; }
|
||||
if (showName && name) { chain.push('[' + last + ']drawtext=fontfile=' + fontFile + ":text='" + ffText(name) + "':fontcolor=white:fontsize=" + L.t[2] + ':box=1:boxcolor=0x0b1418@0.72:boxborderw=6:x=' + tx + ':y=' + ty + '[n]'); last = 'n'; }
|
||||
const args = ['-v', 'error', '-y', '-i', path.resolve(base), '-i', path.resolve(qrFile), '-filter_complex', chain.join(';'), '-map', '[' + last + ']', '-frames:v', '1'];
|
||||
if (/\.jpg$/.test(outFile)) args.push('-q:v', '3');
|
||||
args.push(path.resolve(outFile));
|
||||
const r = await run(args, winPath ? path.dirname(F) : undefined);
|
||||
try { fs.unlinkSync(qrFile); } catch (e) {}
|
||||
if (r.code !== 0 || !fs.existsSync(outFile)) return { error: 'Render failed: ' + String(r.err || '').slice(0, 200) };
|
||||
return { ok: true };
|
||||
}
|
||||
// the animated version (streak month 3+): the banner, then the name, then the name and the QR, looping
|
||||
async function renderGif(base, size, name, link, outFile) {
|
||||
const frames = [0, 1, 2].map(i => outFile + '.f' + i + '.png');
|
||||
for (let i = 0; i < 3; i++) { const r = await renderStill(base, size, name, link, i, frames[i]); if (r.error) return r; }
|
||||
const list = outFile + '.txt';
|
||||
fs.writeFileSync(list, frames.map((f, i) => "file '" + path.resolve(f).replace(/\\/g, '/') + "'\nduration " + (i === 2 ? 3 : 1)).join('\n') + "\nfile '" + path.resolve(frames[2]).replace(/\\/g, '/') + "'\n");
|
||||
const r = await run(['-v', 'error', '-y', '-f', 'concat', '-safe', '0', '-i', list, '-filter_complex', 'split[a][b];[a]palettegen=max_colors=96[p];[b][p]paletteuse=dither=bayer', '-loop', '0', path.resolve(outFile)]);
|
||||
for (const f of frames.concat(list)) { try { fs.unlinkSync(f); } catch (e) {} }
|
||||
if (r.code !== 0 || !fs.existsSync(outFile)) return { error: 'GIF render failed: ' + String(r.err || '').slice(0, 200) };
|
||||
return { ok: true };
|
||||
}
|
||||
const hashOf = (email, month, size, variant, v) => crypto.createHmac('sha256', SALT).update([norm(email), program(), month, size, variant, v].join('|')).digest('hex').slice(0, 28);
|
||||
function indexFile() { return path.join(OUT, 'index.json'); }
|
||||
function noteIndex(h, meta) { let ix = {}; try { ix = JSON.parse(fs.readFileSync(indexFile(), 'utf8')); } catch (e) {} ix[h] = meta; const tmp = indexFile() + '.' + process.pid + '.tmp'; fs.writeFileSync(tmp, JSON.stringify(ix)); fs.renameSync(tmp, indexFile()); }
|
||||
// render (or reuse) one personalized file; returns { url, file, size, variant, w, h, bytes }
|
||||
async function personal(who, month, size, variant) {
|
||||
const base = baseFile(month, size); if (!base) return { error: 'That kit has no ' + size + ' art yet.' };
|
||||
const v = Math.round(fs.statSync(base).mtimeMs);
|
||||
const ext = variant === 'gif' ? 'gif' : size === '1200x630' ? 'jpg' : 'png';
|
||||
const h = hashOf(who.email, month, size, variant, v + '|' + who.name + '|' + who.link);
|
||||
const out = path.join(OUT, h + '.' + ext);
|
||||
if (!fs.existsSync(out)) {
|
||||
const tmp = path.join(OUT, h + '.' + process.pid + '.' + Date.now() + '.' + ext);
|
||||
let r; try { r = variant === 'gif' ? await renderGif(base, size, who.name, who.link, tmp) : await renderStill(base, size, who.name, who.link, undefined, tmp); } catch (e) { r = { error: 'The banner renderer is not available: ' + e.message }; }
|
||||
if (r.error) return r;
|
||||
try { fs.renameSync(tmp, out); } catch (e) { try { fs.unlinkSync(tmp); } catch (er) {} }
|
||||
noteIndex(h, { email: norm(who.email), month, size, variant, ts: Date.now() });
|
||||
}
|
||||
const [w, hh] = SIZES[size];
|
||||
return { ok: true, url: '/kitimg/' + h + '.' + ext, abs: String(X.siteUrl || '').replace(/\/+$/, '') + '/kitimg/' + h + '.' + ext, file: out, size, variant, w, h: hh, bytes: fs.statSync(out).size, ext };
|
||||
}
|
||||
// public serving: only files already rendered for an entitled member
|
||||
function servePath(name) { const m = /^([a-f0-9]{28})\.(png|jpg|gif)$/.exec(String(name || '')); if (!m) return null; const f = path.join(OUT, m[0]); return fs.existsSync(f) ? { file: f, mime: { png: 'image/png', jpg: 'image/jpeg', gif: 'image/gif' }[m[2]] } : null; }
|
||||
|
||||
// ---- the member ------------------------------------------------------------------------------------------
|
||||
async function whoOf(email) {
|
||||
const w = await X.linkFor(norm(email)); if (!w || !w.link) return null;
|
||||
return { email: norm(email), name: w.username ? '@' + w.username : '', link: w.link };
|
||||
}
|
||||
async function myKits(email) {
|
||||
const ent = (await X.entitled(norm(email)).catch(() => null)) || null;
|
||||
if (!ent || !ent.on) return { on: false };
|
||||
const s = load(); const months = ent.months || {};
|
||||
const nowMonth = String(ent.today || '').slice(0, 7) || ctMonth(); // a kit released early still waits for its month
|
||||
const kits = Object.values(s.kits).filter(k => k.released && k.month <= nowMonth).sort((a, b) => b.month.localeCompare(a.month)).slice(0, 12).map(k => {
|
||||
const streakAt = months[k.month] || 0; const unlocked = streakAt > 0;
|
||||
return Object.assign(kitView(k), { unlocked, streakAt, gif: unlocked && streakAt >= 3, custom: unlocked && streakAt >= 6 });
|
||||
});
|
||||
// the BannerKitAI "custom banners" credit: an entitlement on record, nothing more yet
|
||||
const customMonths = Object.entries(months).filter(([, k]) => k >= 6).map(([m]) => m);
|
||||
if (customMonths.length) {
|
||||
const e = norm(email); const have = s.credits[e] || {}; let changed = false;
|
||||
for (const m of customMonths) if (!have[m]) { have[m] = { ts: Date.now(), used: false }; changed = true; }
|
||||
if (changed) { s.credits[e] = have; save(s); }
|
||||
}
|
||||
const credits = Object.entries((s.credits[norm(email)] || {})).map(([m, c]) => ({ month: m, used: !!c.used }));
|
||||
const cur = nowMonth; const who = await whoOf(email).catch(() => null);
|
||||
return { on: true, program: program(), brand: brand(), link: who ? who.link : null, name: who ? who.name : null, current: cur, currentLabel: monthLabel(cur), unlockedCurrent: !!months[cur],
|
||||
kits, customCredits: credits, customNote: credits.length ? 'Custom banners made for your own offer with BannerKitAI are coming. Your credit is saved on your account and will be honored when it opens.' : null,
|
||||
nextRefuel: ent.nextRefuel || null };
|
||||
}
|
||||
async function renderFor(email, month, size, variant) {
|
||||
const mk = await myKits(email); if (!mk.on) return { error: 'The Refuel Kit is not switched on.' };
|
||||
const k = mk.kits.find(x => x.month === month); if (!k) return { error: 'No such kit.' };
|
||||
if (!k.unlocked) return { error: 'Your next counted refuel unlocks this kit.' };
|
||||
if (!SIZES[size]) return { error: 'No such size.' };
|
||||
if (variant === 'gif' && !k.gif) return { error: 'The animated version comes with a 3-month streak.' };
|
||||
const who = await whoOf(email); if (!who) return { error: 'Set a username first, so your banners carry your own link.' };
|
||||
return personal(who, month, size, variant === 'gif' ? 'gif' : 'still');
|
||||
}
|
||||
async function preview(month, size, username, variant) {
|
||||
const link = String(X.siteUrl || '').replace(/\/+$/, '') + '/join/' + (username || 'yourname');
|
||||
const who = { email: 'preview@' + program(), name: '@' + (username || 'yourname'), link };
|
||||
return personal(who, month, size, variant === 'gif' ? 'gif' : 'still');
|
||||
}
|
||||
|
||||
module.exports = { init, SIZES, ORDER, LAYOUT, listKits, saveKit, uploadBase, usePlaceholder, myKits, renderFor, preview, servePath, ctMonth, monthLabel, font };
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// "Load into my Banner Spin" for the Refuel Kit (2026-10-24). Each Banner Spin size in an unlocked kit goes into one of the
|
||||
// member's Banner Spins of that size that has room, or into a new Banner Spin when the member's tier allows one more.
|
||||
// The banner is the member's own personalized file (copied into uploads like a normal Banner Spin upload, so health checks,
|
||||
// moderation and Member content treat it the same), labelled "Refuel Kit <month>", the target their own link.
|
||||
// Loading the same kit twice does not add it twice.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
async function load(d) { // { kit, bannerspin, content, uploadsDir, email, month, variant, sizes }
|
||||
const { kit, bannerspin, email, month } = d;
|
||||
const mk = await kit.myKits(email); const k = mk.on && mk.kits.find(x => x.month === month);
|
||||
if (!k) return { error: 'No such kit.' };
|
||||
if (!k.unlocked) return { error: 'Your next counted refuel unlocks this kit.' };
|
||||
const t = await bannerspin.tierFor(email); if (!t.ok) return { error: t.reason, status: 403 };
|
||||
const want = Array.isArray(d.sizes) && d.sizes.length ? d.sizes.map(String) : k.sizes.filter(x => x.ready).map(x => x.size);
|
||||
const label = 'Refuel Kit ' + month; const results = [];
|
||||
for (const size of want.filter(z => bannerspin.SIZES[z] && k.sizes.some(x => x.size === z && x.ready))) {
|
||||
const mine = await bannerspin.list(email);
|
||||
const has = mine.find(x => x.size === size && x.banners.some(b => b.label === label));
|
||||
if (has) { results.push({ size, spinId: has.id, spin: has.name, already: true }); continue; }
|
||||
const r = await kit.renderFor(email, month, size, d.variant === 'gif' && k.gif ? 'gif' : 'still');
|
||||
if (r.error) { results.push({ size, error: r.error }); continue; }
|
||||
if (r.bytes > bannerspin.MAX_BYTES) { results.push({ size, error: 'The ' + size + ' file is over 150 KB, so Banner Spin cannot take it. Use the still version.' }); continue; }
|
||||
let spin = mine.find(x => x.size === size && x.banners.length < t.banners && !x.adminOff), created = false;
|
||||
if (!spin) { const c = await bannerspin.create(email, { name: 'Refuel Kit ' + size, size, fallback: mk.link || '' }); if (c.error) { results.push(Object.assign({ size, error: c.error }, mine.length >= t.spins ? { full: true } : {})); continue; } spin = c.spin; created = true; }
|
||||
const name = crypto.randomBytes(12).toString('hex') + '.' + r.ext;
|
||||
fs.writeFileSync(path.join(d.uploadsDir, name), fs.readFileSync(r.file));
|
||||
const mime = { png: 'image/png', jpg: 'image/jpeg', gif: 'image/gif' }[r.ext];
|
||||
try { if (d.content) d.content.noteUpload(name, email, r.bytes, mime, ''); } catch (e) {}
|
||||
bannerspin.noteImage(email, name, r.w, r.h, r.bytes, mime);
|
||||
const add = await bannerspin.addBanner(email, spin.id, { image: '/uploads/' + name, target: mk.link, label });
|
||||
results.push(add.error ? { size, error: add.error } : { size, spinId: spin.id, spin: spin.name, created });
|
||||
}
|
||||
return { ok: true, results, message: summary(results, t) };
|
||||
}
|
||||
// one plain sentence set for the member (2026-10-24): what loaded, what did not and why, and what to do about it. A Starter
|
||||
// tier holds 2 Banner Spins, so a full kit loads two sizes; that is the rule, and the message has to say so up front.
|
||||
const join = a => a.length <= 1 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1];
|
||||
function summary(results, t) {
|
||||
const ok = results.filter(x => !x.error), full = results.filter(x => x.error && x.full), bad = results.filter(x => x.error && !x.full);
|
||||
const out = [];
|
||||
if (ok.length) out.push('Loaded: ' + join(ok.map(x => x.size + (x.already ? ' (already in "' + x.spin + '")' : x.created ? ' (new Banner Spin "' + x.spin + '")' : ' (added to "' + x.spin + '")'))) + '.');
|
||||
if (full.length) out.push('Not loaded: ' + join(full.map(x => x.size)) + '. Your ' + t.label + ' tier holds ' + t.spins + ' Banner Spins, one size each, and they are all in use. Nothing is broken: pick the sizes you want most and load those, or delete a Banner Spin under Links to make room.'
|
||||
+ (t.next ? ' ' + t.next.label + ' (' + t.next.need + ') holds ' + t.next.spins + '.' : ''));
|
||||
for (const x of bad) out.push(x.size + ': ' + x.error);
|
||||
if (!results.length) out.push('Pick at least one size to load.');
|
||||
return out.join(' ');
|
||||
}
|
||||
// what the Refuel Kit panel needs to pre-pick sizes: the tier, Banner Spins in use, and the sizes that fit (sizes with a
|
||||
// Banner Spin that has room first, then new ones in order of use: 728x90, 300x250, 468x60, 160x600)
|
||||
const PREFER = ['728x90', '300x250', '468x60', '160x600'];
|
||||
async function room(email, bannerspin) {
|
||||
const t = await bannerspin.tierFor(email); if (!t.ok) return { ok: false, reason: t.reason };
|
||||
const mine = await bannerspin.list(email); const sizes = PREFER.filter(z => bannerspin.SIZES[z]);
|
||||
const fits = sizes.filter(z => mine.some(x => x.size === z && x.banners.length < t.banners && !x.adminOff));
|
||||
let free = Math.max(0, t.spins - mine.length); const suggested = sizes.filter(z => fits.includes(z) || (free > 0 && free-- > 0));
|
||||
return { ok: true, tier: t.label, spins: t.spins, used: mine.length, next: t.next, sizes, suggested, all: suggested.length >= sizes.length };
|
||||
}
|
||||
module.exports = { load, room, summary };
|
||||
+4
-3
@@ -4,6 +4,7 @@
|
||||
// on Central time: week = Monday 00:00 to Sunday 23:59, month = calendar month. Winners are recorded at
|
||||
// rollover (checked hourly), announced to Telegram, and credit prizes are granted automatically.
|
||||
const { SITE_HOST, SITE_URL } = require('./host');
|
||||
const themehead = require('./themehead'); // light/dark theme head script (2026-11-01)
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
let R = null; // { chain, accounts, ads, dataDir, siteConfig, notify(text), pushFeed(ev) }
|
||||
@@ -131,8 +132,8 @@ async function renderPage() {
|
||||
+ (v.top.length ? v.top.map(r => '<tr><td>' + r.rank + '</td><td><b>' + esc(r.name) + '</b></td><td>' + r.sales + '</td><td>$' + r.usd.toLocaleString() + '</td><td>' + r.buyers + '</td><td>' + r.joins + '</td></tr>').join('') : '<tr><td colspan="6" class="muted">No sales yet in this period.</td></tr>') + '</table>';
|
||||
const fmtD = ts => new Date(ts).toLocaleDateString('en-US', { timeZone: TZ, month: 'short', day: 'numeric' });
|
||||
const desc = 'Who is selling the most ad packages on LinkSpin this week and this month. Weekly and monthly referral contest standings, read from the chain.';
|
||||
let h = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Leaderboard | LinkSpin</title><meta name="description" content="' + esc(desc) + '"><link rel="canonical" href="' + SITE_URL + '/leaderboard"><meta property="og:title" content="LinkSpin leaderboard"><meta property="og:description" content="' + esc(desc) + '"><meta property="og:image" content="' + SITE_URL + '/banners/iap-hero-1200x630.png"><meta name="twitter:card" content="summary_large_image">'
|
||||
+ '<link rel="icon" type="image/png" href="/logo-icon.png"><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap"><link rel="stylesheet" href="/assets/site.css?v=20260913a">'
|
||||
let h = '<!doctype html><html lang="en"' + themehead.htmlAttr('dark') + '><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Leaderboard | LinkSpin</title><meta name="description" content="' + esc(desc) + '"><link rel="canonical" href="' + SITE_URL + '/leaderboard"><meta property="og:title" content="LinkSpin leaderboard"><meta property="og:description" content="' + esc(desc) + '"><meta property="og:image" content="' + SITE_URL + '/banners/iap-hero-1200x630.png"><meta name="twitter:card" content="summary_large_image">'
|
||||
+ '<link rel="icon" type="image/png" href="/logo-icon.png"><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">' + themehead.tag() + '<link rel="stylesheet" href="/assets/site.css?v=ls20261101t">'
|
||||
+ '<style>.lbw{max-width:860px}.lb{width:100%;border-collapse:collapse;margin:8px 0 26px;font-variant-numeric:tabular-nums}.lb th{text-align:left;color:var(--muted);font-size:11px;letter-spacing:.08em;text-transform:uppercase;padding:8px 10px;border-bottom:1px solid var(--line)}.lb td{padding:10px;border-bottom:1px solid var(--line)}.lb tr:first-child + tr td:first-child{color:#ffd15c;font-weight:800}.prize{border-left:4px solid var(--mint);background:rgba(67,232,195,.07);padding:12px 16px;border-radius:0 12px 12px 0;margin:0 0 18px}.win{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:12px 16px;margin:0 0 10px}</style></head><body><div class="wrap lbw">'
|
||||
+ '<section class="hero" style="padding:56px 0 8px"><p class="eyebrow">Referral contest</p><h1>Leaderboard: <em>who is selling</em>.</h1><p class="lead">Ranked by ad packages sold to other people (your own positions never count, and the company account is not a contestant). Read from the chain, updated live. Weeks run Monday to Sunday, Central time.</p></section>';
|
||||
h += '<h2 style="font-size:24px;margin:0 0 4px">' + week.label + ' <span class="muted small">' + fmtD(week.start) + ' to Sunday</span></h2>' + (week.prize ? '<div class="prize"><b>Weekly prizes:</b> ' + esc(week.prize) + '</div>' : '') + table(week);
|
||||
@@ -141,7 +142,7 @@ async function renderPage() {
|
||||
const w = winners();
|
||||
if (w.length) h += '<h2 style="font-size:24px;margin:0 0 10px">Past winners</h2>' + w.slice(0, 12).map(x => '<div class="win"><b>' + (x.kind === 'week' ? 'Week of ' : 'Month of ') + fmtD(x.start) + '</b>: ' + (x.top[0] ? esc(x.top[0].name) + ' (' + x.top[0].sales + ' sold, $' + x.top[0].usd + ')' : 'no sales') + (x.granted && x.granted.length ? ' · awarded: ' + x.granted.map(g => esc(g.name) + ' +' + g.credits.toLocaleString()).join(', ') : (x.prize ? ' · prize ' + esc(x.prize) : '')) + '</div>').join('');
|
||||
h += '<p class="muted small" style="margin-top:30px">Sales are $ of packages bought by members you directly sponsor. Prizes are advertising credits or packages, never cash. No income is guaranteed.</p>';
|
||||
h += '</div><script src="/assets/common.js?v=20260914a"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
|
||||
h += '</div><script src="/assets/common.js?v=20261101t"></script><script src="/assets/blog-page.js?v=20260914a"></script></body></html>';
|
||||
return h;
|
||||
}
|
||||
module.exports = { init, view, compute, renderPage, rolloverTick, winners, periodBounds };
|
||||
|
||||
@@ -25,9 +25,30 @@ function hasKey() { return OUTBOUND && !!key(); }
|
||||
const MAIL_MODE = String(process.env.LS_MAIL_MODE || 'codes-only').trim();
|
||||
let held = 0;
|
||||
|
||||
// First-email intro (Marty, 2026-10-18, when the gate opened): most people on LinkSpin were carried over from
|
||||
// InstantAdPay and never asked for it, so the first non-code email anyone gets from us starts by saying what
|
||||
// LinkSpin is. Once per address, kept in DATA_DIR/mail-intro.json; sign-in codes and admin alerts never carry it.
|
||||
const INTRO = 'New to LinkSpin? Here is the short version.\n\n'
|
||||
+ 'LinkSpin is the newest platform in the Crypto Team Build Network, from the team behind InstantAdPay. '
|
||||
+ 'If you are an InstantAdPay member, your account is already here. There is nothing new to sign up for: '
|
||||
+ 'sign in at ' + SITE_URL + ' with the same email you use on InstantAdPay.\n\n'
|
||||
+ 'What it does: one spin link that rotates your traffic across every page you promote, bridge pages you can build in a minute, '
|
||||
+ 'ad zones that earn you credits on your own sites, and ad packages from $10 to $500. Every package pays the sponsor line '
|
||||
+ 'on Polygon in the same transaction. Nothing is held for later.\n\n'
|
||||
+ 'We are in pre-launch testing until November 15. Everything is live and working, but details may change while we test.\n\n'
|
||||
+ '----------------------------------------\n\n';
|
||||
const ADMIN = String(process.env.ADMIN_EMAIL || '').trim().toLowerCase();
|
||||
let introSeen = null;
|
||||
const introFile = () => path.join(DATA_DIR, 'mail-intro.json');
|
||||
function introLoad() { if (!introSeen) { try { introSeen = JSON.parse(fs.readFileSync(introFile(), 'utf8')); } catch (e) { introSeen = {}; } } return introSeen; }
|
||||
function introMark(e) { introLoad()[e] = Date.now(); try { fs.writeFileSync(introFile() + '.tmp', JSON.stringify(introSeen)); fs.renameSync(introFile() + '.tmp', introFile()); } catch (err) {} }
|
||||
|
||||
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); }
|
||||
const toKey = String(to || '').trim().toLowerCase();
|
||||
const withIntro = !(opts && opts.code) && !!toKey && toKey !== ADMIN && !introLoad()[toKey];
|
||||
if (withIntro) text = INTRO + text;
|
||||
return new Promise((resolve, reject) => {
|
||||
const body = JSON.stringify({
|
||||
personalizations: [{ to: [{ email: to }] }],
|
||||
@@ -41,7 +62,7 @@ function send(to, subject, text, opts) {
|
||||
res => {
|
||||
let d = '';
|
||||
res.on('data', c => d += c);
|
||||
res.on('end', () => res.statusCode < 300 ? resolve(true) : reject(new Error('sendgrid ' + res.statusCode + ': ' + d.slice(0, 200))));
|
||||
res.on('end', () => { if (res.statusCode < 300 && withIntro) introMark(toKey); return res.statusCode < 300 ? resolve(true) : reject(new Error('sendgrid ' + res.statusCode + ': ' + d.slice(0, 200))); });
|
||||
});
|
||||
req.on('error', reject);
|
||||
req.on('timeout', () => req.destroy(new Error('sendgrid timeout')));
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// One-time claims shared by every running copy of the app (same idea as InstantAdPay's marks.js, 2026-10-24).
|
||||
//
|
||||
// Why: a Coolify deploy starts the new container and only stops the old one once the new one is healthy, so for
|
||||
// about half a minute two copies of this app run side by side. Anything deduped in process memory or in a JSON
|
||||
// file that each copy rewrites from its own memory can fire twice (InstantAdPay, 2026-09-25: two emails and a
|
||||
// doubled Friday bonus). `claim(key)` is true for exactly one caller across all copies, false for everyone else.
|
||||
//
|
||||
// With a database: a row in event_marks that only one INSERT can win. Without one (LinkSpin production runs on
|
||||
// the JSON store): an exclusive file create (open with 'wx') in DATA_DIR/marks/. Both copies mount the same
|
||||
// volume, and O_EXCL creation is atomic on it, so exactly one copy gets the file. Marks older than 60 days are
|
||||
// pruned: every event they guard has long since been handled.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
let db = null, DIR = null;
|
||||
const local = new Set();
|
||||
|
||||
function init(deps) {
|
||||
db = deps && deps.db;
|
||||
DIR = deps && deps.dataDir ? path.join(deps.dataDir, 'marks') : null;
|
||||
if (DIR) { try { fs.mkdirSync(DIR, { recursive: true }); } catch (e) {} }
|
||||
}
|
||||
const dbOn = () => !!(db && db.enabled && db.enabled());
|
||||
|
||||
async function ensureTable() {
|
||||
if (!dbOn()) return;
|
||||
await db.q('CREATE TABLE IF NOT EXISTS event_marks (k VARCHAR(160) PRIMARY KEY, ts BIGINT NOT NULL) ENGINE=InnoDB');
|
||||
}
|
||||
const fileOf = key => path.join(DIR, crypto.createHash('sha1').update(key).digest('hex') + '.m');
|
||||
|
||||
// true = this caller owns the key; false = someone (possibly another copy of the app) already does.
|
||||
async function claim(key) {
|
||||
key = String(key).slice(0, 160);
|
||||
if (dbOn()) {
|
||||
try {
|
||||
const r = await db.q('INSERT IGNORE INTO event_marks (k, ts) VALUES (?, ?)', [key, Date.now()]);
|
||||
return !!(r && r.affectedRows === 1);
|
||||
} catch (e) { console.error('marks: claim fell back to the file for ' + key + ': ' + e.message); }
|
||||
}
|
||||
if (DIR) {
|
||||
try { const fd = fs.openSync(fileOf(key), 'wx'); try { fs.writeSync(fd, key + '\n' + Date.now()); } finally { fs.closeSync(fd); } return true; }
|
||||
catch (e) { if (e.code === 'EEXIST') return false; console.error('marks: file claim failed for ' + key + ': ' + e.message); }
|
||||
}
|
||||
if (local.has(key)) return false; local.add(key); return true;
|
||||
}
|
||||
// whether a key was already claimed (read only, never claims)
|
||||
async function has(key) {
|
||||
key = String(key).slice(0, 160);
|
||||
if (dbOn()) { try { const r = await db.q('SELECT 1 FROM event_marks WHERE k=?', [key]); return r.length > 0; } catch (e) {} }
|
||||
if (DIR) return fs.existsSync(fileOf(key));
|
||||
return local.has(key);
|
||||
}
|
||||
|
||||
async function prune() {
|
||||
const cut = Date.now() - 60 * 86400000;
|
||||
if (dbOn()) { try { await db.q('DELETE FROM event_marks WHERE ts < ?', [cut]); } catch (e) {} }
|
||||
if (DIR) { try { for (const f of fs.readdirSync(DIR)) { const p = path.join(DIR, f); try { if (fs.statSync(p).mtimeMs < cut) fs.unlinkSync(p); } catch (e) {} } } catch (e) {} }
|
||||
}
|
||||
|
||||
module.exports = { init, ensureTable, claim, has, prune };
|
||||
+13
-1
@@ -197,5 +197,17 @@ async function reclassifyCarryNotices(fromEmail) {
|
||||
if (n) J.save();
|
||||
return n;
|
||||
}
|
||||
module.exports = { init, lastFrom, lastBroadcastAt, deliver, inbox, unreadCount, newestUnread, markRead,
|
||||
// admin Member content (2026-10-18): the broadcasts members wrote, one row per send (deliver() stores one row per recipient).
|
||||
// Human broadcasts only: system notices / alerts and the private 1:1 chats are left out.
|
||||
async function adminBroadcasts(limit) {
|
||||
const lim = Math.max(1, Math.min(5000, Number(limit) || 2000));
|
||||
if (db.enabled()) {
|
||||
const rows = await db.q("SELECT from_member, from_email, subject, MAX(body) body, sent, COUNT(*) n FROM sponsor_messages WHERE (kind='broadcast' OR kind IS NULL) GROUP BY from_member, from_email, subject, sent ORDER BY sent DESC LIMIT ?", [lim]);
|
||||
return rows.map(r => ({ fromMember: Number(r.from_member) || 0, fromEmail: String(r.from_email || '').toLowerCase(), subject: r.subject || '', body: String(r.body || ''), sent: Number(r.sent) || 0, recipients: Number(r.n) || 0 }));
|
||||
}
|
||||
if (!J.db) J.load(); const g = new Map();
|
||||
for (const i of J.db.items) { if ((i.kind || 'broadcast') !== 'broadcast') continue; const k = (i.fromEmail || '') + '\u0000' + (i.subject || '') + '\u0000' + i.sent; const o = g.get(k); if (o) o.recipients++; else g.set(k, { fromMember: Number(i.fromMember) || 0, fromEmail: String(i.fromEmail || '').toLowerCase(), subject: i.subject || '', body: String(i.body || ''), sent: i.sent || 0, recipients: 1 }); }
|
||||
return Array.from(g.values()).sort((a, b) => b.sent - a.sent).slice(0, lim);
|
||||
}
|
||||
module.exports = { init, adminBroadcasts, lastFrom, lastBroadcastAt, deliver, inbox, unreadCount, newestUnread, markRead,
|
||||
sendChat, thread, markChatRead, chatUnread, threadList, reclassifyCarryNotices };
|
||||
|
||||
@@ -102,9 +102,22 @@ async function readServed(nasAdId) {
|
||||
}
|
||||
|
||||
// stop a syndicated ad (budget spent, paused, or expired) — remaining:0 halts serving.
|
||||
// THE TRAP (InstantAdPay, found 2026-09-17, ported here 2026-10-27): NAS has no stop flag, so a stop zeroes `remaining`, and
|
||||
// served = assigned - remaining then reads the undelivered rest as DELIVERED. The true figure is captured BEFORE the stop
|
||||
// and returned; callers persist it (ads.stopNas) and never reconcile a stopped ad again.
|
||||
async function deactivate(nasAdId) {
|
||||
if (!enabled()) return { skipped: 'flag-off' };
|
||||
let served = null;
|
||||
try { const s = await readServed(nasAdId); if (s) served = s.served; } catch (e) {}
|
||||
await q('UPDATE sponsorads SET remaining=0, EDate=NOW() WHERE ID=?', [Number(nasAdId)]);
|
||||
return { ok: true, served };
|
||||
}
|
||||
// restart a STOPPED ad with `addImpressions` more, re-basing `assigned` on the TRUE served count recorded at the stop
|
||||
// (a plain topUp would leave the zeroed remainder counted as served)
|
||||
async function restart(nasAdId, trueServed, addImpressions, days) {
|
||||
if (!enabled()) return { skipped: 'flag-off' };
|
||||
const add = Math.max(0, Math.floor(Number(addImpressions) || 0)), base = Math.max(0, Math.floor(Number(trueServed) || 0));
|
||||
await q('UPDATE sponsorads SET assigned=?, remaining=?, approved=1, EDate=DATE_ADD(NOW(), INTERVAL ? DAY) WHERE ID=?', [base + add, add, Number(days || 30), Number(nasAdId)]);
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
@@ -115,6 +128,14 @@ async function setClickUrl(nasAdId, campaignId) {
|
||||
await q('UPDATE sponsorads SET WebsiteURL=? WHERE ID=?', [SITE_URL + '/api/ads/click/' + Number(campaignId), Number(nasAdId)]);
|
||||
return { ok: true };
|
||||
}
|
||||
// an edited campaign's creative (2026-10-18): headline, text line and banner image on the live NAS row.
|
||||
// The click URL never changes (it is our /api/ads/click/<id> redirect), so a new link needs no NAS write.
|
||||
async function updateCreative(nasAdId, c) {
|
||||
if (!enabled()) return { skipped: 'flag-off' };
|
||||
if (c.type === 'banner') await q('UPDATE sponsorads SET BannerURL=?, Subject=? WHERE ID=?', [c.imageUrl || null, c.title || null, Number(nasAdId)]);
|
||||
else if (c.type === 'text') await q('UPDATE sponsorads SET Subject=?, Body=? WHERE ID=?', [c.title || null, c.body || null, Number(nasAdId)]);
|
||||
return { ok: true };
|
||||
}
|
||||
async function topUp(nasAdId, addImpressions, days) {
|
||||
if (!enabled()) return { skipped: 'flag-off' };
|
||||
await q(`UPDATE sponsorads SET assigned=assigned+?, remaining=remaining+?, approved=1,
|
||||
@@ -123,4 +144,4 @@ async function topUp(nasAdId, addImpressions, days) {
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
module.exports = { setClickUrl, enabled, pushCampaign, readServed, deactivate, topUp, impressionsPerCredit, nasKind };
|
||||
module.exports = { setClickUrl, updateCreative, enabled, pushCampaign, readServed, deactivate, restart, topUp, impressionsPerCredit, nasKind };
|
||||
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
// Level-4 override for LinkSpin (ported from InstantAdPay 2026-10-23, Marty approved the program the same day; design in
|
||||
// memory iap-level4-override): 3% of every LinkSpin purchase goes to the buyer's 4th upline on the LinkSpin CONTRACT sponsor
|
||||
// chain when that member has 5+ qualifying buyers (the contract's own buyerCount: referred buyers whose first package was
|
||||
// $20 or more, which on LinkSpin's $10/$25/$50... ladder means $25 or more; the same bar that opens level 3). An unqualified
|
||||
// 4th upline is skipped and the hunt climbs (cap 25 hops, the contract's HOP_CAP). Exactly one recipient per purchase;
|
||||
// company ids (overrideHouseIds, default #1) keep it. Paid weekly with the contract's award(toMemberId) from a pre-funded
|
||||
// payer wallet, purchases from overrideGoLive forward only (no back-pay).
|
||||
//
|
||||
// MODES (site setting overrideMode): 'off' | 'dryrun' (default: Monday who-would-be-paid report to Marty's admin Telegram,
|
||||
// no money moves) | 'live' (pays only when overrideGoLive is set AND OVERRIDE_PAYER_KEY / OVERRIDE_PAYER_KEY_FILE is present).
|
||||
// LinkSpin runs in JSON mode (no DATABASE_URL), so the one-time claims are exclusive file creates on the shared volume.
|
||||
// The money-safety notes in the InstantAdPay copy of this file apply word for word; the code is the same module.
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
let ethersLib = null; try { ethersLib = require('ethers'); } catch (e) { /* optional: the payer stays off without it */ }
|
||||
|
||||
const PCT = 3, MIN_BUYERS = 5, HOP_CAP = 25, LEVEL = 4;
|
||||
const GAS_LIMIT = 150000n; // award(): reentrancy guard + member read + capped-gas send + event, ~60k; generous headroom
|
||||
const WEI = 10n ** 18n;
|
||||
|
||||
// ---- Central-time week math (pure, shared by every instance) ----
|
||||
const CT = new Intl.DateTimeFormat('en-US', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit', weekday: 'short' });
|
||||
const CT_HOUR = new Intl.DateTimeFormat('en-US', { timeZone: 'America/Chicago', weekday: 'short', hour: '2-digit', hourCycle: 'h23' });
|
||||
function weekOf(ts) { // the Monday (YYYY-MM-DD, Central) of the week holding ts
|
||||
const parts = Object.fromEntries(CT.formatToParts(new Date(ts)).map(p => [p.type, p.value]));
|
||||
const back = { Mon: 0, Tue: 1, Wed: 2, Thu: 3, Fri: 4, Sat: 5, Sun: 6 }[parts.weekday];
|
||||
return new Date(Date.UTC(+parts.year, +parts.month - 1, +parts.day - back)).toISOString().slice(0, 10);
|
||||
}
|
||||
const ctMidnight = day => { // ms at 00:00 America/Chicago on YYYY-MM-DD (CDT = UTC-5, CST = UTC-6)
|
||||
for (const off of [5, 6]) { const t = Date.parse(day + 'T0' + off + ':00:00Z'); if (new Intl.DateTimeFormat('en-US', { timeZone: 'America/Chicago', hour: '2-digit', hourCycle: 'h23' }).format(new Date(t)) === '00') return t; }
|
||||
return Date.parse(day + 'T05:00:00Z');
|
||||
};
|
||||
const addDays = (day, n) => new Date(Date.parse(day + 'T12:00:00Z') + n * 86400000).toISOString().slice(0, 10);
|
||||
const weekBounds = monday => ({ from: ctMidnight(monday), to: ctMidnight(addDays(monday, 7)) });
|
||||
// the week may be settled from 9 AM Central on the Monday after it
|
||||
const payableAt = monday => ctMidnight(addDays(monday, 7)) + 9 * 3600000;
|
||||
const polStr = wei => { const w = BigInt(wei); const s = (w * 10000n / WEI).toString().padStart(5, '0'); return s.slice(0, -4) + '.' + s.slice(-4); };
|
||||
const toWei = pol => { const [a, b = ''] = String(pol).trim().split('.'); return BigInt(a || '0') * WEI + BigInt((b + '0'.repeat(18)).slice(0, 18) || '0'); };
|
||||
|
||||
function create() {
|
||||
let DATA_DIR = null, chain = null, siteConfig = () => ({}), notify = null, db = null, now = () => Date.now();
|
||||
let BRAND = 'LinkSpin', SITE_URL = 'https://linkspin.app', HOUSE_DEFAULT = '1', payerOverride = null;
|
||||
const lastError = { at: 0, msg: '' };
|
||||
|
||||
function init(o) {
|
||||
DATA_DIR = o.dataDir; chain = o.chain; siteConfig = o.siteConfig || siteConfig; notify = o.notify || null; db = o.db || null;
|
||||
if (o.brand) BRAND = o.brand; if (o.siteUrl) SITE_URL = o.siteUrl; if (o.houseDefault) HOUSE_DEFAULT = String(o.houseDefault);
|
||||
if (o.payer) payerOverride = o.payer; // tests: a fake signer, never the real chain
|
||||
if (o.now) now = o.now;
|
||||
}
|
||||
const cfg = () => {
|
||||
const s = siteConfig();
|
||||
const num = (v, d) => { const n = Number(v); return v === undefined || v === '' || !isFinite(n) ? d : n; };
|
||||
return { mode: String(s.overrideMode || 'dryrun'), house: String(s.overrideHouseIds || HOUSE_DEFAULT).split(',').map(x => Number(x.trim())).filter(Boolean),
|
||||
goLive: Number(s.overrideGoLive || 0), dustWei: toWei(Math.max(0, num(s.overrideDustPol, 0.01)).toFixed(18)), capWei: toWei(Math.max(0, num(s.overridePayCapPol, 100)).toFixed(18)) };
|
||||
};
|
||||
|
||||
// ---- the payer wallet (OVERRIDE_PAYER_KEY; never logged, never returned) ----
|
||||
function keyHex() {
|
||||
let k = String(process.env.OVERRIDE_PAYER_KEY || '').trim();
|
||||
if (!k && process.env.OVERRIDE_PAYER_KEY_FILE) { try { k = fs.readFileSync(process.env.OVERRIDE_PAYER_KEY_FILE, 'utf8').trim(); } catch (e) {} }
|
||||
if (!k) return null; if (!k.startsWith('0x')) k = '0x' + k;
|
||||
return /^0x[0-9a-fA-F]{64}$/.test(k) ? k : null;
|
||||
}
|
||||
let realPayer = null;
|
||||
function payer() {
|
||||
if (payerOverride) return payerOverride;
|
||||
const k = keyHex(); if (!k || !ethersLib) return null;
|
||||
if (realPayer) return realPayer;
|
||||
const c = chain.getConfig(); const urls = (c.rpcs && c.rpcs.length) ? c.rpcs : [c.rpc]; let idx = 0;
|
||||
const wallet = () => new ethersLib.Wallet(k, new ethersLib.JsonRpcProvider(urls[idx % urls.length], Number(c.chainId), { staticNetwork: true }));
|
||||
const ctr = w => new ethersLib.Contract(chain.getConfig().contract, ['function award(uint32 toMemberId) payable'], w);
|
||||
const address = new ethersLib.Wallet(k).address;
|
||||
realPayer = {
|
||||
address,
|
||||
balance: async () => { try { return await wallet().provider.getBalance(address); } catch (e) { idx++; throw e; } },
|
||||
fees: async () => { const g = await chain.suggestedFees(); return { maxPriorityFeePerGas: BigInt(g.maxPriorityFeePerGas), maxFeePerGas: BigInt(g.maxFeePerGas) }; },
|
||||
// a revert here (unknown member, a wallet that refuses POL) costs nothing and sends nothing
|
||||
preflight: async (id, wei) => { await ctr(wallet()).award.staticCall(Number(id), { value: BigInt(wei) }); },
|
||||
send: async (id, wei, fees) => { const tx = await ctr(wallet()).award(Number(id), Object.assign({ value: BigInt(wei), gasLimit: GAS_LIMIT }, fees)); return { hash: tx.hash, wait: () => tx.wait(1) }; }
|
||||
};
|
||||
return realPayer;
|
||||
}
|
||||
function liveState() {
|
||||
const c = cfg(), why = [];
|
||||
if (c.mode !== 'live') why.push('overrideMode is ' + c.mode + ', not live');
|
||||
if (!c.goLive) why.push('overrideGoLive is not set');
|
||||
if (!payerOverride && !keyHex()) why.push('no payer key (OVERRIDE_PAYER_KEY)');
|
||||
if (!payerOverride && !ethersLib) why.push('ethers is not installed');
|
||||
return { ready: !why.length, why };
|
||||
}
|
||||
|
||||
// ---- one-time claims, fail closed ----
|
||||
const dir = (...p) => path.join(DATA_DIR, 'override', ...p);
|
||||
const mkdirp = d => { try { fs.mkdirSync(d, { recursive: true }); } catch (e) {} };
|
||||
const safe = k => String(k).replace(/[^a-zA-Z0-9_.:-]/g, '_').replace(/:/g, '__').slice(0, 150);
|
||||
async function claim(key) {
|
||||
if (db && db.enabled && db.enabled()) {
|
||||
try { const r = await db.q('INSERT IGNORE INTO event_marks (k, ts) VALUES (?, ?)', ['ov:' + String(key).slice(0, 150), now()]); if (!(r && r.affectedRows === 1)) return false; }
|
||||
catch (e) { lastError.at = now(); lastError.msg = 'claim ' + key + ': ' + e.message; return false; }
|
||||
}
|
||||
mkdirp(dir('claims'));
|
||||
try { fs.closeSync(fs.openSync(dir('claims', safe(key)), 'wx')); return true; }
|
||||
catch (e) { if (e.code !== 'EEXIST') { lastError.at = now(); lastError.msg = 'claim file ' + key + ': ' + e.message; } return false; }
|
||||
}
|
||||
const claimed = key => fs.existsSync(dir('claims', safe(key)));
|
||||
|
||||
// ---- payout store: one small JSON file per week header and per (week, member) row, each with a single writer ----
|
||||
const readJ = f => { try { return JSON.parse(fs.readFileSync(f, 'utf8')); } catch (e) { return null; } };
|
||||
const writeJ = (f, o) => { mkdirp(path.dirname(f)); const tmp = f + '.' + process.pid + '.tmp'; fs.writeFileSync(tmp, JSON.stringify(o)); fs.renameSync(tmp, f); };
|
||||
const getWeek = wk => readJ(dir('weeks', wk, 'week.json'));
|
||||
const putWeek = (wk, patch) => { const cur = getWeek(wk) || { week: wk }; const o = Object.assign(cur, patch, { updated: now() }); writeJ(dir('weeks', wk, 'week.json'), o); return o; };
|
||||
const getRow = (wk, id) => readJ(dir('weeks', wk, 'm' + id + '.json'));
|
||||
const putRow = (wk, id, patch) => { const cur = getRow(wk, id) || { week: wk, memberId: id }; const o = Object.assign(cur, patch, { updated: now() }); writeJ(dir('weeks', wk, 'm' + id + '.json'), o); return o; };
|
||||
const rowsOf = wk => { try { return fs.readdirSync(dir('weeks', wk)).filter(f => /^m\d+\.json$/.test(f)).map(f => readJ(dir('weeks', wk, f))).filter(Boolean).sort((a, b) => a.memberId - b.memberId); } catch (e) { return []; } };
|
||||
const plannedWeeks = () => { try { return fs.readdirSync(dir('weeks')).filter(w => /^\d{4}-\d{2}-\d{2}$/.test(w)).sort(); } catch (e) { return []; } };
|
||||
|
||||
// ---- who gets the override on one purchase ----
|
||||
const memo = new Map();
|
||||
async function mem(id) {
|
||||
const c = memo.get(id); if (c && now() - c.t < 600000) return c.v;
|
||||
const m = await chain.member(id); const v = { sponsorId: m.sponsorId || 0, buyerCount: m.buyerCount || 0 };
|
||||
memo.set(id, { t: now(), v }); return v;
|
||||
}
|
||||
// { recipientId, hops, skipped: [{id, buyers}] } or { recipientId: 0, reason }
|
||||
async function recipientFor(buyerId) {
|
||||
const ups = []; let cur = buyerId;
|
||||
for (let i = 0; i < LEVEL - 1 + HOP_CAP; i++) { const s = (await mem(cur)).sponsorId; if (!s || s === cur) break; ups.push(s); cur = s; }
|
||||
if (ups.length < LEVEL) return { recipientId: 0, reason: 'line shorter than ' + LEVEL + ' levels' };
|
||||
const skipped = [], house = cfg().house;
|
||||
for (let i = LEVEL - 1; i < ups.length && i < LEVEL - 1 + HOP_CAP; i++) {
|
||||
const id = ups[i];
|
||||
if (house.includes(id)) return { recipientId: 0, reason: 'reached the company account #' + id, skipped };
|
||||
const b = (await mem(id)).buyerCount;
|
||||
if (b >= MIN_BUYERS) return { recipientId: id, hops: i - (LEVEL - 1), skipped };
|
||||
skipped.push({ id, buyers: b });
|
||||
}
|
||||
return { recipientId: 0, reason: 'no qualified upline within ' + HOP_CAP + ' hops', skipped };
|
||||
}
|
||||
|
||||
// every Purchase in the full-history index (chain.recentEvents keeps the whole history in memory; the file is the fallback)
|
||||
function purchases() {
|
||||
try { if (chain && chain.recentEvents) return chain.recentEvents(1e9).filter(e => e.type === 'Purchase'); } catch (e) {}
|
||||
try { return (JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'chain-index.json'), 'utf8')).events || []).filter(e => e.type === 'Purchase'); } catch (e) { return []; }
|
||||
}
|
||||
// purchases in [from, to) (and from overrideGoLive on): one row per purchase + totals per recipient
|
||||
async function report(from, to) {
|
||||
const c = cfg(); const rows = [], per = {};
|
||||
for (const p of purchases()) {
|
||||
if (p.ts < from || p.ts >= to || (c.goLive && p.ts < c.goLive)) continue;
|
||||
const wei = BigInt(p.paidWei || '0') * BigInt(PCT) / 100n, usd = Math.round((p.priceCents || 0) * PCT) / 10000; // dollars: price cents x 3% / 100
|
||||
const r = await recipientFor(p.buyerId).catch(e => ({ recipientId: 0, reason: 'read failed: ' + e.message, readFailed: true }));
|
||||
rows.push({ tx: p.tx, ts: p.ts, buyerId: p.buyerId, priceCents: p.priceCents, overrideWei: wei.toString(), overrideUsd: usd, recipientId: r.recipientId, hops: r.hops || 0, skipped: r.skipped || [], reason: r.reason || '', readFailed: !!r.readFailed });
|
||||
if (r.recipientId) { const o = per[r.recipientId] = per[r.recipientId] || { recipientId: r.recipientId, purchases: 0, wei: 0n, usdCents: 0 }; o.purchases++; o.wei += wei; o.usdCents += (p.priceCents || 0) * PCT / 100; }
|
||||
}
|
||||
const recipients = Object.values(per).map(o => ({ recipientId: o.recipientId, purchases: o.purchases, wei: o.wei.toString(), pol: Number(o.wei) / 1e18, usd: Math.round(o.usdCents) / 100 })).sort((a, b) => b.usd - a.usd || a.recipientId - b.recipientId);
|
||||
const paidUsd = recipients.reduce((n, o) => n + o.usd, 0), keptUsd = rows.filter(x => !x.recipientId).reduce((n, x) => n + x.overrideUsd, 0);
|
||||
return { mode: c.mode, from, to, purchases: rows.length, readFailures: rows.filter(x => x.readFailed).length, recipients,
|
||||
totals: { wouldPayUsd: Math.round(paidUsd * 100) / 100, wouldPayPol: recipients.reduce((n, o) => n + o.pol, 0), companyKeepsUsd: Math.round(keptUsd * 100) / 100, salesUsd: rows.reduce((n, x) => n + x.priceCents, 0) / 100 }, rows };
|
||||
}
|
||||
// last full week, or the week containing `day`
|
||||
async function week(day) {
|
||||
const monday = day ? weekOf(Date.parse(day + 'T12:00:00Z')) : weekOf(now() - 7 * 86400000);
|
||||
const b = weekBounds(monday);
|
||||
return Object.assign(await report(b.from, b.to), { week: monday, status: weekStatus(monday) });
|
||||
}
|
||||
|
||||
// ---- planning: freeze who gets how much for one closed week (single writer via claim) ----
|
||||
// carried rows from earlier weeks roll into this plan; under-dust totals are carried again
|
||||
async function plan(wk) {
|
||||
if (getWeek(wk)) return getWeek(wk);
|
||||
const b = weekBounds(wk);
|
||||
if (now() < b.to) return null; // not closed yet
|
||||
const r = await report(b.from, b.to);
|
||||
if (r.readFailures) { lastError.at = now(); lastError.msg = 'week ' + wk + ': ' + r.readFailures + ' sponsor reads failed, plan postponed'; return null; } // never plan on a partial read
|
||||
if (!await claim('plan:' + wk)) return getWeek(wk); // another copy is planning (or did)
|
||||
putWeek(wk, { state: 'planning', created: now(), from: b.from, to: b.to, purchases: r.purchases, salesUsd: r.totals.salesUsd, companyKeepsUsd: r.totals.companyKeepsUsd });
|
||||
const per = {};
|
||||
for (const o of r.recipients) per[o.recipientId] = { wei: BigInt(o.wei), usd: o.usd, purchases: o.purchases, carriedIn: 0n, carriedFrom: [] };
|
||||
for (const w of plannedWeeks().filter(w => w < wk)) for (const row of rowsOf(w)) {
|
||||
if (row.state !== 'carried') continue;
|
||||
const o = per[row.memberId] = per[row.memberId] || { wei: 0n, usd: 0, purchases: 0, carriedIn: 0n, carriedFrom: [] };
|
||||
o.wei += BigInt(row.amountWei); o.usd = Math.round((o.usd + (row.usd || 0)) * 100) / 100; o.carriedIn += BigInt(row.amountWei); o.carriedFrom.push(w);
|
||||
putRow(w, row.memberId, { state: 'rolled', rolledInto: wk });
|
||||
}
|
||||
const dust = cfg().dustWei; let total = 0n, n = 0;
|
||||
for (const [id, o] of Object.entries(per)) {
|
||||
const st = o.wei < dust ? 'carried' : 'pending'; if (st === 'pending') { total += o.wei; n++; }
|
||||
putRow(wk, Number(id), { amountWei: o.wei.toString(), usd: o.usd, purchases: o.purchases, carriedInWei: o.carriedIn.toString(), carriedFrom: o.carriedFrom, state: st, note: st === 'carried' ? 'under the ' + polStr(dust) + ' POL minimum, carried to next week' : '' });
|
||||
}
|
||||
return putWeek(wk, { state: n ? 'planned' : 'paid', totalWei: total.toString(), recipients: n, planned: now() });
|
||||
}
|
||||
|
||||
// settle rows whose send answer was lost, from the chain index only (AwardPaid from the payer to that member, that amount)
|
||||
function reconcile(wk, pay) {
|
||||
if (!pay || !chain.recentEvents) return;
|
||||
const b = weekBounds(wk), used = overrideTxs(true);
|
||||
for (const row of rowsOf(wk)) {
|
||||
if (row.state !== 'review' && row.state !== 'sent') continue;
|
||||
const hit = chain.recentEvents(1e9).find(e => e.type === 'AwardPaid' && e.toId === row.memberId && String(e.amountWei) === String(row.amountWei)
|
||||
&& String(e.from || '').toLowerCase() === String(pay.address).toLowerCase() && e.ts >= b.to
|
||||
&& (row.txHash ? String(e.tx).toLowerCase() === String(row.txHash).toLowerCase() : !used.has(String(e.tx).toLowerCase())));
|
||||
if (hit) putRow(wk, row.memberId, { state: 'paid', txHash: hit.tx, note: 'confirmed from the chain index' });
|
||||
}
|
||||
}
|
||||
// admin decision for a stuck row: 'carry' (you checked the payer wallet and nothing went out) or 'paid' with the tx,
|
||||
// which must be an AwardPaid in the chain index from the payer wallet to that member for that exact amount
|
||||
async function resolve(wk, memberId, action, tx) {
|
||||
const r = getRow(wk, Number(memberId)); if (!r) return { error: 'no such row' };
|
||||
if (!['review', 'failed', 'sending', 'sent'].includes(r.state)) return { error: 'row is ' + r.state + ', nothing to resolve' };
|
||||
if (action === 'carry') { putRow(wk, r.memberId, { state: 'carried', note: 'admin: nothing went out, carried to next week (was ' + r.state + ')' }); return finishWeek(wk); }
|
||||
if (action === 'paid') {
|
||||
const p = (payerOverride || keyHex()) ? payer() : null;
|
||||
const hit = p && chain.recentEvents(1e9).find(e => e.type === 'AwardPaid' && String(e.tx).toLowerCase() === String(tx || '').toLowerCase());
|
||||
if (!hit || hit.toId !== r.memberId || String(hit.amountWei) !== String(r.amountWei) || String(hit.from).toLowerCase() !== String(p.address).toLowerCase()) return { error: 'that tx is not an AwardPaid from the payer wallet to #' + r.memberId + ' for ' + polStr(r.amountWei) + ' POL in the chain index' };
|
||||
putRow(wk, r.memberId, { state: 'paid', txHash: hit.tx, note: 'admin: confirmed tx' }); return finishWeek(wk);
|
||||
}
|
||||
return { error: 'action must be carry or paid' };
|
||||
}
|
||||
|
||||
// ---- paying one planned week (live only) ----
|
||||
async function pay(wk) {
|
||||
const live = liveState(); if (!live.ready) return { week: wk, paid: 0, why: live.why };
|
||||
let w = getWeek(wk); if (!w) return { week: wk, why: ['not planned'] };
|
||||
if (w.state === 'planning') return { week: wk, why: ['plan is being written (or a plan write stopped halfway: needs review if this lasts)'] };
|
||||
const p = payer(); reconcile(wk, p);
|
||||
let rows = rowsOf(wk).filter(r => r.state === 'pending');
|
||||
if (!rows.length) return finishWeek(wk);
|
||||
const c = cfg(); const total = rows.reduce((n, r) => n + BigInt(r.amountWei), 0n);
|
||||
if (total > c.capWei) { putWeek(wk, { state: 'held', heldWhy: 'over the weekly cap: ' + polStr(total) + ' POL planned, cap ' + polStr(c.capWei) + ' POL' }); await alertOnce(wk, 'cap', '⛔ <b>Level-4 override HELD</b> · ' + BRAND + ' · week of ' + wk + '\nPlanned ' + polStr(total) + ' POL is over the weekly cap of ' + polStr(c.capWei) + ' POL. Nothing was sent. Raise overridePayCapPol or review the plan, then press Pay this week now in admin.'); return { week: wk, held: 'cap' }; }
|
||||
let fees, bal;
|
||||
try { fees = await p.fees(); bal = BigInt(await p.balance()); } catch (e) { lastError.at = now(); lastError.msg = 'payer read: ' + e.message; return { week: wk, why: ['payer read failed: ' + e.message] }; }
|
||||
const gas = BigInt(rows.length) * GAS_LIMIT * fees.maxFeePerGas;
|
||||
if (bal < total + gas) { putWeek(wk, { state: 'held', heldWhy: 'payer wallet ' + p.address + ' holds ' + polStr(bal) + ' POL, needs ' + polStr(total + gas) + ' (payouts ' + polStr(total) + ' + gas ' + polStr(gas) + ')' }); await alertOnce(wk, 'balance', '⚠️ <b>Level-4 override HELD</b> · ' + BRAND + ' · week of ' + wk + '\nPayer wallet ' + p.address + ' holds ' + polStr(bal) + ' POL; this week needs ' + polStr(total + gas) + ' POL (' + polStr(total) + ' payouts + up to ' + polStr(gas) + ' gas). Nothing was sent. Fund it and it pays on the next check (or press Pay this week now).'); return { week: wk, held: 'balance' }; }
|
||||
putWeek(wk, { state: 'paying', heldWhy: '' });
|
||||
let sent = 0;
|
||||
for (const r0 of rows) {
|
||||
if (!await claim('pay:' + wk + ':' + r0.memberId)) continue; // another copy owns this row
|
||||
const r = getRow(wk, r0.memberId); if (!r || r.state !== 'pending') continue;
|
||||
try { await p.preflight(r.memberId, r.amountWei); }
|
||||
catch (e) { putRow(wk, r.memberId, { state: 'carried', note: 'award() would revert (' + String(e.reason || e.shortMessage || e.message).slice(0, 100) + '); nothing sent, carried to next week' }); continue; }
|
||||
putRow(wk, r.memberId, { state: 'sending', sendingAt: now() }); // on disk BEFORE the send
|
||||
let tx;
|
||||
try { tx = await p.send(r.memberId, r.amountWei, fees); }
|
||||
catch (e) { putRow(wk, r.memberId, { state: 'review', note: 'send error, may or may not have gone out: ' + String(e.shortMessage || e.message).slice(0, 140) }); continue; }
|
||||
putRow(wk, r.memberId, { state: 'sent', txHash: tx.hash });
|
||||
console.log('override: week ' + wk + ' #' + r.memberId + ' ' + polStr(r.amountWei) + ' POL tx ' + tx.hash);
|
||||
try { const rc = await tx.wait(); if (rc && Number(rc.status) === 1) { putRow(wk, r.memberId, { state: 'paid', paidAt: now() }); sent++; } else putRow(wk, r.memberId, { state: 'failed', note: 'reverted on chain (no POL moved except gas); needs review' }); }
|
||||
catch (e) { putRow(wk, r.memberId, { state: 'review', note: 'sent, receipt not confirmed: ' + String(e.message).slice(0, 120) }); }
|
||||
}
|
||||
return Object.assign(await finishWeek(wk), { sentNow: sent });
|
||||
}
|
||||
async function finishWeek(wk) {
|
||||
// a send that stopped halfway (no answer in 15 minutes) is never retried: it becomes review
|
||||
for (const r of rowsOf(wk)) {
|
||||
if (r.state === 'sending' && now() - (r.sendingAt || r.updated || 0) > 15 * 60000) putRow(wk, r.memberId, { state: 'review', note: 'the app stopped during the send; it may or may not have gone out' });
|
||||
if (r.state === 'sent' && now() - (r.updated || 0) > 15 * 60000) putRow(wk, r.memberId, { state: 'review', note: 'sent, no receipt and not in the chain index after 15 minutes' });
|
||||
}
|
||||
reconcile(wk, (payerOverride || keyHex()) ? payer() : null);
|
||||
const rows = rowsOf(wk); const open = rows.filter(r => ['pending', 'sending', 'sent', 'review', 'failed'].includes(r.state));
|
||||
if (open.length) {
|
||||
const stuck = open.filter(r => r.state === 'review' || r.state === 'failed'); // in-flight rows of another copy are not stuck
|
||||
if (stuck.length) await alertOnce(wk, 'review', '\u{1F50E} <b>Level-4 override needs review</b> · ' + BRAND + ' · week of ' + wk + '\n' + stuck.map(r => '#' + r.memberId + ' ' + polStr(r.amountWei) + ' POL: ' + r.state + (r.txHash ? ' ' + txLink(r.txHash) : '') + ' ' + (r.note || '')).join('\n') + '\nNothing is re-sent automatically. Check the payer wallet on the explorer, then resolve it in admin.');
|
||||
return { week: wk, state: (getWeek(wk) || {}).state, open: open.length };
|
||||
}
|
||||
const w = putWeek(wk, { state: 'paid', done: now() });
|
||||
await summaryPaid(wk);
|
||||
return { week: wk, state: w.state };
|
||||
}
|
||||
const txLink = h => { const c = chain.getConfig(); return (c.explorer ? c.explorer.replace(/\/+$/, '') : 'https://polygonscan.com') + '/tx/' + h; };
|
||||
async function alertOnce(wk, kind, text) { if (!notify) return; if (!await claim('tg:' + wk + ':' + kind)) return; await notify(text, null).catch(() => {}); }
|
||||
async function summaryPaid(wk) {
|
||||
if (!notify || !await claim('tg:' + wk + ':paid')) return;
|
||||
const w = getWeek(wk) || {}, rows = rowsOf(wk), paid = rows.filter(r => r.state === 'paid'), carried = rows.filter(r => r.state === 'carried');
|
||||
const tot = paid.reduce((n, r) => n + BigInt(r.amountWei), 0n), usd = paid.reduce((n, r) => n + (r.usd || 0), 0);
|
||||
await notify('\u{1F4B8} <b>Level-4 override PAID</b> · ' + BRAND + ' · week of ' + wk + '\n' + (w.purchases || 0) + ' purchases, $' + Number(w.salesUsd || 0).toFixed(2) + ' sales\n'
|
||||
+ 'Paid ' + polStr(tot) + ' POL (about $' + usd.toFixed(2) + ' at purchase prices) to ' + paid.length + ' member' + (paid.length === 1 ? '' : 's') + '; company keeps $' + Number(w.companyKeepsUsd || 0).toFixed(2) + ' of the 3%.\n'
|
||||
+ (paid.map(r => '#' + r.memberId + ': ' + polStr(r.amountWei) + ' POL ($' + (r.usd || 0).toFixed(2) + ') <a href="' + txLink(r.txHash) + '">tx</a>').join('\n') || 'Nobody qualified this week.')
|
||||
+ (carried.length ? '\nCarried to next week (under the minimum or the wallet refused): ' + carried.map(r => '#' + r.memberId + ' ' + polStr(r.amountWei) + ' POL').join(', ') : '')
|
||||
+ '\nDetails: ' + SITE_URL + '/api/admin/override?week=' + wk, null).catch(() => {});
|
||||
}
|
||||
|
||||
// weeks the live payer is responsible for: from the go-live week to the last closed one, in order
|
||||
function dueWeeks(force) {
|
||||
const c = cfg(); if (!c.goLive) return [];
|
||||
const out = []; let wk = weekOf(c.goLive);
|
||||
while (true) { const b = weekBounds(wk); if (now() < b.to) break; if (!force && now() < payableAt(wk)) break; out.push(wk); wk = addDays(wk, 7); if (out.length > 520) break; }
|
||||
return out;
|
||||
}
|
||||
// settle every due week in order; stop at the first one that is not fully paid
|
||||
async function payDue(opts) {
|
||||
const o = opts || {}; const results = [];
|
||||
if (!liveState().ready) return { ready: false, why: liveState().why, results };
|
||||
for (const wk of dueWeeks(o.force)) {
|
||||
if (o.week && wk > o.week) break;
|
||||
let w = getWeek(wk);
|
||||
if (!w) w = await plan(wk);
|
||||
if (!w) { results.push({ week: wk, why: ['not planned yet: ' + (lastError.msg || 'waiting')] }); break; }
|
||||
if (w.state === 'paid') { await summaryPaid(wk); results.push({ week: wk, state: 'paid' }); continue; }
|
||||
const r = await pay(wk); results.push(r);
|
||||
if ((getWeek(wk) || {}).state !== 'paid') break;
|
||||
}
|
||||
return { ready: true, results };
|
||||
}
|
||||
|
||||
function weekStatus(wk) {
|
||||
const w = getWeek(wk); if (!w) return { week: wk, state: claimed('plan:' + wk) ? 'planning' : 'not planned' };
|
||||
const rows = rowsOf(wk);
|
||||
return { week: wk, state: w.state, heldWhy: w.heldWhy || '', totalWei: w.totalWei, totalPol: w.totalWei ? polStr(w.totalWei) : '0',
|
||||
rows: rows.map(r => ({ memberId: r.memberId, pol: polStr(r.amountWei), amountWei: r.amountWei, usd: r.usd, purchases: r.purchases, state: r.state, txHash: r.txHash || '', tx: r.txHash ? txLink(r.txHash) : '', note: r.note || '', carriedFrom: r.carriedFrom || [], rolledInto: r.rolledInto || '' })) };
|
||||
}
|
||||
async function payerStatus() {
|
||||
const c = cfg(), live = liveState(); const out = { mode: c.mode, ready: live.ready, why: live.why, goLive: c.goLive || 0, capPol: polStr(c.capWei), dustPol: polStr(c.dustWei), house: c.house, keyPresent: !!(payerOverride || keyHex()), lastError: lastError.msg ? lastError : null };
|
||||
const p = (payerOverride || keyHex()) ? payer() : null;
|
||||
if (p) { out.address = p.address; try { out.balancePol = polStr(await p.balance()); } catch (e) { out.balanceError = e.message; } }
|
||||
return out;
|
||||
}
|
||||
// AwardPaid txs this payer made (for the Earnings label and the payout email): tx -> { week, memberId }
|
||||
let txCache = { at: 0, map: new Map() };
|
||||
function overrideTxs(fresh) {
|
||||
if (!fresh && now() - txCache.at < 30000) return txCache.map;
|
||||
const m = new Map(); for (const wk of plannedWeeks()) for (const r of rowsOf(wk)) if (r.txHash) m.set(String(r.txHash).toLowerCase(), { week: wk, memberId: r.memberId });
|
||||
txCache = { at: now(), map: m }; return m;
|
||||
}
|
||||
const txInfo = tx => { return overrideTxs(true).get(String(tx || '').toLowerCase()) || null; };
|
||||
|
||||
// ---- the scheduler: every 30 minutes ----
|
||||
async function tick() {
|
||||
const c = cfg(); if (c.mode === 'off') return;
|
||||
const live = liveState();
|
||||
if (live.ready) { try { await payDue(); } catch (e) { lastError.at = now(); lastError.msg = 'payDue: ' + e.message; console.error('override pay', e.message); } return; }
|
||||
// dry run (or 'live' that is not ready): the Monday report, once per week across every copy of the app
|
||||
const parts = Object.fromEntries(CT_HOUR.formatToParts(new Date(now())).map(p => [p.type, p.value]));
|
||||
if (parts.weekday !== 'Mon' || Number(parts.hour) < 9 || !notify) return;
|
||||
const r = await week(); if (r.readFailures) return; // try again in 30 minutes rather than report a partial week
|
||||
if (!await claim('tg:' + r.week + ':dry')) return;
|
||||
let st = {}; try { st = JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'override-dryrun.json'), 'utf8')); } catch (e) {}
|
||||
st.lastWeek = r.week; st.reports = Object.assign(st.reports || {}, { [r.week]: { totals: r.totals, recipients: r.recipients, purchases: r.purchases } });
|
||||
try { fs.writeFileSync(path.join(DATA_DIR, 'override-dryrun.json'), JSON.stringify(st)); } catch (e) {}
|
||||
const top = r.recipients.slice(0, 8).map(o => '#' + o.recipientId + ': $' + o.usd.toFixed(2) + ' (' + o.pol.toFixed(2) + ' POL, ' + o.purchases + ' buys)').join('\n');
|
||||
await notify('\u{1F4CA} <b>Level-4 override, DRY RUN</b> · ' + BRAND + ' · week of ' + r.week + '\n' + r.purchases + ' purchases, $' + r.totals.salesUsd.toFixed(2) + ' sales\n'
|
||||
+ 'Would pay $' + r.totals.wouldPayUsd.toFixed(2) + ' (' + r.totals.wouldPayPol.toFixed(2) + ' POL) to ' + r.recipients.length + ' members; company keeps $' + r.totals.companyKeepsUsd.toFixed(2) + ' of the 3%.\n'
|
||||
+ (top || 'Nobody qualified this week.') + '\nNo money moved' + (c.mode === 'live' ? ' (live switch is on but not paying: ' + live.why.join('; ') + ')' : '') + '. Details: ' + SITE_URL + '/api/admin/override?week=' + r.week, null).catch(() => {});
|
||||
}
|
||||
|
||||
return { init, report, week, recipientFor, tick, plan, pay, payDue, resolve, dueWeeks, weekStatus, payerStatus, liveState, overrideTxs, txInfo, claim, cfg };
|
||||
}
|
||||
|
||||
const main = create();
|
||||
module.exports = Object.assign(main, { create, weekOf, ctMidnight, weekBounds, payableAt, polStr, toWei, PCT, MIN_BUYERS, HOP_CAP, LEVEL, GAS_LIMIT });
|
||||
+3
-3
@@ -27,7 +27,7 @@ function baseCss(k) {
|
||||
+ '.hero,main,.foot,.wrap{position:relative;z-index:1}'
|
||||
+ '.hero{' + heroSkin + ';padding:72px 24px 64px;text-align:center;overflow:hidden}.hero>*{position:relative;z-index:1}'
|
||||
+ '.hero h1{' + h1font + ';margin:0 auto 18px;max-width:840px;color:' + heroInk + ';text-wrap:balance}.hero .lead{font-size:19px;line-height:1.6;color:' + heroBody + ';max-width:660px;margin:0 auto 8px}.hero .media{max-width:760px;margin:34px auto 0}.hero .ctawrap{margin:28px 0 0}'
|
||||
+ '.hs-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:56px;align-items:center;max-width:1080px;margin:0 auto;text-align:left}.hero.split{text-align:left;padding:72px 32px 64px}.hero.split h1{margin:0 0 18px;text-align:left;max-width:none}.hero.split .lead{margin:0 0 8px;max-width:none}.hero.split .media{margin:0}'
|
||||
+ '.hs-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:56px;align-items:center;max-width:1080px;margin:0 auto;text-align:left}.hero.split{text-align:left;padding:72px 32px 64px}.hero.split h1{margin:0 0 18px;text-align:left;max-width:none}.hero.split .lead{margin:0 0 8px;max-width:none}.hero.split .media{margin:0}.ctawrap{text-align:center}.hero.split .ctawrap{text-align:left}'
|
||||
+ 'main{max-width:680px;margin:0 auto;padding:56px 24px 64px}main h2{font-size:' + (k.design === 'editorial' ? '28px;font-family:' + S.SERIF : '24px') + ';margin:28px 0 10px;color:' + (dkGround ? C.cream : C.ink) + '}main h3{font-size:18px;margin:18px 0 6px;color:' + (dkGround ? C.cream : C.ink) + '}'
|
||||
+ (k.design === 'editorial' ? 'main p:first-of-type::first-letter{float:left;font-size:58px;line-height:.9;padding:6px 10px 0 0;color:' + C.gold + ';font-weight:700}' : '')
|
||||
// squeeze card
|
||||
@@ -35,7 +35,7 @@ function baseCss(k) {
|
||||
+ '.card{background:' + (k.design === 'ignition' ? 'rgba(8,8,8,.55)' : '#fff') + ';max-width:560px;width:100%;border-radius:12px;border-top:4px solid ' + C.gold + ';padding:44px 40px 40px;text-align:center;box-shadow:0 24px 80px rgba(0,0,0,' + (dkGround ? '.45' : '.12') + ');color:' + (k.design === 'ignition' ? S.rgba(C.cream, 0.85) : C.body) + (k.design === 'ignition' ? ';border:1px solid ' + S.rgba(S.hotRamp(k.pk).hot1, 0.3) + ';border-top:4px solid ' + S.hotRamp(k.pk).hot1 + ';backdrop-filter:blur(6px)' : '') + '}'
|
||||
+ '.card h1{' + h1font.replace(/clamp\([^)]*\)/, 'clamp(28px,5.5vw,38px)') + ';margin:0 0 16px;color:' + (k.design === 'ignition' ? '#fff' : C.ink) + '}.card .sub{font-size:18px;line-height:1.6;margin:0 0 24px}.card ul.checks{margin:0 auto 24px;max-width:26em}.card .hero-img{width:100%;height:auto;border-radius:12px;margin:0 0 20px}'
|
||||
+ '.sq-grid{display:grid;grid-template-columns:1fr .85fr;gap:56px;align-items:center;max-width:1060px;width:100%;margin:0 auto}.sq-grid .card{max-width:none;text-align:left}.sq-grid ul.checks{max-width:none;margin:0 0 24px}'
|
||||
+ '@media(max-width:820px){.hs-grid,.sq-grid{grid-template-columns:1fr;gap:36px}.hero.split{text-align:center}.hero.split h1{text-align:center}.sq-grid .card{text-align:center}.sq-grid .pv,.hs-grid .media{order:-1}}@media(max-width:480px){.card{padding:32px 20px 28px}.hero{padding:52px 18px 44px}}'
|
||||
+ '@media(max-width:820px){.hs-grid,.sq-grid{grid-template-columns:1fr;gap:36px}.hero.split{text-align:center}.hero.split h1{text-align:center}.hero.split .ctawrap{text-align:center}.sq-grid .card{text-align:center}.sq-grid .pv,.hs-grid .media{order:-1}}@media(max-width:480px){.card{padding:32px 20px 28px}.hero{padding:52px 18px 44px}}'
|
||||
+ S.kitCss(k.design, k.pk) + S.visualCss(k.pk)
|
||||
+ (dkGround ? '.pc div{background:rgba(255,255,255,.04);border-color:' + S.rgba(C.cream, 0.1) + ';color:' + S.rgba(C.cream, 0.85) + '}.verdict{background:rgba(255,255,255,.04);color:' + S.rgba(C.cream, 0.85) + '}.bonus{background:rgba(255,255,255,.04);border-color:' + S.rgba(C.cream, 0.12) + ';box-shadow:none;color:' + S.rgba(C.cream, 0.85) + '}.bonus .tag{background:' + S.rgba(C.gold, 0.16) + ';color:' + C.goldSoft + '}' : '')
|
||||
+ (k.design === 'editorial' ? '.foot{color:' + C.muted + '}' : dkGround ? '.foot{color:rgba(245,241,232,.5)}' : '.foot{color:' + C.muted + '}');
|
||||
@@ -56,7 +56,7 @@ function sideVisual(k, c) {
|
||||
function formArea(page, opts) {
|
||||
const c = page.content || {};
|
||||
if (c.formEmbed) { const parsed = formrestyle.parse(c.formEmbed); if (parsed) return '<div class="formarea">' + formrestyle.html(parsed, (c.cta && c.cta.text) || 'Send me the details') + '</div>'; }
|
||||
return '<div class="formarea"><form class="ls-form" method="post" action="' + esc(opts.leadUrl) + '"><input class="ls-in" type="text" name="name" placeholder="Your first name"><input class="ls-in" type="email" name="email" placeholder="Your best email" required><input type="text" name="website" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px" aria-hidden="true"><input type="hidden" name="lsid" value="">'
|
||||
return '<div class="formarea"><form class="ls-form" method="post" action="' + esc(opts.leadUrl) + '"><input class="ls-in" type="text" name="name" placeholder="Your first name"><input class="ls-in" type="email" name="email" placeholder="Your best email" required><input type="text" name="website" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px" aria-hidden="true"><input type="hidden" name="lsid" value="' + esc(/^[a-z0-9]{6,20}$/i.test(String(opts.lsid || '')) ? opts.lsid : '') + '">'
|
||||
+ '<button class="cta" type="submit">' + esc((c.cta && c.cta.text) || 'Send me the details') + '</button></form></div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -253,4 +253,14 @@ async function removeImage(owner, id) {
|
||||
}
|
||||
// the file behind /u/pages/<hash>/<id>.<ext>, only when the index knows it (never a raw directory read)
|
||||
function imageFile(hash, id, ext) { const i = J.db.images.find(x => x.h === String(hash) && x.id === String(id) && x.ext === String(ext)); return i ? { file: path.join(DATA_DIR, 'uploads', 'pages', i.h, i.id + '.' + i.ext), mime: i.mime } : null; }
|
||||
module.exports = { init, TYPES, list, get, bySlug, create, update, html, view, lead, leads, csv, scan, write, totals, summary, readUpload, uploadImage, images, removeImage, imageFile, IMG_MAX, IMG_BYTES, providers: () => formrestyle.PROVIDERS, provider: formrestyle.provider };
|
||||
// -- admin Member content (2026-10-18): every page and every hosted image, all owners; counts in one pass over the views
|
||||
function adminAll() {
|
||||
const by = {}; for (const v of J.db.views) { const o = by[v.p] = by[v.p] || { views: 0, u: new Set(), clicks: 0 }; if (v.k === 'cta') o.clicks++; else { o.views++; o.u.add(v.v); } }
|
||||
const ld = {}; for (const l of J.db.leads) ld[l.p] = (ld[l.p] || 0) + 1;
|
||||
return J.db.pages.map(p => { const o = by[p.id] || { views: 0, u: new Set(), clicks: 0 }; const c = p.content || {};
|
||||
return { id: p.id, owner: p.owner, slug: p.slug, type: p.type, title: p.title, status: p.status, created: p.created, updated: p.updated, angle: p.angle || '', scanUrl: p.scan && p.scan.url || '',
|
||||
headline: c.headline || '', sub: c.sub || '', body: String(c.body || '').slice(0, 600), ctaUrl: c.cta && c.cta.url || '', ctaText: c.cta && c.cta.text || '', image: c.image || '', bonus: String(c.bonus || '').slice(0, 300),
|
||||
formProvider: p.type === 'squeeze' && c.formEmbed ? formrestyle.provider(c.formEmbed) : null, views: o.views, uniques: o.u.size, clicks: o.clicks, leads: ld[p.id] || 0 }; });
|
||||
}
|
||||
function adminImages() { return J.db.images.map(i => Object.assign(pubImage(i), { owner: i.owner })); }
|
||||
module.exports = { init, TYPES, list, get, bySlug, create, update, html, view, lead, leads, csv, scan, write, totals, summary, readUpload, uploadImage, images, removeImage, imageFile, IMG_MAX, IMG_BYTES, providers: () => formrestyle.PROVIDERS, provider: formrestyle.provider, adminAll, adminImages };
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ const STAGES = [
|
||||
{ key: 'talking', label: 'Talking to', hint: 'People you have reached out to who have not joined yet.' },
|
||||
{ key: 'joined', label: 'Joined', hint: 'Joined free. Next: link a wallet.' },
|
||||
{ key: 'wallet', label: 'Wallet linked', hint: 'Next: switch on payouts, one free transaction.' },
|
||||
{ key: 'payouts', label: 'Payouts on', hint: 'Next: a first package. $20 or more counts for you.' },
|
||||
{ key: 'payouts', label: 'Payouts on', hint: 'Next: a first package. $25 or more counts for you.' },
|
||||
{ key: 'bought', label: 'Bought', hint: 'Your qualifying buyer. Next: their first person.' },
|
||||
{ key: 'building', label: 'Building', hint: 'They have buyers of their own. Coach them to their two.' },
|
||||
{ key: 'later', label: 'Later', hint: 'Parked: not now, no response, not interested.' }
|
||||
|
||||
+7
-4
@@ -17,7 +17,7 @@ const J = { db: null, FILE: () => path.join(DATA_DIR, 'postbacks.json'),
|
||||
save() { try { fs.writeFileSync(this.FILE(), JSON.stringify(this.db)); } catch (e) {} } };
|
||||
function init(opts) { DATA_DIR = opts.dataDir; ownHosts = opts.ownHosts || (() => []); rotator = opts.rotator; SOURCES = opts.sources || null; J.load(); }
|
||||
const norm = e => String(e || '').trim().toLowerCase();
|
||||
const EVENTS = ['join', 'lead', 'wallet', 'purchase', 'external'];
|
||||
const EVENTS = ['join', 'lead', 'wallet', 'purchase', 'external', 'goal']; // 'goal' = any conversion-pixel goal (2026-10-23); {event} carries the goal's name
|
||||
const MACRO = /\{([a-z0-9_]{1,24})\}/gi;
|
||||
|
||||
function isPrivateIp(ip) {
|
||||
@@ -102,7 +102,8 @@ async function fire(owner, event, ctx) {
|
||||
const q = (ctx.q || {});
|
||||
const vals = { clickid: q.clickid || q.cid || q.click_id || q.external_id || q.visitor_id || '', subid: q.subid || q.sub_id || q.s1 || '', s1: q.s1 || q.sub1 || '', s2: q.s2 || q.sub2 || '', s3: q.s3 || q.sub3 || '', s4: q.s4 || q.sub4 || '', s5: q.s5 || q.sub5 || '', source: ctx.source || '', event, payout: ctx.payout != null ? ctx.payout : '', currency: ctx.currency || 'USD', txid: ctx.txid || '', lsid: ctx.lsid || '', code: ctx.code || '', country: ctx.country || '', device: ctx.device || '' };
|
||||
for (const [k, v] of Object.entries(q)) if (/^(utm_[a-z]+|sub\d|s\d|aff_sub\d?|t\d|cost|zone|placement|site|campaign|creative|banner|keyword|geo|os|browser|carrier|format)$/.test(k) && vals[k] == null) vals[k] = v;
|
||||
for (const p of J.db.items.filter(x => x.owner === o && x.enabled && x.events.includes(event))) {
|
||||
const listens = evs => (evs || []).includes(event) || (!!ctx.goal && (evs || []).includes('goal'));
|
||||
for (const p of J.db.items.filter(x => x.owner === o && x.enabled && listens(x.events))) {
|
||||
if (!rateOk(o)) break;
|
||||
const url = fill(p.url, vals);
|
||||
let r = await deliver(p, url, Object.assign({}, ctx, { event }));
|
||||
@@ -112,7 +113,7 @@ async function fire(owner, event, ctx) {
|
||||
// the traffic source that sent this click (and only that one) hears about it through its own postback
|
||||
if (ctx.sourceId && SOURCES) {
|
||||
const s = SOURCES.forFire(o, ctx.sourceId);
|
||||
if (s && (s.events || []).includes(event) && rateOk(o)) {
|
||||
if (s && listens(s.events) && rateOk(o)) {
|
||||
const url = fill(s.postbackUrl, vals);
|
||||
let r = await deliver(s, url, Object.assign({}, ctx, { event, viaSource: s.id }));
|
||||
if (!r.ok && !ctx.test) { await new Promise(res => setTimeout(res, 4000)); r = await deliver(s, url, Object.assign({}, ctx, { event, viaSource: s.id })); }
|
||||
@@ -150,4 +151,6 @@ async function inbound(key, body) {
|
||||
try { await fire(owner, event, ctx); } catch (e) {}
|
||||
return { ok: true, recorded: event, lsid };
|
||||
}
|
||||
module.exports = { init, EVENTS, validateUrl, fill, deliver, list, create, update, logFor, logForSource, partnerKey, rotateKey, bindClick, clickOf, fire, test, convertFor, inbound };
|
||||
// admin Member content (2026-10-18): every postback of every owner
|
||||
function adminAll() { return J.db.items.map(p => Object.assign(pubItem(p), { owner: p.owner })); }
|
||||
module.exports = { init, adminAll, EVENTS, validateUrl, fill, deliver, list, create, update, logFor, logForSource, partnerKey, rotateKey, bindClick, clickOf, fire, test, convertFor, inbound };
|
||||
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
// Prohibited-content policy, one module shared by InstantAdPay and LinkSpin (keep the two copies identical).
|
||||
// 2026-10-30: an SEO backlink farm opened 106 free accounts, each with a casino or local-business bio and a
|
||||
// website link, and Google indexed that text under our domains through the public walls. Rules (Marty):
|
||||
// - profile fields are not a free backlink: a bio may not carry a URL or a domain-looking token;
|
||||
// - gambling, adult, pharma, weapons and link-selling terms are refused in every member-set text field
|
||||
// (bio, social links, line banner, wall offers, campaign names, headlines, copy and target URLs);
|
||||
// - case-insensitive and Unicode aware (NFC, lower-cased, letter/number boundaries, so "Essex" never hits "sex").
|
||||
// Pure functions, no state, no dependencies.
|
||||
'use strict';
|
||||
|
||||
// One entry per term or phrase; spaces match any run of whitespace. Grouped for the Terms page and the admin.
|
||||
const LIST = {
|
||||
gambling: ['casino', 'casinos', 'cassino', 'cassinos', 'slots', 'slot gacor', 'betting', 'sportsbook', 'sportsbooks', 'bookmaker', 'bookmakers', 'bookie',
|
||||
'lottery', 'lotteries', 'lotto', 'poker', 'baccarat', 'roulette', 'blackjack', 'jackpot', 'togel', 'judi', 'judi online', 'apostas', 'apuestas',
|
||||
'nổ hũ', 'cá cược', 'đổi thưởng', 'xổ số', 'kèo', 'nhà cái', 'soi kèo', 'game bài', 'tài xỉu', 'bắn cá'],
|
||||
adult: ['porn', 'porno', 'pornography', 'sex', 'sexy', 'escort', 'escorts', 'erotic', 'erotica', 'xxx', 'onlyfans', 'nude', 'nudes', 'hentai', 'cam girl', 'cam girls', 'sex cam', 'hookup', 'hookups'],
|
||||
pharma: ['viagra', 'cialis', 'levitra', 'pharmacy', 'pharmacies', 'prescription', 'prescriptions', 'steroids', 'anabolic', 'cannabis', 'marijuana', 'weed', 'cbd', 'kratom', 'opioid', 'opioids',
|
||||
'xanax', 'adderall', 'tramadol', 'oxycodone', 'ketamine', 'cocaine', 'mdma', 'psilocybin', 'vape', 'vaping'],
|
||||
weapons: ['firearm', 'firearms', 'guns', 'gun shop', 'gun store', 'ammunition', 'ammo', 'rifle', 'rifles', 'pistol', 'pistols', 'handgun', 'handguns', 'silencer', 'suppressor', 'explosives'],
|
||||
linkfarm: ['backlink', 'backlinks', 'seo service', 'seo services', 'seo agency', 'link building', 'link-building', 'guest post', 'guest posts', 'guest posting', 'pbn', 'buy links', 'sell links', 'dofollow']
|
||||
};
|
||||
const ALL = Object.values(LIST).reduce((a, b) => a.concat(b), []);
|
||||
|
||||
const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const ZW = /[-]/g; // zero-width joiners hide nothing
|
||||
const strip = s => String(s == null ? '' : s).normalize('NFC').replace(ZW, '');
|
||||
const norm = s => strip(s).toLowerCase();
|
||||
// Boundary = anything that is not a letter or a number (works for every script, unlike \b).
|
||||
const TERM_RE = new RegExp('(?<![\\p{L}\\p{N}])(?:' + ALL.map(t => esc(norm(t)).replace(/\s+/g, '\\s+')).join('|') + ')(?![\\p{L}\\p{N}])', 'u');
|
||||
|
||||
// Common gTLDs plus the ccTLDs link farms actually use. A short two-letter list keeps "Mr.Li" style text out of it.
|
||||
const TLDS = 'com|net|org|info|biz|io|co|app|xyz|me|tv|us|uk|vn|de|fr|ru|in|id|br|es|it|nl|ca|au|eu|ch|at|be|pt|pl|cz|se|no|fi|dk|ie|nz|za|ng|ke|eg|tr|ua|il|ae|sa|pk|bd|lk|np|kh|la|mm|my|sg|ph|th|jp|kr|cn|tw|hk|mx|ar|cl|pe|to|ly|cc|gg|ai|pw|ws|tk|ml|ga|cf|gq|su|'
|
||||
+ 'site|online|store|shop|club|top|pro|live|link|page|dev|fun|vip|one|tech|space|website|cloud|digital|agency|company|email|news|blog|life|world|today|zone|guru|ninja|game|games|team|network|money|cash|gold|bid|trade|win|bet|casino|poker|mobi|name|tel|travel|jobs|pics|photo|video|press|media|art|design|studio|capital|finance|exchange|solutions|services|systems|tools|works|center|group|global|international|institute|academy|school|education|university|church|community|social|chat|dating|love|wiki|review|reviews|directory|guide|help|support|rocks|ventures|holdings|partners|limited|ltd|llc|inc|asia|africa|london|nyc|tokyo|berlin|paris|best|buzz|click|host|hosting|lol|monster|wtf|ooo|icu|sbs|cfd|cyou|rest|bar|cam|surf|run|fit|health|care|dog|cat|pet|pets|wine|beer|vodka|bio|eco|green|energy|solar|car|cars|auto|bike|tires|taxi|limo|rent|rentals|house|homes|realty|estate|land|city|town|place|map|earth|fund|loans|credit|insure|legal|law|lawyer|attorney|tax|accountant|consulting|marketing|promo|sale|deals|discount|coupons|gift|gifts|toys|baby|kids|mom|family|wedding|party|events|tickets|show|theater|film|movie|music|band|dance|yoga|golf|football|soccer|hockey|tennis|racing';
|
||||
// Schemes and www. are matched in any case; a bare domain token (or an email address) only with its TLD in lower case, so a
|
||||
// missed space after a period ("ads.One day") is not mistaken for a link while real spam domains (typed lower case) are caught.
|
||||
const SCHEME_RE = /(?:https?:\/\/|ftp:\/\/|(?<![\p{L}\p{N}])www\.)/iu;
|
||||
const DOMAIN_RE = new RegExp('(?<![\\p{L}\\p{N}])[\\p{L}\\p{N}-]{1,63}(?:\\.[\\p{L}\\p{N}-]{1,63})*\\.(?:' + TLDS + ')(?![\\p{L}\\p{N}])', 'u');
|
||||
|
||||
// The matching prohibited term, or null.
|
||||
function match(text) { const m = TERM_RE.exec(norm(text)); return m ? m[0].replace(/\s+/g, ' ') : null; }
|
||||
// True when the text carries a URL or a domain-looking token (http(s)://, www., word.tld).
|
||||
function hasUrl(text) { const t = strip(text); return SCHEME_RE.test(t) || DOMAIN_RE.test(t); }
|
||||
|
||||
const BIO_LINK_MSG = 'Links go in the social fields, not the bio.';
|
||||
const blockedMsg = site => 'That content is not allowed on ' + (site || 'InstantAdPay/LinkSpin') + ' profiles (see Terms).';
|
||||
const blockedAdMsg = site => 'That content is not allowed on ' + (site || 'InstantAdPay/LinkSpin') + ' (see Terms, Prohibited content).';
|
||||
|
||||
// Bio rule: no links, no prohibited terms. Returns { ok: true } or { error, reason }.
|
||||
function checkBio(bio, site) {
|
||||
const t = String(bio || '');
|
||||
if (!t.trim()) return { ok: true };
|
||||
if (hasUrl(t)) return { error: BIO_LINK_MSG, reason: 'url' };
|
||||
const term = match(t);
|
||||
if (term) return { error: blockedMsg(site), reason: 'term:' + term };
|
||||
return { ok: true };
|
||||
}
|
||||
// Any other member-set text (social URL, banner target, campaign name, headline, copy): prohibited terms only.
|
||||
// Pass profile: true for profile fields (the message names profiles), else the ad message is used.
|
||||
function checkText(text, site, opts) {
|
||||
const term = match(text);
|
||||
if (!term) return { ok: true };
|
||||
return { error: (opts && opts.profile) ? blockedMsg(site) : blockedAdMsg(site), reason: 'term:' + term };
|
||||
}
|
||||
// Several fields at once: { name: value, ... } -> first failure, with the field named in `field`.
|
||||
function checkFields(fields, site, opts) {
|
||||
for (const k of Object.keys(fields || {})) {
|
||||
const v = fields[k]; if (v == null || v === '') continue;
|
||||
const r = checkText(Array.isArray(v) ? v.join(' ') : String(v), site, opts);
|
||||
if (r.error) return Object.assign({ field: k }, r);
|
||||
}
|
||||
return { ok: true };
|
||||
}
|
||||
// Profile ingest (registry sync from the other property, or a saved profile replayed): the parts of a profile that may be
|
||||
// stored. A bio with a link or a prohibited term is dropped (null); a social URL carrying a prohibited term is dropped.
|
||||
function cleanProfile(pf, site) {
|
||||
const out = { avatarUrl: null, bio: null, socials: null, dropped: [] };
|
||||
if (!pf || typeof pf !== 'object') return out;
|
||||
const av = String(pf.avatarUrl || '').trim(); if (/^https:\/\/[^\s]+$/i.test(av) && av.length <= 300) out.avatarUrl = av;
|
||||
const bio = String(pf.bio || '').trim().slice(0, 600);
|
||||
if (bio) { const r = checkBio(bio, site); if (r.ok) out.bio = bio; else out.dropped.push('bio:' + r.reason); }
|
||||
const src = pf.socials && typeof pf.socials === 'object' ? pf.socials : (typeof pf.socials === 'string' ? safeJson(pf.socials) : null);
|
||||
if (src) {
|
||||
const c = {};
|
||||
for (const k of Object.keys(src)) {
|
||||
const v = String(src[k] || '').trim(); if (!v) continue;
|
||||
const r = checkText(v, site, { profile: true }); if (r.ok) c[k] = v; else out.dropped.push('socials.' + k + ':' + r.reason);
|
||||
}
|
||||
if (Object.keys(c).length) out.socials = c;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function safeJson(s) { try { const o = JSON.parse(s); return o && typeof o === 'object' ? o : null; } catch (e) { return null; } }
|
||||
// Terms-page wording, one line per group (kept here so both sites say the same thing).
|
||||
const POLICY = [
|
||||
'gambling, casinos, betting, lotteries and sweepstakes',
|
||||
'adult or sexual content',
|
||||
'drugs and prescription pharmaceuticals',
|
||||
'weapons',
|
||||
'hate or harassment',
|
||||
'malware, phishing and counterfeit goods',
|
||||
'misleading financial promises',
|
||||
'accounts created to place links in profile fields (link farming), which are removed without notice together with their profile text'
|
||||
];
|
||||
// One log line per refusal, with the email masked (never the text itself at full length).
|
||||
function logRefusal(where, email, r) {
|
||||
try { console.log('prohibited-content refused', where, String(email || '-').replace(/^(.).*(@.*)$/, '$1***$2'), r && r.field ? 'field=' + r.field : '', r && r.reason ? r.reason : ''); } catch (e) {}
|
||||
}
|
||||
module.exports = { LIST, ALL, POLICY, match, hasUrl, checkBio, checkText, checkFields, cleanProfile, logRefusal, BIO_LINK_MSG, blockedMsg, blockedAdMsg };
|
||||
+99
-8
@@ -1,15 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Admin | LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261011b">
|
||||
<style>@import url("/assets/site.css?v=ls20260916a") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261008a">
|
||||
<link rel="stylesheet" href="/assets/admin.css?v=20261012a">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>@import url("/assets/site.css?v=ls20261101t") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261101t">
|
||||
<link rel="stylesheet" href="/assets/admin.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
@@ -44,11 +45,13 @@
|
||||
<button data-pane="house" class="nb" type="button" title="House ads"><svg viewBox="0 0 24 24"><path d="M3 11l14-5v12L3 13v-2z"/><path d="M17 8a4 4 0 0 1 0 8M7 13v5a2 2 0 0 0 4 0v-3"/></svg><span class="lbl">House ads</span></button>
|
||||
<button data-pane="campaigns" class="nb" type="button" title="All campaigns"><svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10"/></svg><span class="lbl">All campaigns</span></button>
|
||||
<button data-pane="members" class="nb" type="button" title="Members"><svg viewBox="0 0 24 24"><circle cx="12" cy="7" r="3.2"/><circle cx="5" cy="17" r="2.6"/><circle cx="19" cy="17" r="2.6"/><path d="M12 10v3M12 13l-5 2M12 13l5 2"/></svg><span class="lbl">Members</span></button>
|
||||
<button data-pane="content" class="nb" type="button" title="Member content"><svg viewBox="0 0 24 24"><path d="M12 3l9 5-9 5-9-5z"/><path d="M3 13l9 5 9-5"/><path d="M3 17.5l9 5 9-5" opacity=".55"/></svg><span class="lbl">Member content</span><span class="pill" id="ctBadge" hidden></span></button>
|
||||
<button data-pane="reports" class="nb" type="button" title="Reports"><svg viewBox="0 0 24 24"><path d="M12 3l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg><span class="lbl">Reports</span><span class="pill" id="repBadge" hidden></span></button>
|
||||
<button data-pane="traffic" class="nb" type="button" title="Traffic"><svg viewBox="0 0 24 24"><path d="M3 17l6-6 4 4 8-8"/><path d="M14 7h7v7"/></svg><span class="lbl">Traffic</span></button>
|
||||
<button data-pane="zones" class="nb" type="button" title="Zones"><svg viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18M8 15h8"/></svg><span class="lbl">Zones</span></button>
|
||||
<button data-pane="domains" class="nb" type="button" title="Link domains"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/></svg><span class="lbl">Link domains</span></button>
|
||||
<button data-pane="blog" class="nb" type="button" title="Blog"><svg viewBox="0 0 24 24"><path d="M4 4h12l4 4v12H4z"/><path d="M8 12h8M8 16h8M8 8h4"/></svg><span class="lbl">Blog</span></button>
|
||||
<button data-pane="kb" class="nb" type="button" title="Knowledge base"><svg viewBox="0 0 24 24"><path d="M4 5.5A2.5 2.5 0 0 1 6.5 3H20v15H6.5A2.5 2.5 0 0 0 4 20.5z"/><path d="M4 20.5A2.5 2.5 0 0 0 6.5 21H20v-3"/><path d="M9 8h7M9 11.5h5"/></svg><span class="lbl">Knowledge base</span></button>
|
||||
<button data-pane="releases" class="nb" type="button" title="Releases"><svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h10M4 18h7"/><circle cx="18" cy="17" r="3"/></svg><span class="lbl">Releases</span></button>
|
||||
<button data-pane="pnl" class="nb" type="button" title="P&L"><svg viewBox="0 0 24 24"><path d="M4 19V5M4 19h16"/><path d="M8 15l3-4 3 2 5-6"/></svg><span class="lbl">P&L</span></button>
|
||||
<button data-pane="settings" class="nb" type="button" title="Settings"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg><span class="lbl">Settings</span></button>
|
||||
@@ -88,6 +91,11 @@
|
||||
<div id="ovChain" class="small">…</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Refill notices</h3><span class="sub" id="rfSub">low, out and idle ads: one message per owner</span></div>
|
||||
<div id="rfBox" class="small muted">…</div>
|
||||
<p style="margin:10px 0 0"><button class="btn small sec" id="rfRun" type="button">Send the next batch now</button></p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Quick actions</h3></div>
|
||||
<p style="display:flex;gap:10px;flex-wrap:wrap;margin:0">
|
||||
@@ -175,6 +183,11 @@
|
||||
</div>
|
||||
|
||||
<div class="pane" id="pane-campaigns" hidden>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Login-ad queue</h3><span class="sub" id="lqSub">paid reservations, first paid first served</span></div>
|
||||
<p class="small muted" style="margin:0 0 8px">Members pay in full when they reserve. The oldest reservation starts by itself within a minute of a slot freeing (a slot ends or is paused). Cancel before start refunds the whole amount as purchased credits.</p>
|
||||
<div class="tablewrap"><table class="adm-table" id="lqTable"></table></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>All campaigns</h3><span class="sub" id="campSub">newest first</span></div>
|
||||
<p style="margin:0 0 10px"><input id="campFilter" placeholder="Filter by owner, name, type or status" style="width:100%"></p>
|
||||
@@ -208,12 +221,51 @@
|
||||
<p class="small muted" style="margin:12px 0 6px">Adoptions (newest first)</p>
|
||||
<div class="tablewrap"><table class="adm-table" id="tankAdopt"></table></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Sponsor check: InstantAdPay and LinkSpin</h3><span class="sub" id="scSub">members on both sites whose sponsor differs</span></div>
|
||||
<p class="small muted">Deliberate changes (a tank adoption, a rescue, a release, the end of an adoption window, an admin edit) follow to the other site until the member is bound on that site's contract. Everything else keeps the first sponsor. To settle a difference, pick the side whose sponsor is right: it is applied on the other site, unless the member is already bound there.</p>
|
||||
<p><button class="btn small" id="scRun" type="button">Run the check</button></p>
|
||||
<div class="tablewrap"><table class="adm-table" id="scTable"></table></div>
|
||||
<details style="margin-top:10px"><summary class="small muted">Recent sponsor follow activity on both sites</summary><div class="tablewrap"><table class="adm-table" id="scLog"></table></div></details>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Members</h3><span class="sub" id="memSub">newest first</span></div>
|
||||
<p style="margin:0 0 10px"><input id="memFilter" placeholder="Filter by email, username, member # or sponsor" style="width:100%"></p>
|
||||
<p class="small muted">Sponsor = the token the account joined under (username, share code, or member #). Editing it re-points free referrals and future purchases. On-chain sponsorship is permanent once activated.</p>
|
||||
<div class="tablewrap"><table class="adm-table" id="memTable"></table></div>
|
||||
</div>
|
||||
<div class="card" id="spamCard">
|
||||
<div class="card-head"><h3>Link-farm list</h3><span class="sub" id="spamSub">daily scan at 06:30 Central</span></div>
|
||||
<p class="small muted">Free accounts (no package, no wallet) that carry a link plus a farm signal: a prohibited term in the profile, a sign-in that ended within 15 minutes of the sign-up, or no sponsor. Nothing is deleted on its own. Delete uses the normal member delete (on-chain members are refused) and never touches InstantAdPay; the "also on InstantAdPay" column is there so you can decide. Allow keeps an email off this list for good.</p>
|
||||
<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:0 0 10px"><button class="btn small" id="spamRun" type="button">Scan now</button><button class="btn small sec" id="spamDelete" type="button">Delete selected</button><span class="small muted" id="spamAllow"></span></p>
|
||||
<div class="tablewrap"><table class="adm-table" id="spamTable"></table></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pane" id="pane-content" hidden>
|
||||
<!-- Banner Spin feature switch (2026-10-20): the whole feature off = every placement shows a neutral blank image and clicks go to each fallback -->
|
||||
<div class="card" id="bsSwitchCard" style="display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:12px">
|
||||
<div style="flex:1;min-width:220px"><b>Banner Spin</b> <span class="st" id="bsSwitchState">...</span><div class="small muted" id="bsSwitchNote">Switching it off blanks every member's Banner Spin at once (a neutral blank image, clicks to each fallback). Members keep everything and it comes back as it was.</div></div>
|
||||
<button type="button" class="btn small" id="bsSwitchBtn" disabled>...</button>
|
||||
<button type="button" class="btn small sec" id="bsHealthBtn" title="Check every live banner's image and target now">Run banner checks</button>
|
||||
</div>
|
||||
<div class="ct-totals" id="ctTotals"></div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Everything members made</h3><span class="sub" id="ctSub">newest first</span></div>
|
||||
<div class="ct-tabs" id="ctTabs" role="tablist" aria-label="Content type"></div>
|
||||
<div class="ct-filters">
|
||||
<input id="ctQ" type="search" autocomplete="off" placeholder="Search owner, @username, member #, URL, domain or text">
|
||||
<label class="small">From <input type="date" id="ctFrom"></label>
|
||||
<label class="small">To <input type="date" id="ctTo"></label>
|
||||
<label class="ct-chk small"><input type="checkbox" id="ctFlagged"> Flagged only</label>
|
||||
<button type="button" class="btn small sec" id="ctClear">Clear</button>
|
||||
<button type="button" class="btn small sec" id="ctRefresh">Refresh</button>
|
||||
</div>
|
||||
<p class="small muted" id="ctNote" style="margin:8px 0 6px">Dates are Central time. Flags: open member reports on an ad, a destination that failed its health check, a host that is one of our burned link domains, failing postbacks, admin-paused zones and home-page demo links. LinkSpin has no destination deny list yet, so the busiest hosts below are the quickest way to spot a cluster: click one to filter by it. Opening a short link counts as a click on it; page previews are never counted.</p>
|
||||
<div class="ct-hosts" id="ctHosts"></div>
|
||||
<div class="tablewrap"><table class="adm-table ct-table" id="ctTable"></table></div>
|
||||
<div class="ct-pager" id="ctPager"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pane" id="pane-reports" hidden>
|
||||
@@ -252,7 +304,7 @@
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Where visitors come from</h3><span class="sub" id="trfSub"></span></div>
|
||||
<div class="chips" id="trfRange" style="margin:0 0 10px"><button type="button" class="chip-t" data-days="7">7 days</button><button type="button" class="chip-t on" data-days="30">30 days</button><button type="button" class="chip-t" data-days="90">90 days</button><button type="button" class="chip-t" data-days="365">Year</button></div>
|
||||
<p class="muted small" style="margin:0 0 10px">Page views are public-page loads by referring domain (crawlers skipped; our own pages and no referrer count as direct). Join-page views are invite-link opens. Signups, registered and $20+ buyers are accounts whose first-touch source was that domain; legacy arrivals show as legacy:brand:domain.</p>
|
||||
<p class="muted small" style="margin:0 0 10px">Page views are public-page loads by referring domain (crawlers skipped; our own pages and no referrer count as direct). Join-page views are invite-link opens. Signups, registered and $25+ buyers are accounts whose first-touch source was that domain; legacy arrivals show as legacy:brand:domain.</p>
|
||||
<p style="margin:0 0 6px;display:flex;gap:8px;align-items:center"><input class="tfilter small" data-for="trfSources" placeholder="Filter sources" style="max-width:260px"><span class="tfilter-count muted small"></span></p><div class="tablewrap"><table class="adm-table" id="trfSources"></table></div>
|
||||
</div>
|
||||
<div class="grid c2">
|
||||
@@ -328,6 +380,26 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pane" id="pane-kb" hidden>
|
||||
<div id="kbList">
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Knowledge base</h3><span class="sub" id="kbSub">what the chat assistant answers from</span></div>
|
||||
<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:10px 0">
|
||||
<input id="kbQ" class="small" placeholder="Search title, questions, answer, tags" style="flex:1;min-width:200px">
|
||||
<select id="kbSrc" class="small"><option value="">All sources</option><option value="canned">From the code</option><option value="faq">FAQ</option><option value="ticket">From tickets</option><option value="admin">Added here</option></select>
|
||||
<button type="button" class="btn small" id="kbNew">+ New entry</button>
|
||||
</p>
|
||||
<div class="tablewrap"><table class="adm-table" id="kbTable"></table></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Try a question</h3><span class="sub">which entry answers it, and what the AI is given</span></div>
|
||||
<p style="display:flex;gap:8px;flex-wrap:wrap;margin:0"><input id="kbTry" class="small" placeholder="Ask it the way a member would" style="flex:1;min-width:200px"><button type="button" class="btn small sec" id="kbTryGo">Test</button></p>
|
||||
<div id="kbTryOut" class="small"></div>
|
||||
</div>
|
||||
<p class="small muted">Instant answers (a pattern is set) reply on their own with no AI call. For every other question the closest entries go to the AI as its knowledge base, and when nothing fits it says it is not sure and points to support. Entries from the code follow chatbot.js and kb-seed.js until you edit them. LinkSpin tickets are answered on the InstantAdPay support desk: when a reply there is worth keeping for LinkSpin members, add it here with + New entry.</p>
|
||||
</div>
|
||||
<div id="kbEdit" class="card" hidden></div>
|
||||
</div>
|
||||
<div class="pane" id="pane-releases" hidden>
|
||||
<div class="grid c2">
|
||||
<div class="card">
|
||||
@@ -406,8 +478,26 @@
|
||||
<p class="small" id="burnerLine">…</p>
|
||||
<p><button class="btn small sec" type="button" id="burnerRun">Run now</button></p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Level 4 override</h3><span class="sub">3% of each purchase to the qualified 4th upline, paid weekly from the payer wallet</span></div>
|
||||
<p class="small" id="ovPayer">…</p>
|
||||
<div id="ovWeeks" class="small"></div>
|
||||
<p><select id="ovWeek"></select> <button class="btn small sec" type="button" id="ovShow">Show week</button> <button class="btn small" type="button" id="ovPay" hidden>Pay this week now</button></p>
|
||||
<div id="ovOut" class="small"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pane" id="pane-settings" hidden>
|
||||
<div class="card" id="kitCard">
|
||||
<div class="card-head"><h3>Refuel Kit</h3><span class="sub" id="kitSub">monthly members-only banners: unlocked by a counted refuel (needs refuelStreak on)</span></div>
|
||||
<p class="small muted">Five base images per month for this site's own program: 728x90, 300x250, 468x60, 160x600, 1200x630. Each member's @name and a QR to their own link are drawn on top: keep the right end clear on 728x90 and 468x60 (QR) with room for the name left of it, the bottom-right corner on 300x250 and 1200x630, and the bottom 170 px on 160x600. No income claims in any banner. Release on the 1st; a member unlocks the month's kit with their next counted refuel.</p>
|
||||
<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center"><input id="kitMonth" placeholder="YYYY-MM" style="max-width:110px"><input id="kitTheme" placeholder="Theme (e.g. Harvest)" style="max-width:240px">
|
||||
<button class="btn small" id="kitSave" type="button">Save kit</button><button class="btn small sec" id="kitPlaceholder" type="button">Use placeholder art (public/banners)</button></p>
|
||||
<div id="kitSizes"></div>
|
||||
<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:10px">Preview <select id="kitPrevSize"></select><input id="kitPrevName" placeholder="username" style="max-width:160px"><label class="small"><input type="checkbox" id="kitPrevGif" style="width:auto"> animated</label><button class="btn small sec" id="kitPreview" type="button">Preview</button></p>
|
||||
<div id="kitPrevBox"></div>
|
||||
<div id="kitList" class="small"></div>
|
||||
<div id="kitBox"></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-head"><h3>Follow-up emails</h3><span class="sub" id="dripSub">sent to every new free member, hours after sign-up</span></div>
|
||||
<p class="small muted">One card per email. Placeholders fill in per reader: click a chip to drop it where your cursor is.
|
||||
@@ -450,7 +540,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/admin.js?v=20261012a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/admin-kb.js?v=20261020kb"></script>
|
||||
<script src="/assets/admin.js?v=20261101t"></script><script src="/assets/admin-sponsorcheck.js?v=20261022sc"></script><script src="/assets/admin-refill.js?v=20261024rf"></script><script src="/assets/admin-kits.js?v=20261024kit"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+26
-10
@@ -1,29 +1,40 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Ads · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
.cl .hd,.cl .rw{grid-template-columns:minmax(0,1.4fr) minmax(0,1.4fr) 110px 80px 60px 110px 130px}
|
||||
/* layout by the space the screen really has (rail expanded or collapsed), not the viewport: the campaign table squeezed
|
||||
its first column to a word, then a letter, per line once the rail and the side cards took the width (tester, 2026-10-18) */
|
||||
.body{padding:16px 24px;display:grid;gap:16px;container:adsbody/inline-size}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}
|
||||
.side{display:grid;gap:16px;align-content:start}
|
||||
.cl{container:camptbl/inline-size}
|
||||
.cl .hd,.cl .rw{grid-template-columns:minmax(150px,1.4fr) minmax(110px,1fr) 104px 64px 56px 96px 128px}
|
||||
/* side cards drop under the table once beside it the table would fall under its seven-column width */
|
||||
@container adsbody (max-width:1180px){.two{grid-template-columns:minmax(0,1fr)}.side{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}}
|
||||
/* narrower than seven columns fit: each campaign becomes a two-column card */
|
||||
@container camptbl (max-width:820px){.cl .hd{display:none}.cl .rw{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.cl .rw > :first-child{grid-column:1/-1}.cl .rw > .r{text-align:left}.cl .rw > :nth-child(4)::before{content:"views "}.cl .rw > :nth-child(5)::before{content:"clicks "}.cl .rw > .r::before{color:var(--muted);font:700 10.5px var(--mono);letter-spacing:.08em;text-transform:uppercase}}
|
||||
.cl .rw > *{min-width:0;overflow-wrap:anywhere}
|
||||
.thumb{width:72px;height:36px;object-fit:contain;background:var(--inset);border:1px solid var(--chrome-line);border-radius:4px;display:block}
|
||||
.bar{margin-top:6px}
|
||||
.field{width:100%;box-sizing:border-box}
|
||||
#composer[hidden]{display:none}
|
||||
.where{display:grid;gap:9px}.where div{display:flex;gap:10px;align-items:flex-start}.where b{min-width:60px;color:var(--accent-hi);font:700 11px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding-top:2px}
|
||||
@media (max-width:900px){.two{grid-template-columns:1fr}.cl .hd{display:none}.cl .rw{grid-template-columns:1fr 1fr}.body{padding:12px 16px}}
|
||||
[data-st="queued"]{--st:#7c3aed} [data-st="cancelled"]{--st:#94a3b8} /* prepaid login-slot line (2026-10-23) */
|
||||
@media (max-width:900px){.body{padding:12px 16px}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div class="body">
|
||||
<div class="tiles" id="tiles"></div>
|
||||
<div class="panel" id="erPanel" hidden style="padding:0;margin-bottom:16px"><div class="ph"><h3>Engine Room</h3><span class="meta">LinkSpin and InstantAdPay at a glance</span></div><div style="padding:12px 16px 14px" id="erRoot" data-host="erPanel" aria-live="polite"></div></div>
|
||||
<div class="panel" id="composer" hidden>
|
||||
<h2 id="cmpTitle">New ad</h2>
|
||||
<div class="seg" id="typeChips"><button class="chip on" type="button" data-t="banner">Banner</button><button class="chip" type="button" data-t="text">Text ad</button><button class="chip" type="button" data-t="login">Login ad</button></div>
|
||||
@@ -54,14 +65,19 @@
|
||||
</div>
|
||||
<div class="two">
|
||||
<div class="tbl cl"><div class="hd"><span>Campaign</span><span>Creative</span><span>Budget</span><span class="r">Views</span><span class="r">Clicks</span><span>Status</span><span></span></div><div id="rows"></div><div class="ft" id="foot"></div></div>
|
||||
<div style="display:grid;gap:16px;align-content:start">
|
||||
<div class="side">
|
||||
<div class="panel" id="rfPanel" hidden style="padding:0" aria-live="polite"><div class="ph"><h3>Monthly Refuel</h3><span class="meta" id="rfMeta"></span></div><div style="padding:12px 16px 14px;font-size:13px" class="ink2" id="rfBody"></div></div>
|
||||
<div class="panel" id="rkPanel" hidden style="padding:0" aria-live="polite"><div class="ph"><h3>Refuel Kit</h3><span class="meta">members-only banners</span></div><div style="padding:12px 16px 14px;font-size:13px" class="ink2" id="rkBody"></div></div>
|
||||
<div class="panel"><h2>Earn credits</h2><div class="gauge" id="earnGauge"><i></i><i></i><i></i><i></i><i></i></div><div class="muted" id="earnLine" style="margin-top:8px">loading</div><div style="display:flex;gap:8px;flex-wrap:wrap;margin-top:12px"><button class="btn blue" type="button" id="earnNext">View an ad</button><button class="btn" type="button" id="earnClaim" hidden>Claim</button></div><div class="muted" id="earnNote" style="margin-top:8px"></div></div>
|
||||
<div class="panel"><h2>Where your ads run</h2><div class="where ink2"><div><b>Banner</b><span>the ad viewer here, every member zone on outside sites, and the partner network</span></div><div><b>Text</b><span>the ad viewer and the partner network</span></div><div><b>Login</b><span>full screen to every member right after they sign in, one sponsor a day</span></div></div><div class="muted" id="rateLine" style="margin-top:10px"></div></div>
|
||||
<div class="panel"><h2>Where your ads run</h2><div class="where ink2"><div><b>Banner</b><span>the ad viewer here, every member zone on outside sites, and the partner network</span></div><div><b>Text</b><span>the ad viewer and the partner network</span></div><div><b>Login</b><span id="loginWhere">full screen to every member right after they sign in, for a flat 30-day slot of purchased credits</span></div></div><div class="muted" id="rateLine" style="margin-top:10px"></div></div>
|
||||
<div class="panel" hidden><h2>Credit activity</h2><div id="creditLog" class="ink2" style="font-size:13px"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/ads-screen.js?v=20261008b"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/ads-screen.js?v=20261027nr"></script>
|
||||
<script src="/assets/fuel.js?v=20261025ff"></script>
|
||||
<script src="/assets/engine-room.js?v=20261101t"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// Admin > Knowledge base (2026-10-20, kb.js on the server): list, search, add, edit and delete the
|
||||
// entries the chat assistant answers from, and try a question against them. Same file as InstantAdPay's
|
||||
// admin-kb.js; LinkSpin tickets are answered on the InstantAdPay desk, so fromTicket is unused here.
|
||||
(function () {
|
||||
const $ = IAP.$;
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
async function api(path, body, method) {
|
||||
const opts = { method: method || (body === undefined ? 'GET' : 'POST'), headers: {} };
|
||||
if (body !== undefined) { opts.headers['Content-Type'] = 'application/json'; opts.body = JSON.stringify(body); }
|
||||
const r = await (await fetch(path, opts)).json();
|
||||
if (r.error) throw new Error(r.error === 'auth' ? 'Session expired. Sign in again.' : r.error);
|
||||
return r;
|
||||
}
|
||||
const ctDay = ts => ts ? new Date(Number(ts)).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', year: 'numeric' }) : '';
|
||||
const SRC = { canned: 'from the code', faq: 'FAQ', ticket: 'from a ticket', admin: 'added here' };
|
||||
let entries = [], filter = { q: '', src: '' }, wired = false;
|
||||
|
||||
function wire() {
|
||||
if (wired) return; wired = true;
|
||||
let t = null;
|
||||
$('kbQ').addEventListener('input', () => { clearTimeout(t); t = setTimeout(() => { filter.q = $('kbQ').value.trim(); load().catch(e => IAP.status(e.message, 'bad')); }, 300); });
|
||||
$('kbSrc').addEventListener('change', () => { filter.src = $('kbSrc').value; draw(); });
|
||||
$('kbNew').addEventListener('click', () => compose({}));
|
||||
$('kbTable').addEventListener('click', e => { const tr = e.target.closest('[data-kbid]'); if (tr) edit(tr.dataset.kbid).catch(err => IAP.status(err.message, 'bad')); });
|
||||
const go = async () => {
|
||||
const q = $('kbTry').value.trim(); if (!q) return $('kbTry').focus();
|
||||
const r = await api('/api/admin/kb/test', { question: q });
|
||||
$('kbTryOut').innerHTML = (r.fast ? '<p style="margin:6px 0"><b>Instant answer:</b> ' + esc(r.fast.title) + ' <span class="mono muted">' + esc(r.fast.id) + '</span> (no AI call)</p>' : '<p style="margin:6px 0">No instant answer, so this goes to the AI with:</p>')
|
||||
+ (r.ranked.length ? '<ol style="margin:4px 0 0 18px;padding:0">' + r.ranked.map(h => '<li' + (h.used ? '' : ' class="muted"') + '><a href="#" data-kbopen="' + esc(h.id) + '">' + esc(h.title) + '</a> <span class="mono">' + h.score + '</span>' + (h.used ? ' <b>used</b>' : '') + '</li>').join('') + '</ol>'
|
||||
: '<p class="muted" style="margin:4px 0">No entry matches, so the assistant is told to say it is not sure and point to support.</p>');
|
||||
};
|
||||
$('kbTryGo').addEventListener('click', () => go().catch(e => IAP.status(e.message, 'bad')));
|
||||
$('kbTry').addEventListener('keydown', e => { if (e.key === 'Enter') go().catch(err => IAP.status(err.message, 'bad')); });
|
||||
$('kbTryOut').addEventListener('click', e => { const a = e.target.closest('[data-kbopen]'); if (a) { e.preventDefault(); edit(a.dataset.kbopen).catch(err => IAP.status(err.message, 'bad')); } });
|
||||
}
|
||||
|
||||
async function load() {
|
||||
wire();
|
||||
$('kbEdit').hidden = true; $('kbList').hidden = false;
|
||||
const r = await api('/api/admin/kb' + (filter.q ? '?q=' + encodeURIComponent(filter.q) : ''));
|
||||
entries = r.entries || [];
|
||||
$('kbSub').textContent = (r.stamp ? r.stamp.count : entries.length) + ' entries' + (r.stamp && r.stamp.updated ? ' · last change ' + r.stamp.updated : '');
|
||||
draw();
|
||||
}
|
||||
function draw() {
|
||||
const rows = entries.filter(e => !filter.src || e.source === filter.src);
|
||||
$('kbTable').innerHTML = '<tr><th>Entry</th><th>Asked as</th><th>Source</th><th>Updated</th></tr>'
|
||||
+ (rows.length ? rows.map(e => '<tr data-kbid="' + esc(e.id) + '" style="cursor:pointer"><td><b>' + esc(e.title) + '</b>' + (e.score != null ? ' <span class="small muted mono">' + e.score + '</span>' : '')
|
||||
+ '<div class="small muted">' + esc(String(e.answer).slice(0, 140)) + (String(e.answer).length > 140 ? '…' : '') + '</div>'
|
||||
+ ((e.tags || []).length ? '<div class="small" style="margin-top:3px">' + e.tags.map(t => '<span class="house-tag" style="margin:0 4px 0 0">' + esc(t) + '</span>').join('') + '</div>' : '') + '</td>'
|
||||
+ '<td class="small">' + (e.questions || []).slice(0, 3).map(esc).join('<br>') + ((e.questions || []).length > 3 ? '<br><span class="muted">+' + (e.questions.length - 3) + ' more</span>' : '') + '</td>'
|
||||
+ '<td class="small">' + esc(SRC[e.source] || e.source) + (e.pattern ? '<div class="muted">instant</div>' : '') + (e.ticketRef ? '<div class="mono muted">' + esc(e.ticketRef) + '</div>' : '') + (e.edited && e.source !== 'admin' && e.source !== 'ticket' ? '<div class="muted">edited</div>' : '') + '</td>'
|
||||
+ '<td class="small muted" style="white-space:nowrap">' + esc(ctDay(e.updated)) + '</td></tr>').join('')
|
||||
: '<tr><td colspan="4" class="muted">No entries here.</td></tr>');
|
||||
}
|
||||
|
||||
async function edit(id) { const r = await api('/api/admin/kb/' + encodeURIComponent(id)); compose(r.entry); }
|
||||
// e: an existing entry (has id), or a prefill for a new one ({ title, questions, answer, tags, source, ticketRef })
|
||||
function compose(e) {
|
||||
wire();
|
||||
e = e || {};
|
||||
const isNew = !e.id;
|
||||
$('kbList').hidden = true; $('kbEdit').hidden = false;
|
||||
$('kbEdit').innerHTML = '<div class="card-head"><h3>' + (isNew ? 'New entry' : 'Edit entry') + '</h3><span class="sub mono">' + (isNew ? (e.ticketRef ? 'from ' + esc(e.ticketRef) : '') : esc(e.id) + ' · ' + esc(SRC[e.source] || e.source) + (e.ticketRef ? ' · ' + esc(e.ticketRef) : '') + ' · updated ' + esc(ctDay(e.updated))) + '</span></div>'
|
||||
+ (e.source === 'ticket' && isNew ? '<p class="small" style="margin:0 0 10px;color:var(--amber,#ffb238)">Taken from a support reply. Take out names, emails, member numbers and anything about this one account before saving: entries are shown to the assistant for every member who asks something similar.</p>' : '')
|
||||
+ (!isNew && (e.source === 'canned' || e.source === 'faq') && !e.edited ? '<p class="small muted" style="margin:0 0 10px">This entry comes from the code (chatbot.js or kb-seed.js) and follows it when the code changes. Saving it here makes it yours: later code changes to this entry are not applied.</p>' : '')
|
||||
+ '<div style="display:grid;gap:10px">'
|
||||
+ '<label class="small">Title<input id="kbTitle" maxlength="200" style="width:100%" value="' + esc(e.title || '') + '" placeholder="Can I use my regular Coinbase account?"></label>'
|
||||
+ '<label class="small">Question variants, one per line (how members actually ask it)<textarea id="kbQs" rows="4" style="width:100%">' + esc((e.questions || []).join('\n')) + '</textarea></label>'
|
||||
+ '<label class="small">Answer (plain words, no em dashes, never a promise of income; full https links)<textarea id="kbAns" rows="8" maxlength="4000" style="width:100%">' + esc(e.answer || '') + '</textarea></label>'
|
||||
+ '<label class="small">Tags, comma separated<input id="kbTags" style="width:100%" value="' + esc((e.tags || []).join(', ')) + '" placeholder="coinbase, exchange account, wallet"></label>'
|
||||
+ '<label class="small"><input type="checkbox" id="kbHandoff"' + (e.handoff ? ' checked' : '') + '> Offer "Send this to support" under this answer</label>'
|
||||
+ '<details' + (e.pattern ? ' open' : '') + '><summary class="small">Instant answer (advanced)</summary>'
|
||||
+ '<p class="small muted" style="margin:6px 0">A regular expression (case-insensitive). When a question matches it, this answer is sent as is, with no AI call. The lowest order number wins when several match; the code seeds use 10, 20, 30 and so on. Leave it empty to answer through the AI only.</p>'
|
||||
+ '<div style="display:grid;grid-template-columns:1fr 110px;gap:8px"><input id="kbPat" class="mono small" value="' + esc(e.pattern || '') + '" placeholder="(coinbase account|regular coinbase)"><input id="kbOrd" class="small" type="number" value="' + (e.order == null ? '' : esc(e.order)) + '" placeholder="order"></div></details>'
|
||||
+ '</div>'
|
||||
+ '<p style="display:flex;gap:10px;flex-wrap:wrap;margin:14px 0 0"><button type="button" class="btn small" id="kbSave">' + (isNew ? 'Add entry' : 'Save') + '</button><button type="button" class="btn small sec" id="kbCancel">Cancel</button>'
|
||||
+ (isNew ? '' : '<button type="button" class="btn small sec" id="kbDel" style="margin-left:auto">Delete</button>') + '</p>';
|
||||
$('kbCancel').addEventListener('click', () => { load().catch(err => IAP.status(err.message, 'bad')); });
|
||||
$('kbSave').addEventListener('click', async () => {
|
||||
const b = $('kbSave'); if (b.disabled) return; b.disabled = true;
|
||||
try {
|
||||
const body = { title: $('kbTitle').value, questions: $('kbQs').value.split('\n'), answer: $('kbAns').value, tags: $('kbTags').value.split(','),
|
||||
handoff: $('kbHandoff').checked, pattern: $('kbPat').value, order: $('kbOrd').value, source: e.source, ticketRef: e.ticketRef };
|
||||
if (isNew) await api('/api/admin/kb', body); else await api('/api/admin/kb/' + encodeURIComponent(e.id), body, 'PUT');
|
||||
IAP.status(isNew ? 'Entry added. The assistant uses it from the next question.' : 'Entry saved.', 'ok');
|
||||
await load();
|
||||
} catch (err) { IAP.status(err.message, 'bad'); } finally { b.disabled = false; }
|
||||
});
|
||||
if ($('kbDel')) $('kbDel').addEventListener('click', async () => {
|
||||
if (!(await IAP.confirmBox('Delete "' + (e.title || e.id) + '"? The assistant stops using it right away.', { ok: 'Delete', cancel: 'Keep it' }))) return;
|
||||
try { await api('/api/admin/kb/' + encodeURIComponent(e.id), undefined, 'DELETE'); IAP.status('Entry deleted.', 'ok'); await load(); } catch (err) { IAP.status(err.message, 'bad'); }
|
||||
});
|
||||
$('kbTitle').focus();
|
||||
}
|
||||
|
||||
// a support reply, tidied into a draft: the greeting and sign-off go, the member's words become the question
|
||||
function fromTicket(t, question, reply) {
|
||||
const q = String(question || '').replace(/^[\s\S]*?\bMe: /, '').split(/\nAssistant: /)[0].replace(/\s+/g, ' ').trim().slice(0, 300);
|
||||
const a = String(reply || '').replace(/^\s*(hi|hello|hey|dear|good (morning|afternoon|evening))\b[^\n]*\n+/i, '')
|
||||
.replace(/\n+\s*(thanks|thank you|cheers|best|regards|kind regards|talk soon|marty)\b[\s\S]{0,80}$/i, '').trim();
|
||||
const title = String(t.subject || '').replace(/^Chat:\s*/i, '').trim().slice(0, 200) || q.slice(0, 120);
|
||||
const tags = String(t.category || '').toLowerCase().split(/\s*&\s*|\s*,\s*/).filter(x => x && x !== 'other');
|
||||
return { title, questions: q ? [q] : [], answer: a, tags, source: 'ticket', ticketRef: t.ref };
|
||||
}
|
||||
|
||||
window.IAPKB = { load: () => load(), compose, fromTicket };
|
||||
})();
|
||||
@@ -0,0 +1,40 @@
|
||||
// Admin > Settings > Refuel Kit (2026-10-24). The SAME file ships in InstantAdPay and LinkSpin. Upload one month's base art
|
||||
// (five sizes, this site's own program), preview the personalization (@name + QR to the member's link), then release it.
|
||||
// Keep the QR corner and the name strip clear in the art (see the layout note on the card).
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id);
|
||||
if (!$('kitBox')) return;
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
const say = m => { $('kitSub').textContent = m; };
|
||||
const api = async (url, opt) => { const r = await fetch(url, Object.assign({ cache: 'no-store' }, opt || {})); const j = await r.json().catch(() => ({})); if (!r.ok || j.error) throw new Error(j.error || ('HTTP ' + r.status)); return j; };
|
||||
const post = (url, body) => api(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) });
|
||||
const nextMonth = () => { const d = new Date(); const ct = new Date(d.toLocaleString('en-US', { timeZone: 'America/Chicago' })); ct.setDate(1); ct.setMonth(ct.getMonth() + 1); return ct.getFullYear() + '-' + String(ct.getMonth() + 1).padStart(2, '0'); };
|
||||
let sizes = [];
|
||||
async function load() {
|
||||
try {
|
||||
const d = await api('/api/admin/kits'); sizes = d.sizes;
|
||||
if (!$('kitMonth').value) $('kitMonth').value = nextMonth();
|
||||
$('kitList').innerHTML = d.kits.length ? d.kits.map(k => '<div style="border:1px solid var(--line,#ccd);border-radius:8px;padding:10px;margin:8px 0">'
|
||||
+ '<b>' + esc(k.label) + '</b> ' + (k.theme ? '· ' + esc(k.theme) + ' ' : '') + '<span class="small muted">(' + esc(k.month) + ')</span> '
|
||||
+ (k.released ? '<span class="badge">released</span>' : '<span class="badge amber">draft</span>') + '<div class="small" style="margin:6px 0">'
|
||||
+ k.sizes.map(s => s.size + ': ' + (s.ready ? 'ready' : '<b>missing</b>')).join(' · ') + '</div>'
|
||||
+ '<div style="display:flex;gap:6px;flex-wrap:wrap"><button class="btn small sec" type="button" data-kedit="' + esc(k.month) + '" data-theme="' + esc(k.theme) + '">Edit</button>'
|
||||
+ '<button class="btn small' + (k.released ? ' sec' : '') + '" type="button" data-krel="' + esc(k.month) + '" data-on="' + (k.released ? '0' : '1') + '"' + (!k.complete && !k.released ? ' disabled title="upload all five sizes first"' : '') + '>' + (k.released ? 'Unrelease' : 'Release to members') + '</button></div></div>').join('') : '<p class="small muted">No kits yet.</p>';
|
||||
$('kitList').querySelectorAll('[data-kedit]').forEach(b => b.addEventListener('click', () => { $('kitMonth').value = b.dataset.kedit; $('kitTheme').value = b.dataset.theme; say('editing ' + b.dataset.kedit); }));
|
||||
$('kitList').querySelectorAll('[data-krel]').forEach(b => b.addEventListener('click', async () => { try { await post('/api/admin/kits', { month: b.dataset.krel, released: b.dataset.on === '1' }); load(); } catch (e) { say(e.message); } }));
|
||||
$('kitSizes').innerHTML = sizes.map(s => '<label class="small" style="display:block;margin:4px 0">' + s + ' <input type="file" accept="image/png,image/jpeg,image/gif" data-ksize="' + s + '"></label>').join('');
|
||||
$('kitSizes').querySelectorAll('[data-ksize]').forEach(inp => inp.addEventListener('change', async () => {
|
||||
const f = inp.files && inp.files[0]; if (!f) return; const m = $('kitMonth').value.trim();
|
||||
try { await api('/api/admin/kits/upload?month=' + encodeURIComponent(m) + '&size=' + inp.dataset.ksize, { method: 'POST', headers: { 'Content-Type': f.type }, body: f }); say(inp.dataset.ksize + ' uploaded for ' + m); load(); } catch (e) { say(e.message); }
|
||||
}));
|
||||
$('kitPrevSize').innerHTML = sizes.map(s => '<option>' + s + '</option>').join('');
|
||||
} catch (e) { say('Could not load: ' + e.message); }
|
||||
}
|
||||
$('kitSave').addEventListener('click', async () => { try { await post('/api/admin/kits', { month: $('kitMonth').value.trim(), theme: $('kitTheme').value }); say('saved'); load(); } catch (e) { say(e.message); } });
|
||||
$('kitPlaceholder').addEventListener('click', async () => { try { const r = await post('/api/admin/kits/placeholder', { month: $('kitMonth').value.trim() }); say('placeholder art: ' + r.sizes.join(', ')); load(); } catch (e) { say(e.message); } });
|
||||
$('kitPreview').addEventListener('click', () => {
|
||||
const q = 'month=' + encodeURIComponent($('kitMonth').value.trim()) + '&size=' + encodeURIComponent($('kitPrevSize').value) + '&username=' + encodeURIComponent($('kitPrevName').value || 'yourname') + ($('kitPrevGif').checked ? '&variant=gif' : '') + '&t=' + Date.now();
|
||||
$('kitPrevBox').innerHTML = '<img alt="preview" style="max-width:100%;border:1px solid #ccd" src="/api/admin/kits/preview?' + q + '">';
|
||||
});
|
||||
load();
|
||||
})();
|
||||
@@ -0,0 +1,29 @@
|
||||
// Admin > Overview > Refill notices (2026-10-24): who was told their ads ran low, ran out or sat idle, and what they did next.
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id);
|
||||
if (!$('rfBox')) return;
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
const ct = ts => new Date(Number(ts)).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT';
|
||||
const STATE = { low: 'running low', out: 'out of credits', idle: 'idle a week' };
|
||||
async function load() {
|
||||
try {
|
||||
const r = await (await fetch('/api/admin/refill', { cache: 'no-store' })).json();
|
||||
if (r.error) throw new Error(r.error);
|
||||
const t = r.totals || {};
|
||||
$('rfSub').textContent = (r.enabled ? 'on' : 'OFF (site setting refillNotices)') + ', low at ' + r.lowPct + '% delivered';
|
||||
const st = Object.entries(r.byState || {}).map(([k, v]) => esc(STATE[k] || k) + ': ' + v.sent + ' sent, ' + v.converted + ' acted').join(' · ');
|
||||
const kinds = Object.entries(r.byKind || {}).map(([k, v]) => esc(k) + ' ' + v).join(', ');
|
||||
$('rfBox').innerHTML = '<p class="small" style="margin:0 0 8px"><b>' + (t.sent || 0) + '</b> sent (' + (t.emailed || 0) + ' emailed), <b>' + (t.converted || 0) + '</b> acted on it (' + (t.ratePct || 0) + '%)'
|
||||
+ (t.purchasesUsd ? ', $' + t.purchasesUsd + ' in packages after a notice' : '') + (t.medianHours != null ? ', median ' + t.medianHours + ' h' : '') + '</p>'
|
||||
+ '<p class="small muted" style="margin:0 0 8px">' + st + (kinds ? '<br>' + kinds : '') + '</p>'
|
||||
+ ((r.recent || []).length ? '<div class="tbl-wrap"><table class="tbl small"><tr><th>When</th><th>Owner</th><th>State</th><th>Ads</th><th>Credits then</th><th>Next</th></tr>'
|
||||
+ r.recent.slice(0, 20).map(x => '<tr><td>' + esc(ct(x.at)) + '</td><td>' + esc(x.owner) + '</td><td>' + esc(STATE[x.state] || x.state) + (x.emailed ? '' : ' <span class="muted">(on-site only)</span>') + '</td><td>' + esc((x.names || []).join(', ')) + '</td><td>' + Number(x.credits || 0).toLocaleString() + '</td><td>' + (x.converted ? esc(x.converted.kind) + ' after ' + x.converted.hours + ' h' : '<span class="muted">nothing yet</span>') + '</td></tr>').join('') + '</table></div>' : '<p class="small muted">Nothing sent yet.</p>');
|
||||
} catch (e) { $('rfBox').textContent = 'Could not load: ' + e.message; }
|
||||
}
|
||||
$('rfRun') && $('rfRun').addEventListener('click', async () => {
|
||||
$('rfRun').disabled = true;
|
||||
try { const r = await (await fetch('/api/admin/refill/run', { method: 'POST', cache: 'no-store' })).json(); $('rfSub').textContent = 'pass done: ' + (r.sent || 0) + ' sent'; } catch (e) {}
|
||||
$('rfRun').disabled = false; load();
|
||||
});
|
||||
load();
|
||||
})();
|
||||
@@ -0,0 +1,64 @@
|
||||
// Admin > Members > Sponsor check (2026-10-22). The SAME file ships in InstantAdPay and LinkSpin.
|
||||
// Lists members on both sites whose sponsor differs (or is set on one side only), with when and how each side's sponsor
|
||||
// was set and whether each side is bound on its contract. "Use X's sponsor" applies X's sponsor on the OTHER site; the
|
||||
// server refuses when the member is already bound there. Nothing runs until the admin presses "Run the check".
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id);
|
||||
if (!$('scRun')) return;
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
const day = ts => ts ? new Date(Number(ts)).toLocaleString([], { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) : '';
|
||||
const say = (m, k) => { try { IAP.status(m, k); } catch (e) {} };
|
||||
const HOW = { adopt: 'adopted from the tank', rescue: 'rescued to the tank', release: 'released to the tank', expire: 'adoption window ended', admin: 'admin edit' };
|
||||
const NAME = { instantadpay: 'InstantAdPay', linkspin: 'LinkSpin' };
|
||||
function side(f) {
|
||||
if (!f) return '<span class="muted">no account</span>';
|
||||
const sp = f.sponsorEmail ? esc(f.sponsorName || f.sponsorEmail) + '<br><span class="small muted">' + esc(f.sponsorEmail) + '</span>' : f.deadLink ? '<span class="badge amber">dead link: ' + esc(f.sponsorRef) + '</span>' : '<span class="muted">none (in the tank)</span>';
|
||||
const how = [];
|
||||
if (f.prov) how.push('<b>' + esc(HOW[f.prov.by] || f.prov.by) + '</b> ' + esc(day(f.prov.at)) + (f.prov.origin ? ' on ' + esc(NAME[f.prov.origin] || f.prov.origin) : '') + (f.prov.prevEmail ? ', before: ' + esc(f.prov.prevEmail) : ''));
|
||||
else how.push('no deliberate change on record; account made ' + esc(day(f.created)) + (f.joinedVia ? ' via ' + esc(f.joinedVia) : '') + (f.joinedRef ? ' (' + esc(f.joinedRef) + ')' : ''));
|
||||
for (const a of (f.adoptions || []).slice(-3)) how.push('tank: ' + esc(a.status) + ' by ' + esc(a.adopter) + ' ' + esc(day(a.ts)));
|
||||
if (f.remoteTank && f.remoteTank.open) how.push('adopted on the other site by ' + esc(f.remoteTank.adopterEmail));
|
||||
if (f.pending) how.push('<span class="badge amber">follow waiting: ' + esc(f.pending.why || '') + '</span>');
|
||||
for (const l of (f.log || []).filter(x => x.conflict).slice(0, 2)) how.push('<span class="badge amber">' + esc(l.action) + '</span> ' + esc(l.reason || '') + ' ' + esc(day(l.ts)));
|
||||
const bound = f.bound ? '<span class="badge">bound on chain' + (f.memberId ? ': member #' + f.memberId : '') + (f.activation ? ', on-chain sponsor #' + f.activation.sponsorId + ', block ' + f.activation.block : '') + '</span>' : '<span class="muted small">not bound on chain' + (f.wallet ? ' (wallet linked)' : '') + '</span>';
|
||||
return sp + '<div class="small" style="margin-top:4px">' + how.join('<br>') + '</div><div style="margin-top:4px">' + bound + '</div>';
|
||||
}
|
||||
let last = null;
|
||||
async function run() {
|
||||
$('scRun').disabled = true; $('scSub').textContent = 'checking both sites...';
|
||||
try {
|
||||
const r = await (await fetch('/api/admin/sponsor-check', { cache: 'no-store' })).json();
|
||||
if (r.error) throw new Error(r.error === 'auth' ? 'Session expired. Sign in again.' : r.error);
|
||||
last = r;
|
||||
if (r.peerError) { $('scSub').textContent = 'could not read the other site: ' + r.peerError; $('scTable').innerHTML = ''; return; }
|
||||
const differ = r.rows.filter(x => x.kind === 'differ').length;
|
||||
$('scSub').textContent = r.shared + ' on both sites, ' + r.same + ' match, ' + differ + ' differ, ' + (r.rows.length - differ) + ' set on one side only (' + day(r.at) + ')';
|
||||
$('scTable').innerHTML = '<tr><th>Member</th><th>InstantAdPay sponsor</th><th>LinkSpin sponsor</th><th>Settle it</th></tr>' + (r.rows.length ? r.rows.map(x => {
|
||||
const iapBound = !!(x.iap && x.iap.bound), lsBound = !!(x.ls && x.ls.bound);
|
||||
return '<tr><td>' + esc(x.username ? '@' + x.username : '') + '<br><span class="small muted">' + esc(x.email) + '</span><br><span class="small muted">' + esc(x.kind === 'differ' ? 'different sponsors' : x.kind === 'iap-only' ? 'sponsor on InstantAdPay only' : 'sponsor on LinkSpin only') + '</span></td>'
|
||||
+ '<td>' + side(x.iap) + '</td><td>' + side(x.ls) + '</td><td class="act">'
|
||||
+ '<button class="btn small sec" data-scuse="instantadpay" data-email="' + esc(x.email) + '"' + (lsBound ? ' disabled title="bound on the LinkSpin contract: its sponsor there cannot change"' : '') + '>Use InstantAdPay\'s sponsor</button><br>'
|
||||
+ '<button class="btn small sec" style="margin-top:6px" data-scuse="linkspin" data-email="' + esc(x.email) + '"' + (iapBound ? ' disabled title="bound on the InstantAdPay contract: its sponsor there cannot change"' : '') + '>Use LinkSpin\'s sponsor</button></td></tr>';
|
||||
}).join('') : '<tr><td colspan="4" class="muted">Every shared member has the same sponsor on both sites.</td></tr>');
|
||||
const logs = [].concat((r.follow && r.follow.recent) || []).map(l => Object.assign({ where: r.here }, l)).concat(((r.peerFollow && r.peerFollow.recent) || []).map(l => Object.assign({ where: r.here === 'linkspin' ? 'instantadpay' : 'linkspin' }, l))).sort((a, b) => b.ts - a.ts).slice(0, 60);
|
||||
$('scLog').innerHTML = '<tr><th>When</th><th>Site</th><th>Member</th><th>What</th><th>From</th><th>To</th><th>Why</th></tr>' + (logs.length ? logs.map(l => '<tr><td class="when">' + esc(day(l.ts)) + '</td><td>' + esc(NAME[l.where] || l.where) + '</td><td class="small">' + esc(l.email || '') + '</td><td>' + (l.conflict ? '<span class="badge amber">' + esc(l.action) + '</span>' : esc(l.action)) + (l.by ? ' <span class="small muted">' + esc(HOW[l.by] || l.by) + '</span>' : '') + '</td><td class="small">' + esc(l.from || '-') + '</td><td class="small">' + esc(l.to || '(tank)') + '</td><td class="small muted">' + esc(l.reason || '') + '</td></tr>').join('') : '<tr><td colspan="7" class="muted">nothing yet</td></tr>');
|
||||
} catch (e) { $('scSub').textContent = e.message; say(e.message, 'bad'); }
|
||||
finally { $('scRun').disabled = false; }
|
||||
}
|
||||
$('scRun').addEventListener('click', run);
|
||||
document.addEventListener('click', async e => {
|
||||
const b = e.target.closest('[data-scuse]'); if (!b || b.disabled) return;
|
||||
const use = b.dataset.scuse, email = b.dataset.email; const row = last && last.rows.find(x => x.email === email); if (!row) return;
|
||||
const from = use === 'instantadpay' ? row.iap : row.ls; const target = use === 'instantadpay' ? 'LinkSpin' : 'InstantAdPay';
|
||||
const who = from && from.sponsorEmail ? (from.sponsorName || from.sponsorEmail) : 'no sponsor (back to the holding tank)';
|
||||
let ok = false;
|
||||
try { ok = await IAP.confirmBox('Set ' + email + "'s sponsor on " + target + ' to ' + who + '? The other site keeps what it has. This is refused if the member is already bound on the ' + target + ' contract.', { title: 'Use ' + NAME[use] + "'s sponsor", ok: 'Apply on ' + target, cancel: 'Cancel' }); } catch (err) { ok = false; }
|
||||
if (!ok) return;
|
||||
b.disabled = true;
|
||||
try {
|
||||
const r = await (await fetch('/api/admin/sponsor-check/resolve', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, use }) })).json();
|
||||
if (r.error) throw new Error(r.error === 'auth' ? 'Session expired. Sign in again.' : r.error);
|
||||
say('Done: ' + email + ' now has ' + who + ' on ' + target + '.', 'ok'); await run();
|
||||
} catch (err) { say(err.message, 'bad'); b.disabled = false; }
|
||||
});
|
||||
})();
|
||||
+62
-13
@@ -25,7 +25,7 @@
|
||||
.adm .rail .nb.on{background:rgba(31,111,235,.22);color:#fff}
|
||||
.adm .rail .nb.on::before{content:"";position:absolute;left:-10px;top:10px;bottom:10px;width:3px;border-radius:0 3px 3px 0;background:var(--sig)}
|
||||
.adm .rail .nb .lbl{display:none;white-space:nowrap}
|
||||
.adm .rail .nb .pill{position:absolute;top:4px;right:4px;margin:0;min-width:16px;height:16px;border-radius:8px;background:var(--sig);color:#fff;font:700 10px/16px var(--mono);padding:0 4px;text-align:center}
|
||||
.adm .rail .nb .pill{position:absolute;top:4px;right:4px;margin:0;min-width:16px;height:16px;border-radius:8px;background:var(--sig);color:var(--sig-ink);font:700 10px/16px var(--mono);padding:0 4px;text-align:center}
|
||||
.app.wide .rail .nb{width:auto;justify-content:flex-start;gap:12px;padding:0 10px}
|
||||
.app.wide .rail .nb .lbl{display:inline}
|
||||
.app.wide .rail .nb .pill{position:static;margin-left:auto}
|
||||
@@ -47,8 +47,8 @@
|
||||
.adm .pane>.grid:first-child{margin-top:0}
|
||||
.adm .card p{margin:0 0 10px} .adm .card p:last-child{margin-bottom:0}
|
||||
.adm .card h3+p,.adm .card-head+p{margin-top:6px}
|
||||
.adm .bo-content .btn:not(.sec):not(.ghost):not(.pri){background:linear-gradient(180deg,#3A83F0,var(--accent));color:#fff;border-color:var(--accent-hi);box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset}
|
||||
.adm .bo-content .btn:not(.sec):not(.ghost):not(.pri):hover{background:linear-gradient(180deg,#4A8FF3,#2A77ED)}
|
||||
.adm .bo-content .btn:not(.sec):not(.ghost):not(.pri){background:var(--btn-blue);color:var(--accent-ink);border-color:var(--accent-hi);box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset}
|
||||
.adm .bo-content .btn:not(.sec):not(.ghost):not(.pri):hover{filter:brightness(1.06)}
|
||||
.adm .btn.small.ghost{background:transparent;box-shadow:none;border-color:transparent;color:var(--accent-hi)}
|
||||
.adm .btn.small.ghost:hover{border-color:var(--line-strong)}
|
||||
.adm .btn.sec:hover{border-color:var(--accent);color:var(--accent-hi)}
|
||||
@@ -58,10 +58,10 @@
|
||||
.adm .adm-form label.small{display:block;margin-bottom:4px}
|
||||
.adm .small{font-size:12.5px}
|
||||
.adm .card .sub{color:var(--muted)}
|
||||
.adm .badge.amber{background:var(--warn-soft);color:var(--warn);border-color:rgba(194,65,12,.35)}
|
||||
.adm .badge.amber{background:var(--warn-soft);color:var(--warn);border-color:var(--warn-line)}
|
||||
.adm code{font-family:var(--mono);font-size:11.5px;background:var(--panel-2);border:1px solid var(--line);border-radius:4px;padding:1px 5px;color:var(--ink)}
|
||||
.adm pre.small{background:var(--panel-2)!important;color:var(--ink);font-family:var(--mono);font-size:12px}
|
||||
.adm #memHits{background:#fff}
|
||||
.adm #memHits{background:var(--panel)}
|
||||
.adm #memHits button:hover{background:var(--accent-soft)}
|
||||
.adm .statx .nv{font-size:26px}
|
||||
.adm .chip.flat{margin-top:6px}
|
||||
@@ -78,29 +78,29 @@
|
||||
.adm-table td.act,.adm-table th:last-child{width:1%;white-space:nowrap}
|
||||
.adm-table td:first-child{overflow-wrap:anywhere}
|
||||
.adm-table th,.adm-table td{padding:8px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line);font-size:13px;color:var(--ink)}
|
||||
.adm-table tr:hover td{background:rgba(31,111,235,.04)}
|
||||
.adm-table tr:hover td{background:var(--row-hover)}
|
||||
.adm-table td.when{white-space:nowrap}
|
||||
.adm-table th{color:var(--muted);font-family:var(--mono);font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;background:var(--panel-2)}
|
||||
.adm-table .act{white-space:nowrap}
|
||||
.adm-table .act button,.adm-table .act .btn{margin-right:6px}
|
||||
.adm-table a{color:var(--accent-hi)}
|
||||
.tablewrap{border:1px solid var(--line);border-radius:8px;background:#fff;overflow-x:auto}
|
||||
.tablewrap{border:1px solid var(--line);border-radius:8px;background:var(--panel);overflow-x:auto}
|
||||
.tablewrap:empty,.tablewrap:has(> table:empty){display:none}
|
||||
|
||||
/* status pills */
|
||||
.st{display:inline-block;border-radius:4px;padding:1px 7px;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;border:1px solid var(--line-strong);color:var(--ink-2);background:var(--panel-2)}
|
||||
.st.active,.st.running,.st.released,.st.done{background:var(--ok-soft);color:var(--ok);border-color:rgba(14,138,92,.4)}
|
||||
.st.paused,.st.pending,.st.queued,.st.draft{background:var(--warn-soft);color:var(--warn);border-color:rgba(194,65,12,.4)}
|
||||
.st.active,.st.running,.st.released,.st.done{background:var(--ok-soft);color:var(--ok);border-color:var(--ok-line)}
|
||||
.st.paused,.st.pending,.st.queued,.st.draft{background:var(--warn-soft);color:var(--warn);border-color:var(--warn-line)}
|
||||
.st.out,.st.ended,.st.finished{background:var(--panel-2);color:var(--muted);border-color:var(--line-strong)}
|
||||
.st.rejected,.st.burned,.st.failed{background:var(--bad-soft);color:var(--bad);border-color:rgba(185,28,28,.4)}
|
||||
.house-tag{display:inline-block;white-space:nowrap;overflow-wrap:normal;word-break:normal;border:1px solid rgba(109,74,255,.45);color:#6D4AFF;background:#EEE9FF;border-radius:4px;padding:0 6px;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;margin-left:6px;vertical-align:middle}
|
||||
.st.rejected,.st.burned,.st.failed{background:var(--bad-soft);color:var(--bad);border-color:var(--bad-line)}
|
||||
.house-tag{display:inline-block;white-space:nowrap;overflow-wrap:normal;word-break:normal;border:1px solid var(--violet-line);color:var(--violet);background:var(--violet-soft);border-radius:4px;padding:0 6px;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;margin-left:6px;vertical-align:middle}
|
||||
|
||||
/* forms */
|
||||
.adm-form p{margin:0 0 10px}
|
||||
.trunc{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;vertical-align:bottom}
|
||||
textarea.json{font-family:var(--mono);font-size:12px;width:100%;min-height:260px}
|
||||
.ph-chips{display:inline-flex;gap:6px;flex-wrap:wrap;margin-left:6px;vertical-align:middle}
|
||||
.ph-chips .chip-t{padding:2px 10px;font-size:11px;font-family:var(--mono);text-transform:none;letter-spacing:0;cursor:pointer;background:#fff}
|
||||
.ph-chips .chip-t{padding:2px 10px;font-size:11px;font-family:var(--mono);text-transform:none;letter-spacing:0;cursor:pointer;background:var(--panel)}
|
||||
.drip-steps{display:grid;gap:12px}
|
||||
.drip-step{border:1px solid var(--line);border-radius:8px;padding:14px 16px;background:var(--panel-2)}
|
||||
.drip-step .ds-head{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:8px}
|
||||
@@ -112,7 +112,7 @@ textarea.json{font-family:var(--mono);font-size:12px;width:100%;min-height:260px
|
||||
.drip-step .ds-tools .btn{padding:4px 10px;font-size:11px}
|
||||
.drip-step input.ds-subject{width:100%;margin-bottom:8px;font-weight:700}
|
||||
.drip-step textarea.ds-body{width:100%;min-height:200px;font-size:13px;line-height:1.5}
|
||||
.drip-step input,.drip-step textarea{background:#fff}
|
||||
.drip-step input,.drip-step textarea{background:var(--field-bg)}
|
||||
.rates-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px 22px}
|
||||
.rates-form .rf{display:flex;flex-direction:column;gap:4px}
|
||||
.rates-form .rf label{font-size:12.5px;font-weight:700;color:var(--ink)}
|
||||
@@ -130,6 +130,42 @@ textarea.json{font-family:var(--mono);font-size:12px;width:100%;min-height:260px
|
||||
.kv-row input[type=checkbox]{width:auto;justify-self:start}
|
||||
.ed-bar button{font-size:12px}
|
||||
|
||||
/* member content (2026-10-18): type tiles, tabs, filters, busiest hosts, one row per item */
|
||||
.ct-totals{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px;margin:0 0 16px}
|
||||
.ct-tile{text-align:left;cursor:pointer;font:inherit;color:inherit;display:block;width:100%}
|
||||
.ct-tile .nv{font-size:22px;font-weight:700;font-family:var(--display);color:var(--ink)}
|
||||
.ct-tile .lb{font-size:12px;font-weight:700;color:var(--ink-2);margin:2px 0}
|
||||
.ct-tile:hover{border-color:var(--accent)}
|
||||
.ct-tile.on{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}
|
||||
.ct-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 10px}
|
||||
.ct-filters{display:flex;gap:8px 10px;flex-wrap:wrap;align-items:center}
|
||||
.ct-filters #ctQ{flex:1 1 260px;min-width:0}
|
||||
.ct-filters label.small{display:flex;align-items:center;gap:6px;font-weight:600;color:var(--ink-2)}
|
||||
.ct-filters input[type=date]{width:auto}
|
||||
.ct-filters .ct-chk input{width:auto;margin:0}
|
||||
.ct-hosts{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:0 0 10px}
|
||||
.ct-hosts .chip-t{font-family:var(--mono);text-transform:none;letter-spacing:0;font-size:11px}
|
||||
.ct-hosts .chip-t.bad{border-color:var(--bad-line);color:var(--bad);background:var(--bad-soft)}
|
||||
.ct-table .ct-type{font:700 10.5px var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--accent-hi);white-space:nowrap}
|
||||
.ct-table .ct-title{font-weight:700;margin:0 0 3px;overflow-wrap:anywhere}
|
||||
.ct-table td{overflow-wrap:anywhere}
|
||||
.ct-table .ct-l{font-size:12.5px;color:var(--ink-2);margin:2px 0;line-height:1.45}
|
||||
.ct-table .ct-flags{margin:2px 0 4px;display:flex;gap:4px;flex-wrap:wrap}
|
||||
.ct-table .ct-flags .st{text-transform:none;letter-spacing:0;font-family:var(--body);font-size:11px}
|
||||
.ct-table tr.ct-flagged td{background:color-mix(in srgb,var(--bad) 5%,transparent)}
|
||||
.ct-table .ct-nums div{white-space:nowrap}
|
||||
.ct-table td[data-l="Status"] .st{white-space:nowrap}
|
||||
.ct-table .ct-mem{font-weight:700}
|
||||
.ct-table td[data-l="Owner"]{min-width:180px;overflow-wrap:break-word}
|
||||
.ct-table .ct-dest{display:inline-block;margin:0 8px 2px 0;font-size:12px}
|
||||
.ct-table .ct-dest.off a{text-decoration:line-through;opacity:.7}
|
||||
.ct-table .bad{color:var(--bad)}
|
||||
.ct-thumb{display:inline-block;vertical-align:middle;border:1px solid var(--line);border-radius:4px;overflow:hidden;background:var(--panel-2);line-height:0}
|
||||
.ct-thumb img{max-height:40px;max-width:90px;display:block}
|
||||
.ct-thumb.big img{max-height:64px;max-width:240px}
|
||||
.ct-pager{display:flex;gap:12px;align-items:center;justify-content:center;margin:12px 0 0}
|
||||
.ct-pager:empty{display:none}
|
||||
|
||||
/* phone: the rail is a scrolling bottom bar with icon + label (twelve admin panes do not fit side by side) */
|
||||
@media (max-width:760px){
|
||||
.adm .rail{justify-content:flex-start;overflow-x:auto;overflow-y:hidden;gap:2px;scrollbar-width:none}
|
||||
@@ -149,4 +185,17 @@ textarea.json{font-family:var(--mono);font-size:12px;width:100%;min-height:260px
|
||||
.kv-row{grid-template-columns:1fr} .kv-row .btn{justify-self:start}
|
||||
.adm .pane [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important}
|
||||
.trunc{max-width:160px}
|
||||
.ct-totals{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
|
||||
.ct-tile.statx{padding:8px 10px} .ct-tile .nv{font-size:17px} .ct-tile .lb{font-size:10.5px}
|
||||
.ct-table,.ct-table tbody,.ct-table tr,.ct-table td{display:block;width:100%}
|
||||
.ct-table tr:first-child{display:none}
|
||||
.ct-table tr{border-bottom:1px solid var(--line);padding:8px 0}
|
||||
.ct-table td{border:0;padding:3px 12px}
|
||||
.ct-table td[data-l]::before{content:attr(data-l);display:block;font:700 9.5px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
|
||||
.ct-table td[data-l="Type"]::before{display:none}
|
||||
.ct-table td.act{width:auto}
|
||||
.ct-table .ct-nums{display:flex;flex-wrap:wrap;gap:2px 12px}
|
||||
.ct-table .ct-nums::before{flex-basis:100%}
|
||||
.ct-filters label.small{flex:1 1 140px}
|
||||
.ct-filters input[type=date]{flex:1;min-width:0}
|
||||
}
|
||||
|
||||
+253
-9
@@ -44,8 +44,8 @@
|
||||
});
|
||||
|
||||
// ── panes ──
|
||||
const TITLES = { overview: 'Overview', house: 'House ads', campaigns: 'All campaigns', members: 'Members', reports: 'Reports', zones: 'Zones', domains: 'Link domains', traffic: 'Traffic', blog: 'Blog', releases: 'Releases and roadmap', pnl: 'Profit and loss', settings: 'Settings' };
|
||||
const loaders = { overview: loadOverview, house: loadHouse, campaigns: loadCampaigns, members: loadMembers, reports: loadReports, zones: loadZones, domains: loadDomains, traffic: loadTraffic, blog: loadBlog, releases: loadReleases, pnl: loadPnl, settings: loadSettings };
|
||||
const TITLES = { overview: 'Overview', house: 'House ads', campaigns: 'All campaigns', members: 'Members', content: 'Member content', reports: 'Reports', zones: 'Zones', domains: 'Link domains', traffic: 'Traffic', blog: 'Blog', kb: 'Knowledge base', releases: 'Releases and roadmap', pnl: 'Profit and loss', settings: 'Settings' };
|
||||
const loaders = { overview: loadOverview, house: loadHouse, campaigns: loadCampaigns, members: loadMembers, content: loadContent, reports: loadReports, zones: loadZones, domains: loadDomains, traffic: loadTraffic, blog: loadBlog, kb: () => window.IAPKB.load(), releases: loadReleases, pnl: loadPnl, settings: loadSettings };
|
||||
function setPane(name) {
|
||||
if (!TITLES[name]) name = 'overview';
|
||||
document.querySelectorAll('.pane').forEach(p => { p.hidden = p.id !== 'pane-' + name; });
|
||||
@@ -261,7 +261,24 @@
|
||||
|
||||
// ── all campaigns ──
|
||||
let allCamps = [];
|
||||
// prepaid login-slot queue (2026-10-23): the line, with admin cancel + full refund
|
||||
async function loadLoginQueue() {
|
||||
try {
|
||||
const r = await api('/api/admin/login-queue'); const q = r.queue || [], L = r.slots || {};
|
||||
$('lqSub').textContent = (L.used || 0) + ' of ' + (L.max || 0) + ' slots live · ' + q.length + ' in line';
|
||||
$('lqTable').innerHTML = q.length ? '<tr><th>Place</th><th>ID</th><th>Owner</th><th>Ad</th><th>Paid</th><th>Reserved</th><th>Est. start (CT)</th><th></th></tr>' + q.map(x => '<tr><td>#' + x.place + '</td><td>#' + x.id + '</td><td><span class="trunc" title="' + esc(x.owner) + '">' + esc(x.owner) + '</span></td><td>' + esc(x.name) + '<div><a class="small trunc" href="' + esc(x.targetUrl) + '" target="_blank" rel="noopener">' + esc(x.targetUrl) + '</a></div></td><td class="mono small">' + (x.budget || 0).toLocaleString() + '</td><td class="small muted">' + when(x.queuedAt) + '</td><td class="small">' + esc(x.estStartCt || 'no estimate') + '</td><td class="act"><button class="btn small sec" type="button" data-lqcancel="' + x.id + '" data-owner="' + esc(x.owner) + '" data-paid="' + (x.budget || 0) + '">Cancel + refund</button></td></tr>').join('') : '<tr><td class="muted">Nobody is waiting for a login-ad slot.</td></tr>';
|
||||
} catch (e) { $('lqSub').textContent = e.message; }
|
||||
}
|
||||
$('lqTable').addEventListener('click', async e => {
|
||||
const b = e.target.closest('[data-lqcancel]'); if (!b) return;
|
||||
let ok = false; try { ok = await IAP.confirmBox('Cancel reservation #' + b.dataset.lqcancel + ' for ' + b.dataset.owner + '? Their ' + Number(b.dataset.paid).toLocaleString() + ' credits come back in full as purchased credits, and they leave the line.', { title: 'Cancel and refund', ok: 'Cancel and refund', cancel: 'Keep it' }); } catch (err) { ok = false; }
|
||||
if (!ok) return;
|
||||
b.disabled = true;
|
||||
try { const r = await api('/api/admin/campaigns/' + b.dataset.lqcancel + '/cancel-reservation', {}); IAP.status('Reservation #' + b.dataset.lqcancel + ' cancelled, ' + r.refunded + ' credits refunded.', 'ok'); await Promise.all([loadLoginQueue(), loadCampaigns()]); }
|
||||
catch (err) { IAP.status(err.message, 'bad'); b.disabled = false; }
|
||||
});
|
||||
async function loadCampaigns() {
|
||||
loadLoginQueue();
|
||||
const r = await api('/api/admin/campaigns');
|
||||
allCamps = r.campaigns || [];
|
||||
drawCamps();
|
||||
@@ -279,12 +296,18 @@
|
||||
async function loadTank() {
|
||||
try {
|
||||
const r = await (await fetch('/api/admin/tank')).json(); if (r.error) return;
|
||||
$('tankAdmSub').textContent = r.waiting.length + ' waiting · cap ' + r.cap + ' open per adopter · ' + r.ttlDays + '-day window';
|
||||
$('tankWait').innerHTML = '<tr><th>Waiting</th><th>Email</th><th>Joined</th><th>Last sign-in</th></tr>' + (r.waiting.length ? r.waiting.map(w => '<tr><td>' + esc(w.name) + '</td><td>' + esc(w.email) + '</td><td class="when">' + when(w.joined) + '</td><td class="when">' + (w.lastSeen ? when(w.lastSeen) : '<span class="muted">never</span>') + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">empty</td></tr>');
|
||||
const nReady = r.waiting.filter(w => w.ready).length;
|
||||
$('tankAdmSub').textContent = r.waiting.length + ' waiting' + (nReady ? ' (' + nReady + ' ready to activate)' : '') + ' · cap ' + r.cap + ' open per adopter · ' + r.ttlDays + '-day window · ready members: the free activation is held ' + (r.holdHours || 24) + ' h (a purchase never is), then auto-assigned in rotation';
|
||||
// ready = wallet linked: the plain activation is held (never the company) until someone adopts them or the 24-hour safety net assigns them (2026-10-27)
|
||||
const left = w => { const ms = (w.holdUntil || 0) - Date.now(); if (ms <= 0) return 'assigning now'; const m = Math.round(ms / 60000); return (m >= 60 ? Math.floor(m / 60) + ' h ' + (m % 60) + ' min' : m + ' min') + ' left'; };
|
||||
const rb = w => w.ready ? ' <span class="badge" style="background:var(--ok-soft);border-color:var(--ok);color:var(--ok)">Ready to activate · ' + left(w) + '</span>' : '';
|
||||
$('tankWait').innerHTML = '<tr><th>Waiting</th><th>Email</th><th>Joined</th><th>Last sign-in</th></tr>' + (r.waiting.length ? r.waiting.map(w => '<tr><td>' + esc(w.name) + rb(w) + '</td><td>' + esc(w.email) + '</td><td class="when">' + when(w.joined) + '</td><td class="when">' + (w.lastSeen ? when(w.lastSeen) : '<span class="muted">never</span>') + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">empty</td></tr>')
|
||||
+ ((r.aligned || []).length ? '<tr><th colspan="4">Aligned to their network sponsor (InstantAdPay) instead of the tank</th></tr>' + r.aligned.slice(0, 15).map(x => '<tr><td>' + esc(x.email) + '</td><td>' + esc(x.toName || x.to) + '</td><td class="when">' + when(x.at) + '</td><td class="muted">' + esc(x.via || '') + '</td></tr>').join('') : '');
|
||||
$('tankAdopt').innerHTML = '<tr><th>Member</th><th>Adopted by</th><th>When</th><th>Window ends</th><th>Status</th></tr>' + (r.adoptions.length ? r.adoptions.map(a => '<tr><td>' + esc(a.adopteeName) + '</td><td>' + esc(a.adopterName) + '</td><td class="when">' + when(a.ts) + '</td><td class="when">' + (a.status === 'released' ? '' : when(a.expires)) + '</td><td>' + esc(a.status) + '</td></tr>').join('') : '<tr><td colspan="5" class="muted">none yet</td></tr>');
|
||||
} catch (e) {}
|
||||
}
|
||||
async function loadMembers() {
|
||||
loadSpamScan().catch(() => {});
|
||||
loadTank();
|
||||
const r = await api('/api/admin/members');
|
||||
allMembers = r.members || [];
|
||||
@@ -303,6 +326,31 @@
|
||||
+ '<td class="act"><button class="btn small sec" data-mcopen="' + esc(a.email) + '">Open</button> <button class="btn small sec" data-spon="' + esc(a.email) + '" data-cur="' + esc(a.sponsorRef || '') + '">Sponsor</button></td></tr>').join('');
|
||||
}
|
||||
$('memFilter').addEventListener('input', drawMembers);
|
||||
// Link-farm list (2026-10-30): the daily scan's candidates; Delete selected = one DELETE /api/admin/member per email (on-chain refused); Allow = spamScanAllow
|
||||
async function loadSpamScan() {
|
||||
let v; try { v = await api('/api/admin/spamscan'); } catch (e) { return; }
|
||||
const last = v.last || {}; const rows = last.candidates || [];
|
||||
$('spamSub').textContent = last.at ? (rows.length + ' candidate' + (rows.length === 1 ? '' : 's') + ' \u00B7 scanned ' + when(last.at) + (last.manual ? ' (manual)' : '') + ' \u00B7 ' + (last.scanned || 0) + ' accounts, ' + (last.skipped || 0) + ' allowlisted') : 'no scan yet (daily at 06:30 Central)';
|
||||
$('spamAllow').textContent = 'Allowlist: ' + ((v.allow || []).join(', ') || 'empty');
|
||||
$('spamTable').innerHTML = '<tr><th></th><th>Account</th><th>Joined</th><th>Sponsor</th><th>First link</th><th>Why</th><th>Also on ' + esc(v.otherSite || 'the other site') + '</th><th></th></tr>'
|
||||
+ (rows.length ? rows.map(c => '<tr><td><input type="checkbox" data-spamsel="' + esc(c.email) + '"></td><td>' + (c.username ? '<b>@' + esc(c.username) + '</b><br>' : '') + '<span class="small">' + esc(c.email) + '</span>' + (c.quarantined ? ' <span class="badge amber">quarantined</span>' : '') + '</td>'
|
||||
+ '<td class="small muted when">' + when(c.created) + '</td><td class="small">' + esc(c.sponsorName || 'none') + '</td><td class="small mono" style="max-width:260px;overflow:hidden;text-overflow:ellipsis" title="' + esc((c.links || []).join(' ')) + '">' + esc(c.firstLink || '') + '</td>'
|
||||
+ '<td class="small">' + esc((c.reasons || []).join(', ')) + '</td><td class="small">' + (c.alsoOn === true ? 'yes' : c.alsoOn === false ? 'no' : 'unknown') + '</td>'
|
||||
+ '<td class="act"><button class="btn small sec" data-mcopen="' + esc(c.email) + '">Open</button> <button class="btn small sec" data-spamallow="' + esc(c.email) + '">Allow</button></td></tr>').join('') : '<tr><td colspan="8" class="muted small">Nothing to review.</td></tr>');
|
||||
}
|
||||
$('spamRun').addEventListener('click', busy($('spamRun'), async () => { await api('/api/admin/spamscan/run', {}); await loadSpamScan(); IAP.status('Scan done.', 'ok'); }));
|
||||
$('spamDelete').addEventListener('click', busy($('spamDelete'), async () => {
|
||||
const sel = [...document.querySelectorAll('[data-spamsel]:checked')].map(x => x.dataset.spamsel);
|
||||
if (!sel.length) { IAP.status('Tick the accounts to delete first.', 'bad'); return; }
|
||||
if (!await IAP.confirmBox('Delete ' + sel.length + ' account' + (sel.length === 1 ? '' : 's') + ' with their profile text? On-chain members are refused. InstantAdPay is not touched.', { title: 'Delete selected', ok: 'Delete', cancel: 'Cancel' })) return;
|
||||
let ok = 0, bad = 0; for (const e of sel) { try { await api('/api/admin/member?email=' + encodeURIComponent(e), undefined, 'DELETE'); ok++; } catch (err) { bad++; } }
|
||||
IAP.status(ok + ' deleted' + (bad ? ', ' + bad + ' refused' : '') + '.', bad ? 'bad' : 'ok');
|
||||
await api('/api/admin/spamscan/run', {}).catch(() => {}); await loadSpamScan(); loadMembers().catch(() => {});
|
||||
}));
|
||||
document.addEventListener('click', async e => {
|
||||
const b = e.target.closest('[data-spamallow]'); if (!b) return;
|
||||
try { await api('/api/admin/spamscan/allow', { email: b.dataset.spamallow }); IAP.status('Allowed ' + b.dataset.spamallow + '.', 'ok'); await api('/api/admin/spamscan/run', {}).catch(() => {}); loadSpamScan(); } catch (err) { IAP.status(err.message, 'bad'); }
|
||||
});
|
||||
document.addEventListener('click', async e => {
|
||||
const b = e.target.closest('[data-spon]'); if (!b) return;
|
||||
const v = await IAP.ask({ title: 'Sponsor for ' + b.dataset.spon, text: 'Username, share code, or member #. Leave blank to clear.', value: b.dataset.cur, ok: 'Save' });
|
||||
@@ -330,7 +378,7 @@
|
||||
mcCur = d; const a = d.account; $('memHits').hidden = true;
|
||||
$('memCard').hidden = false; document.querySelectorAll('#pane-members > .card').forEach(c => { if (c.id !== 'memCard' && c.id !== 'memSearchCard') c.hidden = true; });
|
||||
$('mcName').textContent = (a.username ? '@' + a.username : a.email) + (a.memberId ? ' · member #' + a.memberId : ' · free member');
|
||||
$('mcSub').textContent = 'joined ' + when(a.created) + ' · last seen ' + ago(a.lastSeen);
|
||||
$('mcSub').textContent = 'joined ' + when(a.created) + ' · last seen ' + ago(a.lastSeen) + (a.profileQuarantined ? ' · PROFILE QUARANTINED (link planted on a brand-new free account; not shown publicly)' : '');
|
||||
$('mcWall').hidden = !a.username; if (a.username) $('mcWall').href = '/wall/' + a.username;
|
||||
const ch = d.chain, cr = d.credits, t = d.totals;
|
||||
const level = ch && !ch.readError ? (ch.buyerCount >= 5 ? 'level 3 (5+ buyers)' : ch.buyerCount >= 2 ? 'level 2 (2 buyers)' : 'level 1') : '';
|
||||
@@ -503,6 +551,174 @@
|
||||
try { await api('/api/admin/zones/' + s.dataset.zntier + '/tier', { tier: s.value }, 'POST'); IAP.status('Tier saved: ' + s.value, 'ok'); loadZones(); } catch (e) { IAP.status(e.message, 'bad'); loadZones(); }
|
||||
}));
|
||||
}
|
||||
// ── member content (Marty, 2026-10-18): everything members made in one list, newest first. Read-only: the only
|
||||
// buttons are the moderation routes that already exist (campaign pause / resume, zone pause / resume) ──
|
||||
const CT = { type: 'all', page: 1, data: null, timer: 0 };
|
||||
const ctN = v => Number(v || 0).toLocaleString();
|
||||
const ctWhen = ts => ts ? new Date(Number(ts)).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT' : '';
|
||||
const ctSize = b => (b || 0) >= 1048576 ? (b / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round((b || 0) / 1024)) + ' KB';
|
||||
const ctSafe = u => /^(https?:\/\/|\/(?!\/))/i.test(String(u || '')) ? String(u) : ''; // member URLs: http(s) or our own paths, never javascript:
|
||||
const ctA = (u, text) => { const h = ctSafe(u); return h ? '<a href="' + esc(h) + '" target="_blank" rel="noopener noreferrer">' + esc(text == null ? h : text) + '</a>' : (u ? esc(text == null ? u : text) : ''); };
|
||||
const ctImg = (u, big) => { const h = ctSafe(u); return h ? '<a href="' + esc(h) + '" target="_blank" rel="noopener noreferrer" class="ct-thumb' + (big ? ' big' : '') + '"><img src="' + esc(h) + '" alt="" loading="lazy" referrerpolicy="no-referrer"></a>' : ''; };
|
||||
const ctHost = u => { try { return new URL(u, location.origin).hostname.replace(/^www\./, ''); } catch (e) { return ''; } };
|
||||
const ctCut = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
||||
const ctLabel = k => ((CT.data && CT.data.types) || []).reduce((m, t) => t.key === k ? t.label : m, k);
|
||||
const CT_ONE = { page: 'Page', link: 'Link', bannerspin: 'Banner Spin', source: 'Source', zone: 'Zone', ad: 'Ad', postback: 'Postback', upload: 'Upload', profile: 'Profile', message: 'Broadcast', audience: 'Audience', video: 'Video' };
|
||||
function ctDetail(r) {
|
||||
const d = r.detail || {}; const L = [];
|
||||
const line = h => { if (h) L.push('<div class="ct-l">' + h + '</div>'); };
|
||||
if (r.type === 'page') {
|
||||
line('<span class="chip-t">' + esc(d.kind) + '</span> ' + ctA(r.url, ctCut(r.url, 70)) + (r.open ? ' · <a href="' + esc(r.open) + '" target="_blank" rel="noopener">Preview</a>' : ''));
|
||||
if (d.headline) line('<b>' + esc(ctCut(d.headline, 140)) + '</b>');
|
||||
line('Button: ' + (d.ctaUrl ? ctA(d.ctaUrl, ctCut(d.ctaUrl, 80)) : (d.formProvider ? 'form (' + esc(d.formProvider) + ')' : '<span class="muted">not set</span>')) + (d.scanUrl && d.scanUrl !== d.ctaUrl ? ' · scanned ' + ctA(d.scanUrl, ctHost(d.scanUrl)) : ''));
|
||||
if (d.image) line(ctImg(d.image));
|
||||
} else if (r.type === 'link') {
|
||||
const ds = d.destinations || [];
|
||||
line(ctA(r.url, ctCut(r.url, 60)) + ' · <span class="mono">' + esc(d.code) + '</span> · ' + ds.length + ' destination' + (ds.length === 1 ? '' : 's') + (d.dayparted ? ' · dayparted' : '') + (d.expires ? ' · demo expires ' + ctWhen(d.expires) : ''));
|
||||
line(ds.slice(0, 6).map(x => '<span class="ct-dest' + (x.active ? '' : ' off') + '">' + ctA(x.url, ctHost(x.url) || x.url) + (x.weight > 1 ? ' ×' + x.weight : '') + (!x.active ? ' <span class="muted">' + (x.autoPaused ? 'auto-paused' : 'paused') + '</span>' : '') + (x.health && x.health !== 'ok' && x.health !== 'live' ? ' <span class="bad">' + esc(x.health) + '</span>' : '') + '</span>').join(' ') + (ds.length > 6 ? ' <span class="muted">+' + (ds.length - 6) + ' more</span>' : ''));
|
||||
if (d.fallback) line('Fallback: ' + ctA(d.fallback, ctCut(d.fallback, 70)));
|
||||
} else if (r.type === 'bannerspin') {
|
||||
const bs = d.banners || [];
|
||||
line('<span class="chip-t">' + esc(d.size) + '</span> <span class="mono">' + esc(d.code) + '</span> · ' + (d.mode === 'visitor' ? 'one per visitor' : 'random by weight') + ' · ' + bs.length + ' banner' + (bs.length === 1 ? '' : 's') + (d.dayparted ? ' · dayparted' : '') + ' · ' + ctA(d.image, 'image URL') + ' · ' + ctA(d.click, 'click URL'));
|
||||
line(bs.slice(0, 8).map(x => '<span class="ct-dest' + (x.active && !x.adminOff ? '' : ' off') + '">' + ctImg(x.image) + ' #' + x.id + ' ' + (x.link ? 'spin link #' + x.link : ctA(x.target, ctHost(x.target) || x.target)) + (x.weight > 1 ? ' ×' + x.weight : '') + (x.adminOff ? ' <span class="bad">offline</span>' : !x.active ? ' <span class="muted">paused</span>' : '') + '</span>').join(' ') + (bs.length > 8 ? ' <span class="muted">+' + (bs.length - 8) + ' more</span>' : ''));
|
||||
line('Fallback: ' + (d.fallback ? ctA(d.fallback, ctCut(d.fallback, 70)) : '<span class="muted">none</span>') + (d.fallbackImage ? ' ' + ctImg(d.fallbackImage) : ''));
|
||||
} else if (r.type === 'source') {
|
||||
line(esc(d.template === 'custom' ? 'Custom source' : 'Template ' + d.template) + (d.site ? ' · ' + ctA('https://' + d.site, d.site) : '') + (d.costModel ? ' · ' + esc(d.costModel) : '') + ' · ' + ctN(d.params) + ' params');
|
||||
line(d.postbackUrl ? 'Postback (' + esc(d.method) + ', ' + esc((d.events || []).join(', ')) + '): <span class="mono small">' + esc(ctCut(d.postbackUrl, 90)) + '</span>' : '<span class="muted">No postback</span>');
|
||||
} else if (r.type === 'zone') {
|
||||
line(ctA(r.url, d.site) + ' · ' + esc(d.size) + ' · ' + esc(d.tier) + ' · <span class="mono small">' + esc(r.id) + '</span>');
|
||||
line(esc(d.statusLabel) + (d.lastSeen ? ' · last view ' + ctWhen(d.lastSeen) : ' · <span class="muted">never seen</span>'));
|
||||
} else if (r.type === 'ad') {
|
||||
line('<span class="chip-t">' + esc(d.adType) + '</span> #' + esc(r.id) + ' · target ' + ctA(r.url, ctCut(r.url, 70)));
|
||||
if (d.imageUrl) line(ctImg(d.imageUrl, true) + (d.width ? ' <span class="muted small">' + d.width + '×' + d.height + '</span>' : ''));
|
||||
if (d.title || d.body) line((d.title ? '<b>' + esc(ctCut(d.title, 100)) + '</b> ' : '') + esc(ctCut(d.body, 200)));
|
||||
line('Budget ' + ctN(d.budget) + ' · spent ' + ctN(d.spent) + ' · left ' + ctN(Math.max(0, (d.budget || 0) - (d.spent || 0))) + (d.dailyCap ? ' · cap ' + ctN(d.dailyCap) + '/day' : '') + (d.geo ? ' · tiers ' + esc(d.geo) : '') + (d.starts ? ' · starts ' + ctWhen(d.starts) : '') + (d.expires ? ' · ends ' + ctWhen(d.expires) : ''));
|
||||
if (d.edits || (d.editLog && d.editLog.length)) line('Edited by the member ' + ctN(d.edits) + ' time' + (d.edits === 1 ? '' : 's') + (d.edits ? ' (first free)' : '') + (d.editLog || []).slice().reverse().map(e => '<div class="small muted">' + ctWhen(e.ts) + ' · ' + esc(e.by === 'admin' ? 'admin' : 'member') + (e.fee ? ' · ' + ctN(e.fee) + ' cr' : ' · free') + ' · ' + (e.fields || []).map(k => esc(k) + ': <s>' + esc(ctCut((e.from || {})[k], 50)) + '</s> → ' + esc(ctCut((e.to || {})[k], 50))).join('; ') + '</div>').join(''));
|
||||
} else if (r.type === 'postback') {
|
||||
line('<span class="mono small">' + esc(ctCut(d.postbackUrl, 110)) + '</span>');
|
||||
line(esc(d.method) + ' · ' + esc((d.events || []).join(', ')) + (d.lastStatus ? ' · last ' + esc(d.lastStatus) + ' ' + ctWhen(d.lastAt) : ''));
|
||||
} else if (r.type === 'upload') {
|
||||
line((d.image ? ctImg(r.url) + ' ' : '') + ctA(r.url, ctCut(d.file, 60)) + ' · ' + ctSize(d.size) + ' · ' + esc(d.store));
|
||||
if (d.usedBy && d.usedBy.length) line('Used by ' + d.usedBy.map(esc).join(', ') + (d.ownerGuess ? ' <span class="muted">(owner taken from that use)</span>' : ''));
|
||||
else if (d.store === 'Uploads') line('<span class="muted">Not used by any campaign or profile right now</span>');
|
||||
} else if (r.type === 'profile') {
|
||||
line((d.avatarUrl ? ctImg(d.avatarUrl) + ' ' : '') + (d.bio ? esc(ctCut(d.bio, 220)) : '<span class="muted">No bio</span>') + (r.url ? ' · ' + ctA(r.url, 'Wall') : ''));
|
||||
if (d.lineTargetUrl || d.lineBannerUrl) line('Line banner: ' + (d.lineBannerUrl ? ctImg(d.lineBannerUrl) + ' ' : '') + ctA(d.lineTargetUrl, ctCut(d.lineTargetUrl, 70)));
|
||||
if (d.wallOffers && d.wallOffers.length) line('Wall offers: ' + d.wallOffers.map(o => (o.bannerUrl ? ctImg(o.bannerUrl) + ' ' : '') + ctA(o.targetUrl, (o.title ? o.title + ' · ' : '') + ctHost(o.targetUrl))).join(' · '));
|
||||
const so = Object.entries(d.socials || {}); if (so.length) line(so.map(([k, v]) => ctA(v, k)).join(' · '));
|
||||
} else if (r.type === 'message') {
|
||||
line(esc(ctCut(d.body, 320)));
|
||||
} else if (r.type === 'audience') {
|
||||
line('<span class="mono small">' + esc(d.audienceId) + '</span> · pixel <code>' + esc(d.pixel) + '</code>');
|
||||
} else if (r.type === 'video') {
|
||||
line((r.url ? ctA(r.url, 'Watch the render') : '<span class="muted">No file yet</span>') + (d.username ? ' · end card for @' + esc(d.username) : '') + (d.error ? ' · <span class="bad">' + esc(ctCut(d.error, 140)) + '</span>' : ''));
|
||||
}
|
||||
return L.join('');
|
||||
}
|
||||
function ctNums(r) {
|
||||
const c = r.counts || {}; const d = r.detail || {}; const k = (n, l) => '<div><b>' + (n == null ? '-' : n) + '</b> <span class="muted">' + l + '</span></div>';
|
||||
if (r.type === 'page') return k(ctN(c.views), 'views') + k(ctN(c.uniques), 'uniques') + k(ctN(c.clicks), 'clicks out') + k(ctN(c.leads), 'leads');
|
||||
if (r.type === 'link') return k(ctN(c.clicks7), 'clicks 7d') + k(ctN(c.clicks), 'all time') + (c.conversions ? k(ctN(c.conversions), 'conversions') : '') + (c.bots ? k(ctN(c.bots), 'bots') : '');
|
||||
if (r.type === 'bannerspin') return k(ctN(c.imps), 'impressions') + k(ctN(c.clicks), 'clicks') + (c.conversions ? k(ctN(c.conversions), 'conversions') : '');
|
||||
if (r.type === 'zone') return k(ctN(c.views30), 'imps 30d') + k(c.viewablePct == null ? '-' : c.viewablePct + '%', 'viewable') + k(ctN(c.clicks30), 'clicks') + k(ctN(c.credits), 'credits paid');
|
||||
if (r.type === 'ad') return k(ctN(d.spent) + ' / ' + ctN(d.budget), 'spent') + k(ctN(c.imps) + (c.impsNas ? ' +' + ctN(c.impsNas) : ''), 'views') + k(ctN(c.clicks), 'clicks');
|
||||
if (r.type === 'source' || r.type === 'postback') return k(ctN(c.sent), 'sent') + k(ctN(c.fails), 'fails');
|
||||
if (r.type === 'audience') return k(ctN(c.size30), 'people 30d') + k(ctN(c.size7), '7d');
|
||||
if (r.type === 'message') return k(ctN(c.recipients), 'recipients');
|
||||
return '<span class="muted">-</span>';
|
||||
}
|
||||
function ctOwner(o) {
|
||||
if (!o || o.demo) return '<span class="muted">demo visitor</span>';
|
||||
if (!o.email) return '<span class="muted">unknown</span>';
|
||||
return (o.username ? '<b>@' + esc(o.username) + '</b><br>' : '') + '<span class="small">' + esc(o.email) + '</span><br><span class="muted small">' + (o.memberId ? 'member #' + o.memberId : 'free member') + '</span>'
|
||||
+ '<br><a href="#members" class="small ct-mem" data-ctmember="' + esc(o.email) + '">Open member</a>';
|
||||
}
|
||||
function drawContent() {
|
||||
const d = CT.data; if (!d) return;
|
||||
$('ctTotals').innerHTML = d.types.map(t => { const x = d.totals[t.key] || {}; return '<button type="button" class="statx ct-tile' + (CT.type === t.key ? ' on' : '') + '" data-cttype="' + t.key + '"><div class="nv">' + ctN(x.n) + '</div><div class="lb">' + esc(t.label) + '</div><div class="small muted">' + ctN(x.live) + ' live' + (x.flagged ? ' · <span class="bad">' + ctN(x.flagged) + ' flagged</span>' : '') + '</div></button>'; }).join('');
|
||||
$('ctTabs').innerHTML = '<button type="button" class="chip-t' + (CT.type === 'all' ? ' on' : '') + '" data-cttype="all" role="tab">All, newest first (' + ctN(d.all) + ')</button>'
|
||||
+ d.types.map(t => '<button type="button" class="chip-t' + (CT.type === t.key ? ' on' : '') + '" data-cttype="' + t.key + '" role="tab">' + esc(t.label) + ' (' + ctN((d.totals[t.key] || {}).n) + ')</button>').join('');
|
||||
$('ctSub').textContent = ctN(d.matched) + ' match' + (d.matched === 1 ? '' : 'es') + ' of ' + ctN(d.all) + ' · ' + ctN(d.flaggedAll) + ' flagged · as of ' + ctWhen(d.generated);
|
||||
$('ctBadge').hidden = !d.flaggedAll; $('ctBadge').textContent = d.flaggedAll || '';
|
||||
$('ctHosts').innerHTML = d.hosts.length ? '<span class="small muted">Busiest hosts in this view:</span> ' + d.hosts.map(h => '<button type="button" class="chip-t' + (h.burned ? ' bad' : '') + '" data-cthost="' + esc(h.host) + '">' + esc(h.host) + ' <b>' + h.n + '</b></button>').join('') : '';
|
||||
$('ctTable').innerHTML = '<tr><th>Type</th><th>Item</th><th>Owner</th><th>Created</th><th>Status</th><th>Numbers</th><th></th></tr>'
|
||||
+ (d.items.length ? d.items.map((r, i) => '<tr' + (r.flags.length ? ' class="ct-flagged"' : '') + '>'
|
||||
+ '<td data-l="Type"><span class="ct-type">' + esc(CT_ONE[r.type] || r.type) + '</span></td>'
|
||||
+ '<td data-l="Item"><div class="ct-title">' + esc(r.title || '(untitled)') + '</div>' + (r.flags.length ? '<div class="ct-flags">' + r.flags.map(f => '<span class="st rejected" title="' + esc(f.t) + '">' + esc(f.t) + '</span>').join(' ') + '</div>' : '') + ctDetail(r) + '</td>'
|
||||
+ '<td data-l="Owner">' + ctOwner(r.owner) + '</td>'
|
||||
+ '<td data-l="Created" class="small when">' + ctWhen(r.created) + '</td>'
|
||||
+ '<td data-l="Status"><span class="st ' + esc(r.live ? 'active' : (r.status === 'draft' || r.status === 'paused' ? r.status : 'out')) + '">' + esc(r.status) + '</span></td>'
|
||||
+ '<td data-l="Numbers" class="small ct-nums">' + ctNums(r) + '</td>'
|
||||
+ '<td class="act">' + (r.actions || []).map((a, j) => '<button type="button" class="btn small ' + (/^Pause|offline$/.test(a.label) ? 'sec' : '') + '" data-ctact="' + i + ':' + j + '">' + esc(a.label) + '</button>').join('') + (r.open && r.type !== 'page' ? ctA(r.open, 'Open') : '') + '</td></tr>').join('')
|
||||
: '<tr><td colspan="7" class="muted">Nothing matches.</td></tr>');
|
||||
$('ctPager').innerHTML = d.pages > 1 ? '<button type="button" class="btn small sec" data-ctpage="' + (d.page - 1) + '"' + (d.page <= 1 ? ' disabled' : '') + '>← Newer</button><span class="small muted">Page ' + d.page + ' of ' + d.pages + ' · ' + d.per + ' per page</span><button type="button" class="btn small sec" data-ctpage="' + (d.page + 1) + '"' + (d.page >= d.pages ? ' disabled' : '') + '>Older →</button>' : '';
|
||||
}
|
||||
async function loadContent(fresh) {
|
||||
const sp = new URLSearchParams({ type: CT.type, page: String(CT.page), per: '50' });
|
||||
const q = $('ctQ').value.trim(); if (q) sp.set('q', q);
|
||||
if ($('ctFrom').value) sp.set('from', $('ctFrom').value); if ($('ctTo').value) sp.set('to', $('ctTo').value);
|
||||
if ($('ctFlagged').checked) sp.set('flagged', '1'); if (fresh === true) sp.set('fresh', '1');
|
||||
CT.data = await api('/api/admin/content?' + sp.toString()); drawContent();
|
||||
loadBsSwitch().catch(e => { $('bsSwitchState').textContent = 'could not load'; });
|
||||
}
|
||||
// ── Banner Spin feature switch (2026-10-20): the button for POST /api/admin/bannerspins { off }, plus "run the checks now" ──
|
||||
async function loadBsSwitch() {
|
||||
const r = await api('/api/admin/bannerspins'); const off = !!(r.settings && r.settings.off); const t = r.totals || {};
|
||||
$('bsSwitchState').className = 'st ' + (off ? 'rejected' : 'active'); $('bsSwitchState').textContent = off ? 'switched off' : 'live';
|
||||
const b = $('bsSwitchBtn'); b.textContent = off ? 'Switch Banner Spin back on' : 'Switch Banner Spin off'; b.dataset.off = off ? '1' : '0'; b.className = 'btn small' + (off ? '' : ' sec'); b.disabled = false;
|
||||
$('bsSwitchNote').textContent = (off ? 'Off: every placement shows a neutral blank image and clicks go to each fallback. ' : 'Live. Switching it off blanks every member\'s Banner Spin at once (a neutral blank image, clicks to each fallback). ')
|
||||
+ ctN(t.spins) + ' Banner Spin' + (t.spins === 1 ? '' : 's') + ', ' + ctN(t.banners) + ' banners. Members keep everything; it comes back exactly as it was.';
|
||||
}
|
||||
$('bsSwitchBtn').addEventListener('click', busy($('bsSwitchBtn'), async () => {
|
||||
const turnOff = $('bsSwitchBtn').dataset.off !== '1';
|
||||
if (turnOff && !await IAP.confirmBox('Switch Banner Spin off for every member? Every placement shows a blank image until you switch it back on.', { title: 'Switch Banner Spin off', ok: 'Switch it off', cancel: 'Keep it on' })) return;
|
||||
await api('/api/admin/bannerspins', { off: turnOff }, 'POST'); IAP.status(turnOff ? 'Banner Spin is switched off.' : 'Banner Spin is live again.', 'ok'); await loadBsSwitch();
|
||||
}));
|
||||
$('bsHealthBtn').addEventListener('click', busy($('bsHealthBtn'), async () => {
|
||||
const r = await api('/api/admin/bannerspins/health', {}, 'POST'); IAP.status('Checked ' + ctN(r.checked) + ' banner' + (r.checked === 1 ? '' : 's') + '.', 'ok'); await loadContent(true);
|
||||
}));
|
||||
const ctReload = (fresh) => loadContent(fresh).catch(e => IAP.status(e.message, 'bad'));
|
||||
$('ctQ').addEventListener('input', () => { clearTimeout(CT.timer); CT.timer = setTimeout(() => { CT.page = 1; ctReload(); }, 250); });
|
||||
['ctFrom', 'ctTo', 'ctFlagged'].forEach(id => $(id).addEventListener('change', () => { CT.page = 1; ctReload(); }));
|
||||
$('ctClear').addEventListener('click', () => { $('ctQ').value = ''; $('ctFrom').value = ''; $('ctTo').value = ''; $('ctFlagged').checked = false; CT.type = 'all'; CT.page = 1; ctReload(); });
|
||||
$('ctRefresh').addEventListener('click', busy($('ctRefresh'), () => loadContent(true)));
|
||||
$('pane-content').addEventListener('click', async e => {
|
||||
const t = e.target.closest('[data-cttype]'); if (t) { CT.type = t.dataset.cttype; CT.page = 1; return ctReload(); }
|
||||
const h = e.target.closest('[data-cthost]'); if (h) { $('ctQ').value = h.dataset.cthost; CT.page = 1; return ctReload(); }
|
||||
const pg = e.target.closest('[data-ctpage]'); if (pg && !pg.disabled) { CT.page = Number(pg.dataset.ctpage) || 1; await ctReload(); $('ctTable').scrollIntoView({ block: 'start', behavior: 'smooth' }); return; }
|
||||
const m = e.target.closest('[data-ctmember]'); if (m) { e.preventDefault(); setPane('members'); return openMember(m.dataset.ctmember); }
|
||||
const b = e.target.closest('[data-ctact]'); if (!b || b.disabled) return;
|
||||
const [i, j] = b.dataset.ctact.split(':').map(Number); const r = CT.data && CT.data.items[i]; const a = r && r.actions[j]; if (!a) return;
|
||||
if (a.edit) return ctEditAd(r, a);
|
||||
if (a.warn && !await IAP.confirmBox(a.warn, { title: a.label, ok: a.label, cancel: 'Cancel' })) return;
|
||||
b.disabled = true;
|
||||
try { await api(a.path, a.body || {}, 'POST'); IAP.status(a.label + ': done.', 'ok'); await loadContent(true); } catch (err) { IAP.status(err.message, 'bad'); b.disabled = false; }
|
||||
});
|
||||
|
||||
// admin edit of any member ad (2026-10-18): the same checks as a member edit, free, and the member keeps their free one
|
||||
function ctEditAd(r, a) {
|
||||
const d = r.detail || {}; const t = d.adType;
|
||||
const F = [['name', 'Name', d.name || r.title, 60], ['targetUrl', 'Where the click goes', r.url, 0]];
|
||||
if (t === 'banner') F.push(['imageUrl', 'Image URL (' + d.width + 'x' + d.height + ')', d.imageUrl, 0]);
|
||||
if (t === 'text') F.push(['title', 'Headline (60)', d.title, 60], ['body', 'One line (140)', d.body, 140]);
|
||||
const back = document.createElement('div'); back.className = 'modal-back'; back.style.zIndex = '200';
|
||||
back.innerHTML = '<div class="modal-card" role="dialog" aria-modal="true" style="max-width:780px"><h3 style="margin:0 0 8px">Edit ad #' + esc(r.id) + ' (' + esc(t) + ')</h3><p class="muted small" style="margin:0 0 8px">Free from admin; the member keeps their free correction. Type, size, budget, countries, schedule and audience stay a new campaign.</p>'
|
||||
+ F.map(f => '<label class="small" style="display:block;margin-top:8px">' + esc(f[1]) + '<input data-k="' + f[0] + '" value="' + esc(f[2] || '') + '"' + (f[3] ? ' maxlength="' + f[3] + '"' : '') + ' style="width:100%" autocomplete="off"></label>').join('')
|
||||
+ (t === 'banner' ? '<div id="aePrev" style="margin-top:8px;max-width:100%;overflow:auto"></div>' : '')
|
||||
+ '<div style="display:flex;gap:10px;justify-content:flex-end;margin-top:16px"><button type="button" class="btn sec small" data-x="no">Cancel</button><button type="button" class="btn small" data-x="ok">Save</button></div></div>';
|
||||
document.body.appendChild(back);
|
||||
const im = back.querySelector('[data-k="imageUrl"]'); const paint = () => { const p = back.querySelector('#aePrev'); if (p) p.innerHTML = ctSafe(im.value.trim()) ? '<img src="' + esc(im.value.trim()) + '" alt="" style="width:' + d.width + 'px;height:' + d.height + 'px;display:block" referrerpolicy="no-referrer">' : ''; };
|
||||
if (im) { im.addEventListener('input', paint); paint(); }
|
||||
back.addEventListener('click', async e => {
|
||||
const x = e.target.closest('[data-x]'); if (e.target === back || (x && x.dataset.x === 'no')) return back.remove(); if (!x) return;
|
||||
const body = {}; F.forEach(f => { const v = back.querySelector('[data-k="' + f[0] + '"]').value.trim(); if (v !== String(f[2] || '').trim()) body[f[0]] = v; });
|
||||
if (!Object.keys(body).length) return IAP.status('Nothing changed.', 'bad');
|
||||
x.disabled = true;
|
||||
try { const res = await api(a.path, body, 'POST'); back.remove(); IAP.status('Ad #' + r.id + ' saved' + (res.network === 'retrying' ? ' (the network copy retries on the next pass)' : '') + '.', 'ok'); await loadContent(true); }
|
||||
catch (err) { IAP.status(err.message, 'bad'); x.disabled = false; }
|
||||
});
|
||||
}
|
||||
|
||||
// ── link domains: channel per domain, last safety check, burned flag; check now / clear / pull (2026-10-10) ──
|
||||
async function loadDomains() {
|
||||
const d = await api('/api/admin/domains');
|
||||
@@ -512,7 +728,7 @@
|
||||
const ago = t => t ? new Date(t).toLocaleString() : 'never';
|
||||
const mark = v => v === 'clean' ? '<span style="color:var(--ok,#2e9b5a)">clean</span>' : v === 'flagged' || v === 'listed' ? '<b style="color:var(--bad)">' + v + '</b>' : /^ok:/.test(v || '') ? '<span style="color:var(--ok,#2e9b5a)">answered ' + esc(v.slice(3)) + '</span>' : '<span class="muted">unknown</span>';
|
||||
$('dmTable').innerHTML = '<tr><th>Domain</th><th>Channel</th><th>Safe Browsing</th><th>URIBL</th><th>SURBL</th><th>Reach</th><th>Status</th><th>Last check</th><th></th></tr>'
|
||||
+ (list.length ? list.map(x => '<tr' + (x.burned ? ' style="background:rgba(192,57,43,.08)"' : '') + '><td><b>' + esc(x.host) + '</b></td>'
|
||||
+ (list.length ? list.map(x => '<tr' + (x.burned ? ' style="background:var(--bad-soft)"' : '') + '><td><b>' + esc(x.host) + '</b></td>'
|
||||
+ '<td><select data-dmch="' + esc(x.host) + '">' + (d.channels || []).map(c => '<option value="' + c + '"' + (c === x.channel ? ' selected' : '') + '>' + esc(d.labels[c] || c) + '</option>').join('') + '</select><br><span class="muted small">' + esc(d.notes[x.channel] || '') + '</span></td>'
|
||||
+ '<td>' + mark(x.gsb) + '</td><td>' + mark(x.uribl) + '</td><td>' + mark(x.surbl) + '</td><td>' + mark(x.reach) + '</td>'
|
||||
+ '<td>' + (x.burned ? '<b style="color:var(--bad)">BURNED</b><br><span class="muted small">' + esc(x.reason || '') + (x.burnedAt ? ' · ' + ago(x.burnedAt) : '') + '</span>' : x.channel === 'reserve' ? '<span class="muted">held in reserve</span>' : '<span style="color:var(--ok,#2e9b5a)">live</span>') + '</td>'
|
||||
@@ -559,7 +775,7 @@
|
||||
// conversion columns (Marty, 2026-09-13): visits = page views + join-page views; signup rate is per visit,
|
||||
// registered and buyer rates are per signup (what happened to the people who did sign up)
|
||||
const pct = (num, den) => den ? (100 * num / den).toFixed(num && 100 * num / den < 10 ? 1 : 0) + '%' : '<span class="muted">-</span>';
|
||||
$('trfSources').innerHTML = '<tr><th>Source</th><th>Page<br>views</th><th>Join-page<br>views</th><th>Signups</th><th>Visit →<br>signup</th><th>Registered</th><th>Signup →<br>registered</th><th>$20+<br>buyers</th><th>Signup →<br>buyer</th></tr>'
|
||||
$('trfSources').innerHTML = '<tr><th>Source</th><th>Page<br>views</th><th>Join-page<br>views</th><th>Signups</th><th>Visit →<br>signup</th><th>Registered</th><th>Signup →<br>registered</th><th>$25+<br>buyers</th><th>Signup →<br>buyer</th></tr>'
|
||||
+ (d.sources.length ? d.sources.map(s => '<tr><td>' + esc(s.source) + '</td><td>' + n(s.hits) + '</td><td>' + n(s.joinViews) + '</td><td>' + n(s.signups) + '</td><td>' + pct(s.signups, s.hits + s.joinViews) + '</td><td>' + n(s.registered) + '</td><td>' + pct(s.registered, s.signups) + '</td><td>' + n(s.buyers) + '</td><td>' + pct(s.buyers, s.signups) + '</td></tr>').join('') : '<tr><td colspan="9" class="muted">Nothing recorded in this range yet.</td></tr>');
|
||||
$('trfPaths').innerHTML = '<tr><th>Page</th><th>Views</th></tr>' + (d.paths.length ? d.paths.map(p => '<tr><td>' + esc(p.path) + '</td><td>' + n(p.hits) + '</td></tr>').join('') : '<tr><td colspan="2" class="muted">No page views yet.</td></tr>');
|
||||
$('trfAngles').innerHTML = '<tr><th>Angle</th><th>Join-page<br>views</th><th>Signups</th><th>View →<br>signup</th></tr>' + (d.angles.length ? d.angles.map(a => '<tr><td>' + esc(a.angle) + '</td><td>' + n(a.views) + '</td><td>' + n(a.signups) + '</td><td>' + pct(a.signups, a.views) + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">No angle data yet.</td></tr>');
|
||||
@@ -662,6 +878,7 @@
|
||||
}
|
||||
|
||||
async function loadPnl() {
|
||||
loadOverride().catch(() => {}); // its own request: does not wait for the chain reads below
|
||||
const r = await api('/api/admin/pnl?days=' + pnlDays);
|
||||
const px = r.polUsd || 0;
|
||||
const platUsd = (Number(BigInt(r.platformWei || '0') / 10n ** 14n) / 10000) * px;
|
||||
@@ -686,6 +903,29 @@
|
||||
}
|
||||
document.querySelectorAll('#pnlPeriods [data-days]').forEach(b => b.addEventListener('click', () => { pnlDays = Number(b.dataset.days); document.querySelectorAll('#pnlPeriods [data-days]').forEach(x => x.classList.toggle('on', x === b)); loadPnl().catch(e => IAP.status(e.message, 'bad')); }));
|
||||
if ($('pnlFixedSave')) $('pnlFixedSave').addEventListener('click', async () => { try { await api('/api/admin/site', { pnlFixedMonthlyUsd: Number($('pnlFixed').value) || 0 }, 'PATCH'); IAP.status('Saved.', 'ok'); loadPnl(); } catch (e) { IAP.status(e.message, 'bad'); } });
|
||||
// Level 4 override (2026-10-23): week status from /api/admin/override; the pay button exists only while the live payer is ready
|
||||
const OV_STATE = { 'not planned': 'not planned', planning: 'planning', planned: 'pending', paying: 'paying', held: 'held', paid: 'paid' };
|
||||
async function loadOverride(week) {
|
||||
if (!$('ovPayer')) return;
|
||||
let r; try { r = await (await fetch('/api/admin/override' + (week ? '?week=' + encodeURIComponent(week) : ''), { cache: 'no-store' })).json(); } catch (e) { $('ovPayer').textContent = 'Could not read the override: ' + e.message; return; }
|
||||
const pz = r.payer || {};
|
||||
$('ovPayer').textContent = 'Mode: ' + (pz.mode || '?') + (pz.ready ? ' · PAYING automatically each Monday after 9 AM CT' : ' · not paying (' + (pz.why || []).join('; ') + ')')
|
||||
+ (pz.address ? ' · payer wallet ' + pz.address + ' holds ' + (pz.balancePol || '?') + ' POL' : '') + ' · weekly cap ' + (pz.capPol || '?') + ' POL · minimum ' + (pz.dustPol || '?') + ' POL'
|
||||
+ (pz.goLive ? ' · purchases from ' + new Date(pz.goLive).toLocaleString('en-US', { timeZone: 'America/Chicago' }) + ' CT' : '') + (pz.lastError ? ' · last error: ' + pz.lastError.msg : '');
|
||||
$('ovPay').hidden = !pz.ready;
|
||||
const sel = $('ovWeek'); if (!sel.options.length) { const now = new Date(); for (let i = 0; i < 10; i++) { const d = new Date(now.getTime() - i * 7 * 86400000); const v = d.toISOString().slice(0, 10); sel.innerHTML += '<option value="' + v + '">week containing ' + v + '</option>'; } sel.selectedIndex = 1; }
|
||||
$('ovWeeks').innerHTML = (r.dueWeeks || []).length ? '<table><tr><th>Week of</th><th>Status</th><th>Total</th></tr>' + r.dueWeeks.map(w => '<tr><td>' + esc(w.week) + '</td><td>' + esc(OV_STATE[w.state] || w.state) + (w.heldWhy ? ' <span class="muted">(' + esc(w.heldWhy) + ')</span>' : '') + '</td><td class="mono">' + esc(w.totalPol || '0') + ' POL</td></tr>').join('') + '</table>' : '';
|
||||
const st = r.status || {}; const t = r.totals || {};
|
||||
$('ovOut').innerHTML = '<p>Week of ' + esc(r.week || '') + ': ' + (r.purchases || 0) + ' purchases, $' + Number(t.salesUsd || 0).toFixed(2) + ' sales. Override due: $' + Number(t.wouldPayUsd || 0).toFixed(2) + ' (' + Number(t.wouldPayPol || 0).toFixed(4) + ' POL) to ' + (r.recipients || []).length + ' members; company keeps $' + Number(t.companyKeepsUsd || 0).toFixed(2) + '. Payout status: <b>' + esc(OV_STATE[st.state] || st.state || '?') + '</b>' + (st.heldWhy ? ' (' + esc(st.heldWhy) + ')' : '') + '.</p>'
|
||||
+ ((st.rows || []).length ? '<table><tr><th>Member</th><th>POL</th><th>USD</th><th>Status</th><th></th></tr>' + st.rows.map(x => '<tr><td>#' + x.memberId + '</td><td class="mono">' + esc(x.pol) + '</td><td class="mono">$' + Number(x.usd || 0).toFixed(2) + '</td><td>' + esc(x.state) + (x.note ? ' <span class="muted">' + esc(x.note) + '</span>' : '') + '</td><td>' + (x.tx ? '<a target="_blank" rel="noopener" href="' + esc(x.tx) + '">tx</a>' : '') + '</td></tr>').join('') + '</table>'
|
||||
: (r.recipients || []).length ? '<table><tr><th>Member</th><th>POL</th><th>USD</th><th>Buys</th></tr>' + r.recipients.map(x => '<tr><td>#' + x.recipientId + '</td><td class="mono">' + Number(x.pol).toFixed(4) + '</td><td class="mono">$' + Number(x.usd).toFixed(2) + '</td><td>' + x.purchases + '</td></tr>').join('') + '</table>' : '');
|
||||
}
|
||||
if ($('ovShow')) $('ovShow').addEventListener('click', () => loadOverride($('ovWeek').value));
|
||||
if ($('ovPay')) $('ovPay').addEventListener('click', async () => {
|
||||
const wk = $('ovWeek').value;
|
||||
if (!await IAP.confirmBox('This sends real POL from the payer wallet for every closed week up to the week containing ' + wk + ' that is not paid yet. Each member is paid once; anything already paid is skipped.', { title: 'Pay the override now?', ok: 'Pay now' })) return;
|
||||
try { const r = await api('/api/admin/override/pay', { week: wk }); IAP.status('Override: ' + (r.results || []).map(x => x.week + ' ' + (x.state || x.held || (x.why || []).join(', '))).join(' · '), 'ok'); loadOverride(wk); } catch (e) { IAP.status(e.message, 'bad'); }
|
||||
});
|
||||
if ($('burnerRun')) $('burnerRun').addEventListener('click', async () => { try { const r = await api('/api/admin/burner/run', {}); IAP.status('Burner ran: ' + (r.burned || 0) + ' burned.', 'ok'); loadPnl(); } catch (e) { IAP.status(e.message, 'bad'); } });
|
||||
async function loadAudit() {
|
||||
if (!$('audTable')) return;
|
||||
@@ -792,9 +1032,13 @@
|
||||
bannerBatch: ['Banner: views per batch', 'impressions counted before a banner campaign is charged'],
|
||||
bannerCreditsPerBatch: ['Banner: credits per batch', 'charged to the advertiser per batch'],
|
||||
textBatch: ['Text ad: views per batch', ''], textCreditsPerBatch: ['Text ad: credits per batch', ''],
|
||||
loginCreditsPerDay: ['Login ad: credits per day', 'flat daily charge while active'],
|
||||
loginSlotCredits: ['Login ad: slot price (credits)', 'one flat buy, purchased credits only, unlimited sign-in impressions'],
|
||||
loginSlotDays: ['Login ad: slot length (days)', 'the slot ends and frees its place after this many days'],
|
||||
loginSlotsMax: ['Login ad: member slots at once', 'a new slot is refused while this many are live; house ads do not count'],
|
||||
loginCreditsPerDay: ['Login ad: legacy credits per day', 'only for old login ads with no end date (none since slots)'],
|
||||
loginDwellSeconds: ['Login ad: seconds shown', 'full-screen interstitial after sign-in'],
|
||||
burnBatchMin: ['On-chain burn batch (credits)', 'accrued spend is burned once it reaches this'],
|
||||
synRateDivisor: ['Network rate divisor (N)', 'partner-network (NAS) views and member ads in other members zones cost 1/N of the on-site rate; 1 = same rate; whole numbers'],
|
||||
welcomeCredits: ['Welcome credits', 'granted after the welcome tour'],
|
||||
dailyViewTarget: ['Daily view set (ads)', 'ads a member views for the daily claim'],
|
||||
dailyClaimCredits: ['Daily claim (credits)', 'paid when the set is complete'],
|
||||
@@ -848,7 +1092,7 @@
|
||||
}));
|
||||
|
||||
// site settings: key / value rows; booleans as checkboxes, numbers stay numbers
|
||||
const SITE_META = { noPayoutIds: 'No-payout positions (member #s, comma): linkage only, no buys from them, no joins routed under them', siteName: 'Site name', tagline: 'Tagline', rehearsal: 'Testnet rehearsal banner', defaultSponsorId: 'Fallback sponsor (member #)', walletConnectProjectId: 'WalletConnect project id', moonpayPublicKey: 'MoonPay public key', telegramBotToken: 'Telegram proof feed: bot token', telegramChatId: 'Telegram proof feed: chat id', telegramTopicId: 'Telegram proof feed: topic id (optional)', telegramEvents: 'Telegram proof feed: events (payouts | payouts+purchases | all)', telegramCtaUrl: 'Telegram proof feed: join link under each post', aiCreditsPerGen: 'AI Copy Engine: credits per generation after the free allowance', aiFreeSurge: 'AI Copy Engine: free generations a month at Surge', aiFreeCircuit: 'AI Copy Engine: free generations a month at Circuit', aiFreeNexus: 'AI Copy Engine: free generations a month at Nexus', snapshotEnabled: 'Daily growth snapshot to Telegram (1/0)', snapshotHourUtc: 'Daily growth snapshot: hour (UTC; 14 = 9 AM Central)', snapshotTargets: 'Daily growth snapshot: targets (feed = proof channel, echo = shared payments topic; comma list)', pipelineMode: 'Pipeline board: off (coming soon card) | preview (admin account only) | on (everyone)', pipelineEta: 'Pipeline: opening date shown on the coming-soon card (e.g. Sep 28)', memberWeeklyEmail: 'Weekly member email to everyone active (1) or only sponsors with a line (0)', leaderboardWeeklyPrize: 'Leaderboard: weekly prize text (optional; blank shows the credit ladder)', leaderboardMonthlyPrize: 'Leaderboard: monthly prize text (optional)', leaderboardWeeklyCredits: 'Leaderboard: weekly credits for 1st,2nd,3rd… (e.g. 1000,500,250; blank = none)', leaderboardMonthlyCredits: 'Leaderboard: monthly credits for 1st,2nd,3rd… (e.g. 5000,2500,1000)', leaderboardAnnounceGeneral: 'Leaderboard: announce winners in the main group too (1/0)', telegramEchoChatId: 'Telegram echo (shared payments topic): chat id', telegramEchoTopicId: 'Telegram echo: topic id', telegramEchoEvents: 'Telegram echo: events (payouts | payouts+purchases | all)', legacyCreditsAdvertiser: 'Legacy welcome credits: former advertisers', legacyCreditsEarner: 'Legacy welcome credits: former earners', pnlFixedMonthlyUsd: 'P&L: fixed monthly cost (USD)' };
|
||||
const SITE_META = { noPayoutIds: 'No-payout positions (member #s, comma): linkage only, no buys from them, no joins routed under them', siteName: 'Site name', tagline: 'Tagline', rehearsal: 'Testnet rehearsal banner', defaultSponsorId: 'Fallback sponsor (member #)', walletConnectProjectId: 'WalletConnect project id', telegramBotToken: 'Telegram proof feed: bot token', telegramChatId: 'Telegram proof feed: chat id', telegramTopicId: 'Telegram proof feed: topic id (optional)', telegramEvents: 'Telegram proof feed: events (payouts | payouts+purchases | all)', telegramCtaUrl: 'Telegram proof feed: join link under each post', aiCreditsPerGen: 'AI Copy Engine: credits per generation after the free allowance', aiFreeSurge: 'AI Copy Engine: free generations a month at Surge', aiFreeCircuit: 'AI Copy Engine: free generations a month at Circuit', aiFreeNexus: 'AI Copy Engine: free generations a month at Nexus', snapshotEnabled: 'Daily growth snapshot to Telegram (1/0)', snapshotHourUtc: 'Daily growth snapshot: hour (UTC; 14 = 9 AM Central)', snapshotTargets: 'Daily growth snapshot: targets (feed = proof channel, echo = shared payments topic; comma list)', pipelineMode: 'Pipeline board: off (coming soon card) | preview (admin account only) | on (everyone)', pipelineEta: 'Pipeline: opening date shown on the coming-soon card (e.g. Sep 28)', memberWeeklyEmail: 'Weekly member email to everyone active (1) or only sponsors with a line (0)', leaderboardWeeklyPrize: 'Leaderboard: weekly prize text (optional; blank shows the credit ladder)', leaderboardMonthlyPrize: 'Leaderboard: monthly prize text (optional)', leaderboardWeeklyCredits: 'Leaderboard: weekly credits for 1st,2nd,3rd… (e.g. 1000,500,250; blank = none)', leaderboardMonthlyCredits: 'Leaderboard: monthly credits for 1st,2nd,3rd… (e.g. 5000,2500,1000)', leaderboardAnnounceGeneral: 'Leaderboard: announce winners in the main group too (1/0)', telegramEchoChatId: 'Telegram echo (shared payments topic): chat id', telegramEchoTopicId: 'Telegram echo: topic id', telegramEchoEvents: 'Telegram echo: events (payouts | payouts+purchases | all)', legacyCreditsAdvertiser: 'Legacy welcome credits: former advertisers', legacyCreditsEarner: 'Legacy welcome credits: former earners', pnlFixedMonthlyUsd: 'P&L: fixed monthly cost (USD)', campaignEditFee: 'Ad edits: credits per edit after the first, free one on each ad (0 = always free)' };
|
||||
function drawSite() {
|
||||
const wrap = $('siteForm');
|
||||
wrap.innerHTML = Object.entries(siteObj).map(([k, v]) => '<div class="kv-row"><span class="k" title="' + esc(k) + '">' + esc(SITE_META[k] || humanize(k)) + '</span>'
|
||||
|
||||
+89
-12
@@ -7,14 +7,25 @@
|
||||
const NOTE = {
|
||||
banner: 'Runs in the ad viewer, in every member zone on outside sites, and on the partner network. Views are timed on the server. Spends purchased or earned credits.',
|
||||
text: 'A headline and one line. Runs in the ad viewer and on the partner network. Spends purchased or earned credits.',
|
||||
login: 'Your page, full screen, to every member right after they sign in. One sponsor a day, purchased credits only. No creative needed: the page is the ad.'
|
||||
login: 'Your page, full screen, to every member right after they sign in. A slot is a flat buy of purchased credits for a fixed run of unlimited sign-in impressions, paid once and never charged per day. No creative needed: the page is the ad.'
|
||||
};
|
||||
// login slots (same rule as InstantAdPay): one flat price, a fixed run, a cap on member slots live at once
|
||||
const slotInfo = () => { const r = (D && D.rates) || {}; const ls = (D && D.loginSlots) || {}; const max = ls.max || r.loginSlotsMax || 3;
|
||||
return { credits: ls.credits || r.loginSlotCredits || 1000, days: ls.days || r.loginSlotDays || 30, max, used: ls.used || 0, queued: ls.queued || 0, free: ls.free != null ? ls.free : max }; };
|
||||
// prepaid queue (Marty, 2026-10-23): when every slot is taken you pay now for a place in line; first paid, first served
|
||||
const nextPlace = () => (D && D.loginNext) || { place: 1, estStartCt: null };
|
||||
const estText = ct => ct ? (ct === 'any minute now' ? 'Estimated start: any minute now.' : 'Estimated start: ' + ct + ' (Central time).') + ' This is an estimate: it moves earlier if a running slot is paused, and can move if the number of slots changes.' : 'There is no start estimate yet.';
|
||||
const loginNote = () => { const L = slotInfo();
|
||||
return 'Your page, full screen, to every member right after they sign in. A slot is ' + fmt(L.credits) + ' purchased credits for ' + L.days + ' days of unlimited sign-in impressions, paid once and never charged per day. ' + L.max + ' slots at a time. When all are taken you can reserve the next one: you pay now, your ' + L.days + ' days start when a slot frees up, first paid first served, and cancelling before it starts refunds you in full. No creative needed: the page is the ad.'; };
|
||||
const host = u => { try { return new URL(u).hostname.replace(/^www\./, ''); } catch (e) { return u; } };
|
||||
async function load() {
|
||||
try { [D, EARN] = await Promise.all([CR.get('/api/my/campaigns'), CR.get('/api/my/earn')]); } catch (e) { CR.sub('could not load'); return; }
|
||||
const cs = D.campaigns || []; const live = cs.filter(c => c.status === 'active');
|
||||
{ const sel = $('fAud'); if (sel) { const keep = sel.value; sel.innerHTML = '<option value="">Everyone</option>' + (D.audiences || []).map(a => '<option value="' + a.id + '">' + esc(a.name) + ' (' + fmt(a.size30) + ')</option>').join(''); sel.value = keep; sel.onchange = () => { $('fAudModeRow').hidden = !sel.value; }; } }
|
||||
const views = cs.reduce((n, c) => n + (c.imps || 0) + (c.impsNas || 0), 0);
|
||||
const views = cs.reduce((n, c) => n + (c.imps || 0) + (c.impsNas || 0) + (c.impsSyn || 0), 0);
|
||||
const synN = Math.max(1, Math.floor(Number(D.rates && D.rates.synRateDivisor) || 1)); // network rate (Marty, 2026-10-27, 4:1)
|
||||
const offTxt = c => (c.impsNas ? '<br><span class="muted" style="font-size:11px">+' + fmt(c.impsNas) + ' network' + (synN > 1 ? ' at 1/' + synN : '') + '</span>' : '')
|
||||
+ (c.impsSyn ? '<br><span class="muted" style="font-size:11px">+' + fmt(c.impsSyn) + ' partner zones' + (synN > 1 ? ' at 1/' + synN : '') + '</span>' : '');
|
||||
CR.sub(live.length + ' live · ' + fmt(D.availableCredits) + ' credits available');
|
||||
const hours = new Array(24).fill(0); Object.values(D.hours || {}).forEach(a => (a || []).forEach((n, i) => { hours[i] += Number(n) || 0; })); // last 7 days by UTC hour, all campaigns
|
||||
const week = hours.reduce((a, b) => a + b, 0);
|
||||
@@ -24,19 +35,70 @@
|
||||
CR.tile({ k: 'Views delivered', v: fmt(views), series: week ? hours : null, note: week ? fmt(week) + ' in 7 days, by hour' : '' }),
|
||||
CR.tile({ k: 'Today\'s viewing', v: EARN.views + ' / ' + EARN.target, note: EARN.streakDay > 1 ? 'streak day ' + EARN.streakDay : '' })].join('');
|
||||
const r = D.rates || {};
|
||||
$('rateLine').textContent = 'Rates: ' + r.bannerCreditsPerBatch + ' credits per ' + r.bannerBatch + ' banner views, ' + r.textCreditsPerBatch + ' per ' + r.textBatch + ' text views, ' + r.loginCreditsPerDay + ' per day for the login spot. Viewing pays ' + EARN.claimCredits + ' credits for ' + EARN.target + ' timed views a day.';
|
||||
const st = c => c.scheduled ? '<span class="tag">Scheduled</span>' : c.status === 'active' ? '<span class="tag ok">Live</span>' : c.status === 'paused' ? '<span class="tag warn">Paused</span>' : c.status === 'out' ? '<span class="tag warn">Out of credits</span>' : c.status === 'done' ? '<span class="tag">Ended</span>' : '<span class="tag">' + esc(c.status) + '</span>';
|
||||
const cr = c => c.type === 'banner' ? (c.imageUrl ? '<img class="thumb" src="' + esc(c.imageUrl) + '" alt="">' : '') + '<span class="mono muted" style="font-size:11px">' + c.width + 'x' + c.height + '</span>' : c.type === 'text' ? '<b>' + esc(c.title) + '</b><br><span class="muted" style="font-size:12px">' + esc(c.body || '') + '</span>' : '<span class="muted">full page</span>';
|
||||
$('rows').innerHTML = cs.length ? cs.map(c => '<div class="rw"><div><b>' + esc(c.name) + '</b> <span class="tag t">' + esc(c.type) + '</span>' + (c.audience ? ' <span class="tag plain" title="audience">' + esc((((D && D.audiences) || []).find(a => a.id === c.audience) || {}).name || 'audience') + (c.audienceMode === 'exclude' ? ' · excluded' : '') + '</span>' : '') + '<br><span class="mono muted" style="font-size:11px">#' + c.id + ' · ' + esc(host(c.targetUrl)) + (c.geo ? ' · tiers ' + esc(c.geo) : '') + (c.dailyCap ? ' · cap ' + c.dailyCap + '/day' : '') + '</span></div><div>' + cr(c) + '</div><div><span class="num">' + fmt(c.spent) + '</span><span class="muted"> / ' + fmt(c.budget) + '</span><div class="bar"><i style="width:' + Math.min(100, Math.round(100 * c.spent / Math.max(1, c.budget))) + '%"></i></div></div><span class="r num">' + fmt(c.imps) + (c.impsNas ? '<br><span class="muted" style="font-size:11px">+' + fmt(c.impsNas) + ' network</span>' : '') + '</span><span class="r num">' + fmt(c.clicks) + '</span><span>' + st(c) + '</span><span style="display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap">'
|
||||
$('rateLine').textContent = 'Rates: ' + r.bannerCreditsPerBatch + ' credits per ' + r.bannerBatch + ' banner views, ' + r.textCreditsPerBatch + ' per ' + r.textBatch + ' text views' + (synN > 1 ? ' here (views on the partner network and in other members\u2019 zones cost 1/' + synN + ' of that)' : '') + ', ' + fmt(slotInfo().credits) + ' purchased credits for a ' + slotInfo().days + '-day login slot (' + (slotInfo().free ? slotInfo().free + ' of ' + slotInfo().max + ' open' : 'all ' + slotInfo().max + ' taken' + (slotInfo().queued ? ', ' + slotInfo().queued + ' in line' : '') + ', reserve the next one') + '). Viewing pays ' + EARN.claimCredits + ' credits for ' + EARN.target + ' timed views a day.';
|
||||
// traffic-light status (2026-10-20): live green, running low amber (80%+ of the budget spent), out red, paused grey
|
||||
const stKey = c => c.status === 'queued' ? 'queued' : c.status === 'cancelled' ? 'cancelled' : c.scheduled ? 'sched' : c.status === 'active' ? (c.type !== 'login' && c.budget > 0 && c.spent / c.budget >= 0.8 ? 'low' : 'live') : c.status === 'paused' ? 'paused' : c.status === 'out' ? 'out' : c.status === 'done' ? 'ended' : '';
|
||||
const ST_LABEL = { queued: 'In line', cancelled: 'Cancelled, refunded', sched: 'Scheduled', live: 'Live', low: 'Running low', paused: 'Paused', out: 'Out of credits', ended: 'Ended' };
|
||||
const st = c => { const k = stKey(c); return '<span class="stg" data-st="' + k + '">' + (ST_LABEL[k] || esc(c.status)) + '</span>'; };
|
||||
const QM = {}; (D.loginQueue || []).forEach(q => { QM[q.id] = q; });
|
||||
const qCell = c => { const q = QM[c.id]; return '<span class="muted">full page<br><span style="font-size:12px"><b>#' + (q ? q.place : '?') + ' in line</b>, paid' + (q && q.estStartCt ? '<br>' + (q.estStartCt === 'any minute now' ? 'starts any minute now' : 'est. start ' + esc(q.estStartCt) + ' CT (an estimate)') : '') + '</span></span>'; };
|
||||
const cr = c => c.status === 'queued' ? qCell(c) : c.status === 'cancelled' ? '<span class="muted">full page<br><span style="font-size:12px">' + fmt(c.refunded || 0) + ' credits refunded</span></span>' : c.type === 'banner' ? (c.imageUrl ? '<img class="thumb" src="' + esc(c.imageUrl) + '" alt="">' : '') + '<span class="mono muted" style="font-size:11px">' + c.width + 'x' + c.height + '</span>' : c.type === 'text' ? '<b>' + esc(c.title) + '</b><br><span class="muted" style="font-size:12px">' + esc(c.body || '') + '</span>' : '<span class="muted">full page' + (c.type === 'login' && c.expires ? '<br><span style="font-size:12px">' + (c.expires > Date.now() ? 'slot ends ' : 'ended ') + new Date(c.expires).toLocaleDateString(undefined, { month: 'short', day: 'numeric' }) + '</span>' : '') + '</span>';
|
||||
$('rows').innerHTML = cs.length ? cs.map(c => '<div class="rw st-row" data-st="' + stKey(c) + '"><div><b>' + esc(c.name) + '</b> <span class="tag t">' + esc(c.type) + '</span>' + (c.audience ? ' <span class="tag plain" title="audience">' + esc((((D && D.audiences) || []).find(a => a.id === c.audience) || {}).name || 'audience') + (c.audienceMode === 'exclude' ? ' · excluded' : '') + '</span>' : '') + '<br><span class="mono muted" style="font-size:11px">#' + c.id + ' · ' + esc(host(c.targetUrl)) + (c.geo ? ' · tiers ' + esc(c.geo) : '') + (c.dailyCap ? ' · cap ' + c.dailyCap + '/day' : '') + '</span></div><div>' + cr(c) + '</div><div><span class="num">' + fmt(c.status === 'cancelled' ? 0 : c.spent) + '</span><span class="muted"> / ' + fmt(c.budget) + (c.status === 'queued' ? ' paid' : '') + '</span><div class="bar st"><i style="width:' + (c.status === 'cancelled' ? 0 : Math.min(100, Math.round(100 * c.spent / Math.max(1, c.budget)))) + '%"></i></div></div><span class="r num">' + fmt(c.imps) + offTxt(c) + '</span><span class="r num">' + fmt(c.clicks) + '</span><span>' + st(c) + '</span><span style="display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap">'
|
||||
+ (c.status === 'active' ? '<button class="btn sm" type="button" data-pause="' + c.id + '">Pause</button>' : c.status === 'paused' ? '<button class="btn sm" type="button" data-resume="' + c.id + '">Resume</button>' : '')
|
||||
+ (['active', 'paused', 'out'].includes(c.status) ? '<button class="btn sm" type="button" data-top="' + c.id + '">Top up</button>' : '') + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">No ads yet. Launch one: a banner, a text ad or the login spot.</span></div>';
|
||||
+ (['active', 'paused', 'out'].includes(c.status) && c.type !== 'login' ? '<button class="btn sm" type="button" data-top="' + c.id + '">Top up</button>' : '')
|
||||
+ (c.status === 'queued' ? '<button class="btn sm" type="button" data-qcancel="' + c.id + '" title="Leave the line: the ' + fmt(c.budget) + ' credits you paid come back in full">Cancel and refund</button>' : '')
|
||||
+ (!['done', 'cancelled'].includes(c.status) ? '<button class="btn sm" type="button" data-edit="' + c.id + '" title="' + (c.edits ? 'Edit the link, ' + (c.type === 'banner' ? 'image' : c.type === 'text' ? 'text' : 'name') + ' (' + fmt(D.editFee) + ' credits)' : 'Fix the link, ' + (c.type === 'banner' ? 'image' : c.type === 'text' ? 'text' : 'name') + ' (first edit free)') + '">Edit</button>' : '') + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">No ads yet. Launch one: a banner, a text ad or a login-ad slot.</span></div>';
|
||||
if (D.gauntletPending) $('earnNote').insertAdjacentHTML('afterend', '<div class="muted" style="margin-top:8px">Your welcome credits unlock after the short welcome tour on <a href="/tools">the classic dashboard</a>.</div>');
|
||||
$('foot').textContent = 'views = timed views in the ad viewer plus member zones; network = the partner ad network · a paused ad keeps its credits · unspent credits return when an ad ends';
|
||||
$('foot').textContent = 'views = views here on LinkSpin; network = the partner ad network; partner zones = other members\u2019 zones on their own sites' + (synN > 1 ? ' (network and partner-zone views cost 1/' + synN + ' of the rate here, so ' + synN + ' of them cost what 1 view here does)' : '') + ' · a paused ad keeps its credits · unspent credits return when an ad ends';
|
||||
$('rows').querySelectorAll('[data-pause]').forEach(b => b.addEventListener('click', () => act('/api/my/campaigns/' + b.dataset.pause + '/pause')));
|
||||
$('rows').querySelectorAll('[data-resume]').forEach(b => b.addEventListener('click', () => act('/api/my/campaigns/' + b.dataset.resume + '/resume')));
|
||||
$('rows').querySelectorAll('[data-top]').forEach(b => b.addEventListener('click', async () => { const v = await dialog({ title: 'Top up #' + b.dataset.top, text: 'Add credits to this ad. You have ' + fmt(D.availableCredits) + ' available.', fields: [{ k: 'credits', label: 'Credits to add', value: '25', mono: true }], ok: 'Add' }); if (!v) return; try { await api('/api/my/campaigns/' + b.dataset.top + '/topup', { credits: Number(v.credits) }); toast('Topped up.'); load(); } catch (e) { toast(e.message, true); } }));
|
||||
$('rows').querySelectorAll('[data-qcancel]').forEach(b => b.addEventListener('click', () => cancelReservation(Number(b.dataset.qcancel))));
|
||||
$('rows').querySelectorAll('[data-edit]').forEach(b => b.addEventListener('click', () => openEdit(Number(b.dataset.edit))));
|
||||
{ const w = $('loginWhere'); if (w) w.textContent = 'full screen to every member right after they sign in: ' + fmt(slotInfo().credits) + ' purchased credits for a ' + slotInfo().days + '-day slot, ' + slotInfo().max + ' slots at a time. When all are taken, reserve the next one: pay now, it starts when a slot frees, and a cancel before then refunds in full'; }
|
||||
{ const cl = D.creditLog || []; const box = $('creditLog'); if (box) { box.parentElement.hidden = !cl.length; box.innerHTML = cl.map(x => '<div style="display:flex;justify-content:space-between;gap:10px;padding:5px 0;border-bottom:1px solid var(--chrome-line)"><span>' + esc(x.reason) + (x.campaignId ? ' <span class="mono muted" style="font-size:11px">#' + x.campaignId + '</span>' : '') + '<br><span class="muted" style="font-size:11px">' + new Date(x.ts).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT</span></span><span class="num mono" style="white-space:nowrap">' + (x.delta > 0 ? '+' : '') + (x.delta ? fmt(x.delta) : '') + '</span></div>').join(''); } }
|
||||
slotChip(); if (!$('composer').hidden) setType(TYPE);
|
||||
earnPaint();
|
||||
{ const hm = /^#edit=(\d+)$/.exec(location.hash || ''); if (hm) { history.replaceState(null, '', location.pathname + location.search); openEdit(Number(hm[1])); } } // /tools campaign list links here
|
||||
}
|
||||
// -- edit an ad (2026-10-18): fix the link, the image or the text. The first edit of each ad is free, then D.editFee credits.
|
||||
// Type, size, budget, countries, schedule and audience are the buy itself and stay a new campaign.
|
||||
const feeNote = c => c.status === 'queued' ? 'Edits are free while this ad waits in line, and your one free correction stays for when it runs.' : !c.edits ? 'This edit is free (your one free correction).' : (D.editFee ? 'This edit costs ' + fmt(D.editFee) + ' credits.' : 'Edits are free right now.');
|
||||
async function openEdit(id) {
|
||||
const c = ((D && D.campaigns) || []).find(x => x.id === id); if (!c) { toast('That ad is not in your list.', true); return; }
|
||||
const fields = [{ k: 'name', label: 'Name', value: c.name, max: 60 }, { k: 'targetUrl', label: 'Where the click goes', value: c.targetUrl, mono: true }];
|
||||
if (c.type === 'banner') fields.push({ k: 'imageUrl', label: 'Image URL (' + c.width + 'x' + c.height + ')', value: c.imageUrl || '', mono: true });
|
||||
if (c.type === 'text') fields.push({ k: 'title', label: 'Headline (60)', value: c.title || '', max: 60 }, { k: 'body', label: 'One line (140)', value: c.body || '', max: 140 });
|
||||
const last = (c.editLog || []).slice(-1)[0];
|
||||
const html = '<div class="muted" style="margin:8px 0" id="edFee"><b>' + esc(feeNote(c)) + '</b> ' + (c.status === 'queued' ? '' : c.edits ? 'Your free correction on this ad is used.' : 'After this one, each edit costs ' + fmt(D.editFee) + ' credits.') + '</div>'
|
||||
+ '<div class="muted" style="font-size:12px;margin-bottom:6px">The type, size, budget, countries, schedule and audience stay as they are. To change those, start a new ad.' + (last ? ' Last edited ' + new Date(last.ts).toLocaleString() + '.' : '') + '</div>'
|
||||
+ (c.type === 'banner' ? '<label class="lbl">Or upload a new image (PNG, JPG, WebP, GIF up to 3 MB)<input class="field" id="edFile" type="file" accept="image/png,image/jpeg,image/webp,image/gif"></label><div class="muted" style="margin:6px 0 4px">Preview at real size</div><div id="edPrev" style="max-width:100%;overflow:auto"></div>' : '')
|
||||
+ (c.type === 'login' ? '<div class="muted" style="font-size:12px">A login ad shows the page itself, full screen, so the link is the ad.</div>' : '');
|
||||
const wait = dialog({ title: 'Edit ad #' + c.id + ' (' + c.type + ')', html, fields, ok: 'Review changes' });
|
||||
if (c.type === 'banner') { // the dialog is in the page now: wire the preview and the uploader
|
||||
const host = $('crModalHost'), inp = host.querySelector('#dlg-imageUrl'), prev = host.querySelector('#edPrev');
|
||||
const paint = () => { const u = inp.value.trim(); prev.innerHTML = /^https?:\/\//i.test(u) ? '<img src="' + esc(u) + '" alt="" style="width:' + c.width + 'px;height:' + c.height + 'px;max-width:none;display:block;border:1px solid var(--chrome-line);background:var(--inset)">' : '<span class="muted">No image yet</span>'; };
|
||||
inp.addEventListener('input', paint); paint();
|
||||
host.querySelector('#edFile').addEventListener('change', async e => { const f = e.target.files[0]; if (!f) return; try { const r = await (await fetch('/api/my/upload', { method: 'POST', headers: { 'Content-Type': f.type }, body: f })).json(); if (r.error) throw new Error(r.error); inp.value = location.origin + r.url; paint(); toast('Uploaded.'); } catch (er) { toast(er.message, true); } });
|
||||
}
|
||||
const v = await wait; if (!v) return;
|
||||
const label = { name: 'name', targetUrl: 'link', imageUrl: 'image', title: 'headline', body: 'text line' };
|
||||
const changed = Object.keys(v).filter(k => String(v[k]).trim() !== String(c[k] || '').trim());
|
||||
if (!changed.length) { toast('Nothing changed.'); return; }
|
||||
const paidEdit = c.status !== 'queued' && c.edits && D.editFee;
|
||||
const ok = await dialog({ title: 'Save the new ' + changed.map(k => label[k]).join(', ') + '?', text: feeNote(c) + (paidEdit ? ' It comes out of your earned credits first, then purchased.' : ''), ok: paidEdit ? 'Save and pay ' + fmt(D.editFee) : 'Save' });
|
||||
if (!ok) return;
|
||||
const body = {}; changed.forEach(k => { body[k] = v[k].trim(); });
|
||||
try { const r = await api('/api/my/campaigns/' + c.id + '/edit', body); toast('Saved.' + (r.fee ? ' ' + fmt(r.fee) + ' credits charged.' : '') + (r.warn ? ' ' + r.warn : '')); load(); }
|
||||
catch (e) { toast(e.message, true); }
|
||||
}
|
||||
async function cancelReservation(id) {
|
||||
const c = ((D && D.campaigns) || []).find(x => x.id === id); if (!c) return;
|
||||
const q = (D.loginQueue || []).find(x => x.id === id);
|
||||
const ok = await dialog({ title: 'Cancel reservation #' + id + '?', text: 'You leave the line' + (q ? ' (you are #' + q.place + ')' : '') + ' and the ' + fmt(c.budget) + ' credits you paid come back to you in full, as purchased credits. If you reserve again later, you join at the back of the line.', ok: 'Cancel and refund', no: 'Keep my place', danger: true });
|
||||
if (!ok) return;
|
||||
try { const r = await api('/api/my/campaigns/' + id + '/cancel-reservation', {}); toast('Cancelled. ' + fmt(r.refunded) + ' credits refunded.'); load(); } catch (e) { toast(e.message, true); }
|
||||
}
|
||||
async function act(path) { try { await api(path, {}); load(); } catch (e) { toast(e.message, true); } }
|
||||
// -- earn by viewing: the engine's fraud-guarded flow (server-timed dwell + a human check) runs inside /view/<token>
|
||||
@@ -66,11 +128,18 @@
|
||||
window.addEventListener('storage', e => { if (e.key === 'iap-view-done') earnRefresh(); });
|
||||
$('earnClaim').addEventListener('click', async () => { try { const r = await api('/api/my/claim', {}); toast('+' + r.credited + ' credits' + (r.streakDay > 1 ? ', streak day ' + r.streakDay : '') + '. Spend them on an ad.'); load(); } catch (e) { toast(e.message, true); } });
|
||||
// -- composer
|
||||
function setType(t) { TYPE = t; document.querySelectorAll('#typeChips .chip').forEach(c => c.classList.toggle('on', c.dataset.t === t)); $('typeNote').textContent = NOTE[t]; $('bannerFields').hidden = t !== 'banner'; $('textFields').hidden = t !== 'text'; $('fCap').parentElement.hidden = t === 'login'; cost(); preview(); }
|
||||
function setType(t) { TYPE = t; document.querySelectorAll('#typeChips .chip').forEach(c => c.classList.toggle('on', c.dataset.t === t)); $('typeNote').textContent = t === 'login' ? loginNote() : NOTE[t]; $('bannerFields').hidden = t !== 'banner'; $('textFields').hidden = t !== 'text'; $('fCap').parentElement.hidden = t === 'login';
|
||||
const L = slotInfo(), full = t === 'login' && !L.free; const fb = $('fBudget');
|
||||
if (t === 'login') { fb.dataset.keep = fb.dataset.keep || fb.value; fb.value = L.credits; fb.readOnly = true; } else { if (fb.readOnly && fb.dataset.keep) fb.value = fb.dataset.keep; delete fb.dataset.keep; fb.readOnly = false; }
|
||||
$('fGo').disabled = false; $('fGo').textContent = full ? 'Reserve the next slot' : 'Launch'; $('fGo').title = full ? 'All login-ad slots are taken: pay now for a place in line' : '';
|
||||
cost(); preview(); }
|
||||
function slotChip() { const ch = document.querySelector('#typeChips .chip[data-t="login"]'); if (!ch || !D) return; const L = slotInfo(); ch.textContent = 'Login ad' + (L.free ? ' (' + L.free + ' of ' + L.max + ' open)' : ' (full, reserve the next)'); }
|
||||
function cost() { const b = Math.floor(Number($('fBudget').value) || 0); const r = D ? D.rates : {}; let s = '';
|
||||
if (TYPE === 'banner') s = 'about ' + fmt(Math.floor(b / (r.bannerCreditsPerBatch || 2) * (r.bannerBatch || 10))) + ' timed views';
|
||||
else if (TYPE === 'text') s = 'about ' + fmt(Math.floor(b / (r.textCreditsPerBatch || 1) * (r.textBatch || 10))) + ' timed views';
|
||||
else s = 'about ' + Math.floor(b / (r.loginCreditsPerDay || 100)) + ' day' + (Math.floor(b / (r.loginCreditsPerDay || 100)) === 1 ? '' : 's') + ' as the login sponsor (' + (r.loginCreditsPerDay || 100) + ' per day)';
|
||||
else { const L = slotInfo(); $('fCost').innerHTML = L.free
|
||||
? '<b>' + fmt(L.credits) + '</b> purchased credits for <b>' + L.days + '</b> days of unlimited sign-in impressions · <b>' + L.free + '</b> of ' + L.max + ' slots open'
|
||||
: '<span style="display:block;line-height:1.7">All <b>' + L.max + '</b> login-ad slots are taken' + (L.queued ? ', <b>' + L.queued + '</b> paid reservation' + (L.queued === 1 ? '' : 's') + ' in line' : '') + '. Reserve the next one: <b>' + fmt(L.credits) + '</b> purchased credits now and you would be <b>#' + nextPlace().place + '</b> in line. ' + esc(estText(nextPlace().estStartCt)) + ' Cancel before it starts for a full refund.</span>'; return; }
|
||||
$('fCost').innerHTML = b >= 10 ? s.replace(/(about )([\d,]+)/, '$1<b>$2</b>') : 'minimum <b>10</b> credits'; }
|
||||
function preview() { const p = $('prev'); if (TYPE === 'banner' && IMG) { const sz = ($('fSize').value || '728x90').split('x'); p.innerHTML = '<div class="muted" style="margin-bottom:6px">Preview</div><img src="' + esc(IMG) + '" alt="" style="max-width:100%;width:' + sz[0] + 'px;height:auto;border:1px solid var(--chrome-line);background:var(--inset)">'; }
|
||||
else if (TYPE === 'text') p.innerHTML = '<div class="muted" style="margin-bottom:6px">Preview</div><div class="panel" style="max-width:420px"><b>' + esc($('fTitle').value || 'Your headline') + '</b><br><span class="ink2">' + esc($('fBody').value || 'One line under it.') + '</span><br><span class="mono muted" style="font-size:11px">' + esc(host($('fTarget').value || 'yoursite.com')) + '</span></div>';
|
||||
@@ -94,8 +163,16 @@
|
||||
if ($('fAud') && $('fAud').value) { body.audience = $('fAud').value; body.audienceMode = $('fAudMode').value; }
|
||||
if (TYPE === 'banner') { body.size = $('fSize').value; body.imageUrl = $('fImage').value.trim(); }
|
||||
if (TYPE === 'text') { body.title = $('fTitle').value; body.body = $('fBody').value; }
|
||||
if (TYPE === 'login' && !slotInfo().free) { // the line: say exactly what happens before any credits move
|
||||
const L = slotInfo(), nx = nextPlace();
|
||||
const ok = await dialog({ title: 'Reserve the next login-ad slot?', text: 'All ' + L.max + ' slots are taken. You pay ' + fmt(L.credits) + ' purchased credits now and get place #' + nx.place + ' in line. Your ' + L.days + ' days start the moment a slot frees up (first paid, first served), and we let you know on the site and by email. ' + estText(nx.estStartCt) + ' Until it starts you can edit it for free, or cancel it for a full refund.', ok: 'Pay ' + fmt(L.credits) + ' and reserve' });
|
||||
if (!ok) return;
|
||||
body.reserve = true;
|
||||
}
|
||||
$('fGo').disabled = true;
|
||||
try { await api('/api/my/campaigns', body); toast('Launched. It is live in rotation now.'); $('composer').hidden = true; $('fName').value = ''; load(); } catch (e) { toast(e.message, true); } finally { $('fGo').disabled = false; }
|
||||
try { const r = await api('/api/my/campaigns', body); const c = r.campaign || {};
|
||||
toast(c.status === 'queued' ? 'Reserved and paid. You are #' + (c.place || '?') + ' in line. We let you know when it starts.' : TYPE === 'login' ? 'Launched. Your login-ad slot runs for ' + slotInfo().days + ' days.' : 'Launched. It is live in rotation now.');
|
||||
$('composer').hidden = true; $('fName').value = ''; load(); } catch (e) { toast(e.message, true); } finally { $('fGo').disabled = false; }
|
||||
});
|
||||
CR.requireSession(load);
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
// LinkSpin Banner Spin builder (2026-10-18), the second view of the Links screen. One image address + one click address
|
||||
// rotate up to 25 banners, each with its own target. API: /api/my/bannerspins (bannerspin.js on the server). Uses the
|
||||
// Control Room shell (cr-shell.js) and the hours editor links.js shares as window.LSHours.
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt, api = CR.api, toast = CR.toast, dialog = CR.dialog;
|
||||
let D = null, SPINS = [], SEL = null, STATS = {}, ROT = [], SRC = [], HOST = '', PEND = null, FB = null, BHE = null, HRS = null;
|
||||
const MAXB = () => (D && D.maxBytes) || 153600;
|
||||
const kb = n => Math.max(1, Math.round((n || 0) / 1024)) + ' KB';
|
||||
const sizeOf = s => s.size.split('x').map(Number);
|
||||
const pct = v => v == null ? '-' : v + '%';
|
||||
const health = s => s.adminOff ? { cls: 'bad', t: 'OFFLINE (ADMIN)' } : s.paused ? { cls: 'warn', t: 'PAUSED' } : !s.banners.some(b => b.active && !b.adminOff) ? { cls: 'bad', t: 'NO LIVE BANNER' } : { cls: 'ok', t: 'LIVE' };
|
||||
const base = () => 'https://' + (HOST || location.host);
|
||||
const imgUrl = s => base() + '/i/' + s.code + '.gif', clickUrl = s => base() + '/c/' + s.code, jsUrl = s => base() + '/s/' + s.code + '.js';
|
||||
|
||||
// ── view switch: Spin links | Banner Spins (hash #b or #b<id> opens this view) ──
|
||||
function setView(v) {
|
||||
const on = v === 'banners';
|
||||
$('vsw').querySelectorAll('button').forEach(b => b.classList.toggle('on', b.dataset.v === v));
|
||||
$('ws').hidden = on; $('bsWs').hidden = !on;
|
||||
const nb = $('newBtn'), bn = $('bsNewBtn'); if (nb) nb.hidden = on; if (bn) bn.hidden = !on;
|
||||
if (on) { if (!/^#b/.test(location.hash)) history.replaceState(null, '', '#b' + (SEL || '')); load(true); }
|
||||
else { if (/^#b/.test(location.hash)) history.replaceState(null, '', location.pathname); if (window.LSLinks) window.LSLinks.reload(); }
|
||||
}
|
||||
$('vsw').querySelectorAll('button').forEach(b => b.addEventListener('click', () => setView(b.dataset.v)));
|
||||
|
||||
async function load(keep) {
|
||||
try { D = await CR.get('/api/my/bannerspins'); } catch (e) { toast(e.message, true); return; }
|
||||
SPINS = (D.spins || []).slice().sort((a, b) => (b.imps30 || 0) - (a.imps30 || 0));
|
||||
try { ROT = (await CR.get('/api/my/rotations')).rotations || []; } catch (e) { ROT = []; }
|
||||
try { SRC = (await CR.get('/api/my/sources')).sources || []; } catch (e) { SRC = []; }
|
||||
const hs = D.hosts || []; if (!HOST || !hs.some(h => h.host === HOST)) { const soc = hs.find(h => h.channel === 'social'); HOST = (soc || hs[0] || { host: location.host }).host; }
|
||||
renderTier(); renderList();
|
||||
if (!$('bsWs').hidden) CR.sub(SPINS.length + ' Banner Spin' + (SPINS.length === 1 ? '' : 's') + ' · ' + fmt(SPINS.reduce((n, x) => n + (x.imps30 || 0), 0)) + ' views in 30 days');
|
||||
const want = SEL != null ? SEL : (Number(location.hash.replace(/^#b/, '')) || null);
|
||||
if (want && SPINS.find(x => x.id === want)) return select(want, keep);
|
||||
if (!SPINS.length) { SEL = null; $('bsNoSel').hidden = false; $('bsSel').hidden = true; $('bsWs').classList.remove('focus'); return; }
|
||||
select(SPINS[0].id, true);
|
||||
}
|
||||
function renderTier() {
|
||||
const t = D.tier || {}; const used = SPINS.length;
|
||||
let h;
|
||||
if (!t.ok) h = '<div class="tierbar"><span class="tag warn">LOCKED</span><span>' + esc(t.reason || 'Banner Spin opens with your own package of $25 or more.') + '</span><a class="btn sm" href="/credits">Buy a package</a></div>';
|
||||
else h = '<div class="tierbar"><span class="tag ok">' + esc(t.label) + '</span><span><b>' + used + ' of ' + t.spins + '</b> Banner Spins, up to <b>' + t.banners + '</b> banners each.</span></div>'
|
||||
+ (t.next ? '<div class="muted" style="margin-top:4px">' + esc(t.next.label) + ': ' + t.next.spins + ' Banner Spins x ' + t.next.banners + ' banners, at ' + esc(t.next.need) + '.</div>' : '<div class="muted" style="margin-top:4px">Top tier. Free add-on, nothing to pay.</div>');
|
||||
if (D.off) h += '<div class="note" style="margin-top:6px">Banner Spin is switched off for maintenance. Your placements show a blank image until it is back.</div>';
|
||||
$('bsTier').innerHTML = h;
|
||||
$('bsNoSelText').textContent = t.ok ? 'One image address and one click address that rotate up to ' + t.banners + ' banners, each with its own target. Put it on your site, a forum signature or a safelist once; change the banners here any time.' : (t.reason || '') + ' Your tier then sets how many you can make: Starter 2 x 5 banners, Builder 5 x 15, Leader 10 x 25.';
|
||||
$('bsNewBtn2').hidden = !t.ok; const nb = $('bsNewBtn'); if (nb) nb.disabled = !t.ok || used >= t.spins;
|
||||
}
|
||||
function renderList() {
|
||||
$('bsCount').textContent = SPINS.length + ' Banner Spin' + (SPINS.length === 1 ? '' : 's');
|
||||
$('bsItems').innerHTML = SPINS.length ? SPINS.map(s => { const h = health(s); return '<div class="item' + (s.id === SEL ? ' on' : '') + '" data-id="' + s.id + '" role="button" tabindex="0"><div><div class="nm">' + esc(s.name) + (h.cls !== 'ok' ? ' <span class="tag ' + h.cls + '">' + h.t + '</span>' : '') + '</div><div class="cd">' + esc(s.size) + ' · ' + s.banners.length + ' banner' + (s.banners.length === 1 ? '' : 's') + ' · /i/' + esc(s.code) + '</div></div><div class="rt"><span class="n">' + fmt(s.imps30) + '</span><span class="muted" style="font-size:10px">views 30 d</span></div></div>'; }).join('')
|
||||
: '<div class="empty"><div class="muted">No Banner Spins yet.</div></div>';
|
||||
$('bsItems').querySelectorAll('.item').forEach(el => { const go = () => select(Number(el.dataset.id)); el.addEventListener('click', go); el.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); go(); } }); });
|
||||
}
|
||||
const cur = () => SPINS.find(x => x.id === SEL) || null;
|
||||
function select(id, quiet) {
|
||||
SEL = id; const s = cur(); if (!s) return;
|
||||
if (location.hash !== '#b' + id) history.replaceState(null, '', '#b' + id);
|
||||
$('bsNoSel').hidden = true; $('bsSel').hidden = false; $('bsWs').classList.add('focus');
|
||||
$('bsItems').querySelectorAll('.item').forEach(el => el.classList.toggle('on', Number(el.dataset.id) === id));
|
||||
$('bsName').textContent = s.name; $('bsSize').textContent = s.size;
|
||||
const h = health(s); $('bsLive').innerHTML = '<span class="' + h.cls + '"><span class="dot"></span>' + h.t + '</span>';
|
||||
$('bsPause').textContent = s.paused ? 'Resume' : 'Pause';
|
||||
$('bsHoursChip').textContent = LSHours.chip(s.hours, s.tz); $('bsHoursChip').classList.toggle('set', !!s.hours);
|
||||
$('bsOffNote').hidden = !s.adminOff; if (s.adminOff) $('bsOffNote').textContent = 'LinkSpin took this Banner Spin offline' + (s.adminNote ? ' (' + s.adminNote + ')' : '') + '. Placements show a blank image and clicks go to the fallback. Ask on Help if you think this is a mistake.';
|
||||
renderTiles(s, STATS[id]); renderBanners(s); renderSettings(s); renderCodes(s); renderAddLimit(s);
|
||||
if (!quiet) window.scrollTo({ top: 0 });
|
||||
loadStats(id);
|
||||
}
|
||||
function renderTiles(s, st) {
|
||||
const t = st && st.totals;
|
||||
$('bsTiles').innerHTML = [
|
||||
CR.tile({ k: 'Views, 30 d', v: fmt(s.imps30), hi: true }), CR.tile({ k: 'Views, all time', v: fmt(s.imps) }), CR.tile({ k: 'Clicks', v: fmt(s.clicks) }),
|
||||
CR.tile({ k: 'CTR', v: t && t.ctr != null ? t.ctr + '%' : (s.imps ? (Math.round(s.clicks / s.imps * 10000) / 100) + '%' : '-') }),
|
||||
CR.tile({ k: 'Click match rate', v: t ? pct(t.matchRate) : (s.clicks ? Math.round(s.matched / s.clicks * 100) + '%' : '-') }), CR.tile({ k: 'Conversions', v: fmt(s.conversions) }),
|
||||
CR.tile({ k: 'Live banners', v: s.banners.filter(b => b.active && !b.adminOff).length + ' / ' + s.banners.length })].join('');
|
||||
}
|
||||
// health line under each banner (phase 3): the 30-minute image + target check, auto-pause and auto-resume
|
||||
const ctTime = ts => new Date(ts).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT';
|
||||
function healthLine(b) {
|
||||
const h = b.health;
|
||||
if (b.adminOff) return '';
|
||||
if (!h) return '<span class="muted bhl" data-bhealth="none">Not checked yet. LinkSpin checks each image and target every 30 minutes.</span>';
|
||||
const bad = h.state === 'image' || h.state === 'dead' || h.state === 'parked';
|
||||
if (b.autoPaused) return '<span class="bm bhl" data-bhealth="paused">Auto-paused ' + ctTime(b.autoPaused) + ': ' + esc(h.note) + '. It comes back on its own after two clean checks, or fix it and press Resume.</span>';
|
||||
if (bad) return '<span class="bm bhl" data-bhealth="failing">' + esc(h.note) + (/Kept live/.test(h.note) ? '' : ' (' + h.fails + ' of 3 failed checks pause it)') + ' · checked ' + ctTime(h.checkedAt) + '</span>';
|
||||
if (h.state === 'slow') return '<span class="wm bhl" data-bhealth="slow">' + esc(h.note) + ' · checked ' + ctTime(h.checkedAt) + '</span>';
|
||||
return '<span class="okm bhl" data-bhealth="ok">Image and target OK · checked ' + ctTime(h.checkedAt) + '</span>';
|
||||
}
|
||||
const targetText = b => { if (b.link) { const r = ROT.find(x => x.id === b.link); return r ? 'Spin link: ' + r.name + ' (/r/' + r.code + ')' : 'Spin link (deleted)'; } return b.target; };
|
||||
function renderBanners(s) {
|
||||
const total = s.banners.filter(b => b.active && !b.adminOff).reduce((n, b) => n + b.weight, 0) || 1;
|
||||
const [W, H] = sizeOf(s);
|
||||
$('bsRows').innerHTML = s.banners.length ? s.banners.map(b => { const share = b.active && !b.adminOff ? Math.round(b.weight / total * 100) : 0;
|
||||
return '<div class="rw" data-bid="' + b.id + '"><div style="display:grid;gap:5px;min-width:0"><img class="bthumb" src="' + esc(b.image) + '" alt="" width="' + W + '" height="' + H + '" loading="lazy" referrerpolicy="no-referrer">'
|
||||
+ '<div style="font-weight:700">' + esc(b.label || 'Banner ' + b.id) + (b.hours ? ' <button class="hchip set" type="button" data-bh="' + b.id + '">' + esc(LSHours.text(b.hours)) + '</button>' : '') + '</div>'
|
||||
+ '<div class="mono muted" style="font-size:11px;overflow-wrap:anywhere">' + esc(targetText(b)) + '</div>'
|
||||
+ '<div style="font-size:11px">' + (b.w ? '<span class="' + (b.warn ? 'wm' : 'okm') + '">' + b.w + 'x' + b.h + (b.bytes ? ', ' + kb(b.bytes) : '') + (b.warn ? ', not ' + esc(s.size) : ', fits') + '</span>' : '<span class="muted">pasted image, size not checked</span>') + '</div>'
|
||||
+ '<div>' + healthLine(b) + '</div></div>'
|
||||
+ '<div class="wrow"><div class="bar" style="width:60px"><i style="width:' + share + '%"></i></div><input class="field mono" type="number" min="1" max="100" value="' + b.weight + '" data-w="' + b.id + '" aria-label="Weight"><span class="mono muted" style="font-size:11px">' + share + '%</span></div>'
|
||||
+ '<span class="r num"><span class="ml">Views </span>' + fmt(b.imps) + '</span><span class="r num"><span class="ml">Clicks </span>' + fmt(b.clicks) + '</span>'
|
||||
+ '<span class="tag ' + (b.adminOff ? 'bad' : b.autoPaused ? 'warn' : b.active ? 'ok' : 'dim') + '">' + (b.adminOff ? 'OFFLINE' : b.autoPaused ? 'AUTO-PAUSED' : b.active ? 'LIVE' : 'PAUSED') + '</span>'
|
||||
+ '<span style="display:flex;gap:6px;justify-content:flex-end"><button class="btn sm" type="button" data-bh="' + b.id + '" title="Hours for this banner" aria-label="Hours for this banner"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></button><button class="btn sm" type="button" data-t="' + b.id + '">' + (b.active ? 'Pause' : 'Resume') + '</button><button class="btn sm danger" type="button" data-x="' + b.id + '" aria-label="Remove">×</button></span></div>'
|
||||
+ (BHE && BHE.sid === s.id && BHE.bid === b.id ? '<div class="rw edit" data-he="' + b.id + '"></div>' : ''); }).join('')
|
||||
: '<div class="rw"><span class="muted">No banners yet. Add the first one below. Until then every placement shows the fallback.</span></div>';
|
||||
$('bsFoot').textContent = 'weights are shares of the rotation · ' + (s.mode === 'visitor' ? 'one banner per visitor per day' : 'a fresh pick on every page view') + ' · fallback: ' + (s.fallback || 'none set') + (s.fallbackImps ? ' · fallback shown ' + fmt(s.fallbackImps) + ' times' : '');
|
||||
const heHost = $('bsRows').querySelector('[data-he]');
|
||||
if (heHost) { const b = s.banners.find(q => q.id === Number(heHost.dataset.he));
|
||||
LSHours.editor(heHost, { hours: b.hours, rotTz: s.tz, onCancel: () => { BHE = null; renderBanners(s); }, onSave: async hours => { try { await api('/api/my/bannerspins/' + s.id + '/banner/' + b.id, { hours }); BHE = null; toast(hours ? 'Hours saved' : 'Banner is always on'); load(true); } catch (e) { toast(e.message, true); } } }); }
|
||||
$('bsRows').querySelectorAll('[data-bh]').forEach(x => x.addEventListener('click', () => { const bid = Number(x.dataset.bh); BHE = BHE && BHE.bid === bid ? null : { sid: s.id, bid }; renderBanners(s); }));
|
||||
$('bsRows').querySelectorAll('[data-w]').forEach(i => i.addEventListener('change', async () => { try { await api('/api/my/bannerspins/' + s.id + '/banner/' + i.dataset.w, { weight: i.value }); toast('Weight saved'); load(true); } catch (e) { toast(e.message, true); } }));
|
||||
$('bsRows').querySelectorAll('[data-t]').forEach(x => x.addEventListener('click', async () => { const b = s.banners.find(q => q.id === Number(x.dataset.t)); try { await api('/api/my/bannerspins/' + s.id + '/banner/' + b.id, { active: !b.active }); load(true); } catch (e) { toast(e.message, true); } }));
|
||||
$('bsRows').querySelectorAll('[data-x]').forEach(x => x.addEventListener('click', async () => { if (!await dialog({ title: 'Remove this banner?', text: 'Its numbers stay in the stats.', ok: 'Remove', danger: true })) return; try { await api('/api/my/bannerspins/' + s.id + '/banner/' + x.dataset.x, { remove: true }); toast('Removed'); load(true); } catch (e) { toast(e.message, true); } }));
|
||||
// the "a click goes to" picker: a page address, or one of the member's spin links
|
||||
const sel = $('bsTgtKind'); const was = sel.value;
|
||||
sel.innerHTML = '<option value="url">A page address</option>' + ROT.map(r => '<option value="' + r.id + '">Spin link: ' + esc(r.name) + '</option>').join('');
|
||||
if ([...sel.options].some(o => o.value === was)) sel.value = was; $('bsTgtUrlWrap').hidden = sel.value !== 'url';
|
||||
}
|
||||
function renderAddLimit(s) {
|
||||
const t = D.tier || {}; const full = t.ok && s.banners.length >= t.banners;
|
||||
$('bsAddBtn').disabled = !t.ok || full;
|
||||
$('bsAddNote').innerHTML = !t.ok ? esc(t.reason || '') : full ? 'This Banner Spin holds ' + t.banners + ' banners on your ' + esc(t.label) + ' tier.' + (t.next ? ' ' + esc(t.next.label) + ' (' + esc(t.next.need) + ') holds ' + t.next.banners + '.' : '') : s.banners.length + ' of ' + t.banners + ' banners · uploads count toward your 10 files a day';
|
||||
}
|
||||
|
||||
// ── image checks: real size preview, wrong size / over limit warnings ──
|
||||
function measure(src) { return new Promise(res => { const im = new Image(); im.onload = () => res({ w: im.naturalWidth, h: im.naturalHeight }); im.onerror = () => res(null); im.referrerPolicy = 'no-referrer'; im.src = src; }); }
|
||||
function checkLine(s, d, bytes, kind) {
|
||||
const [W, H] = sizeOf(s); const out = [];
|
||||
if (kind && !/^image\/(png|jpeg|gif)$/.test(kind)) out.push('<span class="bm">Use a JPG, PNG or GIF file.</span>');
|
||||
if (bytes != null && bytes > MAXB()) out.push('<span class="bm">' + kb(bytes) + ' is over the 150 KB limit. Save it smaller (fewer colors or frames for a GIF).</span>');
|
||||
if (d && (d.w !== W || d.h !== H)) out.push('<span class="wm">This image is ' + d.w + 'x' + d.h + '; this Banner Spin is ' + W + 'x' + H + '. It would be stretched to fit. Use a ' + W + 'x' + H + ' image.</span>');
|
||||
if (d && d.w === W && d.h === H) out.push('<span class="okm">' + W + 'x' + H + (bytes != null ? ', ' + kb(bytes) : '') + ': fits this Banner Spin.</span>');
|
||||
if (!d) out.push('<span class="bm">That image did not load. Check the address.</span>');
|
||||
return out.join('<br>');
|
||||
}
|
||||
async function preview(host, s, src, bytes, kind) {
|
||||
const [W, H] = sizeOf(s);
|
||||
if (!src) { host.innerHTML = '<div class="bframe" style="width:' + W + 'px;height:' + H + 'px">' + W + 'x' + H + '</div><div class="muted" style="font-size:11px">Preview at real size</div>'; return null; }
|
||||
const d = await measure(src);
|
||||
host.innerHTML = (d ? '<img src="' + esc(src) + '" alt="" style="width:' + W + 'px;height:' + H + 'px" referrerpolicy="no-referrer">' : '') + '<div style="font-size:12px">' + checkLine(s, d, bytes, kind) + '</div><div class="muted" style="font-size:11px">Preview at real size, ' + W + 'x' + H + '</div>';
|
||||
return d;
|
||||
}
|
||||
async function pickFile(input, host, s, state) {
|
||||
const f = input.files && input.files[0]; if (!f) { state.file = null; return preview(host, s, null); }
|
||||
state.file = f; state.url = '';
|
||||
const u = URL.createObjectURL(f); const d = await preview(host, s, u, f.size, f.type); state.d = d; state.ok = !!d && f.size <= MAXB() && /^image\/(png|jpeg|gif)$/.test(f.type);
|
||||
}
|
||||
async function upload(f, s) {
|
||||
const r = await (await fetch('/api/my/bannerspins/upload?size=' + encodeURIComponent(s.size), { method: 'POST', headers: { 'Content-Type': f.type }, body: f })).json();
|
||||
if (r.error) throw new Error(r.error); return r;
|
||||
}
|
||||
// add a banner: upload first when a file is chosen, then save
|
||||
$('bsFile').addEventListener('change', () => { const s = cur(); if (!s) return; $('bsImgUrl').value = ''; PEND = PEND || {}; pickFile($('bsFile'), $('bsPrev'), s, PEND); });
|
||||
$('bsImgUrl').addEventListener('change', async () => { const s = cur(); if (!s) return; $('bsFile').value = ''; PEND = { url: $('bsImgUrl').value.trim() }; PEND.d = await preview($('bsPrev'), s, PEND.url || null); PEND.ok = !!PEND.d; });
|
||||
$('bsTgtKind').addEventListener('change', () => { $('bsTgtUrlWrap').hidden = $('bsTgtKind').value !== 'url'; });
|
||||
$('bsAddBtn').addEventListener('click', async () => {
|
||||
const s = cur(); if (!s) return; const P = PEND || {};
|
||||
if (!P.file && !P.url) { toast('Choose an image to upload or paste an image address', true); return; }
|
||||
if (P.file && !P.ok) { toast('Fix the image first (type, 150 KB limit)', true); return; }
|
||||
const body = { weight: $('bsWeight').value, label: $('bsLabel').value };
|
||||
if ($('bsTgtKind').value === 'url') { body.target = $('bsTgtUrl').value.trim(); if (!body.target) { $('bsTgtUrl').focus(); toast('Where should a click go?', true); return; } } else body.link = $('bsTgtKind').value;
|
||||
const b = $('bsAddBtn'); b.disabled = true;
|
||||
try {
|
||||
if (P.file) { const up = await upload(P.file, s); body.image = up.url; } else { body.image = P.url; if (P.d) { body.w = P.d.w; body.h = P.d.h; } }
|
||||
const r = await api('/api/my/bannerspins/' + s.id + '/banner', body);
|
||||
toast(r.warn ? 'Added. ' + r.warn : 'Banner added', !!r.warn);
|
||||
PEND = null; $('bsFile').value = ''; $('bsImgUrl').value = ''; $('bsLabel').value = ''; $('bsTgtUrl').value = ''; preview($('bsPrev'), s, null);
|
||||
await load(true);
|
||||
} catch (e) { toast(e.message, true); }
|
||||
b.disabled = false; renderAddLimit(cur() || s);
|
||||
});
|
||||
|
||||
// ── settings ──
|
||||
function renderSettings(s) {
|
||||
document.querySelectorAll('input[name="bsMode"]').forEach(r => { r.checked = r.value === (s.mode || 'weight'); });
|
||||
$('bsSrc').innerHTML = '<option value="">None</option>' + SRC.map(x => '<option value="' + x.id + '"' + (x.id === s.sourceId ? ' selected' : '') + '>' + esc(x.name) + (x.site ? ' · ' + esc(x.site) : '') + '</option>').join('');
|
||||
if (document.activeElement !== $('bsFallback')) $('bsFallback').value = s.fallback || '';
|
||||
if (!FB || FB.sid !== s.id) { FB = { sid: s.id }; $('bsFbFile').value = ''; $('bsFbUrl').value = /^https:/.test(s.fallbackImage || '') ? s.fallbackImage : ''; preview($('bsFbPrev'), s, s.fallbackImage || null); }
|
||||
$('bsFbClear').hidden = !s.fallbackImage;
|
||||
if (!(HRS && HRS.sid === s.id && HRS.dirty)) { HRS = { sid: s.id, dirty: false };
|
||||
LSHours.editor($('bsHours'), { hours: s.hours, tz: s.tz || 'visitor', onCancel: () => { HRS = null; renderSettings(s); }, onSave: async (hours, tz) => { try { await api('/api/my/bannerspins/' + s.id, { hours, tz }); HRS = null; toast(hours ? 'Hours saved' : 'Banner Spin is always on'); load(true); } catch (e) { toast(e.message, true); } } });
|
||||
$('bsHours').addEventListener('pointerdown', () => { if (HRS) HRS.dirty = true; }, { once: true }); }
|
||||
}
|
||||
document.querySelectorAll('input[name="bsMode"]').forEach(r => r.addEventListener('change', async () => { const s = cur(); if (!s || !r.checked) return; try { await api('/api/my/bannerspins/' + s.id, { mode: r.value }); toast(r.value === 'visitor' ? 'One banner per visitor per day' : 'Random by weight on every view'); load(true); } catch (e) { toast(e.message, true); } }));
|
||||
$('bsSrc').addEventListener('change', async () => { const s = cur(); if (!s) return; try { await api('/api/my/bannerspins/' + s.id, { sourceId: $('bsSrc').value }); toast($('bsSrc').value ? 'Source saved' : 'Source removed'); load(true); } catch (e) { toast(e.message, true); } });
|
||||
$('bsFbFile').addEventListener('change', () => { const s = cur(); if (!s) return; $('bsFbUrl').value = ''; FB = { sid: s.id }; pickFile($('bsFbFile'), $('bsFbPrev'), s, FB); });
|
||||
$('bsFbUrl').addEventListener('change', async () => { const s = cur(); if (!s) return; $('bsFbFile').value = ''; FB = { sid: s.id, url: $('bsFbUrl').value.trim() }; FB.d = await preview($('bsFbPrev'), s, FB.url || null); });
|
||||
$('bsFbSave').addEventListener('click', async () => {
|
||||
const s = cur(); if (!s) return; const body = { fallback: $('bsFallback').value.trim() };
|
||||
try {
|
||||
if (FB && FB.file) { if (!FB.ok) { toast('Fix the fallback image first', true); return; } body.fallbackImage = (await upload(FB.file, s)).url; }
|
||||
else if (FB && FB.url) body.fallbackImage = FB.url;
|
||||
await api('/api/my/bannerspins/' + s.id, body); FB = null; toast('Fallback saved'); load(true);
|
||||
} catch (e) { toast(e.message, true); }
|
||||
});
|
||||
$('bsFbClear').addEventListener('click', async () => { const s = cur(); if (!s) return; try { await api('/api/my/bannerspins/' + s.id, { fallbackImage: '' }); FB = null; toast('Fallback image removed'); load(true); } catch (e) { toast(e.message, true); } });
|
||||
|
||||
// ── the four embeds ──
|
||||
function renderCodes(s) {
|
||||
const hs = (D && D.hosts) || [];
|
||||
$('bsHost').innerHTML = hs.map(h => '<option value="' + esc(h.host) + '"' + (h.host === HOST ? ' selected' : '') + '>' + esc(h.host) + ' · ' + esc(h.label || h.channel) + '</option>').join('');
|
||||
const hh = hs.find(h => h.host === HOST); $('bsHostNote').textContent = hh && hh.note ? 'Meant for: ' + hh.note : '';
|
||||
const [W, H] = sizeOf(s); const src = SRC.find(x => x.id === s.sourceId);
|
||||
const qs = src && (src.params || []).length ? '?' + src.params.map(p => p.key + '=' + p.token).join('&') : '';
|
||||
const blocks = [
|
||||
['Image address + click address', 'For any place that asks for an image URL and a link URL (safelists, traffic exchanges, forum profiles).', imgUrl(s) + '\n' + clickUrl(s) + qs],
|
||||
['HTML snippet', 'For your own website or blog.', '<a href="' + clickUrl(s) + qs + '" target="_blank" rel="noopener"><img src="' + imgUrl(s) + '" width="' + W + '" height="' + H + '" alt="" style="border:0"></a>'],
|
||||
['Script tag (exact match)', 'Writes the banner and its own click link together, so every click lands on the right target. Use it wherever scripts are allowed.', '<script src="' + jsUrl(s) + '"></script>'],
|
||||
['Forum BBCode', 'For forum signatures and posts.', '[url=' + clickUrl(s) + qs + '][img]' + imgUrl(s) + '[/img][/url]']];
|
||||
$('bsCodes').innerHTML = blocks.map(([t, n, code], i) => '<div class="panel code-blk"><div class="hd2"><b>' + esc(t) + '</b><button class="btn sm pri" type="button" data-cp="' + i + '">Copy</button></div><div class="muted" style="font-size:12px">' + esc(n) + '</div><pre id="bsCode-' + i + '">' + esc(code) + '</pre>'
|
||||
+ (i === 0 ? '<div style="display:flex;gap:6px;flex-wrap:wrap"><button class="btn sm" type="button" data-cp1="img">Copy image address</button><button class="btn sm" type="button" data-cp1="click">Copy click address</button></div>' : '') + '</div>').join('')
|
||||
+ (src ? '<div class="muted" style="font-size:12px">The click address carries ' + esc(src.name) + '\'s macros, so its conversions fire that source\'s postback.</div>' : '');
|
||||
$('bsCodes').querySelectorAll('[data-cp]').forEach(b => b.addEventListener('click', () => CR.copy($('bsCode-' + b.dataset.cp).textContent)));
|
||||
$('bsCodes').querySelectorAll('[data-cp1]').forEach(b => b.addEventListener('click', () => CR.copy(b.dataset.cp1 === 'img' ? imgUrl(s) : clickUrl(s) + qs)));
|
||||
}
|
||||
$('bsHost').addEventListener('change', () => { HOST = $('bsHost').value; const s = cur(); if (s) renderCodes(s); });
|
||||
|
||||
// ── stats ──
|
||||
async function loadStats(id) {
|
||||
let st = STATS[id]; if (!st) { try { st = await CR.get('/api/my/bannerspins/' + id + '/stats'); } catch (e) { return; } STATS[id] = st; setTimeout(() => { delete STATS[id]; }, 30000); }
|
||||
if (SEL !== id) return; const s = cur(); if (s) renderTiles(s, st);
|
||||
// seven columns: name, views, second number (uniques for a banner, every image load for a placement), clicks, CTR, matched, last
|
||||
const cell = (label, v) => '<span class="r num"><span class="ml">' + label + ' </span>' + v + '</span>';
|
||||
const row = (name, o, second, secondLabel, last, lastLabel) => '<div class="rw"><span style="overflow-wrap:anywhere">' + name + '</span>' + cell('Views', fmt(o.imps)) + cell(secondLabel, second == null ? '-' : fmt(second)) + cell('Clicks', fmt(o.clicks))
|
||||
+ cell('CTR', o.ctr == null ? '-' : o.ctr + '%') + cell('Matched', o.matchRate == null ? '-' : o.matchRate + '%') + '<span class="r num">' + (last == null ? '' : (lastLabel ? '<span class="ml">' + lastLabel + ' </span>' : '') + last) + '</span></div>';
|
||||
$('bsStB').innerHTML = st.banners.length ? st.banners.map(b => row('<img src="' + esc(b.image) + '" alt="" style="max-height:28px;max-width:120px;vertical-align:middle;margin-right:6px" referrerpolicy="no-referrer">' + esc(b.label || 'Banner ' + b.id) + (b.winner ? '<span class="bswin" data-winner="' + b.id + '">WINNER</span>' : ''), b, b.uniques, 'Unique', fmt(b.conversions), 'Conv')).join('')
|
||||
+ (st.fallback.imps || st.fallback.clicks ? row('<span class="muted">Fallback</span>', Object.assign({ matchRate: null }, st.fallback), null, 'Unique', null) : '') : '<div class="rw"><span class="muted">No banners yet.</span></div>';
|
||||
const wm = st.winMin || 1000;
|
||||
$('bsWinNote').textContent = st.winner ? 'WINNER = the best click rate among banners with at least ' + fmt(wm) + ' views each. LinkSpin never changes the weights for you: raise the winner or pause the rest when you are ready.' : 'A WINNER badge appears once two or more live banners have ' + fmt(wm) + ' views each and one leads on click rate. Unique viewers are counted per day from a sample.';
|
||||
$('bsStP').innerHTML = st.placements.length ? st.placements.map(p => row(esc(p.host === '(none)' ? 'No referrer (email, apps, privacy settings)' : p.host) + (p.caches ? '<span class="bscache" data-caches="' + esc(p.host) + '"><b>Caches banners:</b> ' + esc(p.caches) + '</span>' : ''), p, p.loads, 'Loads', p.caches ? '<span class="tag warn" title="' + esc(p.caches) + '">CACHED</span>' : '', '')).join('') : '<div class="rw"><span class="muted">No views yet. Put the code on a page and load it.</span></div>';
|
||||
const kv = (rows, empty) => rows && rows.length ? rows.map(x => '<span>' + esc(x.k) + '</span><span class="bar"><i style="width:' + Math.round(x.n / (rows[0].n || 1) * 100) + '%"></i></span><span class="r num">' + fmt(x.n) + '</span>').join('') : '<span class="muted">' + empty + '</span><span></span><span></span>';
|
||||
$('bsStC').innerHTML = kv(st.country, 'no clicks yet'); $('bsStD').innerHTML = kv(st.device, 'no clicks yet');
|
||||
$('bsStBots').textContent = 'Shown separately and never counted as views or clicks: ' + fmt(st.totals.botLoads || 0) + ' bot and prefetch image loads, ' + fmt(st.totals.serverLoads || 0) + ' loads by servers or mail image proxies, ' + fmt(st.totals.bots || 0) + ' bot clicks.';
|
||||
const days = st.days || []; const dmax = Math.max(1, ...days.map(d => d.imps));
|
||||
$('bsDayBars').style.gridTemplateColumns = 'repeat(' + Math.max(1, days.length) + ',minmax(0,1fr))';
|
||||
$('bsDayBars').innerHTML = days.map(d => '<i style="height:' + Math.round(d.imps / dmax * 100) + '%" title="' + d.day + ' · ' + d.imps + ' views, ' + d.clicks + ' clicks, ' + ((d.bots || 0) + (d.servers || 0)) + ' bot or server loads"></i>').join('');
|
||||
$('bsDayAxis').innerHTML = days.length ? '<span>' + days[0].day + '</span><span>' + days[days.length - 1].day + '</span>' : '<span class="muted">no views recorded yet</span>';
|
||||
const t = st.totals; $('bsStNote').textContent = 'Views are counted on the server: bots and link previews are left out and one visitor reloading counts once a minute per banner. Matched = clicks we could tie to the banner that visitor saw (' + fmt(t.matched) + ' matched, ' + fmt(t.unmatched) + ' went to the fallback). About ' + fmt(t.uniquesSampled) + ' unique visitors (sampled).';
|
||||
}
|
||||
|
||||
// ── header actions ──
|
||||
async function newSpin() {
|
||||
const t = D && D.tier; if (!t || !t.ok) { toast((t && t.reason) || 'Banner Spin is locked', true); return; }
|
||||
if (SPINS.length >= t.spins) { toast('Your ' + t.label + ' tier holds ' + t.spins + ' Banner Spins', true); return; }
|
||||
let size = '468x60';
|
||||
const p = dialog({ title: 'New Banner Spin', text: 'One size per Banner Spin. Every banner in it should be that exact size.', html: '<label class="lbl">Size<select class="field mono" id="bsNewSize">' + ((D && D.sizes) || ['468x60']).map(z => '<option value="' + z + '"' + (z === size ? ' selected' : '') + '>' + z + '</option>').join('') + '</select></label>', fields: [{ k: 'name', label: 'Name (only you see it)', placeholder: 'Forum signature', max: 80 }, { k: 'fallback', label: 'Fallback page, where unmatched clicks go (you can set it later)', placeholder: 'https://', mono: true, type: 'url' }], ok: 'Create' });
|
||||
const ns = $('bsNewSize'); if (ns) ns.addEventListener('change', () => { size = ns.value; });
|
||||
const v = await p; if (!v || !v.name.trim()) return;
|
||||
try { const r = await api('/api/my/bannerspins', { name: v.name, size, fallback: v.fallback }); SEL = r.spin.id; toast('Banner Spin created. Add your banners.'); await load(true); } catch (e) { toast(e.message, true); }
|
||||
}
|
||||
const nb = $('bsNewBtn'); if (nb) nb.addEventListener('click', newSpin); $('bsNewBtn2').addEventListener('click', newSpin);
|
||||
$('bsBack').addEventListener('click', () => $('bsWs').classList.remove('focus'));
|
||||
$('bsBack').hidden = !window.matchMedia('(max-width:760px)').matches;
|
||||
$('bsRename').addEventListener('click', async () => { const s = cur(); if (!s) return; const v = await dialog({ title: 'Rename', fields: [{ k: 'name', label: 'Name', value: s.name, max: 80 }], ok: 'Save' }); if (!v || !v.name.trim()) return; try { await api('/api/my/bannerspins/' + s.id, { name: v.name }); load(true); } catch (e) { toast(e.message, true); } });
|
||||
$('bsPause').addEventListener('click', async () => { const s = cur(); if (!s) return; try { await api('/api/my/bannerspins/' + s.id, { paused: !s.paused }); toast(s.paused ? 'Live again' : 'Paused: placements show the fallback'); load(true); } catch (e) { toast(e.message, true); } });
|
||||
$('bsDel').addEventListener('click', async () => { const s = cur(); if (!s) return; if (!await dialog({ title: 'Delete ' + s.name + '?', text: 'Every placement using this image and click address stops working. This cannot be undone.', ok: 'Delete', danger: true })) return; try { await api('/api/my/bannerspins/' + s.id, { remove: true }); SEL = null; history.replaceState(null, '', '#b'); toast('Deleted'); load(); } catch (e) { toast(e.message, true); } });
|
||||
$('bsHoursChip').addEventListener('click', () => { showTab('settings'); const h = $('bsHours'); if (h.scrollIntoView) h.scrollIntoView({ block: 'start', behavior: 'smooth' }); });
|
||||
const TABS = ['banners', 'settings', 'code', 'stats'];
|
||||
const showTab = name => { $('bsTabs').querySelectorAll('button').forEach(x => x.classList.toggle('on', x.dataset.tab === name)); TABS.forEach(t => { $('bs-' + t).hidden = t !== name; }); if (name === 'stats' && SEL) { delete STATS[SEL]; loadStats(SEL); } };
|
||||
$('bsTabs').querySelectorAll('button').forEach(b => b.addEventListener('click', () => showTab(b.dataset.tab)));
|
||||
// links.js owns the session check and calls ready() once signed in (one sign-in flow per page)
|
||||
let READY = false;
|
||||
window.BannerSpin = { setView, showTab, load, ready: () => { if (READY) return; READY = true; if (/^#b/.test(location.hash)) setView('banners'); setInterval(() => { if (!document.hidden && !$('bsWs').hidden) load(true); }, 60000); } };
|
||||
})();
|
||||
@@ -27,7 +27,7 @@ window.IAP = (function () {
|
||||
const c = await getConfig();
|
||||
const nav = document.createElement('nav');
|
||||
nav.innerHTML = '<div class="wrap">'
|
||||
+ '<span class="logo-wrap"><a class="logo" href="/"><span class="wordmark"><svg viewBox="0 0 24 24" fill="none" stroke="#8cc8ff" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 0 1 14-5.3"/><path d="M18 3v4h-4"/><path d="M20 12a8 8 0 0 1-14 5.3"/><path d="M6 21v-4h4"/></svg>Link<b>Spin</b></span></a><span class="byline">Brought to you by the <b>Crypto Team Build Network</b></span></span>'
|
||||
+ '<span class="logo-wrap"><a class="logo" href="/"><span class="wordmark"><svg viewBox="0 0 24 24" fill="none" style="stroke:var(--mint-hi)" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 0 1 14-5.3"/><path d="M18 3v4h-4"/><path d="M20 12a8 8 0 0 1-14 5.3"/><path d="M6 21v-4h4"/></svg>Link<b>Spin</b></span></a><span class="byline">Brought to you by the <b>Crypto Team Build Network</b></span></span>'
|
||||
+ '<span class="links">'
|
||||
+ '<a href="/#how" data-p="home">How it works</a>'
|
||||
+ '<a href="/#packages" data-p="pricing">Ad packages</a>'
|
||||
@@ -93,7 +93,7 @@ window.IAP = (function () {
|
||||
case 'AdminPaid': return 'platform fee settled: ' + pol(ev.amountWei);
|
||||
case 'BuyerCounted': return '' + nm(ev.sponsorId) + ' now has ' + ev.newCount + ' qualifying buyer(s)';
|
||||
case 'MemberActivated': return '' + nm(ev.id) + ' activated a payout wallet';
|
||||
case 'AwardPaid': return 'award: ' + pol(ev.amountWei) + ' → ' + nm(ev.toId);
|
||||
case 'AwardPaid': return ev.override ? 'Level 4 override' + (ev.overrideWeek ? ' (week of ' + ev.overrideWeek + ')' : '') + ': ' + pol(ev.amountWei) + ' → ' + nm(ev.toId) : 'award: ' + pol(ev.amountWei) + ' → ' + nm(ev.toId);
|
||||
case 'CreditsConsumed': return '' + nm(ev.memberId) + ' ran ads: −' + ev.amount.toLocaleString() + ' credits';
|
||||
case 'PriceCached': return 'oracle price refreshed';
|
||||
case 'FallbackPriceUsed': return 'cached price bridged an oracle gap';
|
||||
@@ -202,7 +202,7 @@ window.IAP = (function () {
|
||||
how: 'Wallet tab, one small transaction. It registers your address with the contract.',
|
||||
why: 'The contract binds each buyer to their sponsor at their first purchase. If payouts are off when your first person buys, that commission is not yours.' },
|
||||
{ key: 'level2', title: 'Qualify: open level 2', done: bc >= 2, href: '/credits', cta: 'Buy packages',
|
||||
how: 'Two of your people buy a $20 or more package. Or use Qualified Start: add two positions from extra wallets in your own MetaMask and buy a $20 package from each (about $23 of POL in each wallet).',
|
||||
how: 'Two of your people buy a $25 or more package. Or use Qualified Start: add two positions from extra wallets in your own MetaMask and buy a $25 package from each (about $23 of POL in each wallet).',
|
||||
why: 'Until you have two qualifying buyers, every level 2 payment from your team climbs past you.',
|
||||
note: 'Qualifying buyers so far: <b>' + bc + '</b> of 2.' },
|
||||
{ key: 'level3', title: 'The leader play: open all three levels', done: bc >= 5, href: '/credits', cta: 'Qualified Start',
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
const $ = id => document.getElementById(id);
|
||||
let c = {}; try { c = await (await fetch('/api/config')).json(); } catch (e) {}
|
||||
const addr = String(c.contract || '');
|
||||
// Level 4 override panel (2026-10-23): only when the site setting overrideMode is 'live' and overrideGoLive is set
|
||||
if (String(c.overrideMode || '') === 'live' && Number(c.overrideGoLive) && $('ovPanel')) {
|
||||
const d = new Date(Number(c.overrideGoLive)).toLocaleDateString('en-US', { timeZone: 'America/Chicago', month: 'long', day: 'numeric', year: 'numeric' });
|
||||
document.querySelectorAll('[data-ov-start]').forEach(e => { e.textContent = d; }); $('ovPanel').hidden = false;
|
||||
}
|
||||
$('cAddr').textContent = addr || 'not deployed yet';
|
||||
$('cChain').textContent = c.chainName || '';
|
||||
const src = 'https://repo.sourcify.dev/contracts/full_match/' + (c.chainId || 137) + '/' + addr + '/';
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Conversion tracking guide (/conversion-tracking, 2026-10-24): the Copy buttons on the code examples, and inside a
|
||||
// traffic-exchange frame (session and sponsor cookies are dropped there) sign-in, join, Control Room and off-site links
|
||||
// open in a new tab, /join carrying the ?ref= this page was opened with (same rule as refuel-guide.js).
|
||||
(function () {
|
||||
function flash(b, t) { var o = b.getAttribute('data-label') || b.textContent; b.setAttribute('data-label', o); b.textContent = t; setTimeout(function () { b.textContent = o; }, 1600); }
|
||||
document.querySelectorAll('[data-copy]').forEach(function (b) {
|
||||
b.addEventListener('click', function () {
|
||||
var box = b.closest('.cg-code'); var pre = box && box.querySelector('pre'); if (!pre) return;
|
||||
var text = pre.textContent;
|
||||
var fallback = function () {
|
||||
try { var r = document.createRange(); r.selectNodeContents(pre); var s = window.getSelection(); s.removeAllRanges(); s.addRange(r); var ok = document.execCommand && document.execCommand('copy'); flash(b, ok ? 'Copied' : 'Selected'); }
|
||||
catch (e) { flash(b, 'Select and copy'); }
|
||||
};
|
||||
try { if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text).then(function () { flash(b, 'Copied'); }, fallback); else fallback(); } catch (e) { fallback(); }
|
||||
});
|
||||
});
|
||||
var framed = false; try { framed = window.top !== window.self; } catch (e) { framed = true; }
|
||||
if (!framed) return;
|
||||
var ref = ''; try { ref = new URLSearchParams(location.search).get('ref') || ''; } catch (e) {}
|
||||
ref = String(ref).toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 40);
|
||||
document.querySelectorAll('a[href]').forEach(function (a) {
|
||||
var h = a.getAttribute('href') || ''; if (h.charAt(0) === '#') return;
|
||||
var member = a.host === location.host && /^\/(join|credits|ads|links|sources|conversions|signin|login)(\/|$)/.test(a.pathname);
|
||||
if (member && ref && a.pathname === '/join' && !/[?&]ref=/.test(a.search)) a.search = (a.search ? a.search + '&' : '?') + 'ref=' + ref;
|
||||
if (member || a.host !== location.host) { a.target = '_blank'; a.rel = 'noopener'; }
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,71 @@
|
||||
// LinkSpin Conversions (conversion pixel, 2026-10-23): goals + pixel ids, the two snippets, a test button, and per goal the
|
||||
// conversions and cost per goal by ad campaign (LinkSpin and InstantAdPay), spin link, destination and traffic source.
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt;
|
||||
let RANGE = 30, D = null, PICK = '';
|
||||
CR.mount({ active: 'conversions', title: 'Conversions', sub: 'loading', actions: '<span style="display:inline-flex;gap:8px;align-items:center"><div class="range" id="range"><button type="button" data-d="7">7d</button><button type="button" data-d="30" class="on">30d</button><button type="button" data-d="90">90d</button></div> <a class="btn" id="csvBtn" href="/api/my/conversions.csv?days=30">CSV</a></span>' });
|
||||
$('range').querySelectorAll('button').forEach(b => b.addEventListener('click', () => { RANGE = Number(b.dataset.d); $('range').querySelectorAll('button').forEach(x => x.classList.toggle('on', x === b)); $('csvBtn').href = '/api/my/conversions.csv?days=' + RANGE; load(); }));
|
||||
const ago = ts => { if (!ts) return 'never'; const m = Math.round((Date.now() - ts) / 60000); return m < 1 ? 'just now' : m < 60 ? m + ' min ago' : m < 1440 ? Math.round(m / 60) + ' h ago' : Math.round(m / 1440) + ' d ago'; };
|
||||
const money = v => v ? '$' + Number(v).toFixed(2) : '';
|
||||
const METH = [['url', 'Address'], ['stored', 'Kept'], ['cookie', 'Cookie'], ['soft', '24 h match']];
|
||||
function snippets() {
|
||||
const g = (D.goals || []).find(x => x.px === PICK) || (D.goals || [])[0];
|
||||
const base = D.base || ('https://' + (D.host || 'linkspin.app'));
|
||||
if (!g) { ['snTag', 'snImg', 'snJs'].forEach(k => { $(k).textContent = 'Add a goal first. Its snippets show here.'; }); $('testBtn').disabled = true; $('testNote').textContent = ''; return; }
|
||||
$('testBtn').disabled = false;
|
||||
$('snTag').textContent = '<script async src="' + base + '/t.js?px=' + g.px + '"></script>';
|
||||
$('snImg').textContent = '<img src="' + base + '/cv.gif?px=' + g.px + '&goal=' + g.name + '" width="1" height="1" alt="" style="display:none">';
|
||||
$('snJs').textContent = '<script async src="' + base + '/cv.js?px=' + g.px + '&goal=' + g.name + '"></script>';
|
||||
$('testNote').textContent = g.lastTest ? 'Last test received ' + ago(g.lastTest) : 'No test received yet';
|
||||
}
|
||||
function paint() {
|
||||
const goals = D.goals || [];
|
||||
CR.sub(RANGE + ' days · ' + goals.length + ' goal' + (goals.length === 1 ? '' : 's') + ' · ' + fmt(D.total || 0) + ' counted');
|
||||
$('goalRows').innerHTML = goals.length ? goals.map(g => '<div class="rw"><span><b>' + esc(g.name) + '</b><span class="muted" style="display:block;font-size:11px">last ' + esc(ago(g.lastAt)) + (g.lastTest ? ' · test ' + esc(ago(g.lastTest)) : '') + '</span></span><span class="mono">' + esc(g.px) + '</span><span class="r num">' + (g.value ? esc(money(g.value)) : '<span class="muted">none</span>') + '</span><span class="r num">' + fmt(g.conv) + '</span><span class="r"><button class="btn sm" type="button" data-pick="' + g.px + '">Snippets</button> <button class="btn sm" type="button" data-edit="' + g.px + '">Edit</button> <button class="btn sm" type="button" data-del="' + g.px + '">Remove</button></span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">No goals yet. Add one, for example <b>subscriber</b> or <b>sale</b>.</span><span></span><span></span><span></span><span></span></div>';
|
||||
if (!goals.some(g => g.px === PICK)) PICK = goals.length ? goals[0].px : '';
|
||||
$('goalPick').innerHTML = goals.map(g => '<option value="' + g.px + '"' + (g.px === PICK ? ' selected' : '') + '>' + esc(g.name) + '</option>').join('');
|
||||
snippets();
|
||||
const m = D.methods || {}; const tot = METH.reduce((n, [k]) => n + (m[k] || 0), 0);
|
||||
$('methRows').innerHTML = METH.map(([k, label]) => '<div class="m"><span class="k">' + label + '</span><span class="v">' + fmt(m[k] || 0) + '</span><span class="muted mono" style="font-size:11px">' + (tot ? Math.round((m[k] || 0) / tot * 100) + '%' : '·') + '</span></div>').join('');
|
||||
$('totalNote').textContent = D.selfTests ? D.selfTests + ' from your own clicks (ads, spin links, Banner Spins), kept as tests and left out' : '';
|
||||
$('goalReports').innerHTML = (D.byGoal || []).filter(G => G.n || !G.removed).map(G => {
|
||||
const camp = G.campaigns.length ? G.campaigns.map(c => '<div class="rw"><span>' + esc(c.name || ('Campaign #' + c.id)) + '<span class="muted" style="display:block;font-size:11px">' + esc(c.site) + ' #' + c.id + (c.spentAsOf ? ' · spend as of ' + esc(ago(c.spentAsOf)) : '') + '</span></span><span class="r num">' + (c.spent != null ? fmt(c.spent) + ' cr' : '·') + '</span><span class="r num">' + fmt(c.clicks) + '</span><span class="r num">' + fmt(c.n) + '</span><span class="r num">' + (c.rate != null ? c.rate + '%' : '·') + '</span><span class="r num">' + (c.costPer != null ? fmt(c.costPer) + ' cr' : '·') + '</span></div>').join('') : '<div class="rw"><span class="muted">No ad campaign conversions for this goal yet.</span><span></span><span></span><span></span><span></span><span></span></div>';
|
||||
const lst = (rows, f) => rows && rows.length ? rows.map(x => '<div class="rw"><span style="overflow-wrap:anywhere">' + f(x) + '</span><span class="r num">' + fmt(x.n) + '</span></div>').join('') : '<div class="rw"><span class="muted">nothing yet</span><span></span></div>';
|
||||
const gm = G.methods || {};
|
||||
return '<div class="sec">Goal: ' + esc(G.goal) + (G.removed ? ' (removed)' : '') + ' · ' + fmt(G.n) + ' counted' + (G.value ? ' · ' + esc(money(G.value)) : '') + ' · ' + METH.map(([k, l]) => l + ' ' + fmt(gm[k] || 0)).join(', ') + '</div>'
|
||||
+ '<div class="panel"><h2>By ad campaign</h2><div class="tbl camps"><div class="hd"><span>Campaign</span><span class="r">Spent</span><span class="r">Clicks</span><span class="r">Goals</span><span class="r">Rate</span><span class="r">Cost / goal</span></div>' + camp + '</div><div class="muted" style="margin-top:8px">Cost per goal = the credits the campaign has spent so far / its conversions of this goal, in that site\'s ad credits. Clicks and goals are for the range above; spend is the campaign\'s total.</div></div>'
|
||||
+ '<div class="two"><div class="panel"><h2>By spin link</h2><div class="tbl lst"><div class="hd"><span>Link</span><span class="r">Goals</span></div>' + lst(G.links, x => esc(x.name || x.code) + ' <span class="pill">/r/' + esc(x.code) + '</span>') + '</div></div>'
|
||||
+ '<div class="panel"><h2>By destination page</h2><div class="tbl lst"><div class="hd"><span>Page</span><span class="r">Goals</span></div>' + lst(G.dests, x => '<span class="mono">' + esc(x.k) + '</span>') + '</div></div></div>'
|
||||
+ '<div class="panel"><h2>By Banner Spin</h2><div class="tbl lst"><div class="hd"><span>Banner Spin</span><span class="r">Goals</span></div>' + lst(G.banners, x => esc(x.name || x.code) + ' <span class="pill">/c/' + esc(x.code) + '</span>') + '</div><div class="muted" style="margin-top:8px">Banners that point straight at a page. A banner that points at a spin link is counted under that spin link.</div></div>'
|
||||
+ '<div class="panel"><h2>By traffic source</h2><div class="tbl lst"><div class="hd"><span>Source</span><span class="r">Goals</span></div>' + lst(G.sources, x => esc(x.name)) + '</div><div class="muted" style="margin-top:8px">A named source is one you set up under <a href="/sources">Sources</a>; otherwise it is the referring site or the ad placement.</div></div>';
|
||||
}).join('');
|
||||
$('goalRows').querySelectorAll('[data-pick]').forEach(b => b.addEventListener('click', () => { PICK = b.dataset.pick; $('goalPick').value = PICK; snippets(); $('snTag').scrollIntoView({ behavior: 'smooth', block: 'center' }); }));
|
||||
$('goalRows').querySelectorAll('[data-edit]').forEach(b => b.addEventListener('click', () => goalForm(goals.find(g => g.px === b.dataset.edit))));
|
||||
$('goalRows').querySelectorAll('[data-del]').forEach(b => b.addEventListener('click', async () => {
|
||||
if (!await CR.dialog({ title: 'Remove this goal?', text: 'Its pixel stops counting at once. Conversions already counted stay in your reports.', ok: 'Remove', danger: true })) return;
|
||||
try { await CR.api('/api/my/conversions/goals/' + b.dataset.del, { remove: true }); CR.toast('Goal removed'); load(); } catch (e) { CR.toast(e.message, true); }
|
||||
}));
|
||||
}
|
||||
async function goalForm(g) {
|
||||
const v = await CR.dialog({ title: g ? 'Edit goal' : 'Add a goal', text: 'One word for what you count, like subscriber or sale. The default value is optional, in US dollars, used when the pixel carries none.',
|
||||
fields: [{ k: 'name', label: 'Goal name', value: g ? g.name : '', placeholder: 'subscriber', max: 32 }, { k: 'value', label: 'Default value (optional)', value: g && g.value ? String(g.value) : '', placeholder: '0.00', max: 10 }], ok: g ? 'Save' : 'Add goal' });
|
||||
if (!v) return;
|
||||
try { const r = g ? await CR.api('/api/my/conversions/goals/' + g.px, v) : await CR.api('/api/my/conversions/goals', v); if (r.goal) PICK = r.goal.px; CR.toast(g ? 'Saved' : 'Goal added. Its snippets are ready below.'); load(); } catch (e) { CR.toast(e.message, true); }
|
||||
}
|
||||
$('addGoal').addEventListener('click', () => goalForm(null));
|
||||
$('goalPick').addEventListener('change', () => { PICK = $('goalPick').value; snippets(); });
|
||||
document.querySelectorAll('[data-copy]').forEach(b => b.addEventListener('click', () => CR.copy($(b.dataset.copy).textContent)));
|
||||
// the test loads the real image pixel, the same request a thank-you page makes; it is recorded apart and never counted
|
||||
$('testBtn').addEventListener('click', async () => {
|
||||
const px = PICK; if (!px) return; $('testBtn').disabled = true; $('testNote').textContent = 'Sending...';
|
||||
let ok = false; try { const r = await fetch('/cv.gif?px=' + px + '&test=1&r=' + Date.now(), { cache: 'no-store' }); ok = r.ok && /^test/.test(r.headers.get('X-LS-Result') || ''); } catch (e) {}
|
||||
if (!ok) { try { await CR.api('/api/my/conversions/goals/' + px, { test: true }); ok = true; } catch (e) {} }
|
||||
CR.toast(ok ? 'Test received. Your pixel id works.' : 'The test did not arrive. Try again in a minute.', !ok); $('testBtn').disabled = false; load();
|
||||
});
|
||||
async function load() {
|
||||
try { D = await CR.get('/api/my/conversions?days=' + RANGE); } catch (e) { CR.sub('could not load'); return; }
|
||||
paint();
|
||||
}
|
||||
CR.requireSession(load);
|
||||
})();
|
||||
@@ -13,7 +13,9 @@ window.CR = (function () {
|
||||
['zones', 'Zones', '/zones', '<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18"/>'],
|
||||
['ads', 'Ads', '/ads', '<path d="M3 11l14-5v12L3 13v-2z"/><path d="M17 8a4 4 0 0 1 0 8"/>'],
|
||||
['credits', 'Credits', '/credits', '<circle cx="12" cy="12" r="8"/><path d="M12 8v8M9.5 10.5h3.5a1.5 1.5 0 0 1 0 3H10a1.5 1.5 0 0 0 0 3h4.5"/>'],
|
||||
['refuel', 'Refuel', '/credits#refuel', '<path d="M5 20V5a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v15"/><path d="M3.5 20h12"/><path d="M7 8h5"/><path d="M14 10h2a2 2 0 0 1 2 2v3.5a1.5 1.5 0 0 0 3 0V8l-3-3"/>'], // Monthly Refuel panel on Credits (Marty 2026-10-25: no refuel option in the menu)
|
||||
['reports', 'Reports', '/reports', '<path d="M4 19V9M10 19V5M16 19v-8M22 19H2"/>'],
|
||||
['conversions', 'Conversions', '/conversions', '<circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="4"/><circle cx="12" cy="12" r="0.8"/>'], // conversion pixel goals (2026-10-23)
|
||||
['team', 'Team', '/team', '<circle cx="9" cy="8" r="3"/><circle cx="17" cy="9" r="2.5"/><path d="M3 19c0-3 3-5 6-5s6 2 6 5M15 15c3 0 6 1.5 6 4"/>'],
|
||||
['wallet', 'Wallet', '/wallet', '<rect x="3" y="6" width="18" height="12" rx="2"/><path d="M16 12h3"/>'],
|
||||
['promo', 'Promo tools', '/tools#promo', '<path d="M7 10s5-1 9-5v14c-4-4-9-5-9-5H5a2 2 0 0 1-2-2v0a2 2 0 0 1 2-2h2z"/><path d="M8 15l1 5h2l-1-5"/>'],
|
||||
@@ -25,8 +27,50 @@ window.CR = (function () {
|
||||
];
|
||||
// screens not built yet fall back to the classic dashboard pane so nothing is a dead end
|
||||
const FALLBACK = {}; // the classic /my dashboard is retired (2026-10-08); its leftover panes live at /tools
|
||||
const BUILT = new Set(['links', 'sources', 'pages', 'zones', 'ads', 'credits', 'reports', 'team', 'wallet', 'tools', 'promo', 'training', 'pipeline', 'profile', 'help']); // Training, Pipeline and Profile on the rail, not behind More (Marty 2026-10-11); Help = support tickets (2026-10-16)
|
||||
const BUILT = new Set(['links', 'sources', 'pages', 'zones', 'ads', 'credits', 'refuel', 'reports', 'conversions', 'team', 'wallet', 'tools', 'promo', 'training', 'pipeline', 'profile', 'help']); // Training, Pipeline and Profile on the rail, not behind More (Marty 2026-10-11); Help = support tickets (2026-10-16)
|
||||
let ME = null, toastT;
|
||||
// Deep links (2026-10-25): /credits#refuel, /credits#buy and /ads#engine scroll to their panel once it has loaded (and any
|
||||
// sign-in or sponsor pop-up is closed) and flash it, so a button that says "Refuel" lands ON the Refuel panel.
|
||||
const ANCHOR = { refuel: 'rfPanel', buy: 'buyPanel', engine: 'erPanel', kit: 'rkPanel' };
|
||||
function focusAnchor() {
|
||||
const id = ANCHOR[location.hash.slice(1)]; if (!id) return;
|
||||
const t0 = Date.now();
|
||||
const tick = () => {
|
||||
const el = $(id);
|
||||
if (!el || el.hidden || !el.offsetParent || document.querySelector('.modal-back')) { if (Date.now() - t0 < 90000) setTimeout(tick, 400); return; }
|
||||
el.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
el.classList.remove('cr-flash'); void el.offsetWidth; el.classList.add('cr-flash');
|
||||
// panels above it (packages, purchases) can still be loading and push it down, mostly on phones: settle once more
|
||||
setTimeout(() => { const r = el.getBoundingClientRect(); if (Math.abs(r.top) > 60) el.scrollIntoView({ block: 'start' }); }, 1600);
|
||||
};
|
||||
setTimeout(tick, 200);
|
||||
}
|
||||
// Arrival strip (2026-10-25, Marty: "it took me to LinkSpin, but I really don't know how to pick up from there"): a link from
|
||||
// InstantAdPay carries ?from=iap&task=<job>; the screen opens with one line naming the job, its first step, a guide and the way back.
|
||||
const ARRIVE = {
|
||||
refuel: ['refuel LinkSpin', 'pick a package of $25 or more (marked "counts for Refuel") under Buy a package, then press Buy. It counts toward the same streak as InstantAdPay.', '/refuel', 'How the Refuel streak works'],
|
||||
conversions: ['set up conversion tracking', 'press Add a goal and name it, for example subscriber or sale. Then paste its two snippets on your pages.', '/conversion-tracking', 'Step-by-step setup guide'],
|
||||
bannerspin: ['make a Banner Spin', 'press + New Banner Spin, pick a banner size and add up to 5 banners. LinkSpin keeps showing the one that gets clicked.'],
|
||||
spinlink: ['make a spin link', 'press + New spin and paste the page you promote. You get one short link to use in your ads.'],
|
||||
testing: ['test A against B', 'open your spin link and add a second page under Destinations (or a second banner to a Banner Spin). The rotation picks the winner.'],
|
||||
page: ['build a page', 'press + New page, fill it in and publish it. Then add it to a spin link.'],
|
||||
ads: ['check your LinkSpin ads', 'your LinkSpin ads are listed on this screen. Open the one you came for to top it up or relaunch it.'],
|
||||
};
|
||||
const qp = (() => { try { return new URLSearchParams(location.search); } catch (e) { return new URLSearchParams(''); } })();
|
||||
const ARR = qp.get('from') === 'iap' ? (ARRIVE[qp.get('task')] || ['carry on from InstantAdPay', 'use the menu on the left. Everything here signs in with the same email.']) : null;
|
||||
function arriveStrip() {
|
||||
if (!ARR || $('crArrive')) return '';
|
||||
if (!document.getElementById('crArriveCss')) { const st = document.createElement('style'); st.id = 'crArriveCss'; st.textContent = '.arrive{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;margin:12px 24px 0;padding:10px 14px;border:1px solid var(--sig,#ff6a1a);border-radius:8px;background:var(--sig-soft,#FFF8F2);font-size:13.5px;line-height:1.45}.arrive .grow{flex:1 1 auto}.arrive button{border:0;background:none;font-size:18px;line-height:1;cursor:pointer;color:inherit;padding:0 2px}@media (max-width:900px){.arrive{margin:10px 16px 0}}.cr-flash{animation:crFlash 2.4s ease-out 1}@keyframes crFlash{0%,40%{box-shadow:0 0 0 4px rgba(255,106,26,.55)}100%{box-shadow:0 0 0 0 rgba(255,106,26,0)}}'; document.head.appendChild(st); }
|
||||
return '<div class="arrive" id="crArrive" role="note"><span><b>You came from InstantAdPay to ' + esc(ARR[0]) + '.</b> <span id="crArriveSi">Sign in with the same email you use on InstantAdPay, then </span><b>Step 1:</b> ' + esc(ARR[1])
|
||||
+ (ARR[2] ? ' <a href="' + ARR[2] + '" target="_blank" rel="noopener">' + esc(ARR[3]) + '</a>' : '') + '</span><span class="grow"></span><a href="https://instantadpay.com/my#engine">Back to InstantAdPay</a><button type="button" aria-label="Hide this note" id="crArriveX">×</button></div>';
|
||||
}
|
||||
// Expired session (Marty 2026-10-23: "told me to sign in but never redirected me"): sessions last 24 h, and a screen
|
||||
// left open past that got 'Sign in first.' errors with no way forward. Any 401 from our API, or coming back to a tab
|
||||
// whose session has lapsed, opens the in-shell sign-in once and reloads the screen after it.
|
||||
let lostOpen = false, lastCheck = Date.now();
|
||||
function sessionLost() { if (lostOpen) return; lostOpen = true; ME = null; toast('Your session ended. Sign in again to keep going.', true); signInFlow(() => location.reload()); }
|
||||
(function () { const f0 = window.fetch.bind(window); window.fetch = async function (input, init) { const r = await f0(input, init); try { const u = new URL(typeof input === 'string' ? input : input.url, location.href); if (r.status === 401 && u.origin === location.origin && /^\/api\//.test(u.pathname) && !/^\/api\/(auth|me$)/.test(u.pathname) && !/^\/api\/admin\//.test(u.pathname)) sessionLost(); } catch (e) {} return r; }; })();
|
||||
document.addEventListener('visibilitychange', async () => { if (document.visibilityState !== 'visible' || lostOpen || !ME || !ME.signedIn || Date.now() - lastCheck < 60000) return; lastCheck = Date.now(); const m = await me(true); if (!m || !m.signedIn) sessionLost(); });
|
||||
function toast(msg, bad) { let t = $('crToast'); if (!t) { t = document.createElement('div'); t.id = 'crToast'; t.className = 'toast'; t.setAttribute('role', 'status'); document.body.appendChild(t); } t.textContent = msg; t.classList.toggle('bad', !!bad); t.classList.add('on'); clearTimeout(toastT); toastT = setTimeout(() => t.classList.remove('on'), 2000); }
|
||||
async function api(path, body) { const r = await (await fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) })).json(); if (r.error) throw new Error(r.error); return r; }
|
||||
async function get(path) { const r = await (await fetch(path, { headers: { Accept: 'application/json' } })).json(); if (r.error) throw new Error(r.error); return r; }
|
||||
@@ -48,21 +92,37 @@ window.CR = (function () {
|
||||
back.addEventListener('keydown', e => { if (e.key === 'Enter' && e.target.tagName !== 'TEXTAREA') back.querySelector('#dlgOk').click(); if (e.key === 'Escape') done(null); });
|
||||
});
|
||||
}
|
||||
// the chat bubble on every Control Room screen (Marty, 2026-10-18: it vanished when /my was retired); once per page
|
||||
function chat() {
|
||||
if (document.getElementById('iapChat') || document.querySelector('script[src^="/assets/chat.js"]')) return;
|
||||
const s = document.createElement('script'); s.src = '/assets/chat.js?v=20261018c'; s.defer = true; document.body.appendChild(s);
|
||||
}
|
||||
function railActive(o) { let a = o.active; if (a === 'credits' && location.hash === '#refuel') a = 'refuel'; return a; }
|
||||
function mount(o) {
|
||||
const page = $('page'); if (!page) return;
|
||||
chat();
|
||||
if (!document.getElementById('crFlashCss')) { const st = document.createElement('style'); st.id = 'crFlashCss'; st.textContent = '.cr-flash{animation:crFlash 2.4s ease-out 1}@keyframes crFlash{0%,40%{box-shadow:0 0 0 4px rgba(255,106,26,.55)}100%{box-shadow:0 0 0 0 rgba(255,106,26,0)}}'; document.head.appendChild(st); }
|
||||
const act = railActive(o);
|
||||
const app = document.createElement('div'); app.className = 'app'; let railWide = true; try { railWide = localStorage.getItem('cr.rail') !== 'narrow'; } catch (e) {} if (railWide) app.classList.add('wide'); // expanded by default (Marty 2026-10-08), the choice remembered per browser
|
||||
app.innerHTML = '<nav class="rail" aria-label="LinkSpin"><a class="mark" href="/" aria-label="LinkSpin home" title="LinkSpin"></a>'
|
||||
+ NAV.map(([k, label, href, svg, sec]) => '<a ' + (k === 'help' ? 'id="crHelp" ' : '') + 'href="' + (BUILT.has(k) ? href : FALLBACK[k]) + '"' + (k === o.active ? ' class="on' + (sec ? ' rsec' : '') + '" aria-current="page"' : (sec ? ' class="rsec"' : '')) + ' title="' + label + '" aria-label="' + label + '"><svg viewBox="0 0 24 24">' + svg + '</svg><span class="lbl">' + label + '</span></a>').join('')
|
||||
+ NAV.map(([k, label, href, svg, sec]) => '<a ' + (k === 'help' ? 'id="crHelp" ' : '') + 'href="' + (BUILT.has(k) ? href : FALLBACK[k]) + '"' + (k === act ? ' class="on' + (sec ? ' rsec' : '') + '" aria-current="page"' : (sec ? ' class="rsec"' : '')) + ' title="' + label + '" aria-label="' + label + '"><svg viewBox="0 0 24 24">' + svg + '</svg><span class="lbl">' + label + '</span></a>').join('')
|
||||
+ '<span class="sp"></span><button class="railtog" type="button" id="crRailTog" title="Collapse or expand the menu" aria-label="Collapse or expand the menu"><svg viewBox="0 0 24 24"><path d="M15 6l-6 6 6 6"/></svg><span class="lbl">Collapse</span></button></nav>'
|
||||
+ '<div class="main"><div class="topbar"><div><div class="crumb">' + esc(o.crumb || 'Control room') + '</div><h1>' + esc(o.title || '') + '</h1></div><span class="readout" id="crSub">' + esc(o.sub || '') + '</span><span class="grow"></span><span id="crActions">' + (o.actions || '') + '</span><button class="who" type="button" id="crUserBtn" title="Account"><i id="crAv"></i><span id="crWho">Sign in</span></button></div>'
|
||||
+ '<div class="main"><div class="topbar"><div><div class="crumb">' + esc(o.crumb || 'Control room') + '</div><h1>' + esc(o.title || '') + '</h1></div><span class="readout" id="crSub">' + esc(o.sub || '') + '</span><span class="grow"></span><span id="crActions">' + (o.actions || '') + '</span>' + themeSeg('crTheme') + '<button class="who" type="button" id="crUserBtn" title="Account"><i id="crAv"></i><span id="crWho">Sign in</span></button></div>'
|
||||
// pre-launch notice (Marty, 2026-10-17): open to everyone from today, official launch November 15
|
||||
+ '<div class="prelaunch" role="note"><b>Pre-launch testing until November 15.</b> Everything is live and working, but features and screens may change while we test. Questions? Use <a href="/help">Help</a>.</div>'
|
||||
+ '<div id="crBody"></div>'
|
||||
+ arriveStrip() + '<div id="crBody"></div>'
|
||||
+ '<div class="strip" id="crStrip"><span><span class="dot off" id="stDot"></span>rotator <b id="stHealth">checking</b></span><span>served today <b id="stServed">·</b></span><span>zones live <b id="stZones">·</b></span><span>network <b id="stNet">·</b></span><span class="grow"></span><span id="stClock"></span></div></div>';
|
||||
page.parentNode.insertBefore(app, page); app.querySelector('#crBody').appendChild(page);
|
||||
if ($('crArriveX')) $('crArriveX').addEventListener('click', () => { const a = $('crArrive'); if (a) a.remove(); });
|
||||
// the rail's Refuel item while already on Credits: only the hash changes, so scroll by hand (and again on a repeat click)
|
||||
const paintRail = () => { const a2 = railActive(o); app.querySelectorAll('.rail a[href]').forEach(x => { const k = x.getAttribute('href') === '/credits#refuel' ? 'refuel' : x.getAttribute('href') === '/credits' ? 'credits' : null; if (k) { x.classList.toggle('on', k === a2); if (k === a2) x.setAttribute('aria-current', 'page'); else x.removeAttribute('aria-current'); } }); };
|
||||
app.querySelectorAll('.rail a[href="/credits#refuel"]').forEach(x => x.addEventListener('click', e => { if (location.pathname !== '/credits') return; e.preventDefault(); history.replaceState(null, '', location.pathname + location.search + '#refuel'); paintRail(); focusAnchor(); }));
|
||||
window.addEventListener('hashchange', () => { paintRail(); focusAnchor(); });
|
||||
focusAnchor();
|
||||
$('crRailTog').addEventListener('click', () => { const wide = !app.classList.contains('wide'); app.classList.toggle('wide', wide); try { localStorage.setItem('cr.rail', wide ? 'wide' : 'narrow'); } catch (e) {} });
|
||||
$('crUserBtn').addEventListener('click', async e => { e.preventDefault(); if (!ME || !ME.signedIn) return signInFlow(() => location.reload()); const v = await dialog({ title: ME.username ? '@' + ME.username : (ME.email || 'Account'), text: 'Signed in on LinkSpin. Your classic dashboard is still at /my.', ok: 'Sign out', no: 'Close', danger: true }); if (v) { try { await api('/api/auth/logout'); } catch (er) {} location.reload(); } });
|
||||
clock(); setInterval(clock, 30000);
|
||||
paintTheme();
|
||||
}
|
||||
// status strip: the clock ticks locally (Central); the readouts come from /api/my/strip once the member is known
|
||||
function clock() { const c = $('stClock'); if (!c) return; try { c.textContent = new Date().toLocaleTimeString('en-US', { timeZone: 'America/Chicago', hour: 'numeric', minute: '2-digit' }) + ' CT'; } catch (e) { c.textContent = ''; } }
|
||||
@@ -70,14 +130,25 @@ window.CR = (function () {
|
||||
try { const s = await get('/api/my/strip'); $('stDot').className = 'dot' + (s.ok ? '' : ' off'); $('stHealth').textContent = s.ok ? 'healthy' : 'degraded'; $('stServed').textContent = fmt(s.served); $('stZones').textContent = fmt(s.zones); $('stNet').textContent = s.network ? 'on' : 'off'; }
|
||||
catch (e) { $('stHealth').textContent = 'offline'; }
|
||||
}
|
||||
function whoPaint(m) { const w = $('crWho'), a = $('crAv'); if (!w) return; if (m && m.signedIn) { const name = m.username ? '@' + m.username : (m.email || '').split('@')[0]; w.textContent = name; a.textContent = (m.username || m.email || '?').replace(/^@/, '').slice(0, 2).toUpperCase(); } else { w.textContent = 'Sign in'; a.textContent = ''; } }
|
||||
function whoPaint(m) { const si = $('crArriveSi'); if (si) si.hidden = !!(m && m.signedIn); const w = $('crWho'), a = $('crAv'); if (!w) return; if (m && m.signedIn) { const name = m.username ? '@' + m.username : (m.email || '').split('@')[0]; w.textContent = name; a.textContent = (m.username || m.email || '?').replace(/^@/, '').slice(0, 2).toUpperCase(); } else { w.textContent = 'Sign in'; a.textContent = ''; } }
|
||||
const sub = t => { const s = $('crSub'); if (s) s.textContent = t; };
|
||||
// ── appearance (2026-11-01): Light / Dark / Auto. The head script (themehead.js) owns window.LSTheme and localStorage
|
||||
// ls.theme; this paints every .theme-seg on the page, saves the choice to the account when signed in, and at sign-in lets
|
||||
// the account value win over the local one (a local choice is pushed up when the account has none yet).
|
||||
const THEMES = [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']];
|
||||
function themeSeg(id) { return '<span class="seg theme-seg"' + (id ? ' id="' + id + '"' : '') + ' role="group" aria-label="Theme">' + THEMES.map(([k, l]) => '<button type="button" data-theme="' + k + '" title="' + l + ' theme">' + l + '</button>').join('') + '</span>'; }
|
||||
function storedTheme() { try { const v = localStorage.getItem('ls.theme'); return v === 'light' || v === 'dark' || v === 'auto' ? v : null; } catch (e) { return null; } }
|
||||
function paintTheme() { const c = window.LSTheme ? LSTheme.get() : 'light'; document.querySelectorAll('.theme-seg [data-theme]').forEach(b => { const on = b.dataset.theme === c; b.classList.toggle('on', on); b.setAttribute('aria-pressed', on ? 'true' : 'false'); }); }
|
||||
function themeSync(m) { if (!window.LSTheme) return; const acct = m && m.signedIn && (m.theme === 'light' || m.theme === 'dark' || m.theme === 'auto') ? m.theme : null; const local = storedTheme(); if (acct) { if (acct !== local) LSTheme.set(acct, true); } else if (m && m.signedIn && local) api('/api/my/profile', { theme: local }).catch(() => {}); paintTheme(); }
|
||||
document.addEventListener('click', e => { const b = e.target.closest && e.target.closest('.theme-seg [data-theme]'); if (!b || !window.LSTheme) return; const v = b.dataset.theme; LSTheme.set(v); if (ME && ME.signedIn) api('/api/my/profile', { theme: v }).catch(() => {}); });
|
||||
window.addEventListener('ls-theme', paintTheme);
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', paintTheme); else paintTheme();
|
||||
async function me(force) { if (ME && !force) return ME; try { ME = await (await fetch('/api/me', { headers: { Accept: 'application/json' } })).json(); } catch (e) { ME = { signedIn: false }; } return ME; }
|
||||
// sign-in inside the shell: email -> six-digit code, on the same endpoints and guards as the dashboard.
|
||||
const FTS = Date.now();
|
||||
async function signInFlow(onReady) {
|
||||
let host = $('crModalHost'); if (!host) { host = document.createElement('div'); host.id = 'crModalHost'; document.body.appendChild(host); }
|
||||
host.innerHTML = '<div class="modal-back"><div class="modal" role="dialog" aria-modal="true"><h2>Sign in</h2><div class="ink2">Email first. We send a six-digit code; no password to remember. New here? The same box creates your account.</div>'
|
||||
host.innerHTML = '<div class="modal-back"><div class="modal" role="dialog" aria-modal="true"><h2>Sign in</h2>' + (ARR ? '<div class="ink2" style="margin-bottom:6px"><b>Use the same email you use on InstantAdPay.</b> You land right back here to ' + esc(ARR[0]) + '.</div>' : '') + '<div class="ink2">Email first. We send a six-digit code; no password to remember. New here? The same box creates your account.</div>'
|
||||
+ '<label class="lbl">Email<input class="field" id="siEmail" type="email" autocomplete="email" placeholder="you@example.com"></label>'
|
||||
+ '<div id="siCodeRow" hidden><label class="lbl">Code from the email<input class="field mono" id="siCode" inputmode="numeric" maxlength="6" placeholder="123456"></label></div>'
|
||||
+ '<div class="muted" id="siMsg"></div><div class="acts"><a class="btn" href="/tools">More tools</a><button class="btn pri" type="button" id="siGo">Send code</button></div></div></div>';
|
||||
@@ -100,7 +171,7 @@ window.CR = (function () {
|
||||
} else {
|
||||
go.disabled = true; say('Checking…');
|
||||
await api('/api/auth/email/verify', { email: email.value.trim(), code: code.value.trim() });
|
||||
host.innerHTML = ''; ME = null; await me(true); toast('You are in'); onReady && onReady(ME);
|
||||
host.innerHTML = ''; ME = null; await me(true); toast('You are in'); try { window.dispatchEvent(new Event('cr:signedin')); } catch (er) {} onReady && onReady(ME); // panels that loaded signed out (Refuel, Engine Room) reload on this
|
||||
}
|
||||
} catch (e) { go.disabled = false; say(e.message, true); }
|
||||
}
|
||||
@@ -148,7 +219,7 @@ window.CR = (function () {
|
||||
if (!b) { b = document.createElement('b'); b.className = 'rbadge'; a.appendChild(b); }
|
||||
b.textContent = n > 9 ? '9+' : String(n); a.title = 'Help: ' + n + ' new repl' + (n === 1 ? 'y' : 'ies'); return n;
|
||||
}
|
||||
async function requireSession(onReady) { let m = await me(); whoPaint(m); if (m && m.signedIn) { strip(); helpBadge(); m = await ensureUsername(m); await loginAd(); return onReady(m); } signInFlow(async r => { whoPaint(r); strip(); helpBadge(); await loginAd(); onReady(r); }); }
|
||||
async function requireSession(onReady) { let m = await me(); whoPaint(m); themeSync(m); if (m && m.signedIn) { strip(); helpBadge(); m = await ensureUsername(m); await loginAd(); return onReady(m); } signInFlow(async r => { whoPaint(r); themeSync(r); strip(); helpBadge(); await loginAd(); onReady(r); }); }
|
||||
// tiles with a sparkline and a delta chip (Instrument scheme, 2026-09-29): series = numbers oldest first
|
||||
function sparkline(series) {
|
||||
const s = (series || []).map(Number); if (s.length < 2 || !s.some(Boolean)) return '';
|
||||
|
||||
+103
-34
@@ -4,21 +4,48 @@
|
||||
scheme so every screen keeps working; only the values and the chrome changed. */
|
||||
:root{
|
||||
--bg:#E9EEF5; --rail:#F3F6FB; --panel:#FFFFFF; --panel-2:#F3F6FB; --line:#CDD7E5; --line-strong:#AEBED4;
|
||||
--ink:#0F1B2E; --ink-2:#324361; --muted:#66768F;
|
||||
--accent:#1F6FEB; --accent-hi:#0B4BB3; --accent-ink:#FFFFFF; --accent-dim:#7CB2FF; --accent-soft:#E1ECFC;
|
||||
--sig:#FF6A1A; --sig-2:#D9530A; --sig-soft:#FFE9DC;
|
||||
--ok:#0E8A5C; --ok-soft:#DDF4E8; --warn:#C2410C; --warn-soft:#FFE7D8; --bad:#B91C1C; --bad-soft:#FBE0E0; --hi-row:#FFF3EA;
|
||||
--chrome:#0B1424; --chrome-2:#101D33; --chrome-ink:#EEF3FA; --chrome-sub:#8CA2C4; --chrome-line:#1E2E4A; --inset:#0F1B2E;
|
||||
--sh:0 10px 24px -18px rgba(15,27,46,.45),0 1px 0 rgba(255,255,255,.9) inset;
|
||||
--ink:#0F1B2E; --ink-2:#324361; --muted:#596984;
|
||||
--accent:#1F6FEB; --accent-hi:#0B4BB3; --accent-ink:#FFFFFF; --accent-dim:#7CB2FF; --accent-pale:#A9CBFA; --accent-soft:#E1ECFC;
|
||||
--sig:#FF6A1A; --sig-2:#B8420A; --sig-soft:#FFE9DC; --sig-ink:#0F1B2E; --sig-line:rgba(255,106,26,.45);
|
||||
--ok:#0B7A52; --ok-soft:#DDF4E8; --ok-ink:#FFFFFF; --ok-line:rgba(11,122,82,.4); --warn:#B23A0A; --warn-soft:#FFE7D8; --warn-line:rgba(178,58,10,.4);
|
||||
--bad:#B91C1C; --bad-soft:#FBE0E0; --bad-ink:#FFFFFF; --bad-line:rgba(185,28,28,.4); --hi-row:#FFF3EA;
|
||||
--violet:#6D4AFF; --violet-soft:#EEE9FF; --violet-line:rgba(109,74,255,.45);
|
||||
--note-bg:#FFFBEB; --note-soft:#FEF3C7; --note-line:#F59E0B; --note-ink:#92400E;
|
||||
--chrome:#0B1424; --chrome-2:#101D33; --chrome-ink:#EEF3FA; --chrome-sub:#8CA2C4; --chrome-line:#1E2E4A; --chrome-hi:#8CC8FF; --chrome-warm:#FFB37D; --inset:#0F1B2E;
|
||||
--on-ink:#FFFFFF; --field-bg:#FFFFFF; --panel-glass:rgba(255,255,255,.55); --row-hover:rgba(31,111,235,.04);
|
||||
--btn-bg:linear-gradient(180deg,#FFFFFF,#F3F6FB); --btn-blue:linear-gradient(180deg,#2A74EC,#1559CC);
|
||||
--panel-grad:linear-gradient(180deg,#FFFFFF,#F6F8FC); --panel-grad-hi:linear-gradient(180deg,#FFFFFF,#EEF4FE); --ph-a:#EEF2F9; --ph-b:#F5F7FC;
|
||||
--hl:rgba(255,255,255,.9); --grid-dot:rgba(31,111,235,.20); --bg-glow:rgba(255,255,255,.6);
|
||||
--sh:0 10px 24px -18px rgba(15,27,46,.45),0 1px 0 rgba(255,255,255,.9) inset; --sh-lg:0 30px 60px -30px rgba(15,27,46,.6);
|
||||
/* aliases some screens reached for */
|
||||
--line2:var(--line-strong); --accent2:var(--accent-hi); --ink2:var(--ink-2);
|
||||
--display:"Rajdhani","Segoe UI",system-ui,sans-serif; --body:"Manrope","Segoe UI",system-ui,sans-serif; --mono:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;
|
||||
--r:7px;
|
||||
color-scheme:light;
|
||||
}
|
||||
/* Dark workspace (2026-11-01: a member asked for light and dark, for vision-impaired readers and for people who
|
||||
struggle with bright or with dark screens). Same token names; the chrome rail, topbar and strip stay as they are.
|
||||
The head script (themehead.js) sets data-theme from localStorage ls.theme / the account; auto follows the device. */
|
||||
:root[data-theme="dark"]{
|
||||
--bg:#0B1424; --rail:#101D33; --panel:#142338; --panel-2:#1B2D47; --line:#273B5C; --line-strong:#3A5580;
|
||||
--ink:#EEF3FA; --ink-2:#C5D2E6; --muted:#97A9C6;
|
||||
--accent:#4D8DF7; --accent-hi:#8CC0FF; --accent-ink:#0B1424; --accent-dim:#3D6FC4; --accent-pale:#2E5699; --accent-soft:#1B325A;
|
||||
--sig:#FF7A32; --sig-2:#FFA06A; --sig-soft:#3B2416; --sig-ink:#0B1424; --sig-line:rgba(255,122,50,.45);
|
||||
--ok:#3FCF92; --ok-soft:#12352A; --ok-ink:#0B1424; --ok-line:rgba(63,207,146,.4); --warn:#F7A35E; --warn-soft:#3D2716; --warn-line:rgba(247,163,94,.4);
|
||||
--bad:#FF8080; --bad-soft:#44202A; --bad-ink:#0B1424; --bad-line:rgba(255,128,128,.4); --hi-row:#2B2119;
|
||||
--violet:#B19CFF; --violet-soft:#2A2350; --violet-line:rgba(177,156,255,.45);
|
||||
--note-bg:#2A2410; --note-soft:#3B3014; --note-line:#B7791F; --note-ink:#F5C462;
|
||||
--inset:#06101E;
|
||||
--on-ink:#0B1424; --field-bg:#0F1B2E; --panel-glass:rgba(20,35,56,.6); --row-hover:rgba(140,192,255,.06);
|
||||
--btn-bg:linear-gradient(180deg,#1E3150,#172743); --btn-blue:linear-gradient(180deg,#8CC0FF,#5A96F5);
|
||||
--panel-grad:linear-gradient(180deg,#162741,#122035); --panel-grad-hi:linear-gradient(180deg,#172A47,#15284A); --ph-a:#182A45; --ph-b:#1B2E4B;
|
||||
--hl:rgba(255,255,255,.05); --grid-dot:rgba(140,192,255,.10); --bg-glow:rgba(31,111,235,.12);
|
||||
--sh:0 10px 24px -18px rgba(0,0,0,.85),0 1px 0 rgba(255,255,255,.04) inset; --sh-lg:0 30px 60px -30px rgba(0,0,0,.9);
|
||||
color-scheme:dark;
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
html,body{height:100%}
|
||||
body{margin:0;background:var(--bg);background-image:radial-gradient(circle,rgba(31,111,235,.20) 1px,transparent 1.3px),radial-gradient(120% 60% at 50% 0%,rgba(255,255,255,.6),transparent 60%);background-size:18px 18px,100% 100%;background-attachment:fixed;color:var(--ink);font-family:var(--body);font-size:13px;line-height:1.45}
|
||||
body{margin:0;background:var(--bg);background-image:radial-gradient(circle,var(--grid-dot) 1px,transparent 1.3px),radial-gradient(120% 60% at 50% 0%,var(--bg-glow),transparent 60%);background-size:18px 18px,100% 100%;background-attachment:fixed;color:var(--ink);font-family:var(--body);font-size:13px;line-height:1.45}
|
||||
a{color:var(--accent-hi)} a:hover{color:var(--accent)}
|
||||
button,input,select,textarea{font:inherit;color:inherit}
|
||||
:focus-visible{outline:2px solid var(--sig);outline-offset:2px}
|
||||
@@ -61,40 +88,40 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.topbar .readout{font-family:var(--mono);font-size:11px;color:var(--chrome-sub);letter-spacing:.02em;padding-left:14px;border-left:1px solid var(--chrome-line)}
|
||||
.topbar .grow{flex:1}
|
||||
.topbar .who{display:inline-flex;align-items:center;gap:8px;font-weight:700;font-size:12px;color:var(--chrome-ink);padding:4px 10px 4px 5px;border:1px solid var(--chrome-line);border-radius:999px;background:transparent;cursor:pointer}
|
||||
.topbar .who i{width:20px;height:20px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent-dim));display:grid;place-items:center;font:700 9px var(--mono);color:#fff;font-style:normal}
|
||||
.topbar .who i{width:20px;height:20px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent-dim));display:grid;place-items:center;font:700 9px var(--mono);color:var(--accent-ink);font-style:normal}
|
||||
.topbar .who:hover{border-color:var(--chrome-sub)}
|
||||
.topbar .btn{color:var(--ink)}
|
||||
.prelaunch{padding:9px 22px;background:#fff4d6;color:#4a3500;border-bottom:1px solid #f0d58a;font-size:13.5px;line-height:1.4}.prelaunch b{color:#2e2100}.prelaunch a{color:#7a4f00;font-weight:600}
|
||||
.prelaunch{padding:9px 22px;background:var(--note-soft);color:var(--note-ink);border-bottom:1px solid var(--note-line);font-size:13.5px;line-height:1.4}.prelaunch b{color:var(--ink)}.prelaunch a{color:var(--note-ink);font-weight:600}
|
||||
.strip{display:flex;gap:22px;align-items:center;padding:8px 22px;margin-top:auto;background:var(--chrome);color:var(--chrome-sub);font-family:var(--mono);font-size:11px;letter-spacing:.03em;border-top:1px solid var(--chrome-line)}
|
||||
.strip b{color:var(--chrome-ink);font-weight:700}
|
||||
.strip .dot{width:7px;height:7px;border-radius:50%;background:var(--ok);display:inline-block;margin-right:7px;box-shadow:0 0 0 3px rgba(14,138,92,.22);animation:crpulse 2.4s ease-in-out infinite}
|
||||
.strip .dot{width:7px;height:7px;border-radius:50%;background:var(--ok);display:inline-block;margin-right:7px;box-shadow:0 0 0 3px color-mix(in srgb,var(--ok) 22%,transparent);animation:crpulse 2.4s ease-in-out infinite}
|
||||
.strip .dot.off{background:var(--muted);animation:none;box-shadow:none}
|
||||
.strip .sig{color:var(--sig)} .strip .grow{flex:1}
|
||||
@keyframes crpulse{0%,100%{box-shadow:0 0 0 3px rgba(14,138,92,.22)}50%{box-shadow:0 0 0 5px rgba(14,138,92,.08)}}
|
||||
@keyframes crpulse{0%,100%{box-shadow:0 0 0 3px color-mix(in srgb,var(--ok) 22%,transparent)}50%{box-shadow:0 0 0 5px color-mix(in srgb,var(--ok) 8%,transparent)}}
|
||||
|
||||
/* controls */
|
||||
.btn{background:linear-gradient(180deg,#FFFFFF,#F3F6FB);color:var(--ink);border:1px solid var(--line-strong);border-radius:var(--r);padding:6px 12px;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap;box-shadow:0 1px 0 rgba(255,255,255,.9) inset,0 1px 2px rgba(15,27,46,.08);text-decoration:none;display:inline-flex;align-items:center;gap:6px;justify-content:center}
|
||||
.btn{background:var(--btn-bg);color:var(--ink);border:1px solid var(--line-strong);border-radius:var(--r);padding:6px 12px;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap;box-shadow:0 1px 0 var(--hl) inset,0 1px 2px rgba(15,27,46,.08);text-decoration:none;display:inline-flex;align-items:center;gap:6px;justify-content:center}
|
||||
.btn:hover{border-color:var(--accent)}
|
||||
.btn.pri{font-family:var(--display);font-size:15px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;background:linear-gradient(180deg,#FF7A32,var(--sig));color:#fff;border-color:var(--sig-2);padding:6px 13px;box-shadow:0 8px 18px -10px rgba(255,106,26,.9),0 1px 0 rgba(255,255,255,.35) inset}
|
||||
.btn.pri{font-family:var(--display);font-size:15px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;background:linear-gradient(180deg,#FF7A32,var(--sig));color:var(--sig-ink);border-color:var(--sig-2);padding:6px 13px;box-shadow:0 8px 18px -10px rgba(255,106,26,.9),0 1px 0 rgba(255,255,255,.35) inset}
|
||||
.btn.pri:hover{background:linear-gradient(180deg,#FF8A48,#FF6A1A);border-color:var(--sig-2)}
|
||||
.btn.blue{background:linear-gradient(180deg,#3A83F0,var(--accent));color:#fff;border-color:var(--accent-hi);box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset}
|
||||
.btn.blue{background:var(--btn-blue);color:var(--accent-ink);border-color:var(--accent-hi);box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset}
|
||||
.btn.sm{padding:4px 9px;font-size:11px}
|
||||
.btn.ghost{background:transparent;box-shadow:none}
|
||||
.btn.danger:hover{border-color:var(--bad);color:var(--bad)}
|
||||
.btn.pri.danger{background:linear-gradient(180deg,#D93030,var(--bad));border-color:#991B1B}
|
||||
.btn.pri.danger{background:linear-gradient(180deg,#D93030,var(--bad));border-color:#991B1B;color:var(--bad-ink)}
|
||||
.btn[disabled]{opacity:.5;cursor:default}
|
||||
.field{background:#fff;border:1px solid var(--line-strong);border-radius:6px;padding:7px 10px;color:var(--ink);width:100%;min-width:0;box-shadow:0 1px 2px rgba(15,27,46,.06) inset}
|
||||
.field:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px rgba(255,106,26,.18)}
|
||||
.field{background:var(--field-bg);border:1px solid var(--line-strong);border-radius:6px;padding:7px 10px;color:var(--ink);width:100%;min-width:0;box-shadow:0 1px 2px rgba(15,27,46,.06) inset}
|
||||
.field:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--sig) 18%,transparent)}
|
||||
.field.mono{font-size:12px}
|
||||
select.field{appearance:auto}
|
||||
label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
|
||||
.code{font-family:var(--mono);font-size:12px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;padding:6px 10px;color:#8CC8FF;overflow-wrap:anywhere}
|
||||
.code{font-family:var(--mono);font-size:12px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;padding:6px 10px;color:var(--chrome-hi);overflow-wrap:anywhere}
|
||||
.led{display:inline-flex;align-items:baseline;gap:8px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;padding:7px 12px;color:var(--chrome-sub);font-family:var(--mono);font-size:11px}
|
||||
.led b{font-family:var(--display);font-size:20px;line-height:1;color:var(--sig);letter-spacing:.04em;font-variant-numeric:tabular-nums}
|
||||
|
||||
/* tiles */
|
||||
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
|
||||
.tile{position:relative;background:linear-gradient(180deg,#FFFFFF,#F6F8FC);border:1px solid var(--line);border-radius:8px;padding:12px 14px;display:grid;gap:3px;box-shadow:var(--sh)}
|
||||
.tile{position:relative;background:var(--panel-grad);border:1px solid var(--line);border-radius:8px;padding:12px 14px;display:grid;gap:3px;box-shadow:var(--sh)}
|
||||
.tile::before,.tile::after{content:"";position:absolute;width:11px;height:11px;border:1.5px solid var(--line-strong);pointer-events:none}
|
||||
.tile::before{top:5px;left:5px;border-right:0;border-bottom:0} .tile::after{bottom:5px;right:5px;border-left:0;border-top:0}
|
||||
.tile .k{display:flex;align-items:center;gap:8px;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted)}
|
||||
@@ -102,7 +129,7 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
.tile .v{font-family:var(--display);font-weight:700;font-size:30px;line-height:1.05;letter-spacing:.02em;font-variant-numeric:tabular-nums;color:var(--ink)}
|
||||
.tile .row{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;min-width:0}
|
||||
.tile .v small{font-family:var(--mono);font-size:12px;font-weight:500;color:var(--muted);margin-left:4px;letter-spacing:0}
|
||||
.tile.hi{background:linear-gradient(180deg,#FFFFFF,#EEF4FE)} .tile.hi::before,.tile.hi::after{border-color:var(--sig)} .tile.hi .k::before{background:var(--sig)} .tile.hi .v{color:var(--accent-hi)}
|
||||
.tile.hi{background:var(--panel-grad-hi)} .tile.hi::before,.tile.hi::after{border-color:var(--sig)} .tile.hi .k::before{background:var(--sig)} .tile.hi .v{color:var(--accent-hi)}
|
||||
.tile .delta{justify-self:start;font-family:var(--mono);font-size:10px;font-weight:700;letter-spacing:.04em;color:var(--ok);background:var(--ok-soft);border-radius:4px;padding:2px 6px;margin-top:2px}
|
||||
.tile .delta.flat{color:var(--muted);background:var(--panel-2)}
|
||||
.tile .delta.down{color:var(--warn);background:var(--warn-soft)}
|
||||
@@ -110,29 +137,31 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
/* tags + chips */
|
||||
.tag{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;border:1px solid var(--line-strong);border-radius:4px;padding:1px 7px;white-space:nowrap;color:var(--ink-2);background:var(--panel-2);vertical-align:middle}
|
||||
.tag::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--line-strong);flex:none}
|
||||
.tag.ok{color:var(--ok);border-color:rgba(14,138,92,.4);background:var(--ok-soft)} .tag.ok::before{background:var(--ok);box-shadow:0 0 0 2px rgba(14,138,92,.2)}
|
||||
.tag.warn{color:var(--warn);border-color:rgba(194,65,12,.4);background:var(--warn-soft)} .tag.warn::before{background:var(--warn)}
|
||||
.tag.bad{color:var(--bad);border-color:rgba(185,28,28,.4);background:var(--bad-soft)} .tag.bad::before{background:var(--bad)}
|
||||
.tag.ok{color:var(--ok);border-color:var(--ok-line);background:var(--ok-soft)} .tag.ok::before{background:var(--ok);box-shadow:0 0 0 2px color-mix(in srgb,var(--ok) 20%,transparent)}
|
||||
.tag.warn{color:var(--warn);border-color:var(--warn-line);background:var(--warn-soft)} .tag.warn::before{background:var(--warn)}
|
||||
.tag.bad{color:var(--bad);border-color:var(--bad-line);background:var(--bad-soft)} .tag.bad::before{background:var(--bad)}
|
||||
.tag.dim{color:var(--muted)}
|
||||
.tag.t,.tag.plain{color:var(--accent-hi);border-color:var(--accent-soft);background:var(--accent-soft)} .tag.t::before,.tag.plain::before{display:none}
|
||||
.dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:currentColor;margin-right:6px;vertical-align:middle}
|
||||
.chips{display:flex;gap:6px;flex-wrap:wrap}
|
||||
.chip{font-size:11px;font-weight:700;color:var(--ink-2);border:1px solid var(--line-strong);border-radius:999px;padding:3px 10px;cursor:pointer;background:#fff}
|
||||
.chip{font-size:11px;font-weight:700;color:var(--ink-2);border:1px solid var(--line-strong);border-radius:999px;padding:3px 10px;cursor:pointer;background:var(--panel)}
|
||||
.chip.on{border-color:var(--accent);color:var(--accent-hi);background:var(--accent-soft)}
|
||||
.seg{display:inline-flex;border:1px solid var(--line-strong);border-radius:8px;overflow:hidden;background:var(--panel-2)}
|
||||
.seg button{background:transparent;border:0;border-right:1px solid var(--line-strong);padding:7px 13px;font-weight:700;font-size:12px;color:var(--ink-2);cursor:pointer;display:inline-flex;align-items:center;gap:6px}
|
||||
.seg button:last-child{border-right:0} .seg button.on{background:var(--ink);color:#fff}
|
||||
.seg button:last-child{border-right:0} .seg button.on{background:var(--ink);color:var(--on-ink)}
|
||||
|
||||
/* tables + panels */
|
||||
.tbl{border:1px solid var(--line);border-radius:8px;background:var(--panel);overflow:hidden;box-shadow:var(--sh)}
|
||||
.tbl .hd,.tbl .rw{display:grid;gap:12px;padding:10px 16px;align-items:center}
|
||||
.tbl .hd{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);border-bottom:1px solid var(--line);background:var(--panel-2)}
|
||||
.tbl .rw{position:relative;border-bottom:1px solid var(--line)} .tbl .rw:last-child{border-bottom:0}
|
||||
.tbl .rw:hover{background:rgba(31,111,235,.04)}
|
||||
.tbl .rw:hover{background:var(--row-hover)}
|
||||
.tbl .rw.on,.tbl .rw.hi-row{background:var(--hi-row)} .tbl .rw.on::before,.tbl .rw.hi-row::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--sig)}
|
||||
/* an empty-state row (one muted note) spans every column instead of wrapping inside the first */
|
||||
.tbl .rw > .muted:only-child{grid-column:1/-1}
|
||||
.tbl .ft{padding:9px 16px;border-top:1px solid var(--line);font-family:var(--mono);font-size:10.5px;color:var(--muted);background:var(--panel-2);letter-spacing:.02em}
|
||||
.r{text-align:right}
|
||||
.ph{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 14px;border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,#EEF2F9 0 6px,#F5F7FC 6px 12px)}
|
||||
.ph{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 14px;border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,var(--ph-a) 0 6px,var(--ph-b) 6px 12px)}
|
||||
.ph h2,.ph h3{font-family:var(--display);font-size:14px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;margin:0;display:flex;align-items:center;gap:8px}
|
||||
.ph h2::before,.ph h3::before{content:"";width:8px;height:8px;background:var(--sig);transform:rotate(45deg);display:inline-block;flex:none}
|
||||
.ph .meta{font-family:var(--mono);font-size:10.5px;color:var(--muted);letter-spacing:.04em;text-align:right}
|
||||
@@ -140,7 +169,7 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
.split{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--line)} .split i{display:block;height:100%} .split .a{background:var(--accent)} .split .b{background:var(--accent-dim)} .split .c{background:var(--sig)}
|
||||
.prog{height:10px;background:var(--line);border-radius:5px;overflow:hidden} .prog i{display:block;height:100%;background:linear-gradient(90deg,var(--accent-hi),var(--accent) 70%,var(--sig))}
|
||||
.gauge{display:grid;grid-template-columns:repeat(5,1fr);gap:5px} .gauge i{display:block;height:12px;border-radius:2px;background:var(--line);border:1px solid var(--line-strong)}
|
||||
.gauge i.on{background:linear-gradient(180deg,#3A83F0,var(--accent));border-color:var(--accent-hi);box-shadow:0 0 8px rgba(31,111,235,.45)}
|
||||
.gauge i.on{background:var(--btn-blue);border-color:var(--accent-hi);box-shadow:0 0 8px color-mix(in srgb,var(--accent) 45%,transparent)}
|
||||
.tabs{display:flex;gap:4px} .tabs button{background:transparent;border:1px solid transparent;border-radius:var(--r);color:var(--muted);font-family:var(--display);font-size:15px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:6px 12px;cursor:pointer}
|
||||
.tabs button.on{background:var(--panel);border-color:var(--accent);color:var(--accent-hi);box-shadow:0 1px 2px rgba(15,27,46,.08)}
|
||||
|
||||
@@ -151,21 +180,21 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
.panel h2::before{content:"";width:8px;height:8px;background:var(--sig);transform:rotate(45deg);display:inline-block;flex:none}
|
||||
|
||||
/* tiny charts: gradient bars, glow on the peak */
|
||||
.bars{display:grid;gap:3px;align-items:end;height:120px;border-bottom:1px solid var(--line-strong);background:repeating-linear-gradient(180deg,transparent 0 29px,rgba(31,111,235,.08) 29px 30px)}
|
||||
.bars{display:grid;gap:3px;align-items:end;height:120px;border-bottom:1px solid var(--line-strong);background:repeating-linear-gradient(180deg,transparent 0 29px,color-mix(in srgb,var(--accent) 10%,transparent) 29px 30px)}
|
||||
.bars i{display:block;width:100%;max-width:56px;justify-self:center;background:linear-gradient(180deg,var(--accent),var(--accent-hi));min-height:1px;border-radius:2px 2px 0 0}
|
||||
.bars i.dim{background:linear-gradient(180deg,var(--accent-dim),#A9CBFA)}
|
||||
.bars i.dim{background:linear-gradient(180deg,var(--accent-dim),var(--accent-pale))}
|
||||
.bars i.hi{background:linear-gradient(180deg,#FF8A48,var(--sig));box-shadow:0 -4px 12px -4px rgba(255,106,26,.6)}
|
||||
.axis{display:flex;justify-content:space-between;font-family:var(--mono);font-size:10px;color:var(--muted)}
|
||||
.spark{display:flex;gap:1px;align-items:end;height:12px} .spark i{display:block;width:5px;background:linear-gradient(180deg,var(--accent-dim),#A9CBFA);border-radius:1px 1px 0 0} .spark i.hi{background:linear-gradient(180deg,var(--accent),var(--accent-hi))}
|
||||
.sparkline{width:74px;height:26px;display:block} .sparkline polyline{fill:none;stroke:var(--accent);stroke-width:1.6;stroke-linejoin:round} .sparkline .fill{fill:rgba(31,111,235,.12);stroke:none}
|
||||
.tile.hi .sparkline polyline{stroke:var(--sig)} .tile.hi .sparkline .fill{fill:rgba(255,106,26,.12)}
|
||||
.spark{display:flex;gap:1px;align-items:end;height:12px} .spark i{display:block;width:5px;background:linear-gradient(180deg,var(--accent-dim),var(--accent-pale));border-radius:1px 1px 0 0} .spark i.hi{background:linear-gradient(180deg,var(--accent),var(--accent-hi))}
|
||||
.sparkline{width:74px;height:26px;display:block} .sparkline polyline{fill:none;stroke:var(--accent);stroke-width:1.6;stroke-linejoin:round} .sparkline .fill{fill:color-mix(in srgb,var(--accent) 12%,transparent);stroke:none}
|
||||
.tile.hi .sparkline polyline{stroke:var(--sig)} .tile.hi .sparkline .fill{fill:color-mix(in srgb,var(--sig) 12%,transparent)}
|
||||
|
||||
/* toast + modal */
|
||||
.toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);background:var(--chrome);color:var(--chrome-ink);border:1px solid var(--chrome-line);border-left:3px solid var(--ok);padding:9px 14px;border-radius:6px;font-size:12px;font-weight:600;opacity:0;transition:opacity .2s;pointer-events:none;z-index:50;box-shadow:0 12px 30px -12px rgba(15,27,46,.6)}
|
||||
.toast.bad{border-left-color:var(--sig)}
|
||||
.toast.on{opacity:1}
|
||||
.modal-back{position:fixed;inset:0;background:rgba(11,20,36,.55);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;padding:16px;z-index:40}
|
||||
.modal{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:18px;width:min(520px,100%);display:grid;gap:12px;box-shadow:0 30px 60px -30px rgba(15,27,46,.6)}
|
||||
.modal{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:18px;width:min(520px,100%);display:grid;gap:12px;box-shadow:var(--sh-lg)}
|
||||
.modal h2{font-family:var(--display);font-size:20px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;margin:0;display:flex;align-items:center;gap:8px}
|
||||
.modal h2::before{content:"";width:8px;height:8px;background:var(--sig);transform:rotate(45deg);display:inline-block}
|
||||
.modal .acts{display:flex;justify-content:flex-end;gap:8px}
|
||||
@@ -186,3 +215,43 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
|
||||
/* JetBrains Mono joins "//" into a ligature that reads as a missing slash in URLs (Marty 2026-10-07): no ligatures anywhere */
|
||||
body,input,textarea,button,code,.mono{font-variant-ligatures:none;font-feature-settings:"liga" 0,"calt" 0}
|
||||
/* chat widget on Control Room screens (2026-10-18: the bubble only lived on the retired /my dashboard) */
|
||||
#iapChatBtn{position:fixed;right:20px;bottom:44px;z-index:60;width:56px;height:56px;border-radius:50%;border:0;background:var(--accent,#3b9dff);color:var(--accent-ink,#fff);font-size:24px;cursor:pointer;box-shadow:0 8px 28px rgba(20,60,140,.35)}
|
||||
#iapChatBtn:hover{transform:scale(1.06)}
|
||||
#iapChatPanel{position:fixed;right:20px;bottom:112px;z-index:60;width:min(360px,calc(100vw - 40px));background:var(--panel,#fff);color:var(--ink,#14213d);border:1px solid var(--line-strong,#c9d3e3);border-radius:16px;overflow:hidden;box-shadow:0 24px 60px rgba(10,20,50,.28);display:flex;flex-direction:column}
|
||||
#iapChatPanel .ch-head{padding:14px 16px;border-bottom:1px solid var(--line,#e2e8f2);font-family:var(--display,inherit);position:relative;font-weight:700}
|
||||
#iapChatPanel .ch-head .ch-sub{display:block;font-size:12px;font-weight:400;color:var(--muted,#64748b)}
|
||||
#iapChatClose{position:absolute;right:10px;top:10px;background:transparent;border:0;color:var(--muted,#64748b);font-size:22px;cursor:pointer;line-height:1}
|
||||
#iapChatPanel .ch-msgs{padding:14px;overflow-y:auto;max-height:340px;display:flex;flex-direction:column;gap:10px}
|
||||
#iapChatPanel .ch-m{border-radius:12px;padding:9px 13px;font-size:13.5px;line-height:1.5;max-width:86%}
|
||||
#iapChatPanel .ch-m.bot{background:var(--accent-soft);border:1px solid var(--accent-dim);align-self:flex-start}
|
||||
#iapChatPanel .ch-m.me{background:var(--panel-2);border:1px solid var(--line,#e2e8f2);align-self:flex-end}
|
||||
#iapChatPanel .ch-m a{word-break:break-all}
|
||||
#iapChatPanel .ch-input{display:flex;gap:8px;padding:11px;border-top:1px solid var(--line,#e2e8f2)}
|
||||
#iapChatPanel .ch-input input{flex:1;min-width:0;padding:9px 11px;border:1px solid var(--line-strong,#c9d3e3);border-radius:10px;font:inherit;background:var(--field-bg);color:var(--ink)}
|
||||
#iapChatPanel .ch-input button{background:var(--accent,#3b9dff);color:var(--accent-ink,#fff);border:0;border-radius:10px;padding:0 16px;font-weight:700;cursor:pointer}
|
||||
|
||||
/* Stage + status colour (Orlando via Marty 2026-10-20): the Pipeline board's stage colours carried to Team rows, and a
|
||||
matching traffic-light for ad status. --st drives the row stripe, the pill and the chip dot. */
|
||||
[data-st]{--st:#64748b}
|
||||
[data-st="joined"]{--st:#2563eb} [data-st="wallet"]{--st:#0891b2} [data-st="payouts"]{--st:#ea580c}
|
||||
[data-st="bought"]{--st:#16a34a} [data-st="building"]{--st:#b7791f} [data-st="quiet"]{--st:#d97706}
|
||||
[data-st="live"]{--st:#16a34a} [data-st="low"]{--st:#d97706} [data-st="out"]{--st:#dc2626} [data-st="paused"]{--st:#64748b} [data-st="sched"]{--st:#2563eb} [data-st="ended"]{--st:#94a3b8}
|
||||
.tbl .rw.st-row{box-shadow:inset 4px 0 0 var(--st)}
|
||||
.tbl .rw.st-row.stalled{background:var(--note-bg)}
|
||||
.stg{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;white-space:nowrap;border-radius:999px;padding:2px 9px;color:color-mix(in srgb,var(--st) 72%,var(--ink));background:color-mix(in srgb,var(--st) 11%,var(--panel));border:1px solid color-mix(in srgb,var(--st) 38%,var(--panel))}
|
||||
.stg::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--st);flex:none}
|
||||
.stg.quiet{margin-top:4px;color:var(--note-ink);background:var(--note-soft);border-color:var(--note-line)}
|
||||
.chip[data-st]{display:inline-flex;align-items:center;gap:6px}
|
||||
.chip[data-st]::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--st);flex:none}
|
||||
.chip[data-st].on{border-color:var(--st);color:var(--ink);background:color-mix(in srgb,var(--st) 13%,var(--panel))}
|
||||
.bar.st i{background:var(--st)}
|
||||
/* dark theme: the stage / status palette lifted so 10.5px pill text still clears 4.5:1 on dark panels */
|
||||
:root[data-theme="dark"] [data-st]{--st:#8E9FB8}
|
||||
:root[data-theme="dark"] [data-st="joined"],:root[data-theme="dark"] [data-st="sched"]{--st:#7AAAFF} :root[data-theme="dark"] [data-st="wallet"]{--st:#4FC3E6} :root[data-theme="dark"] [data-st="payouts"]{--st:#FF9A5C}
|
||||
:root[data-theme="dark"] [data-st="bought"],:root[data-theme="dark"] [data-st="live"]{--st:#4CCB7A} :root[data-theme="dark"] [data-st="building"]{--st:#D9A441} :root[data-theme="dark"] [data-st="quiet"],:root[data-theme="dark"] [data-st="low"]{--st:#F0B44A}
|
||||
:root[data-theme="dark"] [data-st="out"]{--st:#FF7B7B} :root[data-theme="dark"] [data-st="paused"]{--st:#8E9FB8} :root[data-theme="dark"] [data-st="ended"]{--st:#6F7F99}
|
||||
/* theme switch (Light / Dark / Auto) in the topbar and on the Profile pane */
|
||||
.theme-seg button{min-width:0}
|
||||
.topbar .theme-seg{background:transparent;border-color:var(--chrome-line)} .topbar .theme-seg button{color:var(--chrome-sub);border-color:var(--chrome-line);padding:5px 10px;font-size:11px} .topbar .theme-seg button:hover{color:var(--chrome-ink)} .topbar .theme-seg button.on{background:var(--accent);color:var(--accent-ink)}
|
||||
@media (max-width:760px){.topbar .theme-seg button{padding:5px 8px}}
|
||||
|
||||
+100
-21
@@ -9,7 +9,13 @@
|
||||
const pol = wei => { try { return (Number(BigInt(String(wei || '0')) / 10000000000000000n) / 100).toFixed(2); } catch (e) { return '0.00'; } };
|
||||
const usd = c => '$' + (Number(c || 0) / 100).toLocaleString(undefined, { maximumFractionDigits: 2 });
|
||||
const NAMES = { 1000: 'Door', 2500: 'Most chosen', 5000: 'Builder', 10000: 'Growth', 25000: 'Leader', 50000: 'Network' };
|
||||
let CFG = null, ME = null, CAT = [], SEL = null, CAMP = null, DASH = null;
|
||||
let CFG = null, ME = null, CAT = [], SEL = null, CAMP = null, DASH = null, POS = null, FROM = 'main';
|
||||
const short = a => String(a || '').slice(0, 6) + '…' + String(a || '').slice(-4);
|
||||
// Qualified Start (2026-10-18, ported from the classic Buy pane): extra wallets on this account, each its own position
|
||||
// under the main member. Testers could not buy from a second wallet here: the only control was a disconnect that
|
||||
// snapped back to the main wallet, and the buy insisted on the main wallet.
|
||||
const posList = () => (POS && Array.isArray(POS.positions)) ? POS.positions : [];
|
||||
const fromPos = () => FROM !== 'main' && posList().some(x => String(x.address).toLowerCase() === FROM) ? FROM : null;
|
||||
|
||||
function paintTiles() {
|
||||
const avail = CAMP ? CAMP.availableCredits : 0, inLive = CAMP ? CAMP.inCampaigns : 0;
|
||||
@@ -22,12 +28,16 @@
|
||||
CR.tile({ k: 'Qualification', v: bc + ' of ' + (bc >= 5 ? 5 : bc >= 2 ? 5 : 2), note: bc >= 5 ? 'levels 2 and 3 open' : bc >= 2 ? 'level 2 open · 5 opens level 3' : 'buyers to open level 2' })
|
||||
].join('');
|
||||
}
|
||||
// the Monthly Refuel threshold in cents once fuel.js has the member's refuel view (2026-10-25); 0 while the switch is off
|
||||
const rfMin = () => { const v = window.FUEL && window.FUEL.refuel; return v && v.on && v.minUsd ? Math.round(Number(v.minUsd.linkspin) * 100) : 0; };
|
||||
window.LSCredits = { repaint: () => { if (CAT && CAT.length) paintPkgs(); } };
|
||||
function paintPkgs() {
|
||||
const live = CAT.filter(p => p.active !== false && p.exists !== false);
|
||||
if (!live.length) { $('pkgs').innerHTML = '<div class="muted">No packages are on sale right now.</div>'; return; }
|
||||
if (!SEL) SEL = (live.find(p => p.priceCents === 2500) || live[0]).id;
|
||||
$('pkgs').innerHTML = live.map(p => '<button type="button" class="pk' + (p.id === SEL ? ' on' : '') + '" data-id="' + p.id + '"><span class="k">' + esc(NAMES[p.priceCents] || 'Package') + '</span><span class="price">' + usd(p.priceCents) + '</span><span class="cr">' + fmt(p.creditAmount) + ' credits</span>'
|
||||
+ (p.priceCents >= 2000 ? '<span class="tag ok">qualifies</span>' : '<span class="tag">does not qualify</span>') + '</button>').join('');
|
||||
+ (p.priceCents >= 2500 ? '<span class="tag ok">qualifies</span>' : '<span class="tag">does not qualify</span>')
|
||||
+ (rfMin() && p.priceCents >= rfMin() ? '<span class="tag ok" title="A package this size counts as your monthly refuel (or a Pit Stop when this cycle is already refueled here)">counts for Refuel</span>' : '') + '</button>').join('');
|
||||
$('pkgs').querySelectorAll('.pk').forEach(b => b.addEventListener('click', () => { SEL = Number(b.dataset.id); paintPkgs(); paintQuote(); paintGoes(); }));
|
||||
}
|
||||
const sel = () => CAT.find(p => p.id === SEL);
|
||||
@@ -39,7 +49,20 @@
|
||||
$('rateLine').textContent = rate ? 'rate ' + rate.toFixed(4) + ' USD/POL · live from the oracle' : '';
|
||||
const addr = ME && ME.address;
|
||||
$('buyBtn').disabled = !p.costWei;
|
||||
$('buyBtn').textContent = addr ? 'Buy ' + usd(p.priceCents) + ' package' : 'Connect a wallet to buy';
|
||||
const fp = fromPos(), n = fp ? posList().findIndex(x => String(x.address).toLowerCase() === fp) + 2 : 0;
|
||||
$('buyBtn').textContent = addr ? 'Buy ' + usd(p.priceCents) + ' package' + (fp ? ' from position ' + n : '') : 'Connect a wallet to buy';
|
||||
}
|
||||
// "Buy from": the main wallet or one of the positions. Always shown once a main wallet is linked (Michael 2026-10-18:
|
||||
// the instructions say "pick it under Buy from" and the menu did not exist until a position was added)
|
||||
function paintFrom() {
|
||||
const list = posList(), main = POS && POS.main;
|
||||
if (!fromPos()) FROM = 'main';
|
||||
$('fromWrap').hidden = !(ME && ME.address);
|
||||
if (!(ME && ME.address)) return;
|
||||
$('buyFrom').innerHTML = '<option value="main">Main wallet ' + (ME && ME.address ? short(ME.address) : '') + (ME && ME.memberId ? ' · #' + ME.memberId : '') + (main && main.noPayout ? ' · linkage only' : '') + '</option>'
|
||||
+ list.map((x, i) => '<option value="' + esc(String(x.address).toLowerCase()) + '"' + (x.noPayout ? ' disabled' : '') + '>Position ' + (i + 2) + ' ' + short(x.address) + (x.memberId ? ' · #' + x.memberId : ' · not registered yet') + (x.noPayout ? ' · linkage only' : x.counted ? ' · counted' : '') + '</option>').join('');
|
||||
$('buyFrom').value = FROM;
|
||||
$('fromHint').textContent = fromPos() ? 'Your wallet app must be on this position\'s account when you confirm. Its first package registers it under you.' : (list.length ? 'Your wallet app must be on this account when you confirm.' : 'Your main wallet. Positions you add with "Add a position wallet" on this screen appear in this list.');
|
||||
}
|
||||
function paintGoes() {
|
||||
const p = sel(); if (!p) return;
|
||||
@@ -59,19 +82,63 @@
|
||||
$('walletBox').innerHTML = addr
|
||||
? '<div class="code" style="display:block">' + esc(addr) + '</div>'
|
||||
+ (on ? '<div class="ok"><span class="dot"></span>Payouts on. Every package your people buy pays this wallet in the same transaction.</div>'
|
||||
: ME.tankHold ? '<div class="ink2" id="tankHoldNote" style="font-size:13px;color:var(--ok)">' + esc(tankHoldText(ME.tankHold)) + '</div>' // held for an adopter: no activate button
|
||||
: '<div class="ink2" style="font-size:13px">Linked, but payouts are off until this wallet is on the contract. Buying a package does that. So does the free activation below (gas only).</div><div class="acts"><button class="btn blue" type="button" id="activateBtn">Switch on payouts (free)</button></div>')
|
||||
+ '<div class="acts"><a class="btn sm" href="' + esc((CFG && CFG.explorer) || 'https://polygonscan.com') + '/address/' + esc(addr) + '" target="_blank" rel="noopener">Open on the explorer</a><button class="btn sm" type="button" id="relinkBtn">Use a different wallet</button></div>'
|
||||
+ '<div class="acts"><a class="btn sm" href="' + esc((CFG && CFG.explorer) || 'https://polygonscan.com') + '/address/' + esc(addr) + '" target="_blank" rel="noopener">Open on the explorer</a><button class="btn sm" type="button" id="switchBtn">Switch account</button><button class="btn sm" type="button" id="dropBtn">Disconnect</button></div>'
|
||||
+ posBlock()
|
||||
: '<div class="ink2" style="font-size:13px">Link the wallet that should receive your payouts. One free signature, no transaction. SafePal is the recommended wallet; MetaMask, Phantom and any WalletConnect wallet work too.</div><div class="acts"><button class="btn blue" type="button" id="linkBtn">Link a wallet</button><a class="btn sm" href="/wallets" target="_blank" rel="noopener">Wallet guide</a></div>';
|
||||
const lb = $('linkBtn'); if (lb) lb.addEventListener('click', () => guard(lb, linkWallet));
|
||||
const ab = $('activateBtn'); if (ab) ab.addEventListener('click', () => guard(ab, activate));
|
||||
const rb = $('relinkBtn'); if (rb) rb.addEventListener('click', () => guard(rb, async () => { await IAPWallet.disconnect(); CR.toast('Disconnected. Reloading so you can pick another wallet.'); setTimeout(() => location.reload(), 800); }));
|
||||
const sb = $('switchBtn'); if (sb) sb.addEventListener('click', () => guard(sb, switchAccount));
|
||||
const db = $('dropBtn'); if (db) db.addEventListener('click', () => guard(db, async () => { await IAPWallet.disconnect(); CR.toast('Disconnected. Your linked wallet stays on your account. The next purchase or Add a position wallet opens the account picker.'); }));
|
||||
const pb = $('addPosBtn'); if (pb) pb.addEventListener('click', () => guard(pb, addPosition));
|
||||
}
|
||||
function posBlock() {
|
||||
const list = posList(); const max = 5;
|
||||
return '<div style="border-top:1px solid var(--line);padding-top:10px;display:grid;gap:8px"><div style="font:700 10.5px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted)">Extra positions · Qualified Start</div>'
|
||||
+ list.map((x, i) => '<div class="row" style="padding:4px 0"><span>Position ' + (i + 2) + ' <span class="mono">' + esc(short(x.address)) + '</span></span><span class="mono muted" style="font-size:11.5px">' + (x.memberId ? '#' + x.memberId + (x.noPayout ? ' · linkage only' : x.counted ? ' · counted' : '') : 'buy to register') + '</span></div>').join('')
|
||||
+ '<div class="ink2" style="font-size:12.5px">Own another wallet? Add it as a position, then pick it under <b>Buy from</b> and buy a package marked qualifies. Each position that buys counts as a qualifying buyer for you, its credits pool with yours, and you stay signed in as you.</div>'
|
||||
+ (list.length < max ? '<div class="acts"><button class="btn blue sm" type="button" id="addPosBtn">Add a position wallet</button><span class="muted" style="font-size:11.5px">' + list.length + ' of ' + max + ' used</span></div>' : '<div class="muted" style="font-size:11.5px">All ' + max + ' positions are linked.</div>')
|
||||
+ '</div>';
|
||||
}
|
||||
// pick a different account in the wallet (MetaMask's account picker; a fresh session for WalletConnect) and say what it is
|
||||
async function switchAccount() {
|
||||
const a = String(await IAPWallet.pickAccount() || '').toLowerCase(); if (!a) return;
|
||||
const i = posList().findIndex(x => String(x.address).toLowerCase() === a);
|
||||
if (ME && a === String(ME.address || '').toLowerCase()) { FROM = 'main'; CR.toast('Connected as ' + short(a) + ', your main wallet.'); }
|
||||
else if (i >= 0) { FROM = a; CR.toast('Connected as ' + short(a) + ', position ' + (i + 2) + '. It is selected under Buy from.'); }
|
||||
else CR.toast('Connected as ' + short(a) + '. That account is not on LinkSpin yet. To buy from it, use Add a position wallet.');
|
||||
paintFrom(); paintQuote();
|
||||
}
|
||||
// every Add-a-position attempt is reported to the server log, so support can see where it stopped (never blocks the flow)
|
||||
function posReport(stage, detail) { try { fetch('/api/my/position-attempt', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ stage, detail: String(detail || '').slice(0, 300), ua: navigator.userAgent.slice(0, 160), wallet: !!window.ethereum, mm: !!(window.ethereum && window.ethereum.isMetaMask) }), keepalive: true }).catch(() => {}); } catch (e) {} }
|
||||
async function addPosition() {
|
||||
posReport('click', '');
|
||||
const me = await CR.me(true);
|
||||
if (!me.address) throw new Error('Link your main wallet first, then add positions under it.');
|
||||
if (!me.memberId) throw new Error('Switch on payouts for your main wallet first. Positions register under your member number.');
|
||||
const ok = await CR.dialog({ title: 'Add a position wallet', html: '<div class="ink2" style="display:grid;gap:8px"><div>Your wallet asks which account to connect. Choose <b>only the new account</b> (not ' + esc(short(me.address)) + '), then sign once. No transaction, no cost.</div><div>No second account yet? MetaMask: account menu, Add account. SafePal or Trust: create or switch wallet. Phone with WalletConnect: pick the other wallet app in the list.</div></div>', ok: 'Ready', no: 'Cancel' });
|
||||
if (!ok) { posReport('cancelled', ''); return; }
|
||||
CR.toast('Pick the new account in your wallet, then sign once…');
|
||||
posReport('start', '');
|
||||
// the wallet can sit silent (a request already waiting in MetaMask, its window behind the browser, or only one
|
||||
// account to offer): after 20 s say what to check instead of looking like nothing happened (Michael 2026-10-18)
|
||||
const tip = setTimeout(() => { posReport('no-answer-20s', ''); CR.dialog({ title: 'Waiting on your wallet', text: 'Your wallet has not answered yet. Open MetaMask (the fox icon in the browser toolbar): a request may be waiting there, or its window may be behind this one. You also need a second account in MetaMask: Accounts, then Add account. Pick only that new account and sign once.', ok: 'OK' }).catch(() => {}); }, 20000);
|
||||
let r;
|
||||
try { r = await IAPWallet.signIn({ asPosition: true, pick: true }); }
|
||||
catch (e) { posReport('error', (e && e.message) || String(e)); throw e; }
|
||||
finally { clearTimeout(tip); }
|
||||
posReport('added', r && r.address);
|
||||
FROM = String(r.address || '').toLowerCase();
|
||||
CR.toast('Position added: ' + short(r.address) + '. It is selected under Buy from. Pick a qualifying package and buy.');
|
||||
await load();
|
||||
}
|
||||
function paintBuys(E) {
|
||||
const buys = E && Array.isArray(E.purchases) ? E.purchases : [];
|
||||
$('buysMeta').textContent = buys.length + (buys.length === 1 ? ' purchase' : ' purchases') + ' · every row links to the transaction';
|
||||
$('buyRows').innerHTML = buys.length ? buys.slice(0, 50).map(x => {
|
||||
const ts = Number(x.ts || x.time || 0); const when = ts ? new Date(ts * (ts > 1e12 ? 1 : 1000)).toLocaleString() : '';
|
||||
const pkg = x.priceCents ? usd(x.priceCents) : (x.package || x.product || ('#' + (x.productId || '')));
|
||||
const pkg = (x.priceCents ? usd(x.priceCents) : (x.package || x.product || ('#' + (x.productId || '')))) + (x.position ? ' · Position ' + x.position : ''); // bought from a linked position (2026-10-18)
|
||||
const paid = x.amountWei || x.valueWei || x.paidWei ? pol(x.amountWei || x.valueWei || x.paidWei) + ' POL' : '';
|
||||
const tx = x.tx || x.hash || '';
|
||||
return '<div class="rw"><span class="mono muted" style="font-size:12px">' + esc(when) + '</span><span class="num">' + esc(String(pkg)) + '</span><span class="mono">' + esc(paid) + '</span><span>' + (tx ? '<a class="mono" href="' + esc((CFG && CFG.explorer) || 'https://polygonscan.com') + '/tx/' + esc(tx) + '" target="_blank" rel="noopener">' + esc(tx.slice(0, 10)) + '…' + esc(tx.slice(-6)) + '</a>' : '') + '</span></div>';
|
||||
@@ -79,8 +146,17 @@
|
||||
}
|
||||
async function guard(btn, fn) { if (btn.disabled) return; btn.disabled = true; try { await fn(); } catch (e) { CR.toast((e && e.message) || 'Something went wrong.', true); } finally { btn.disabled = false; } }
|
||||
|
||||
// holding tank (2026-10-27): no sponsor yet, so the free Switch on payouts waits for an adopter (24 hours at most).
|
||||
// A purchase is never held: buying goes ahead as before.
|
||||
const holdLeft = ms => { const m = Math.max(1, Math.round(ms / 60000)); const h = Math.floor(m / 60); return h ? h + ' h ' + (m % 60) + ' min' : m + ' min'; };
|
||||
function tankHoldText(h) {
|
||||
let t = "You're being matched with a sponsor. Payouts switch on as soon as someone picks you up (within 24 hours).";
|
||||
if (h && h.until) { const ms = h.until - Date.now(); t += ms > 0 ? ' Time left: ' + holdLeft(ms) + '.' : ' Any minute now.'; }
|
||||
return t;
|
||||
}
|
||||
// a named sponsor that cannot be paid right now: hold the transaction and say why (never credit the company by default)
|
||||
function holdText(sp) {
|
||||
if (sp.sponsorBlocked === 'tankHold') return tankHoldText(sp.tankHold); // the free activation only (intent=activate), never a buy
|
||||
const who = sp.sponsorName ? ('@' + String(sp.sponsorName).replace(/^@/, '')) : 'your sponsor';
|
||||
if (sp.sponsorBlocked === 'claim' && sp.claim) return (sp.claim.nobody ? 'Nobody above you on LinkSpin has a wallet yet, so there is no one for the contract to pay. ' : who + ' has not linked a wallet on LinkSpin yet. ') + 'Your first purchase waits until ' + (sp.claim.deadline ? new Date(sp.claim.deadline).toLocaleDateString() : 'they do') + ', then it goes ahead with the nearest member above who has one. Nothing was charged.';
|
||||
if (sp.sponsorBlocked === 'notActivated') return who + ' has not switched on payouts yet, so this purchase would credit the company instead of them. Ask them to switch on payouts first (one free transaction).';
|
||||
@@ -89,7 +165,7 @@
|
||||
}
|
||||
async function linkWallet() { CR.toast('Check your wallet for the free link signature…'); await IAPWallet.signIn(); CR.toast('Wallet linked. Earnings pay there from now on.'); await load(); }
|
||||
async function activate() {
|
||||
const sp = await CR.get('/api/sponsor?intent=buy'); if (sp.sponsorBlocked) { $('holdBox').textContent = holdText(sp); $('holdBox').hidden = false; return; }
|
||||
const sp = await CR.get('/api/sponsor?intent=activate'); if (sp.sponsorBlocked) { $('holdBox').textContent = holdText(sp); $('holdBox').hidden = false; if (sp.sponsorBlocked === 'tankHold') { ME.tankHold = sp.tankHold || {}; paintWallet(); } return; }
|
||||
CR.toast('Confirm the free activation in your wallet…');
|
||||
const r = await IAPWallet.activate(sp.sponsorId || 0);
|
||||
if (!r.receipt || r.receipt.status !== '0x1') throw new Error('Transaction reverted. Check the explorer.');
|
||||
@@ -99,14 +175,21 @@
|
||||
const p = sel(); if (!p || !p.costWei) return;
|
||||
$('holdBox').hidden = true;
|
||||
let me = await CR.me(true);
|
||||
if (!me.address) { CR.toast('Link your wallet first: one quick signature…'); await IAPWallet.signIn(); me = await CR.me(true); }
|
||||
const want = String(me.address || '').toLowerCase(); if (!want) throw new Error('No wallet linked.');
|
||||
// which wallet buys: the main one, or a position picked under "Buy from" (it registers under the main member id
|
||||
// on its first buy, so its sponsor is always this member)
|
||||
const fp = fromPos(), row = fp ? posList().find(x => String(x.address).toLowerCase() === fp) : (POS && POS.main);
|
||||
if (fp && !me.memberId) throw new Error('Switch on payouts for your main wallet first, so this position can register under you.');
|
||||
if (fp && p.priceCents < 2500 && !(await CR.dialog({ title: 'This package does not qualify', text: 'A ' + usd(p.priceCents) + ' package from a position adds credits but does not count toward your qualification. Pick a package marked qualifies to count this position.', ok: 'Buy anyway', no: 'Pick another' }))) return;
|
||||
if (row && row.noPayout) throw new Error('This ' + (fp ? 'position' : 'wallet') + ' is kept for linkage only. A purchase from it would pay a retired wallet. Buy from another one.');
|
||||
if (!fp && !me.address) { CR.toast('Link your wallet first: one quick signature…'); await IAPWallet.signIn(); me = await CR.me(true); }
|
||||
const want = fp || String(me.address || '').toLowerCase(); if (!want) throw new Error('No wallet linked.');
|
||||
// never buy from a wallet other than the one chosen: a stray wallet would register a brand-new member
|
||||
await IAPWallet.connect();
|
||||
let cur = String(await IAPWallet.activeAddress() || '').toLowerCase();
|
||||
if (cur !== want) { CR.toast('Pick ' + want.slice(0, 6) + '…' + want.slice(-4) + ' in your wallet\'s account picker…'); cur = String(await IAPWallet.pickAccount() || '').toLowerCase(); }
|
||||
if (cur !== want) throw new Error('Your wallet connected as ' + cur.slice(0, 6) + '…' + cur.slice(-4) + ' but your linked wallet is ' + want.slice(0, 6) + '…' + want.slice(-4) + '. Switch accounts in the wallet app and try again.');
|
||||
const sp = await CR.get('/api/sponsor?intent=buy');
|
||||
if (!me.memberId && sp.sponsorBlocked) { $('holdBox').textContent = holdText(sp); $('holdBox').hidden = false; return; }
|
||||
if (cur !== want) { CR.toast('Pick ' + short(want) + ' in your wallet\'s account picker…'); cur = String(await IAPWallet.pickAccount() || '').toLowerCase(); }
|
||||
if (cur !== want) throw new Error('Your wallet connected as ' + short(cur) + ' but you are buying from ' + short(want) + '. Switch accounts in the wallet app (or change Buy from) and try again.');
|
||||
const sp = fp ? { sponsorId: me.memberId } : await CR.get('/api/sponsor?intent=buy');
|
||||
if (!fp && !me.memberId && sp.sponsorBlocked) { $('holdBox').textContent = holdText(sp); $('holdBox').hidden = false; return; }
|
||||
try { // pre-flight: the POL has to be there; Trust Wallet refuses transactions that spend most of a balance
|
||||
const need = BigInt(p.costWei) + BigInt(p.costWei) / 50n;
|
||||
const bal = await IAPWallet.balance(want);
|
||||
@@ -120,24 +203,20 @@
|
||||
CR.toast('Confirm the purchase in your wallet…');
|
||||
const r = await IAPWallet.buy(Number(p.id), sp.sponsorId || 0, p.costWei);
|
||||
if (!r.receipt || r.receipt.status !== '0x1') throw new Error('Transaction reverted. Nothing was charged beyond gas.');
|
||||
CR.toast('Settled on-chain. Your credits are in Ads now.');
|
||||
CR.toast(fp ? 'Settled on-chain. That position now counts toward your qualification, and its credits pool with yours.' : 'Settled on-chain. Your credits are in Ads now.');
|
||||
await load();
|
||||
}
|
||||
$('buyBtn').addEventListener('click', () => guard($('buyBtn'), buy));
|
||||
$('cardBtn').addEventListener('click', () => guard($('cardBtn'), async () => {
|
||||
const p = sel(); const need = p && p.costWei ? Math.max(10, Math.ceil(Number(BigInt(p.costWei) / 1000000000000000000n)) + 3) : 30;
|
||||
const q = '/api/moonpay-url?pol=' + need + (ME && ME.address ? '&address=' + encodeURIComponent(ME.address) : '');
|
||||
const r = await CR.get(q); if (!r.url) throw new Error('The card on-ramp is not available right now.');
|
||||
window.open(r.url, '_blank', 'noopener'); CR.toast('MoonPay opened in a new tab. POL lands straight in your own wallet.');
|
||||
}));
|
||||
$('buyFrom').addEventListener('change', () => { FROM = $('buyFrom').value || 'main'; paintFrom(); paintQuote(); });
|
||||
|
||||
async function load() {
|
||||
try { [CFG, ME] = await Promise.all([CR.get('/api/config'), CR.me(true)]); } catch (e) { CR.sub('could not load'); return; }
|
||||
let cat = null, E = null;
|
||||
try { [cat, CAMP, DASH, E] = await Promise.all([CR.get('/api/catalog'), CR.get('/api/my/campaigns'), CR.get('/api/my/dashboard'), CR.get('/api/my/activity')]); } catch (e) {}
|
||||
try { POS = ME.address ? await CR.get('/api/my/positions') : null; } catch (e) { POS = null; }
|
||||
CAT = (cat && cat.products) || [];
|
||||
CR.sub((CAMP ? fmt(CAMP.availableCredits) + ' free to spend · ' + fmt(CAMP.inCampaigns) + ' in live ads' : '') + (CAT[0] && CAT[0].costWei ? '' : ' · price feed catching up'));
|
||||
paintTiles(); paintPkgs(); paintQuote(); paintGoes(); paintWallet(); paintBuys(E);
|
||||
paintTiles(); paintPkgs(); paintFrom(); paintQuote(); paintGoes(); paintWallet(); paintBuys(E);
|
||||
const spName = ME.sponsorName ? ('@' + String(ME.sponsorName).replace(/^@/, '')) : null;
|
||||
$('sponsorLine').innerHTML = spName
|
||||
? 'Your sponsor <b>' + esc(spName) + '</b> is placed on the contract. The moment you confirm, half of the package lands in their wallet and the rest splits as shown. Credits appear in Ads right away.'
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// The Engine Room (2026-10-24). The SAME file ships in InstantAdPay (Members > Engine Room) and LinkSpin (Ads screen panel).
|
||||
// Plain dials, real numbers, colour only for warnings. Renders into #erRoot from /api/my/engine; hidden while the
|
||||
// refuelStreak switch is off. Unlocked by the first counted refuel, greyed "Refuel to start your engine" until then.
|
||||
(function () {
|
||||
const root = document.getElementById('erRoot'); if (!root) return;
|
||||
const host = document.getElementById(root.dataset.host || 'erPanel');
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
const n = v => Number(v || 0).toLocaleString('en-US');
|
||||
// a link on this site becomes a plain path; a link to the other site carries ?from=<this site>&task=<job> so the other
|
||||
// site opens with an arrival strip naming the job and its first step (2026-10-25, Marty lost the thread on LinkSpin)
|
||||
const TASK = { tracking: 'conversions', start: 'refuel', refuel: 'refuel', pitstop: 'refuel', bannerspin: 'bannerspin', testing: 'testing', relaunch: 'ads', topup: 'ads', cut: 'ads', cruise: 'ads' };
|
||||
let FROM = 'iap';
|
||||
const siteOf = u => /linkspin/i.test(u.host) ? 'linkspin' : 'iap'; // which site a link belongs to, by its host (also right on a local copy)
|
||||
const go = (url, task) => { try { const u = new URL(url); if (u.host === location.host || siteOf(u) === FROM) return u.pathname + u.search + u.hash; if (task) { u.searchParams.set('from', FROM); u.searchParams.set('task', task); } return u.href; } catch (e) { return url; } };
|
||||
// "Refuel LinkSpin this cycle..." gets a way there (2026-10-25): the other site's buy screen, tagged for its arrival strip
|
||||
const otherBuy = note => { const m = /^Refuel (LinkSpin|InstantAdPay) /.exec(note || ''); if (!m) return '';
|
||||
const url = m[1] === 'LinkSpin' ? 'https://linkspin.app/credits#refuel' : 'https://instantadpay.com/my#buy';
|
||||
return ' <a href="' + esc(go(url, 'refuel')) + '">Refuel ' + m[1] + (ext(url) ? ' ↗' : '') + '</a>'; };
|
||||
const ext = url => { try { const u = new URL(url); return u.host !== location.host && siteOf(u) !== FROM; } catch (e) { return false; } };
|
||||
const css = '.er{display:grid;gap:14px}.er-locked{opacity:.45;filter:grayscale(1);pointer-events:none}.er-dials{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));gap:12px}'
|
||||
+ '.er-dial{border:1px solid rgba(127,127,127,.3);border-radius:10px;padding:10px 12px;text-align:center;min-width:0}.er-dial svg{width:100%;max-width:200px;height:auto;display:block;margin:0 auto}'
|
||||
+ '.er-dial .v{font-size:22px;font-weight:700;margin-top:-6px}.er-dial .c{font-size:12px;opacity:.8}.er-row{display:flex;flex-wrap:wrap;gap:8px}'
|
||||
+ '.er-light{display:flex;gap:6px;align-items:center;border:1px solid rgba(127,127,127,.3);border-radius:999px;padding:4px 10px;font-size:12.5px}.er-dot{width:10px;height:10px;border-radius:50%;background:rgba(127,127,127,.45);flex:none}'
|
||||
+ '.er-dot.on{background:var(--warn,#e8a317)}.er-dot.green{background:var(--ok,#2fa36b)}.er-dot.amber{background:var(--warn,#e8a317)}.er-dot.grey{background:rgba(127,127,127,.45)}.er-parts{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr));gap:8px}'
|
||||
+ '.er-part{border:1px solid rgba(127,127,127,.3);border-radius:8px;padding:8px 10px;font-size:13px;display:grid;gap:3px;min-width:0}.er-part b{display:flex;flex-wrap:wrap;gap:2px 6px;align-items:center}.er-next{border:1px solid rgba(127,127,127,.4);border-radius:10px;padding:12px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}'
|
||||
+ '.er-next .w{flex:1 1 220px;font-size:13px}.er-h{font-size:12px;letter-spacing:.06em;text-transform:uppercase;opacity:.75;margin:0}.er-streak{font-size:13.5px;line-height:1.5}.er-goal{display:flex;gap:6px;align-items:center;justify-content:center;margin-top:6px;font-size:12px}.er-goal input{width:70px}';
|
||||
if (!document.getElementById('erCss')) { const st = document.createElement('style'); st.id = 'erCss'; st.textContent = css; document.head.appendChild(st); }
|
||||
// a plain 180-degree dial; pct null = no reading
|
||||
function dial(pct, value, caption, aria, warn) {
|
||||
const p = pct == null ? 0 : Math.max(0, Math.min(100, pct));
|
||||
const a = Math.PI * (1 - p / 100); const x = 100 + 80 * Math.cos(a), y = 100 - 80 * Math.sin(a);
|
||||
const col = warn ? 'var(--warn,#e8a317)' : 'currentColor';
|
||||
return '<div class="er-dial" role="img" aria-label="' + esc(aria) + '"><svg viewBox="0 0 200 112" aria-hidden="true"><path d="M20 100 A80 80 0 0 1 180 100" fill="none" stroke="rgba(127,127,127,.3)" stroke-width="14" stroke-linecap="round"/>'
|
||||
+ (pct == null ? '' : '<path d="M20 100 A80 80 0 0 1 ' + x.toFixed(1) + ' ' + y.toFixed(1) + '" fill="none" stroke="' + col + '" stroke-width="14" stroke-linecap="round"/>') + '</svg>'
|
||||
+ '<div class="v">' + esc(value) + '</div><div class="c">' + caption + '</div></div>';
|
||||
}
|
||||
function view(d) {
|
||||
const f = d.fuel, c = d.clicks, g = d.goals, s = d.streak;
|
||||
const fuelCap = (f.refuelCredits ? n(f.left) + ' of ' + n(f.refuelCredits) + ' credits this cycle' : n(f.left) + ' credits on both sites') + (f.daysLeft != null ? '<br>about ' + n(f.daysLeft) + ' days at your burn (' + n(f.burnPerDay) + ' a day)' : '');
|
||||
const fuelAria = 'Fuel left: ' + n(f.left) + ' credits' + (f.pct != null ? ', ' + f.pct + ' percent of this cycle’s refuel' : '') + (f.daysLeft != null ? ', about ' + f.daysLeft + ' days at your current burn' : '');
|
||||
const clickCap = (c.prevWeek ? 'last week: ' + n(c.prevWeek) + ' (half way = the same)<br>' : '') + (c.per1000 != null ? n(c.per1000) + ' clicks per 1,000 credits' : 'clicks per 1,000 credits: not enough delivery yet') + '<br>all ads, both sites';
|
||||
const goalCap = (g.month == null ? 'LinkSpin did not answer' : g.tracking ? (g.target ? 'goal: ' + n(g.target) + ' this month' : 'set a goal for the month') : 'set up conversion tracking') + '<span class="er-goal"><label>goal <input type="number" min="0" max="100000" data-er-goal value="' + (g.target || '') + '" aria-label="Your goal for this month"></label><button class="btn small sec" type="button" data-er-save>Save</button></span>';
|
||||
const dials = '<div class="er-dials">'
|
||||
+ dial(f.pct, f.pct != null ? f.pct + '%' : n(f.left), 'Fuel left<br>' + fuelCap, fuelAria, f.daysLeft != null && f.daysLeft < 5)
|
||||
+ dial(c.pct, n(c.week), 'Clicks this week<br>' + clickCap, 'Clicks this week: ' + n(c.week) + (c.prevWeek ? ', last week ' + n(c.prevWeek) : '') + (c.per1000 != null ? ', ' + c.per1000 + ' per 1,000 credits' : ''), false)
|
||||
+ dial(g.pct, g.month == null ? '?' : n(g.month), 'Goals this month<br>' + goalCap, 'Goals this month: ' + (g.month == null ? 'unknown' : g.month) + (g.target ? ' of ' + g.target : ''), false) + '</div>';
|
||||
const streak = '<div class="er-streak"><p class="er-h">Streak</p>' + (s.active ? '<b>' + s.months + ' month' + (s.months === 1 ? '' : 's') + '</b>' + (s.both ? ', both engines this cycle' : '') + '. Refuel day <b>' + esc(s.refuelDay) + '</b>, grace to ' + esc(s.graceEnd) + ' (Central).'
|
||||
+ (typeof s.note === 'string' ? (s.note ? ' ' + esc(s.note) + otherBuy(s.note) : '') : s.next ? (s.windowOpen ? ' Window open: next refuel +' + s.next.single + '% (+' + s.next.both + '% on each with both).' : s.both ? ' Both engines fueled this cycle.' : s.next.secondEngine ? ' Refuel the other site this cycle for +' + s.next.secondEngine + '% on both.' : '') : '') // s.note from engine.js (2026-10-24: no 'refuel the other site' once both are done)
|
||||
+ (s.pitStop ? ' Pit Stop: +' + s.pitStop.pct + '% ' + (s.pitStop.iap || s.pitStop.linkspin ? 'available' : 'used') + ' this cycle.' : '') + (s.best > s.months ? ' Best: ' + s.best + '.' : '') : 'Not started.') + '</div>';
|
||||
const warns = '<div><p class="er-h">Warning lights</p><div class="er-row">' + d.warnings.map(w => '<span class="er-light" title="' + esc(w.note) + '"><span class="er-dot' + (w.on ? ' on' : '') + '" aria-hidden="true"></span>' + esc(w.label) + ': ' + (w.on ? '<b>on</b>' : 'off') + '<span class="sr" style="position:absolute;left:-9999px"> (' + esc(w.note) + ')</span></span>').join('') + '</div></div>';
|
||||
const parts = '<div><p class="er-h">The six parts</p><div class="er-parts">' + d.parts.map(p => '<div class="er-part"><b><span class="er-dot ' + p.state + '" aria-hidden="true"></span>' + esc(p.label) + ' <span style="font-weight:400;opacity:.75">(' + (p.state === 'green' ? 'working' : p.state === 'amber' ? 'needs attention' : 'not started') + ')</span></b><span>' + esc(p.note) + '</span>'
|
||||
+ (p.state !== 'green' && p.link ? '<a href="' + esc(go(p.link, p.key)) + '">' + (p.state === 'grey' ? 'Set it up' : 'Fix it') + (ext(p.link) ? ' on ' + (FROM === 'iap' ? 'LinkSpin' : 'InstantAdPay') + ' ↗' : '') + '</a>' : '') + '</div>').join('') + '</div></div>';
|
||||
const nextLink = go(d.next.link, TASK[d.next.key]);
|
||||
const next = '<div class="er-next"><div class="w"><p class="er-h">Next move</p><b>' + esc(d.next.label) + '</b><br>' + esc(d.next.why)
|
||||
+ (d.next.guide ? '<br><a href="' + esc(d.next.guide) + '" target="_blank" rel="noopener" style="font-size:12.5px">' + (d.next.key === 'tracking' ? 'Step-by-step setup guide' : 'How the Refuel streak works') + '</a>' : '') + '</div>'
|
||||
+ '<a class="btn' + (d.locked ? '' : ' pri') + '" href="' + esc(nextLink) + '">' + esc(d.next.label) + (ext(d.next.link) ? ' on ' + (FROM === 'iap' ? 'LinkSpin' : 'InstantAdPay') : '') + '</a></div>';
|
||||
const how = d.next.guide === '/refuel' ? '' : '<p style="margin:0;font-size:12.5px"><a href="/refuel" target="_blank" rel="noopener">How the Refuel streak works</a></p>'; // the member guide (2026-10-24)
|
||||
if (d.locked) return '<div class="er">' + next + how + '<div class="er-locked" aria-hidden="true">' + dials + warns + parts + '</div></div>';
|
||||
return '<div class="er">' + next + dials + streak + how + warns + parts + '<p class="small muted" style="margin:0;font-size:12px;opacity:.75">Numbers cover InstantAdPay and LinkSpin together' + (d.sites && (!d.sites.iap || !d.sites.linkspin) ? ' (one site did not answer just now)' : '') + '. Credits buy ad delivery only.</p></div>';
|
||||
}
|
||||
async function load(fresh) {
|
||||
try {
|
||||
const d = await (await fetch('/api/my/engine' + (fresh ? '?fresh=1' : ''), { cache: 'no-store' })).json();
|
||||
window.FUEL = window.FUEL || {}; window.FUEL.engine = d;
|
||||
if (!d || !d.on) { if (host) host.hidden = true; return; }
|
||||
if (host) host.hidden = false;
|
||||
if (d.error) { root.innerHTML = '<p class="small muted">' + esc(d.error) + '</p>'; return; }
|
||||
FROM = d.site === 'linkspin' ? 'linkspin' : 'iap';
|
||||
root.innerHTML = view(d);
|
||||
const save = root.querySelector('[data-er-save]');
|
||||
if (save) save.addEventListener('click', async () => {
|
||||
const v = root.querySelector('[data-er-goal]').value; save.disabled = true;
|
||||
try { const r = await (await fetch('/api/my/engine/goal', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ goal: Number(v) || 0 }) })).json(); if (r.error) throw new Error(r.error); load(true); }
|
||||
catch (e) { save.disabled = false; save.textContent = 'Try again'; }
|
||||
});
|
||||
} catch (e) { if (host) host.hidden = true; }
|
||||
}
|
||||
window.ENGINE_ROOM = { load };
|
||||
load(); setInterval(() => { if (!document.hidden) load(); }, 120000);
|
||||
window.addEventListener('cr:signedin', () => load(true)); // LinkSpin's in-shell sign-in: the panel loaded signed out
|
||||
})();
|
||||
@@ -0,0 +1,109 @@
|
||||
// Fuel Your Offers (2026-10-24), LinkSpin: the Monthly Refuel panel on Credits and Ads. The streak lives on InstantAdPay
|
||||
// and is shared by both sites; /api/my/refuel relays InstantAdPay's view. Hidden while the refuelStreak switch is off.
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id);
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
const n = v => Number(v || 0).toLocaleString('en-US');
|
||||
window.FUEL = window.FUEL || {};
|
||||
const HOW = '<p class="muted" style="margin:10px 0 0"><a href="/refuel" target="_blank" rel="noopener">How the Refuel streak works</a>' + (location.pathname === '/ads' ? '' : ' · <a href="/ads#engine">Engine Room</a>') + '</p>'; // the member guide (2026-10-24); Engine Room link (2026-10-25)
|
||||
// the one action, said plainly (2026-10-25): which package counts, and a button that lands on the package picker
|
||||
const buyBtn = (v, label, pri) => '<p style="margin:0 0 8px">Any package of <b>$' + v.minUsd.linkspin + ' or more</b> here counts (marked <b>counts for Refuel</b> under Buy a package).</p>'
|
||||
+ '<a class="btn' + (pri ? ' pri' : '') + '" href="/credits#buy" data-rf-buy>' + label + '</a>';
|
||||
function site(name, s, minUsd) {
|
||||
const row = '<div class="row" style="display:flex;justify-content:space-between;align-items:baseline;gap:4px 12px;flex-wrap:wrap;padding:3px 0"><span>' + name + ':</span> '; // own spacing: the Ads screen has no .row rule (2026-10-24)
|
||||
return s && s.refueled ? row + '<b>+' + s.pct + '% · ' + n(s.bonus) + ' bonus credits</b></div>'
|
||||
: row + '<span class="muted">not yet ($' + minUsd + '+ counts)</span></div>';
|
||||
}
|
||||
function body(v) {
|
||||
if (v.error) return '<p class="muted">' + esc(v.error) + '</p>';
|
||||
if (!v.active) {
|
||||
return '<p style="margin:0 0 8px">' + (v.started ? 'Your last streak ended. ' : '') + 'A package of <b>$' + v.minUsd.linkspin + ' or more</b> here, or $' + v.minUsd.iap + '+ on InstantAdPay, ' + (v.started ? 'starts it again' : 'starts your monthly refuel streak and sets your own refuel day') + '.</p>'
|
||||
+ '<p class="muted" style="margin:0 0 10px">Bonus ad credits: month 1 +' + v.ladder.single[0] + '%, then +' + v.ladder.single.slice(1).join('%, +') + '%. Refuel both sites in the same cycle and each gets +' + v.ladder.both.join('%, +') + '%.</p>'
|
||||
+ buyBtn(v, 'Buy a $' + v.minUsd.linkspin + '+ package to start', true) + HOW;
|
||||
}
|
||||
const c = v.cycle || {};
|
||||
let h = v.windowOpen
|
||||
? '<p style="margin:0 0 8px"><b>Your refuel window is open.</b> Refuel day <b>' + esc(v.refuelDayLabel) + '</b>, grace to ' + esc(v.graceLabel) + ' (Central). Next refuel: +' + v.next.single + '%, or +' + v.next.both + '% on each site with both.</p>'
|
||||
: '<p style="margin:0 0 8px">Next refuel day <b>' + esc(v.refuelDayLabel) + '</b> (Central). Window opens ' + esc(v.opensLabel) + ', grace to ' + esc(v.graceLabel) + '.</p>';
|
||||
if (c.month) h += '<div style="margin:0 0 8px">' + site('InstantAdPay', c.iap, v.minUsd.iap) + site('LinkSpin', c.linkspin, v.minUsd.linkspin) + '</div>';
|
||||
if (!v.windowOpen && c.month && !c.both) h += '<p class="muted" style="margin:0 0 8px">Refuel ' + (c.linkspin && c.linkspin.refueled ? 'InstantAdPay ($' + v.minUsd.iap + '+)' : 'LinkSpin ($' + v.minUsd.linkspin + '+)') + ' before ' + esc(v.opensLabel) + ' and both sites move to +' + v.next.secondEngine + '%.'
|
||||
+ (c.linkspin && c.linkspin.refueled ? ' <a href="https://instantadpay.com/my#buy" target="_blank" rel="noopener">Buy on InstantAdPay ↗</a>' : '') + '</p>';
|
||||
if (v.pitStop && (v.pitStop.linkspin || v.pitStop.usedLinkspin)) h += '<p class="muted" style="margin:0 0 8px"><b>Pit Stop</b> ' + (v.pitStop.linkspin ? 'available here: +' + v.pitStop.pct + '% on a $' + v.minUsd.linkspin + '+ top-up, once this cycle. It does not count as your refuel.' : 'used here this cycle.') + '</p>';
|
||||
h += '<p class="muted" style="margin:0 0 10px">' + (v.freeMiss.available ? 'One free miss left this year.' : 'Free miss for this year used.') + '</p>';
|
||||
const lsDone = c.linkspin && c.linkspin.refueled;
|
||||
return h + buyBtn(v, v.windowOpen ? 'Refuel now: buy a $' + v.minUsd.linkspin + '+ package' : lsDone ? 'Buy another package' : 'Buy a $' + v.minUsd.linkspin + '+ package', v.windowOpen || !lsDone) + HOW;
|
||||
}
|
||||
async function load() {
|
||||
const panel = $('rfPanel'); if (!panel) return;
|
||||
try {
|
||||
const v = await (await fetch('/api/my/refuel', { cache: 'no-store' })).json();
|
||||
window.FUEL.refuel = v;
|
||||
if (!v || !v.on) { panel.hidden = true; return; }
|
||||
$('rfMeta').textContent = v.active ? 'streak: ' + v.streak + ' month' + (v.streak === 1 ? '' : 's') : 'shared with InstantAdPay';
|
||||
$('rfBody').innerHTML = body(v); panel.hidden = false;
|
||||
// on Credits the button just scrolls to the package picker (no reload); the picker then marks which packages count
|
||||
panel.querySelectorAll('[data-rf-buy]').forEach(a => a.addEventListener('click', e => { if (location.pathname !== '/credits') return; e.preventDefault(); history.replaceState(null, '', location.pathname + location.search + '#buy'); window.dispatchEvent(new HashChangeEvent('hashchange')); }));
|
||||
if (window.LSCredits) window.LSCredits.repaint();
|
||||
} catch (e) { panel.hidden = true; }
|
||||
}
|
||||
window.FUEL.loadRefuel = load;
|
||||
load(); setInterval(load, 300000);
|
||||
|
||||
// ---- the Refuel Kit: members-only LinkSpin banners with your @name and a QR to your link ----
|
||||
const post = async (url, body) => { const r = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) }); const j = await r.json().catch(() => ({})); if (!r.ok || j.error) throw new Error(j.error || ('HTTP ' + r.status)); return j; };
|
||||
const note = (el, m) => { if (el) el.textContent = m; };
|
||||
// Banner Spin sizes to load (2026-10-24): each size needs its own Banner Spin, and a Starter tier holds 2, so the sizes that
|
||||
// fit are ticked first (728x90 and 300x250 when nothing is set up yet) and the panel says why before the member presses Load
|
||||
function spinPick(k, d) {
|
||||
const R = d.spinRoom; const sizes = k.sizes.filter(s => s.ready && (!R || !R.sizes || R.sizes.includes(s.size))).map(s => s.size).filter(z => z !== '1200x630');
|
||||
if (!sizes.length) return '';
|
||||
const pick = R && R.ok && R.suggested ? R.suggested : sizes;
|
||||
const note = R && R.ok && !R.all ? '<p class="muted" style="margin:0 0 6px">Each size goes into its own Banner Spin. Your ' + esc(R.tier) + ' tier holds ' + R.spins + ' (' + R.used + ' in use), so the sizes that fit are ticked. Untick one to load another instead' + (R.next ? ', or reach ' + esc(R.next.label) + ' (' + esc(R.next.need) + ') for ' + R.next.spins : '') + '.</p>' : '';
|
||||
return note + '<div style="display:flex;gap:6px 14px;flex-wrap:wrap;margin:0 0 8px">' + sizes.map(z => '<label class="muted" style="display:flex;gap:4px;align-items:center"><input type="checkbox" data-ksize="' + esc(k.month) + '" value="' + z + '"' + (pick.includes(z) ? ' checked' : '') + '> ' + z + '</label>').join('') + '</div>';
|
||||
}
|
||||
function kitHtml(k, d) {
|
||||
const head = '<div style="display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap"><b>' + esc(k.label) + (k.theme ? ' · ' + esc(k.theme) : '') + '</b><span class="muted">' + (k.unlocked ? 'yours' : 'locked') + '</span></div>';
|
||||
if (!k.unlocked) return head + '<p class="muted" style="margin:6px 0 0">Your next counted refuel unlocks it: $25+ here or $20+ on InstantAdPay' + (d.nextRefuel ? ' (refuel day ' + esc(d.nextRefuel) + ')' : '') + '.</p>';
|
||||
return head + '<p class="muted" style="margin:6px 0">Your ' + esc(d.name || 'name') + ' and a QR to your link on every banner. Yours to keep after the month.</p>'
|
||||
+ spinPick(k, d)
|
||||
+ '<div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px"><button class="btn pri" type="button" data-kbs="' + esc(k.month) + '">Load into my Banner Spin</button>'
|
||||
+ (k.gif ? '<label class="muted" style="display:flex;gap:4px;align-items:center"><input type="checkbox" data-kgif="' + esc(k.month) + '"> animated</label>' : '') + '</div>'
|
||||
+ '<div class="muted" data-kres="' + esc(k.month) + '" role="status"></div>'
|
||||
+ '<div style="display:grid;gap:8px">' + k.sizes.filter(s => s.ready).map(s => '<div data-kcell data-month="' + esc(k.month) + '" data-size="' + s.size + '" style="border:1px solid var(--line);border-radius:6px;padding:8px;min-width:0">'
|
||||
+ '<div style="display:flex;justify-content:space-between;gap:6px;align-items:center"><span class="mono" style="font-size:11px">' + s.size + '</span><button class="btn" type="button" data-kmake>Make mine</button></div><div data-kimg style="margin-top:6px"></div></div>').join('') + '</div>';
|
||||
}
|
||||
async function loadKits() {
|
||||
const panel = $('rkPanel'); if (!panel) return;
|
||||
try {
|
||||
const d = await (await fetch('/api/my/kits', { cache: 'no-store' })).json();
|
||||
if (!d || !d.on || !d.kits || !d.kits.length) { panel.hidden = true; return; }
|
||||
$('rkBody').innerHTML = d.kits.slice(0, 3).map(k => '<div style="margin-bottom:14px">' + kitHtml(k, d) + '</div>').join('')
|
||||
+ (d.customNote ? '<p class="muted"><b>Custom banners credit:</b> ' + esc(d.customNote) + '</p>' : '') + '<p class="muted" style="margin:0">Ad credits buy delivery only. No banner may promise income.</p>';
|
||||
panel.hidden = false;
|
||||
panel.querySelectorAll('[data-kbs]').forEach(b => b.addEventListener('click', async () => {
|
||||
const m = b.dataset.kbs; const out = panel.querySelector('[data-kres="' + m + '"]'); const g = panel.querySelector('[data-kgif="' + m + '"]');
|
||||
b.disabled = true; note(out, 'Drawing your banners and loading them...');
|
||||
try {
|
||||
const boxes = panel.querySelectorAll('[data-ksize="' + m + '"]'); const sizes = Array.prototype.filter.call(boxes, c => c.checked).map(c => c.value);
|
||||
if (boxes.length && !sizes.length) { note(out, 'Tick at least one size to load.'); b.disabled = false; return; }
|
||||
const r = await post('/api/my/kits/bannerspin', Object.assign({ month: m, variant: g && g.checked ? 'gif' : 'still' }, boxes.length ? { sizes } : {}));
|
||||
note(out, (r.message || r.results.map(x => x.size + ': ' + (x.error ? x.error : x.already ? 'already in "' + x.spin + '"' : (x.created ? 'new Banner Spin "' : 'added to "') + x.spin + '"')).join(' | ')) + ' See Banner Spin under Links.');
|
||||
} catch (e) { note(out, e.message); }
|
||||
b.disabled = false;
|
||||
}));
|
||||
panel.querySelectorAll('[data-kmake]').forEach(b => b.addEventListener('click', async () => {
|
||||
const cell = b.closest('[data-kcell]'); b.disabled = true;
|
||||
try {
|
||||
const g = panel.querySelector('[data-kgif="' + cell.dataset.month + '"]');
|
||||
const r = await post('/api/my/kits/render', { month: cell.dataset.month, size: cell.dataset.size, variant: g && g.checked && cell.dataset.size !== '1200x630' ? 'gif' : 'still' });
|
||||
cell.querySelector('[data-kimg]').innerHTML = '<img src="' + esc(r.url) + '" alt="Your ' + esc(r.size) + ' Refuel Kit banner" style="max-width:100%;height:auto;display:block"><div style="display:flex;gap:6px;flex-wrap:wrap;margin-top:6px"><a class="btn" href="' + esc(r.url) + '" download>Download</a><button class="btn" type="button" data-kcopy="' + esc(r.abs) + '">Copy image link</button></div>';
|
||||
const c = cell.querySelector('[data-kcopy]'); c.addEventListener('click', () => { try { navigator.clipboard.writeText(c.dataset.kcopy); c.textContent = 'Copied'; } catch (e) {} });
|
||||
} catch (e) { cell.querySelector('[data-kimg]').textContent = e.message; }
|
||||
b.disabled = false;
|
||||
}));
|
||||
} catch (e) { panel.hidden = true; }
|
||||
}
|
||||
window.FUEL.loadKits = loadKits;
|
||||
loadKits();
|
||||
window.addEventListener('cr:signedin', () => { load(); loadKits(); }); // signed in from the shell's pop-up (arrivals from InstantAdPay)
|
||||
})();
|
||||
@@ -2,7 +2,7 @@
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt, api = CR.api, toast = CR.toast, dialog = CR.dialog;
|
||||
let ROT = [], HOSTS = [], SEL = null, STATS = {}, FILTER = '', PB = null, SRC = []; // SRC = the member's traffic sources (sources.js, 2026-10-12)
|
||||
CR.mount({ active: 'links', title: 'Links', sub: 'loading', actions: '<button class="btn pri" id="newBtn" type="button">+ New spin</button>' });
|
||||
CR.mount({ active: 'links', title: 'Links', sub: 'loading', actions: '<button class="btn pri" id="newBtn" type="button">+ New spin</button><button class="btn pri" id="bsNewBtn" type="button" hidden>+ New Banner Spin</button>' });
|
||||
const linkUrl = r => 'https://' + (HOSTS[0] || location.host) + '/r/' + r.code;
|
||||
const clicks7 = r => r.hits7 || 0;
|
||||
const health = r => r.paused ? { cls: 'warn', t: 'PAUSED' } : !r.destinations.some(d => d.active) ? { cls: 'bad', t: 'NO LIVE DESTINATION' } : { cls: 'ok', t: 'LIVE' };
|
||||
@@ -56,6 +56,7 @@
|
||||
host.heState = () => ({ hours: grid.map(d => d.join('')), tz }); // so a redraw can keep unsaved taps
|
||||
paint();
|
||||
}
|
||||
window.LSHours = { editor: hoursEditor, text: hoursText, chip: hoursChip }; // shared with the Banner Spin builder (banner-spin.js, 2026-10-18)
|
||||
// ── health readouts ──
|
||||
const ago = ts => { const s = Math.max(0, Math.round((Date.now() - ts) / 1000)); return s < 60 ? 'just now' : s < 3600 ? Math.round(s / 60) + ' min ago' : s < 86400 ? Math.round(s / 3600) + ' h ago' : Math.round(s / 86400) + ' d ago'; };
|
||||
const mdy = ts => new Date(ts).toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
||||
@@ -74,8 +75,10 @@
|
||||
try { const lh = await api('/api/my/link-hosts'); LH = (lh && lh.hosts) || []; } catch (e) { LH = []; } // link domains by channel (domains.js, 2026-10-10)
|
||||
try { SRC = (await CR.get('/api/my/sources')).sources || []; } catch (e) { SRC = []; }
|
||||
const tot7 = ROT.reduce((n, x) => n + clicks7(x), 0);
|
||||
CR.sub(ROT.length + ' link' + (ROT.length === 1 ? '' : 's') + ' · ' + fmt(tot7) + ' clicks in 7 days');
|
||||
const TT = r.tier; const capTxt = TT ? (TT.unlimited ? ' links (' + TT.label + ', unlimited)' : ' of ' + TT.max + ' links (' + TT.label + ')') : (' link' + (ROT.length === 1 ? '' : 's'));
|
||||
if (!/^#b/.test(location.hash)) CR.sub(ROT.length + capTxt + ' · ' + fmt(tot7) + ' clicks in 7 days');
|
||||
renderList();
|
||||
if (/^#b/.test(location.hash)) { renderList(); return; } // the Banner Spin view owns the page (banner-spin.js)
|
||||
const want = SEL != null ? SEL : (Number(location.hash.slice(1)) || null);
|
||||
if (want != null && ROT.find(x => x.id === want)) return select(want, true);
|
||||
if (!ROT.length) { $('noSel').hidden = false; $('sel').hidden = true; SEL = null; }
|
||||
@@ -235,5 +238,6 @@
|
||||
catch (e) { toast(e.message, true); } b.disabled = false; b.textContent = 'Check now'; });
|
||||
$('pbNew').addEventListener('click', () => pbForm(null));
|
||||
$('backBtn').hidden = !window.matchMedia('(max-width:760px)').matches;
|
||||
CR.requireSession(() => { load(); loadPb(); setInterval(() => { if (!document.hidden) load(true); }, 60000); });
|
||||
window.LSLinks = { reload: () => load(true) }; // the Banner Spin view switches back here
|
||||
CR.requireSession(() => { load(); loadPb(); if (window.BannerSpin) window.BannerSpin.ready(); setInterval(() => { if (!document.hidden) load(true); }, 60000); });
|
||||
})();
|
||||
|
||||
+75
-67
@@ -26,7 +26,17 @@
|
||||
return r;
|
||||
}
|
||||
|
||||
// holding tank (2026-10-27): no sponsor yet, so the free Switch on payouts waits for an adopter (24 hours at most).
|
||||
// A purchase is never held: buying goes ahead as before.
|
||||
const holdLeft = ms => { const m = Math.max(1, Math.round(ms / 60000)); const h = Math.floor(m / 60); return h ? h + ' h ' + (m % 60) + ' min' : m + ' min'; };
|
||||
function tankHoldText(h) {
|
||||
let t = "You're being matched with a sponsor. Payouts switch on as soon as someone picks you up (within 24 hours).";
|
||||
if (h && h.until) { const ms = h.until - Date.now(); t += ms > 0 ? ' Time left: ' + holdLeft(ms) + '.' : ' Any minute now.'; }
|
||||
return t;
|
||||
}
|
||||
let TANK_HOLD = null;
|
||||
function nextMove(d) {
|
||||
if (TANK_HOLD && d.address && !d.memberId) return tankHoldText(TANK_HOLD);
|
||||
if (!d.address) return 'Grab your link below and start sharing today. Then link your wallet (one free signature) so every payment can lock to you before your people start buying.';
|
||||
if (!d.memberId) return 'Your wallet is linked. Switch on payouts above (one free transaction) and every purchase in your line pays you the moment it happens.';
|
||||
if (d.buyerCount === 0) return 'Payouts are on and your link is live. Your next milestone: your first buyer of $25 or more. Every direct pays you 50 percent from their very first package.';
|
||||
@@ -69,11 +79,11 @@
|
||||
}
|
||||
|
||||
// achievement badges: the milestone ladder as unlockable medals + share-to-image
|
||||
const BADGES = [ // ribbonY = vertical center of each badge's name ribbon (art differs per tier)
|
||||
{ key: 'payouts', label: 'Spark', sub: 'payouts on', img: '/badges/badge-spark.jpg', ribbonY: 0.728 },
|
||||
{ key: 'firstBuyer', label: 'Surge', sub: 'first qualifying buyer', img: '/badges/badge-surge.jpg?v=2', ribbonY: 0.76 },
|
||||
{ key: 'level2', label: 'Circuit', sub: '2 qualifying buyers', img: '/badges/badge-circuit.jpg?v=2', ribbonY: 0.72 },
|
||||
{ key: 'level3', label: 'Nexus', sub: 'fully qualified', img: '/badges/badge-nexus.jpg?v=2', ribbonY: 0.73 }
|
||||
const BADGES = [ // ribbonY = vertical center of the member's name: the clear band between the art's body line and the footer bar (all four share it)
|
||||
{ key: 'payouts', label: 'Spark', sub: 'payouts on', img: '/badges/badge-spark.jpg', ribbonY: 0.873 },
|
||||
{ key: 'firstBuyer', label: 'Surge', sub: 'first qualifying buyer', img: '/badges/badge-surge.jpg?v=2', ribbonY: 0.873 },
|
||||
{ key: 'level2', label: 'Circuit', sub: '2 qualifying buyers', img: '/badges/badge-circuit.jpg?v=2', ribbonY: 0.873 },
|
||||
{ key: 'level3', label: 'Nexus', sub: 'fully qualified', img: '/badges/badge-nexus.jpg?v=2', ribbonY: 0.873 }
|
||||
];
|
||||
let lastMilestones = [];
|
||||
function renderBadges(d) {
|
||||
@@ -116,7 +126,9 @@
|
||||
x.drawImage(img, 0, 0);
|
||||
if (who) {
|
||||
x.textAlign = 'center'; x.textBaseline = 'middle';
|
||||
x.font = 'bold ' + Math.round(c.width * 0.055) + 'px Sora, "Segoe UI", sans-serif';
|
||||
let fs = Math.round(c.width * 0.052); // the name sits in the clear band under the art's own text (Marty 2026-10-18: it overlapped ACHIEVEMENT UNLOCKED)
|
||||
x.font = 'bold ' + fs + 'px Sora, "Segoe UI", sans-serif';
|
||||
while (fs > 20 && x.measureText(who).width > c.width * 0.8) { fs -= 2; x.font = 'bold ' + fs + 'px Sora, "Segoe UI", sans-serif'; }
|
||||
const y = c.height * (b.ribbonY || 0.75);
|
||||
x.lineJoin = 'round'; x.lineWidth = Math.max(3, Math.round(c.width * 0.008));
|
||||
x.strokeStyle = 'rgba(4,20,15,.9)'; x.strokeText(who, c.width / 2, y);
|
||||
@@ -225,7 +237,8 @@
|
||||
}
|
||||
// ── overview v3 charts: hand-rolled SVG/CSS, real data only ──
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
const CH = { mint: '#3b9dff', cyan: '#54ccff', violet: '#9d7dff', amber: '#ffb238', track: 'rgba(139,166,156,.18)' };
|
||||
// chart colours come from the live theme tokens (2026-11-01): read at draw time so a theme switch repaints correctly
|
||||
const CH = new Proxy({}, { get: (_, k) => { const cs = getComputedStyle(document.documentElement); const v = { mint: '--mint', cyan: '--cyan', violet: '--violet', amber: '--amber', track: '--muted-soft' }[k]; return (v && cs.getPropertyValue(v).trim()) || { mint: '#3b9dff', cyan: '#54ccff', violet: '#9d7dff', amber: '#ffb238', track: 'rgba(139,166,156,.18)' }[k]; } });
|
||||
function bars(el, xel, data) { // data: [{v,label,tip,alt}]
|
||||
if (!el) return;
|
||||
const max = Math.max(1, ...data.map(d => d.v));
|
||||
@@ -247,7 +260,7 @@
|
||||
off -= len;
|
||||
}
|
||||
out += '<text x="21" y="20.5" text-anchor="middle" fill="currentColor" font-size="6.5" font-weight="800" class="donut-center">' + esc(center.big) + '</text>'
|
||||
+ '<text x="21" y="26.5" text-anchor="middle" fill="#8ba69c" font-size="3.1">' + esc(center.small) + '</text>';
|
||||
+ '<text x="21" y="26.5" text-anchor="middle" style="fill:var(--muted)" font-size="3.1">' + esc(center.small) + '</text>';
|
||||
el.innerHTML = out;
|
||||
}
|
||||
function legend(el, rows) {
|
||||
@@ -416,7 +429,7 @@
|
||||
if (it.videoUrl && !isVid) links.push('<a class="btn small sec" href="' + esc(it.videoUrl) + '" target="_blank" rel="noopener">Watch</a>');
|
||||
if (it.docUrl) links.push('<a class="btn small sec" href="' + esc(it.docUrl) + '" target="_blank" rel="noopener">Open material</a>');
|
||||
return head + '<div class="card"><h3>' + esc(it.title || 'Lesson') + '</h3>'
|
||||
+ (it.desc ? '<p class="muted small">' + esc(it.desc) + '</p>' : '')
|
||||
+ (it.desc ? '<p class="muted small" style="white-space:pre-line">' + esc(it.desc) + '</p>' : '') // pre-line: a written lesson keeps its paragraphs (Banner Spin, 2026-10-20)
|
||||
+ (media ? '<p style="margin:10px 0">' + media + '</p>' : '')
|
||||
+ (links.length ? '<p>' + links.join(' ') + '</p>' : '') + '</div>';
|
||||
}).join('');
|
||||
@@ -430,11 +443,11 @@
|
||||
const levels = r.levels || [];
|
||||
const total = levels.reduce((n, L) => n + L.members.length, 0);
|
||||
if ($('treeSub')) $('treeSub').textContent = total ? total + ' across 3 levels' : 'share your link to grow';
|
||||
const chip = (m, q) => '<span class="lt-node' + (q ? ' qualified' : (m.email ? '' : ' deep')) + '" title="' + esc(m.name || 'member') + (q ? ' · bought a $20+ package (counts for their sponsor)' : ' · no $20+ buy yet') + (m.buyers ? ' · ' + m.buyers + ' qualifying buyer' + (m.buyers === 1 ? '' : 's') + ' of their own' : '') + '">' + esc(String(m.name || 'M').replace(/^@/, '').slice(0, m.own ? 20 : 14)) + (m.buyers ? '<i class="lt-n" title="their own qualifying buyers">' + m.buyers + '</i>' : '') + '</span>';
|
||||
const chip = (m, q) => '<span class="lt-node' + (q ? ' qualified' : (m.email ? '' : ' deep')) + '" title="' + esc(m.name || 'member') + (q ? ' · bought a $25+ package (counts for their sponsor)' : ' · no $25+ buy yet') + (m.buyers ? ' · ' + m.buyers + ' qualifying buyer' + (m.buyers === 1 ? '' : 's') + ' of their own' : '') + '">' + esc(String(m.name || 'M').replace(/^@/, '').slice(0, m.own ? 20 : 14)) + (m.buyers ? '<i class="lt-n" title="their own qualifying buyers">' + m.buyers + '</i>' : '') + '</span>';
|
||||
const rowFor = lvl => {
|
||||
const L = levels.find(x => x.level === lvl); const members = L ? L.members : [];
|
||||
// gold = the contract counted this member as one of your qualifying buyers (not "the first N chips")
|
||||
let html = members.map(m => chip(m, !!(m.qualified || m.bought))).join(''); // gold on every level = made their $20+ buy
|
||||
let html = members.map(m => chip(m, !!(m.qualified || m.bought))).join(''); // gold on every level = made their $25+ buy
|
||||
if (lvl <= 2 && members.length < (lvl === 1 ? 2 : 4)) html += '<span class="lt-node open">+ open</span>';
|
||||
if (!html) html = '<span class="lt-node open">+ open</span>';
|
||||
return '<div class="lt-row"><span class="lt-cap">L' + lvl + '</span><div class="lt-nodes">' + html + '</div></div>';
|
||||
@@ -465,9 +478,9 @@
|
||||
const r = await (await fetch('/api/leaderboard?period=week')).json();
|
||||
const esc = t => String(t == null ? '' : t).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
let h = r.prize ? '<p style="margin:0 0 8px"><b>Prize this week:</b> ' + esc(r.prize) + '</p>' : '';
|
||||
h += r.top.length ? '<table style="width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums">' + r.top.slice(0, 5).map(x => '<tr><td style="padding:3px 0;width:26px;color:' + (x.rank === 1 ? '#ffd15c' : 'var(--muted)') + '">' + x.rank + '</td><td style="padding:3px 0"><b>' + esc(x.name) + '</b></td><td style="padding:3px 0;text-align:right">' + x.sales + ' sold · $' + x.usd + '</td></tr>').join('') + '</table>'
|
||||
h += r.top.length ? '<table style="width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums">' + r.top.slice(0, 5).map(x => '<tr><td style="padding:3px 0;width:26px;color:' + (x.rank === 1 ? 'var(--gold)' : 'var(--muted)') + '">' + x.rank + '</td><td style="padding:3px 0"><b>' + esc(x.name) + '</b></td><td style="padding:3px 0;text-align:right">' + x.sales + ' sold · $' + x.usd + '</td></tr>').join('') + '</table>'
|
||||
: '<p class="muted" style="margin:0">No packages sold yet this week. First sale takes the top spot.</p>';
|
||||
h += r.me ? '<p style="margin:8px 0 0">You: <b>#' + r.me.rank + '</b> · ' + r.me.sales + ' sold · $' + r.me.usd + '</p>' : '<p class="muted" style="margin:8px 0 0">You: no sales yet this week. Sales are $20+ packages bought by people you sponsor.</p>';
|
||||
h += r.me ? '<p style="margin:8px 0 0">You: <b>#' + r.me.rank + '</b> · ' + r.me.sales + ' sold · $' + r.me.usd + '</p>' : '<p class="muted" style="margin:8px 0 0">You: no sales yet this week. Sales are $25+ packages bought by people you sponsor.</p>';
|
||||
h += '<p style="margin:6px 0 0"><a href="/leaderboard" target="_blank" rel="noopener" style="color:var(--mint)">Full leaderboard: week, month, all time →</a></p>';
|
||||
$('lbList').innerHTML = h; $('lbCard').hidden = false;
|
||||
} catch (e) {}
|
||||
@@ -494,10 +507,11 @@
|
||||
user: ['Pick your username', 'It becomes your invite link and your public page, and it is permanent.', 'Choose a username', () => showOnboard(true)],
|
||||
wallet: ['Link your wallet', 'Your payouts land in a wallet you control, so the site needs to know which one is yours. One free signature, no purchase. MetaMask recommended; Phantom users switch Polygon on first. Never held crypto? The wallet guide walks you through it.', 'Link my wallet', () => jumpTo('wallet', 'linkBtn')],
|
||||
payouts: ['Switch on payouts', 'One small transaction registers your wallet with the contract so commissions can reach it. Buying any package does this automatically.', 'Activate payouts', () => jumpTo('wallet', 'activateBtn')],
|
||||
package: ['Your first package', 'From $5. The $20 Activation package is the one that counts you as a qualifying buyer for your sponsor and unlocks adopting from the holding tank.', 'See packages', () => jumpTo('buy', null)]
|
||||
package: ['Your first package', 'From $10. The $25 package is the one that counts you as a qualifying buyer for your sponsor and unlocks adopting from the holding tank.', 'See packages', () => jumpTo('buy', null)]
|
||||
}[cur.k];
|
||||
$('gsNow').innerHTML = '<p><b>Next: ' + copy[0] + '</b>' + copy[1] + (cur.k === 'wallet' ? ' <a href="/wallets" target="_blank" rel="noopener" style="color:var(--mint)">Wallet guide</a>' : '') + '</p><button type="button" class="btn" id="gsGo">' + copy[2] + '</button>';
|
||||
$('gsGo').addEventListener('click', copy[3]);
|
||||
if (cur.k === 'payouts' && TANK_HOLD) { copy[0] = 'Matching you with a sponsor'; copy[1] = tankHoldText(TANK_HOLD); copy[2] = null; } // no activate button while held
|
||||
$('gsNow').innerHTML = '<p><b>Next: ' + copy[0] + '</b>' + copy[1] + (cur.k === 'wallet' ? ' <a href="/wallets" target="_blank" rel="noopener" style="color:var(--mint)">Wallet guide</a>' : '') + '</p>' + (copy[2] ? '<button type="button" class="btn" id="gsGo">' + copy[2] + '</button>' : '');
|
||||
if (copy[2]) $('gsGo').addEventListener('click', copy[3]);
|
||||
card.hidden = false;
|
||||
}
|
||||
function jumpTo(pane, id) {
|
||||
@@ -598,7 +612,8 @@
|
||||
tn.hidden = !(tw && tw.count);
|
||||
if (tw && tw.count) tn.innerHTML = '<b>' + tw.count + (tw.count === 1 ? ' person is' : ' people are') + ' waiting for a sponsor in the holding tank</b> \u00b7 '
|
||||
+ tw.names.map(esc).join(', ') + (tw.count > tw.names.length ? ' and more' : '') + '. <a href="#line">Adopt them from My line</a>'
|
||||
+ (tw.eligible ? '.' : ' (you need your own $20 package first).');
|
||||
+ (tw.eligible ? '.' : ' (you need your own $25 package first).')
|
||||
+ (tw.ready ? ' <b style="color:var(--ok)">' + tw.ready + ' of them ' + (tw.ready === 1 ? 'has' : 'have') + ' linked a wallet and ' + (tw.ready === 1 ? 'is' : 'are') + ' ready to switch on payouts.</b>' : '');
|
||||
}
|
||||
} catch (e) {}
|
||||
if (d.username) { // wall link rides the username
|
||||
@@ -695,6 +710,7 @@
|
||||
else if (!render.waiting) { render.waiting = true; window.addEventListener('ls:session', () => { render.waiting = false; render(); }, { once: true }); }
|
||||
}
|
||||
if (!signedIn) return;
|
||||
TANK_HOLD = (!me.memberId && me.tankHold) || null;
|
||||
if ($('adminLink')) $('adminLink').hidden = !me.isAdmin; // admin portal link, only for ADMIN_EMAIL
|
||||
// REQUIRED first step (Marty, 2026-09-12): no username, nothing else. The modal cannot be
|
||||
// skipped or dismissed; it resolves only when a username is saved, then the area renders.
|
||||
@@ -720,17 +736,20 @@
|
||||
const who = [];
|
||||
if (me.email) who.push(me.email);
|
||||
// members kept asking whether the wallet was really connected (Marty, 2026-09-12): say it, with a green check
|
||||
if (me.address) who.push('<span style="display:inline-flex;align-items:center;gap:8px"><span aria-hidden="true" style="display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:#22c55e;color:#04140a;font-weight:900;font-size:13px;line-height:1">✓</span><b style="color:#22c55e">Wallet connected</b> <span class="mono">' + me.address.slice(0, 8) + '…' + me.address.slice(-6) + '</span></span>');
|
||||
if (me.address) who.push('<span style="display:inline-flex;align-items:center;gap:8px"><span aria-hidden="true" style="display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--ok);color:var(--ok-ink);font-weight:900;font-size:13px;line-height:1">✓</span><b style="color:var(--ok)">Wallet connected</b> <span class="mono">' + me.address.slice(0, 8) + '…' + me.address.slice(-6) + '</span></span>');
|
||||
else who.push('<span style="display:inline-flex;align-items:center;gap:8px"><span aria-hidden="true" style="display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;border:2px solid var(--muted);color:var(--muted);font-weight:900;font-size:12px;line-height:1">!</span><b>No wallet connected yet</b> <span class="muted">(link one below)</span></span>');
|
||||
if (me.memberId) who.push('on-chain <b>member #' + me.memberId + '</b>'
|
||||
+ (me.onchainSponsorId ? ', sponsored by #' + me.onchainSponsorId : ''));
|
||||
else if (me.sponsorId) who.push('invited by member #' + me.sponsorId);
|
||||
else if (me.sponsorId && !TANK_HOLD) who.push('invited by member #' + me.sponsorId);
|
||||
$('posLine').innerHTML = who.join('<br>');
|
||||
|
||||
$('creditLine').textContent = (me.credits || 0).toLocaleString();
|
||||
loadPositions(me);
|
||||
$('linkCard').hidden = !!me.address;
|
||||
$('activateCard').hidden = !(me.address && !me.memberId);
|
||||
{ let hn = $('tankHoldNote'); // held for an adopter: say so, and no activate button
|
||||
if (!hn) { hn = document.createElement('p'); hn.id = 'tankHoldNote'; hn.className = 'small'; hn.style.cssText = 'margin:8px 0 0;color:var(--ok)'; $('activateBtn').insertAdjacentElement('beforebegin', hn); }
|
||||
hn.hidden = !TANK_HOLD; hn.textContent = TANK_HOLD ? tankHoldText(TANK_HOLD) : ''; $('activateBtn').hidden = !!TANK_HOLD; }
|
||||
$('activityArea').hidden = !me.memberId;
|
||||
$('campGate').hidden = true; // earned credits fund campaigns for everyone
|
||||
$('campaignCard').hidden = false;
|
||||
@@ -756,7 +775,7 @@
|
||||
$('qualLine').innerHTML = '<b>' + bc + '</b> qualifying buyer(s) referred<br>'
|
||||
+ (bc >= 5 ? '<span class="badge">Level 3 unlocked: full three-level earnings</span>'
|
||||
: bc >= 2 ? '<span class="badge">Level 2 unlocked</span> · ' + (5 - bc) + ' more for level 3'
|
||||
: (2 - bc) + ' more buyer(s) of $20+ unlock level 2');
|
||||
: (2 - bc) + ' more buyer(s) of $25+ unlock level 2');
|
||||
loadActivity();
|
||||
} else {
|
||||
$('qualLine').innerHTML = 'Share your link now. Then switch on payouts (free, above) '
|
||||
@@ -785,7 +804,7 @@
|
||||
try {
|
||||
const r = await (await fetch('/api/my/campaigns')).json();
|
||||
if (r.error) return;
|
||||
lastRates = r.rates;
|
||||
lastRates = r.rates; lastSlots = r.loginSlots || null;
|
||||
if ($('cGeoHint') && r.tiers) $('cGeoHint').textContent = 'All three ticked = everyone. Tier 1: ' + r.tiers.t1.join(', ') + '. Tier 2: ' + r.tiers.t2.join(', ') + '. Tier 3: every other country. Geo applies to delivery on this site; a narrowed banner or text ad is kept off the worldwide partner network. ' + (r.geoReady ? '' : 'Country data is still loading, so narrowed campaigns pause until it is ready. ') + 'IP geolocation by DB-IP.';
|
||||
// populate the banner-size dropdown once (ids map to NAS width/height)
|
||||
if (r.bannerSizes && $('cSize') && !$('cSize').options.length)
|
||||
@@ -799,32 +818,34 @@
|
||||
if ($('spendNote')) $('spendNote').textContent = r.inCampaigns
|
||||
? 'Not counting ' + r.inCampaigns.toLocaleString() + ' credits already set aside for your live campaigns. That budget spends down inside each campaign below. This number only moves when you start, top up or pause a campaign.'
|
||||
: 'This is what is not committed to a campaign. When you start one, its budget moves out of here and spends down inside the campaign.';
|
||||
$('spendRates').innerHTML = [['Banner', r.rates.bannerCreditsPerBatch + ' cr / ' + r.rates.bannerBatch + ' views'], ['Text', r.rates.textCreditsPerBatch + ' cr / ' + r.rates.textBatch + ' views'], ['Login', r.rates.loginCreditsPerDay + ' cr / day'], ['Solo', r.rates.soloCostPerRecipient + ' cr / delivery'], ['Featured', (r.rates.featuredPerDay || 40) + ' cr / day'], ['Visit', (r.rates.visitCostPerVisit || 3) + ' cr / visit']].map(x => '<span><b>' + x[0] + '</b> ' + x[1] + '</span>').join('');
|
||||
$('spendRates').innerHTML = [['Banner', r.rates.bannerCreditsPerBatch + ' cr / ' + r.rates.bannerBatch + ' views'], ['Text', r.rates.textCreditsPerBatch + ' cr / ' + r.rates.textBatch + ' views'], ['Login', (r.rates.loginSlotCredits || 1000).toLocaleString() + ' cr / ' + (r.rates.loginSlotDays || 30) + '-day slot'], ['Solo', r.rates.soloCostPerRecipient + ' cr / delivery'], ['Featured', (r.rates.featuredPerDay || 40) + ' cr / day'], ['Visit', (r.rates.visitCostPerVisit || 3) + ' cr / visit']].map(x => '<span><b>' + x[0] + '</b> ' + x[1] + '</span>').join('');
|
||||
}
|
||||
$('rateLine').textContent = 'Available to spend: ' + r.availableCredits.toLocaleString()
|
||||
+ (r.earnedCredits ? ' (' + r.purchasedCredits.toLocaleString() + ' purchased + ' + r.earnedCredits + ' earned)' : '')
|
||||
+ (r.inCampaigns ? ' · ' + r.inCampaigns.toLocaleString() + ' set aside in live campaigns' : '')
|
||||
+ ' credits · rates: banner ' + r.rates.bannerCreditsPerBatch + 'cr/' + r.rates.bannerBatch
|
||||
+ ' views, text ' + r.rates.textCreditsPerBatch + 'cr/' + r.rates.textBatch
|
||||
+ ' views, login ' + r.rates.loginCreditsPerDay + 'cr/day, solo '
|
||||
+ ' views, login ' + (r.rates.loginSlotCredits || 1000) + 'cr per ' + (r.rates.loginSlotDays || 30) + '-day slot, solo '
|
||||
+ (r.rates.soloCostPerRecipient || 5) + 'cr/delivery';
|
||||
const el = $('campList');
|
||||
el.innerHTML = '';
|
||||
if (!r.campaigns.length) { el.innerHTML = '<p class="muted small">No campaigns yet. Launch your first below.</p>'; return; }
|
||||
const tbl = document.createElement('div');
|
||||
tbl.className = 'tablewrap';
|
||||
tbl.innerHTML = '<table class="camp-table"><thead><tr><th>Name</th><th>Type</th><th class="num">Views here</th><th class="num" title="Impressions delivered by Network Ad Space across the wider network (banner and text ads only)">Network views</th><th class="num">Clicks</th>'
|
||||
const synN = Math.max(1, Math.floor(Number(r.rates && r.rates.synRateDivisor) || 1)); // network rate (Marty, 2026-10-27, 4:1)
|
||||
tbl.innerHTML = '<table class="camp-table"><thead><tr><th>Name</th><th>Type</th><th class="num">Views here</th><th class="num" title="Impressions on the partner ad network plus views in other members\u2019 zones on their own sites (banner and text ads)' + (synN > 1 ? ', at 1/' + synN + ' of the rate here' : '') + '">Network views</th><th class="num">Clicks</th>'
|
||||
+ '<th class="num">Spent</th><th class="num">Budget</th><th>Status</th><th></th></tr></thead><tbody>'
|
||||
+ r.campaigns.map(c => '<tr><td data-l="Campaign"><b>' + c.name + '</b>' + hourBars(r.hours && r.hours[c.id]) + geoLine(r.geo && r.geo[c.id]) + '</td>'
|
||||
+ '<td data-l="Type">' + c.type + (c.type === 'banner' && c.width ? ' <span class="muted small">' + c.width + '×' + c.height + '</span>' : '') + (c.dailyCap ? ' <span class="muted small" title="daily cap: ' + c.dailyCap + ' credits, ' + (c.daySpent || 0) + ' spent today">cap ' + c.dailyCap + '/day</span>' : '') + (c.geo ? ' <span class="muted small" title="shown only to viewers in these country tiers">tier ' + esc(c.geo.replace(/,/g, '+')) + '</span>' : '') + schedChips(c) + '</td>'
|
||||
+ '<td class="num" data-l="Views here">' + c.imps.toLocaleString() + '</td>'
|
||||
+ '<td class="num" data-l="Network views">' + (['banner', 'text'].includes(c.type) ? (c.impsNas || 0).toLocaleString() : '<span class="muted small" title="only banner and text ads syndicate to the network">n/a</span>') + '</td>'
|
||||
+ '<td class="num" data-l="Network views">' + (['banner', 'text'].includes(c.type) ? ((c.impsNas || 0) + (c.impsSyn || 0)).toLocaleString() + (synN > 1 && (c.impsNas || c.impsSyn) ? ' <span class="muted small">at 1/' + synN + '</span>' : '') : '<span class="muted small" title="only banner and text ads syndicate to the network">n/a</span>') + '</td>'
|
||||
+ '<td class="num" data-l="Clicks">' + c.clicks + (r.clickSources && r.clickSources[c.id] ? '<div class="muted small clk-src" title="where the clicks happened">' + Object.entries(r.clickSources[c.id]).sort((a, b) => b[1] - a[1]).map(([k, v]) => '<span>' + esc(k) + ' ' + v + '</span>').join('') + (c.impsNas ? ' · network: see Network views' : '') + '</div>' : '') + '</td>'
|
||||
+ '<td class="num" data-l="Spent">' + c.spent + '</td><td class="num" data-l="Budget">' + c.budget + '</td>'
|
||||
+ '<td data-l="Status">' + (c.status === 'out' ? '<span class="badge amber">budget spent</span>' : c.status === 'done' ? '<span class="muted">ended</span>' : c.scheduled ? '<span class="badge">scheduled</span>' : c.status) + '</td>'
|
||||
+ '<td class="act">' + (c.status === 'active' ? '<button class="btn small sec" data-camp="' + c.id + '" data-act="pause">Pause</button>'
|
||||
: c.status === 'paused' ? '<button class="btn small sec" data-camp="' + c.id + '" data-act="resume">Resume</button>' : '')
|
||||
+ ' <button class="btn small sec" data-topup="' + c.id + '">Buy more views</button>'
|
||||
+ (c.status !== 'done' ? ' <a class="btn small sec" href="/ads#edit=' + c.id + '" title="Fix the link, image or text on the Ads screen (first edit free)">Edit</a>' : '')
|
||||
+ '</td></tr>').join('') + '</tbody></table>';
|
||||
el.appendChild(tbl);
|
||||
el.querySelectorAll('button[data-camp]').forEach(b => b.addEventListener('click', async () => {
|
||||
@@ -841,7 +862,7 @@
|
||||
}));
|
||||
} catch (e) {}
|
||||
}
|
||||
let lastRates = null;
|
||||
let lastRates = null, lastSlots = null;
|
||||
function soloHint() {
|
||||
if (!lastRates || $('cType').value !== 'solo') return;
|
||||
const cost = lastRates.soloCostPerRecipient || 5;
|
||||
@@ -895,12 +916,15 @@
|
||||
});
|
||||
const WHERE = { banner: 'Runs in the ad viewer, on the home page, the live ledger, every Overview, the sidebar tile, and out in the Network Ad Space rotation across the wider network.',
|
||||
text: 'Runs in the ad viewer, the live ledger text slot, and out in the Network Ad Space rotation.',
|
||||
login: 'Full screen for every member who signs in, ten seconds, once a day per member. Opens in a fresh tab, so any working page qualifies. Login ads spend purchased credits only.',
|
||||
login: 'Full screen for every member who signs in, ten seconds, once a day per member. Opens in a fresh tab, so any working page qualifies. A slot is 1,000 purchased credits for 30 days of unlimited sign-in impressions, never charged per day. 3 slots at a time, first come first served. Login ads spend purchased credits only.',
|
||||
solo: 'Delivered into member inboxes under Earn credits. Each read is timed and rewarded, so it gets opened.',
|
||||
video: 'Plays in Watch videos and the Shorts feed under Earn credits. You pay only for completed watches.',
|
||||
featured: 'Your headline and link in the Featured strip on every member Overview for the days you book.',
|
||||
visits: 'A distinct member opens your site in a new tab, stays eight seconds and passes a check. Nobody counts twice.' };
|
||||
const whereHint = () => { const el = $('cWhere'); if (el) el.textContent = WHERE[$('cType').value] || ''; };
|
||||
const whereHint = () => { const el = $('cWhere'); if (!el) return; const t = $('cType').value; let s = WHERE[t] || '';
|
||||
if (t === 'login' && lastRates) s = s.replace('1,000', (lastRates.loginSlotCredits || 1000).toLocaleString()).replace('30 days', (lastRates.loginSlotDays || 30) + ' days').replace('3 slots', (lastRates.loginSlotsMax || 3) + ' slots');
|
||||
if (t === 'login' && lastSlots) s += lastSlots.free ? ' ' + lastSlots.free + ' of ' + lastSlots.max + ' slots open right now.' : ' All ' + lastSlots.max + ' slots are taken right now. You can reserve the next one on the Ads screen (' + location.origin + '/ads): pay now, it starts when a slot frees, and a cancel before then refunds in full.';
|
||||
el.textContent = s; };
|
||||
whereHint();
|
||||
// runs on every type change AND once at load, so the default type (banner) shows its size + image rows immediately
|
||||
function applyType() { // hoisted: loadCampaigns may run before this line is reached
|
||||
@@ -924,6 +948,7 @@
|
||||
// solo ads have a real floor (5cr x 10 deliveries): default to 50 so 10 isn't rejected
|
||||
if (t === 'solo' && (!$('cBudget').value || Number($('cBudget').value) < 50)) $('cBudget').value = (lastRates && lastRates.soloCostPerRecipient ? lastRates.soloCostPerRecipient : 5) * 10;
|
||||
if (t === 'visits') visitHint();
|
||||
if (t === 'login') $('cBudget').value = (lastRates && lastRates.loginSlotCredits) || 1000; // a slot is one flat price
|
||||
$('cTitle').placeholder = t === 'solo' ? 'Subject line (max 80)' : 'Headline (max 60)';
|
||||
soloHint();
|
||||
if (t === 'video') videoHint();
|
||||
@@ -1227,8 +1252,8 @@
|
||||
// ── pay it forward: send POL from the sponsor's own wallet to a downline's linked address ──
|
||||
async function pif(email, name, address) {
|
||||
let suggest = 25;
|
||||
try { const { products } = await (await fetch('/api/catalog')).json(); const p20 = (products || []).find(p => p.priceCents === 2000); if (p20 && p20.costWei) suggest = Math.ceil(Number(p20.costWei) / 1e18) + 3; } catch (e) {}
|
||||
const amt = await IAP.ask({ title: 'Pay it forward', text: 'Send POL from your wallet to ' + name + ' (' + address.slice(0, 6) + '…' + address.slice(-4) + ') for their first package.\nSuggested: the $20 package plus fees. Amount in POL:', type: 'number', value: String(suggest), ok: 'Send POL' });
|
||||
try { const { products } = await (await fetch('/api/catalog')).json(); const p25 = (products || []).find(p => p.priceCents === 2500); if (p25 && p25.costWei) suggest = Math.ceil(Number(p25.costWei) / 1e18) + 3; } catch (e) {}
|
||||
const amt = await IAP.ask({ title: 'Pay it forward', text: 'Send POL from your wallet to ' + name + ' (' + address.slice(0, 6) + '…' + address.slice(-4) + ') for their first package.\nSuggested: the $25 package plus fees. Amount in POL:', type: 'number', value: String(suggest), ok: 'Send POL' });
|
||||
if (amt === null) return;
|
||||
const pol = Number(amt); if (!(pol > 0)) { IAP.status('Enter an amount in POL.', 'bad'); return; }
|
||||
try {
|
||||
@@ -1258,7 +1283,8 @@
|
||||
$('tankMine').querySelectorAll('[data-tchat]').forEach(b => b.addEventListener('click', () => openConvo(b.dataset.tchat, b.dataset.tname)));
|
||||
$('tankMine').querySelectorAll('[data-pif]').forEach(b => b.addEventListener('click', () => pif(b.dataset.pif, b.dataset.pname, b.dataset.paddr)));
|
||||
if (!r.waiting.length) { el.innerHTML = '<p class="muted small">The tank is empty. Anyone who joins from the public site without a sponsor lands here.</p>'; return; }
|
||||
el.innerHTML = r.waiting.map(w => '<div class="lin-row"><span class="nm">' + esc(w.name) + '</span>'
|
||||
const readyBadge = w => w.ready ? ' <span class="badge" style="background:var(--ok-soft);border-color:var(--ok);color:var(--ok)" title="Wallet linked. If nobody adopts them, the site assigns them to the next eligible adopter when the time runs out.">Ready to activate \u00b7 ' + (w.holdUntil > Date.now() ? holdLeft(w.holdUntil - Date.now()) + ' left' : 'assigning now') + '</span>' : '';
|
||||
el.innerHTML = r.waiting.slice().sort((a, b) => (b.ready ? 1 : 0) - (a.ready ? 1 : 0)).map(w => '<div class="lin-row"><span class="nm">' + esc(w.name) + readyBadge(w) + '</span>'
|
||||
+ '<span class="em">joined ' + ago(w.joined) + '</span>'
|
||||
+ '<span class="dt">last sign-in: <b>' + ago(w.lastSeen) + '</b></span>'
|
||||
+ (r.eligible ? '<button class="btn small" type="button" data-adopt="' + esc(w.username || w.email) + '" data-aname="' + esc(w.name) + '">Adopt</button>' : '') + '</div>').join('');
|
||||
@@ -1360,7 +1386,7 @@
|
||||
if (c.tag) chips.push('<span class="chip flat">' + esc(c.tag) + '</span>');
|
||||
if (c.kind === 'member' && c.buyers) chips.push('<span class="chip flat">' + c.buyers + ' buyer' + (c.buyers === 1 ? '' : 's') + '</span>');
|
||||
const stage = showStage ? (PIPE.stages.find(s => s.key === c.stage) || {}).label || '' : '';
|
||||
return '<div class="pipe-card' + (c.key === PIPE_KEY ? ' on' : '') + '" tabindex="0" data-pk="' + esc(c.key) + '">'
|
||||
return '<div class="pipe-card' + (c.key === PIPE_KEY ? ' on' : '') + (c.stalled ? ' stalled' : '') + '" tabindex="0" data-pk="' + esc(c.key) + '" data-stage="' + esc(c.stage || '') + '">'
|
||||
+ '<div class="nm"><span>' + esc(c.name) + '</span><small>' + (c.kind === 'prospect' ? 'prospect' : (c.lastSeen ? 'seen ' + pipeAgo(c.lastSeen) : 'never signed in')) + '</small></div>'
|
||||
+ '<div class="sub">' + esc(stage ? stage + ' · ' + c.next : c.next) + '</div>'
|
||||
+ (c.note ? '<div class="note" title="' + esc(c.note) + '">' + esc(c.note) + '</div>' : '')
|
||||
@@ -1380,7 +1406,7 @@
|
||||
$('pipeDueCount').hidden = !r.due.length; $('pipeDueCount').textContent = r.due.length;
|
||||
$('pipeDue').innerHTML = r.due.length ? '<div class="pipe-due">' + r.due.map(c => pipeCardHtml(c, true)).join('') + '</div>' : '<p class="muted small">Nothing due. Set a follow-up date on any card and it shows up here.</p>';
|
||||
$('pipeSummary').textContent = r.counts.total ? r.counts.total + ' people on your board' + (r.counts.stalled ? ', ' + r.counts.stalled + ' stalled' : '') + '. Cards move on their own when something happens on the ledger; open one to add a note, a follow-up date or a tag.' : 'Nobody on your board yet. Add prospects on My line, and everyone who joins through your link appears here on their own.';
|
||||
$('pipeBoard').innerHTML = r.columns.map(col => '<div class="pipe-col"><h4>' + esc(col.label) + '<span>' + col.cards.length + '</span></h4><p class="hint">' + esc(col.hint) + '</p>' + col.cards.map(c => pipeCardHtml(c, false)).join('') + '</div>').join('');
|
||||
$('pipeBoard').innerHTML = r.columns.map(col => '<div class="pipe-col" data-stage="' + esc(col.key) + '"><h4>' + esc(col.label) + '<span>' + col.cards.length + '</span></h4><p class="hint">' + esc(col.hint) + '</p>' + col.cards.map(c => pipeCardHtml(c, false)).join('') + '</div>').join('');
|
||||
$('pipeLive').querySelectorAll('[data-pk]').forEach(el => {
|
||||
el.addEventListener('click', () => openPipeCard(el.dataset.pk));
|
||||
el.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openPipeCard(el.dataset.pk); } });
|
||||
@@ -1486,8 +1512,8 @@
|
||||
const BC_TEMPLATES = [
|
||||
{ label: 'Welcome', subject: 'Welcome to my line: your first three moves', html: '<p>Glad you are in. Three things today, in this order:</p><ol><li>Pick your username on the Profile tab (it becomes your link).</li><li>Wallet tab: Connect and link wallet, then Switch on payouts. Both are free.</li><li>Copy your invite link from My line and send it to one person.</li></ol><p>Reply here if you get stuck on any of them. That is what I am here for.</p>' },
|
||||
{ label: 'Switch on payouts', subject: 'One free step so nothing passes you by', html: '<p>Quick reminder: if payouts are not switched on yet, do it now on the Wallet tab. One free transaction.</p><p>The contract locks each buyer to their sponsor at their first purchase, and payouts only route to wallets that are switched on. Ready early and you never miss one.</p>' },
|
||||
{ label: 'The $5 test', subject: 'See a payout land in real time', html: '<p>Want to see the whole thing work? Buy the $5 Micro package on Buy packages and watch the live ledger while you do it. You will see your credits mint and the split go out in the same transaction.</p><p>When you are ready to count as a qualifying buyer for me, the $20 Activation package is the one.</p>' },
|
||||
{ label: 'Qualified Start', subject: 'How to open level 2 today with your own positions', html: '<p>You can be your own first buyers, openly. On Buy packages, the Qualified Start card lets you link a second wallet you own as a position. When it buys a $20 package, it counts as a qualifying buyer, half comes straight back to your main wallet, and the credits pool with yours.</p><p>Two positions open level 2 the same day. The three Qualified Start videos in Training show every click.</p>' },
|
||||
{ label: 'The $10 test', subject: 'See a payout land in real time', html: '<p>Want to see the whole thing work? Buy the $10 package on Buy packages and watch the live ledger while you do it. You will see your credits mint and the split go out in the same transaction.</p><p>When you are ready to count as a qualifying buyer for me, the $20 Activation package is the one.</p>' },
|
||||
{ label: 'Qualified Start', subject: 'How to open level 2 today with your own positions', html: '<p>You can be your own first buyers, openly. On Buy packages, the Qualified Start card lets you link a second wallet you own as a position. When it buys a $25 package, it counts as a qualifying buyer, half comes straight back to your main wallet, and the credits pool with yours.</p><p>Two positions open level 2 the same day. The three Qualified Start videos in Training show every click.</p>' },
|
||||
{ label: 'Share your link', subject: 'One conversation a day is the whole job', html: '<p>Promo tools has posts, texts and emails that already carry your link. Pick one and send it to one person today.</p><p>Do not wait for the perfect moment. Nobody who waited ever built a line.</p>' }
|
||||
];
|
||||
(function () {
|
||||
@@ -1522,7 +1548,7 @@
|
||||
el.innerHTML = r.levels.map(L => !L.members.length ? '' :
|
||||
'<div class="lin-lvl"><div class="cap">Level ' + L.level + ' · ' + L.members.length + (L.level === 1 ? ' direct' : '') + '</div>'
|
||||
+ L.members.map(m => '<div class="lin-row' + (m.own ? ' own' : '') + '"><span class="nm">' + esc(m.name) + (m.own ? ' <span class="badge">yours</span>' : '') + '</span>'
|
||||
+ '<span class="em">' + (m.email ? esc(m.email) : (m.memberId ? '<span class="id">#' + m.memberId + '</span>' : '')) + (m.sponsor ? '<span class="sp">sponsored by ' + esc(m.sponsor) + '</span>' : '') + (m.own ? '' : '<span class="sp">' + (m.bought ? '$20+ buy ✓' : 'no $20+ buy yet') + (m.buyers ? ' · ' + m.buyers + ' qualifying buyer' + (m.buyers === 1 ? '' : 's') + ' of their own' : '') + '</span>') + '</span>'
|
||||
+ '<span class="em">' + (m.email ? esc(m.email) : (m.memberId ? '<span class="id">#' + m.memberId + '</span>' : '')) + (m.sponsor ? '<span class="sp">sponsored by ' + esc(m.sponsor) + '</span>' : '') + (m.own ? '' : '<span class="sp">' + (m.bought ? '$25+ buy ✓' : 'no $25+ buy yet') + (m.buyers ? ' · ' + m.buyers + ' qualifying buyer' + (m.buyers === 1 ? '' : 's') + ' of their own' : '') + '</span>') + '</span>'
|
||||
+ '<span class="earn' + (m.earnedWei && m.earnedWei !== '0' ? ' on' : '') + '" title="POL this person has paid you so far">'
|
||||
+ (m.earnedWei && m.earnedWei !== '0' ? '+' + IAP.fmtPol(m.earnedWei) + ' POL' : '0.00 POL') + '</span>'
|
||||
+ '<span class="dt">' + new Date(m.joined).toLocaleDateString() + '</span>'
|
||||
@@ -1630,7 +1656,7 @@
|
||||
$('tkTierLine').textContent = 'you are at ' + names[r.tier];
|
||||
$('tkTiers').innerHTML = r.tiers.map(t => '<div class="tk-tier' + (t.reached ? ' reached' : '') + (t.key === r.tier ? ' current' : '') + '"><b>' + esc(t.name) + (t.reached ? ' ✓' : '') + '</b><div class="need">' + (t.reached ? esc(t.blurb) : 'Unlocks when you ' + esc(t.needText)) + '</div><ul>' + t.items.map(i => '<li' + (i.live ? '' : ' class="soon"') + '>' + esc(i.t) + '</li>').join('') + '</ul>' + (t.reached ? '' : '<div class="lock" style="margin-top:8px">locked</div>') + '</div>').join('');
|
||||
$('tkLocked').hidden = r.unlocked; $('tkForm').hidden = !r.unlocked;
|
||||
if (!r.unlocked) { $('tkLocked').textContent = 'Unlocks at Surge: your first qualifying buyer of a $20 or larger package. Then it writes posts, DMs, follow-ups, objection replies, emails and story posts in your name, with your link, inside the honesty rules. ' + (r.tier === 'free' ? 'Step one is switching on payouts.' : 'You are one buyer away.'); $('tkUsage').textContent = 'locked'; renderTkTools(r); return; }
|
||||
if (!r.unlocked) { $('tkLocked').textContent = 'Unlocks at Surge: your first qualifying buyer of a $25 or larger package. Then it writes posts, DMs, follow-ups, objection replies, emails and story posts in your name, with your link, inside the honesty rules. ' + (r.tier === 'free' ? 'Step one is switching on payouts.' : 'You are one buyer away.'); $('tkUsage').textContent = 'locked'; renderTkTools(r); return; }
|
||||
$('tkUsage').textContent = r.freeLeft + ' free this month · then ' + r.cost + ' credits each · you have ' + r.available.toLocaleString() + ' credits';
|
||||
$('tkCostLine').textContent = r.freeLeft > 0 ? 'This one is free (' + r.freeLeft + ' left this month).' : 'This one costs ' + r.cost + ' credits from your earned pool.';
|
||||
if (!$('tkKind').options.length) { $('tkKind').innerHTML = r.kinds.map(k => '<option value="' + k.key + '">' + esc(k.label) + '</option>').join(''); $('tkAngle').innerHTML = r.angles.map(a => '<option value="' + a + '">' + a + '</option>').join(''); }
|
||||
@@ -1908,23 +1934,6 @@
|
||||
|
||||
// ── in-dashboard package buying ──
|
||||
const PKG = { 1: 'Micro', 2: 'Activation', 3: 'Builder', 4: 'Growth', 5: 'Leader' };
|
||||
// Card on-ramp: buy POL with a card via MoonPay, delivered to the buyer's own
|
||||
// wallet. Signed + wallet-prefilled once MoonPay keys are set; generic page
|
||||
// otherwise. The site never touches funds — MoonPay is merchant of record.
|
||||
async function openMoonpay(pol) {
|
||||
try {
|
||||
let addr = '';
|
||||
try { const me = await (await fetch('/api/me')).json(); addr = me.address || ''; } catch (e) {}
|
||||
const q = '/api/moonpay-url?pol=' + encodeURIComponent(pol || '') + (addr ? '&address=' + encodeURIComponent(addr) : '');
|
||||
const r = await (await fetch(q)).json();
|
||||
if (r && r.url) {
|
||||
window.open(r.url, '_blank', 'noopener');
|
||||
IAP.status(r.signed
|
||||
? 'MoonPay opened in a new tab with your wallet address pre-filled. Choose POL on Polygon, finish the purchase, then come back and buy your package.'
|
||||
: 'MoonPay opened in a new tab. Choose POL on the Polygon network and paste your own wallet address as the destination, then come back.', 'ok');
|
||||
}
|
||||
} catch (e) { IAP.status('Could not open MoonPay: ' + ((e && e.message) || e), 'bad'); }
|
||||
}
|
||||
// ── linked positions (Qualified Start) ──
|
||||
const short = a => a ? a.slice(0, 6) + '…' + a.slice(-4) : '';
|
||||
let noPayoutAddrs = new Set(); // positions the site refuses to buy from (see siteConfig.noPayoutIds)
|
||||
@@ -1935,7 +1944,7 @@
|
||||
const list = r.positions || [];
|
||||
const rows = list.map((p, i) => '<div class="lin-row"><span class="nm">Position ' + (i + 2) + ' <span class="mono">' + short(p.address) + '</span></span>'
|
||||
+ '<span class="id">' + (p.memberId ? '#' + p.memberId : 'not on-chain yet') + '</span>'
|
||||
+ '<span class="earn' + (p.counted ? ' on' : '') + '">' + (p.noPayout ? 'linkage only: no purchases from this position (payouts would reach a retired wallet)' : p.counted ? 'counts as a qualifying buyer' : p.memberId ? 'registered, buy $20+ to count' : 'buy a $20+ package to register it') + '</span>'
|
||||
+ '<span class="earn' + (p.counted ? ' on' : '') + '">' + (p.noPayout ? 'linkage only: no purchases from this position (payouts would reach a retired wallet)' : p.counted ? 'counts as a qualifying buyer' : p.memberId ? 'registered, buy $25+ to count' : 'buy a $25+ package to register it') + '</span>'
|
||||
+ '<span class="dt">' + (p.credits || 0).toLocaleString() + ' credits' + (p.balanceWei != null ? ' · ' + (Number(BigInt(p.balanceWei) / 10n ** 14n) / 10000).toLocaleString(undefined, { maximumFractionDigits: 2 }) + ' POL' : '') + '</span>'
|
||||
+ (!p.memberId ? '<button class="btn sec small" type="button" data-unlink="' + p.address + '">Unlink</button>' : '')
|
||||
+ '</div>').join('');
|
||||
@@ -1982,8 +1991,8 @@
|
||||
if (!(await IAP.confirmBox('Your wallet will ask which account to connect. Tick ONLY the new account (not ' + short(me.address) + '), then sign once.\n\nIf you have not created the extra account yet: MetaMask, account menu, Add account. Trust or SafePal: switch wallet.\n\nReady?', { title: 'Add a position', ok: 'Ready' }))) return;
|
||||
IAP.status('Pick the new account in your wallet, then sign once…');
|
||||
const r = await IAPWallet.signIn({ asPosition: true, pick: true });
|
||||
$('qsHint').textContent = 'Added ' + short(r.address) + '. Now choose it under "Buy from" and buy a $20 or larger package.';
|
||||
IAP.status('Position added: ' + short(r.address) + '. Pick it under "Buy from" above and buy a $20+ package to count it.', 'ok');
|
||||
$('qsHint').textContent = 'Added ' + short(r.address) + '. Now choose it under "Buy from" and buy a $25 or larger package.';
|
||||
IAP.status('Position added: ' + short(r.address) + '. Pick it under "Buy from" above and buy a $25+ package to count it.', 'ok');
|
||||
await loadPositions();
|
||||
const sel = $('buyFrom'); if (sel) sel.value = r.address.toLowerCase();
|
||||
try { $('buyFrom').scrollIntoView({ behavior: 'smooth', block: 'center' }); } catch (e) {}
|
||||
@@ -2065,15 +2074,12 @@
|
||||
} catch (e) { IAP.status('Purchase failed: ' + ((e && e.message) || e), 'bad'); }
|
||||
finally { b.disabled = false; }
|
||||
}));
|
||||
// brand new to crypto? buy POL with a card, sent straight to the wallet
|
||||
const builder = products.find(p => p.priceCents === 5000) || products[products.length - 1];
|
||||
const needPol = (builder && builder.costWei) ? Math.max(30, Math.ceil(Number(builder.costWei) / 1e18) + 3) : 30;
|
||||
// brand new to crypto? point to the wallet guide (buy POL on any exchange or on-ramp, send it to your own wallet)
|
||||
const cta = document.createElement('div');
|
||||
cta.style.cssText = 'grid-column:1/-1;margin-top:10px;text-align:center';
|
||||
cta.innerHTML = '<p class="muted small" style="margin:0 0 8px">New to crypto? Buy POL with a debit or credit card, Apple Pay, or Google Pay. It lands straight in your own wallet, and this site never touches your money.</p>'
|
||||
+ '<button class="btn small sec" id="moonpayBtn" type="button">💳 Buy POL with a card</button> <a class="btn small sec" href="/wallets" target="_blank" rel="noopener">Wallet and MoonPay guide</a>';
|
||||
cta.innerHTML = '<p class="muted small" style="margin:0 0 8px">New to crypto? Buy POL with a card on any major exchange or on-ramp, then send it to your own wallet on the Polygon network. This site never touches your money.</p>'
|
||||
+ '<a class="btn small sec" href="/wallets" target="_blank" rel="noopener">Wallet help</a>';
|
||||
wrap.appendChild(cta);
|
||||
const mb = $('moonpayBtn'); if (mb) mb.addEventListener('click', () => openMoonpay(needPol));
|
||||
} catch (e) {}
|
||||
}
|
||||
loadBuyTiles();
|
||||
@@ -2281,10 +2287,12 @@
|
||||
if (sp.sponsorBlocked === 'claim' && sp.claim) return (sp.claim.nobody ? 'Nobody above you on LinkSpin has a wallet yet, so there is no one for the contract to pay. ' : who + ' has not linked a wallet on LinkSpin yet. They have until ' + new Date(sp.claim.deadline).toLocaleString() + ' to do it, and we have told them. ') + 'You can use everything else meanwhile; your purchase waits so it pays the right person.';
|
||||
if (sp.sponsorBlocked === 'notActivated') return who + ' has not switched on payouts yet, so this purchase would credit the company instead of them. Ask them to switch on payouts (Wallet tab, one free transaction), then try again.';
|
||||
if (sp.sponsorBlocked === 'rpc') return 'Could not confirm your sponsor on the chain just now. Try again in a minute; nothing was charged.';
|
||||
if (sp.sponsorBlocked === 'tankHold') return tankHoldText(sp.tankHold);
|
||||
return 'Your sponsor link could not be matched to a member. Send a ticket from Help (/help) before buying so ' + who + ' gets credit.';
|
||||
}
|
||||
$('activateBtn').addEventListener('click', busy($('activateBtn'), async () => {
|
||||
const me = await (await fetch('/api/sponsor?intent=buy')).json();
|
||||
const me = await (await fetch('/api/sponsor?intent=activate')).json(); // the free activation: a tank member waits for an adopter (a buy never does)
|
||||
if (me.sponsorBlocked === 'tankHold') { TANK_HOLD = me.tankHold || {}; IAP.status(tankHoldText(me.tankHold), 'ok'); await render(); return; }
|
||||
if (me.sponsorBlocked) { IAP.status(sponsorHoldText(me), 'bad'); return; }
|
||||
IAP.status('Confirm the free activation in your wallet…');
|
||||
const r = await IAPWallet.activate(me.sponsorId || 0);
|
||||
@@ -2388,7 +2396,7 @@
|
||||
}
|
||||
$('woStatus').textContent = unlocked >= 3 ? 'Fully qualified: all three wall positions are yours.'
|
||||
: unlocked === 2 ? 'Position 2 is yours. ' + (5 - bc) + ' more qualifying buyer' + (5 - bc === 1 ? '' : 's') + ' and position 3 is too.'
|
||||
: (2 - bc) + ' more qualifying buyer' + (2 - bc === 1 ? '' : 's') + ' ($20 or more) opens position 2. You can set your links now; they go live the moment a slot unlocks.';
|
||||
: (2 - bc) + ' more qualifying buyer' + (2 - bc === 1 ? '' : 's') + ' ($25 or more) opens position 2. You can set your links now; they go live the moment a slot unlocks.';
|
||||
}
|
||||
document.querySelectorAll('.wo-upload').forEach(b => b.addEventListener('click', () => { const f = document.querySelector('.wo-file[data-slot="' + b.dataset.slot + '"]'); if (f) f.click(); }));
|
||||
document.querySelectorAll('.wo-file').forEach(inp => inp.addEventListener('change', async () => {
|
||||
@@ -2441,7 +2449,7 @@
|
||||
for (const p of SOCIALS) body.socials[p] = ($('soc-' + p) && $('soc-' + p).value.trim()) || '';
|
||||
if (pfAvatar) body.avatarUrl = pfAvatar;
|
||||
const r = await api('/api/my/profile-details', body);
|
||||
IAP.status('Profile saved.', 'ok');
|
||||
IAP.status(r.notice ? 'Profile saved. ' + r.notice : 'Profile saved.', 'ok');
|
||||
if (r.account) fillProfileDetails(r.account);
|
||||
}));
|
||||
$('lbUploadBtn').addEventListener('click', () => $('lbFile').click());
|
||||
@@ -2685,7 +2693,7 @@
|
||||
(function () {
|
||||
const btn = document.getElementById('promoApply'), inp = document.getElementById('promoCode'), msg = document.getElementById('promoMsg');
|
||||
if (!btn || !inp) return;
|
||||
const say = (t, ok) => { msg.hidden = false; msg.textContent = t; msg.style.color = ok ? 'var(--mint)' : '#ff8a8a'; };
|
||||
const say = (t, ok) => { msg.hidden = false; msg.textContent = t; msg.style.color = ok ? 'var(--mint)' : 'var(--bad)'; };
|
||||
const go = async () => {
|
||||
const code = inp.value.trim(); if (!code) { say('Enter a promo code.', false); return; }
|
||||
btn.disabled = true;
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
let r; try { r = await CR.get('/api/my/pages'); } catch (e) { CR.sub('could not load'); return; }
|
||||
PAGES = r.pages || []; HOSTS = r.hosts || []; BASE = r.pageBase || ''; if (r.styles) STYLES = r.styles; PROVIDERS = r.providers || []; IMAGES = r.images || []; if (r.imageMax) IMG_MAX = r.imageMax; if (r.imageBytes) IMG_BYTES = r.imageBytes;
|
||||
const pubd = PAGES.filter(p => p.status === 'published').length;
|
||||
CR.sub(PAGES.length + ' page' + (PAGES.length === 1 ? '' : 's') + ' · ' + pubd + ' live');
|
||||
const TT = r.tier; const capTxt = TT ? (TT.unlimited ? ' pages (' + TT.label + ', unlimited)' : ' of ' + TT.max + ' pages (' + TT.label + ')') : (' page' + (PAGES.length === 1 ? '' : 's'));
|
||||
CR.sub(PAGES.length + capTxt + ' · ' + pubd + ' live');
|
||||
const views = PAGES.reduce((n, p) => n + p.views, 0), leads = PAGES.reduce((n, p) => n + p.leads, 0), clicks = PAGES.reduce((n, p) => n + p.clicks, 0);
|
||||
$('tiles').innerHTML = [['Pages', fmt(PAGES.length)], ['Live', fmt(pubd)], ['Views', fmt(views)], ['Clicks through', fmt(clicks)], ['Leads on your list', fmt(leads)]].map(([k, v], i) => '<div class="tile' + (i === 4 ? ' hi' : '') + '"><span class="k">' + k + '</span><span class="v">' + v + '</span></div>').join('');
|
||||
$('gal').innerHTML = PAGES.length ? PAGES.map(p => '<div class="card' + (p.id === SEL ? ' on' : '') + '" data-id="' + p.id + '" role="button" tabindex="0"><div class="thumb"><i class="t"></i><i style="width:55%"></i><i style="width:65%"></i><i class="b"></i></div><div class="cap"><b>' + esc(p.title) + '</b><span class="mono muted" style="font-size:11px">' + p.type + ' · ' + (p.status === 'published' ? '<span class="ok">live</span>' : 'draft') + ' · ' + fmt(p.views) + ' views' + (p.leads ? ' · ' + fmt(p.leads) + ' leads' : '') + '</span></div></div>').join('')
|
||||
|
||||
@@ -13,6 +13,7 @@ window.IAPPromo = (function () {
|
||||
|
||||
// ── social posts ──
|
||||
const POSTS = [
|
||||
{ net: 'X', label: 'X · Banner Spin', text: 'One banner slot on a traffic exchange, up to 25 banners rotating in it. LinkSpin Banner Spin: one image address, one click address, every click lands on the page of the banner that was shown, and the report tells you which banner wins. Free with your first $25 package: {{LINK:links}}' },
|
||||
{ net: 'X', label: 'X · one link', text: 'I stopped juggling six affiliate links. One LinkSpin link now rotates every page I promote, with weights, hours and a fallback, and a report by source, country and device. Free, no account needed to try the spin: {{LINK}}' },
|
||||
{ net: 'X', label: 'X · instant payout', text: 'No withdraw button. A verified contract on Polygon splits every ad package the second it sells: 50% to the sponsor, 20% to level 2, 10% to level 3, straight to wallets. Watch the ledger move: {{LINK}}' },
|
||||
{ net: 'X', label: 'X · advertiser', text: 'Marketers: you were buying traffic anyway. Here the ad spend in your line pays you, in the same transaction, on a public ledger. Packages from $10. Join free: {{LINK:zones}}' },
|
||||
@@ -43,6 +44,8 @@ window.IAPPromo = (function () {
|
||||
|
||||
// ── objection bank (truth + say this) ──
|
||||
const OBJECTIONS = [
|
||||
// Banner Spin (2026-10-20): the add-on that opens with the member's own $25 package
|
||||
{ q: 'What is Banner Spin?', truth: 'One image address and one click address that rotate up to 25 banners, each with its own target page or spin link. The member pastes it once into a banner slot (traffic exchange, safelist, forum signature, their own site) and changes the banners from the Control Room. A click goes to the banner that visitor saw, unmatched clicks go to a fallback, and reports show views, clicks, click rate and conversions per banner and per placement, with a WINNER badge once two banners have 1,000 views each. It is a free add-on with the member\'s own package of $25 or more: Starter 2 Banner Spins x 5 banners, Builder (2 qualifying buyers) 5 x 15, Leader (5 qualifying buyers) 10 x 25. It does not rotate inside paid ad networks or Gmail, which keep their own copy of the image.', say: 'You know how every exchange gives you one banner slot? Banner Spin turns that slot into a rotation of up to 25 banners, each going to its own page, and tells you which one gets the clicks. Set it once, swap banners any time from your dashboard. It comes free with your first $25 package: {{LINK}}' },
|
||||
{ q: 'What is a spin link?', truth: 'One short link on a LinkSpin link domain that rotates visitors through a list of destination pages by weight. Each destination can be paused, limited to hours of the day, capped per day, or pointed at a fallback. Clicks are reported by source, country and device, and tracker macros are filled on the way through. The rotator is free and needs no package.', say: 'It is one link that stands in for all of yours. You give it the pages you promote and how often each should show, and it rotates visitors through them. Pause a page, cap it, give it hours. Free, and you can try a spin before you even sign up: {{LINK}}' },
|
||||
{ q: 'Which crypto do I get paid in?', truth: 'One coin, one network: POL, the native coin of Polygon. Packages are dollar-priced and settled in POL at the live Chainlink rate; every payout is sent as POL to the recipient\'s own Polygon wallet in the same transaction. No tokens, no other chains, no stablecoins.', say: 'You get paid in POL, which is Polygon\'s own coin, straight into your wallet the moment a package in your line sells. Any Polygon wallet works, SafePal, MetaMask, Phantom, and if you have never held crypto there is a card on-ramp inside the control room. {{LINK}}' },
|
||||
{ q: 'Is this a pyramid scheme?', truth: 'There is a real product with no referral needed: the rotator, the page builder and the zone script are free tools, and the paid product is ad delivery at one cent per credit across seven live formats that members can watch serving. Sponsor payments are referral commissions written as constants in a verified contract, paid only when a real package sells. Nobody has to recruit, and joining costs nothing.', say: 'Fair question. Here is the test I use: is there something people would use with no referral involved? Here there is, and most of it is free: a link rotator, a page builder, an ad slot for your site. The paid product is advertising you can watch run. The sponsor split is a referral commission on those sales, fixed in a public contract. Join free and never refer anyone if you like. {{LINK:stack}}' },
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
try { var u = new URL(a.href); for (var k in P) if (!u.searchParams.has(k)) u.searchParams.set(k, P[k]); a.href = u.toString(); } catch (e) {}
|
||||
a.addEventListener('click', function () { try { navigator.sendBeacon('/api/p/' + slug + '/hit', new Blob([JSON.stringify({ k: 'cta' })], { type: 'application/json' })); } catch (e) {} });
|
||||
});
|
||||
var f = document.querySelector('.lsform input[name="lsid"]'); if (f && lsid) f.value = lsid;
|
||||
// the built-in form (.ls-form) usually arrives with the lsid filled by the server; this is the fallback. A pasted
|
||||
// provider form (.lsform) only gets it when the member's own form code carries an lsid field.
|
||||
if (lsid) document.querySelectorAll('.ls-form input[name="lsid"], .lsform input[name="lsid"]').forEach(function (f) { if (!f.value) f.value = lsid; });
|
||||
})();
|
||||
|
||||
+42
-23
@@ -4,18 +4,37 @@
|
||||
InstantAdPay clone (sapphire glow, mint, circuit texture) is in here. */
|
||||
:root{
|
||||
--bg:#E9EEF5; --panel:#FFFFFF; --panel-2:#F3F6FB; --line:#CDD7E5; --line-strong:#AEBED4;
|
||||
--ink:#0F1B2E; --ink-2:#324361; --muted:#66768F;
|
||||
--accent:#1F6FEB; --accent-hi:#0B4BB3; --accent-dim:#7CB2FF; --accent-soft:#E1ECFC;
|
||||
--sig:#FF6A1A; --sig-2:#D9530A; --sig-soft:#FFE9DC;
|
||||
--ok:#0E8A5C; --ok-soft:#DDF4E8; --warn:#C2410C; --warn-soft:#FFE7D8; --bad:#B91C1C; --hi-row:#FFF3EA;
|
||||
--chrome:#0B1424; --chrome-2:#101D33; --chrome-ink:#EEF3FA; --chrome-sub:#8CA2C4; --chrome-line:#1E2E4A; --inset:#0F1B2E;
|
||||
--ink:#0F1B2E; --ink-2:#324361; --muted:#596984;
|
||||
--accent:#1F6FEB; --accent-hi:#0B4BB3; --accent-ink:#FFFFFF; --accent-dim:#7CB2FF; --accent-soft:#E1ECFC;
|
||||
--sig:#FF6A1A; --sig-2:#B8420A; --sig-soft:#FFE9DC; --sig-ink:#0F1B2E; --sig-line:rgba(255,106,26,.45);
|
||||
--ok:#0B7A52; --ok-soft:#DDF4E8; --ok-ink:#FFFFFF; --ok-line:rgba(11,122,82,.4); --warn:#B23A0A; --warn-soft:#FFE7D8; --warn-line:rgba(178,58,10,.4);
|
||||
--bad:#B91C1C; --bad-soft:#FBE0E0; --hi-row:#FFF3EA;
|
||||
--chrome:#0B1424; --chrome-2:#101D33; --chrome-ink:#EEF3FA; --chrome-sub:#8CA2C4; --chrome-line:#1E2E4A; --chrome-hi:#8CC8FF; --chrome-warm:#FFB37D; --inset:#0F1B2E;
|
||||
--on-ink:#FFFFFF; --field-bg:#FFFFFF; --btn-bg:linear-gradient(180deg,#FFFFFF,#F3F6FB); --btn-blue:linear-gradient(180deg,#2A74EC,#1559CC);
|
||||
--panel-grad:linear-gradient(180deg,#FFFFFF,#F6F8FC); --panel-grad-hi:linear-gradient(180deg,#FFFFFF,#EEF4FE); --ph-a:#EEF2F9; --ph-b:#F5F7FC;
|
||||
--hl:rgba(255,255,255,.9); --grid-dot:rgba(31,111,235,.20); --bg-glow:rgba(255,255,255,.6);
|
||||
--sh:0 10px 24px -18px rgba(15,27,46,.45),0 1px 0 rgba(255,255,255,.9) inset;
|
||||
--display:"Rajdhani","Segoe UI",system-ui,sans-serif; --body:"Manrope","Segoe UI",system-ui,sans-serif; --mono:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;
|
||||
color-scheme:light;
|
||||
}
|
||||
/* dark variant (2026-11-01), same values as cr.css so the public pages and the Control Room match */
|
||||
:root[data-theme="dark"]{
|
||||
--bg:#0B1424; --panel:#142338; --panel-2:#1B2D47; --line:#273B5C; --line-strong:#3A5580;
|
||||
--ink:#EEF3FA; --ink-2:#C5D2E6; --muted:#97A9C6;
|
||||
--accent:#4D8DF7; --accent-hi:#8CC0FF; --accent-ink:#0B1424; --accent-dim:#3D6FC4; --accent-soft:#1B325A;
|
||||
--sig:#FF7A32; --sig-2:#FFA06A; --sig-soft:#3B2416; --sig-ink:#0B1424; --sig-line:rgba(255,122,50,.45);
|
||||
--ok:#3FCF92; --ok-soft:#12352A; --ok-ink:#0B1424; --ok-line:rgba(63,207,146,.4); --warn:#F7A35E; --warn-soft:#3D2716; --warn-line:rgba(247,163,94,.4);
|
||||
--bad:#FF8080; --bad-soft:#44202A; --hi-row:#2B2119;
|
||||
--inset:#06101E;
|
||||
--on-ink:#0B1424; --field-bg:#0F1B2E; --btn-bg:linear-gradient(180deg,#1E3150,#172743); --btn-blue:linear-gradient(180deg,#8CC0FF,#5A96F5);
|
||||
--panel-grad:linear-gradient(180deg,#162741,#122035); --panel-grad-hi:linear-gradient(180deg,#172A47,#15284A); --ph-a:#182A45; --ph-b:#1B2E4B;
|
||||
--hl:rgba(255,255,255,.05); --grid-dot:rgba(140,192,255,.10); --bg-glow:rgba(31,111,235,.12);
|
||||
--sh:0 10px 24px -18px rgba(0,0,0,.85),0 1px 0 rgba(255,255,255,.04) inset;
|
||||
color-scheme:dark;
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
html{scroll-behavior:smooth}
|
||||
body{margin:0;min-height:100vh;display:flex;flex-direction:column;background:var(--bg);background-image:radial-gradient(circle,rgba(31,111,235,.20) 1px,transparent 1.3px),radial-gradient(120% 60% at 50% 0%,rgba(255,255,255,.6),transparent 60%);background-size:18px 18px,100% 100%;background-attachment:fixed;color:var(--ink);font:15px/1.5 var(--body)}
|
||||
body{margin:0;min-height:100vh;display:flex;flex-direction:column;background:var(--bg);background-image:radial-gradient(circle,var(--grid-dot) 1px,transparent 1.3px),radial-gradient(120% 60% at 50% 0%,var(--bg-glow),transparent 60%);background-size:18px 18px,100% 100%;background-attachment:fixed;color:var(--ink);font:15px/1.5 var(--body)}
|
||||
a{color:var(--accent-hi)} a:hover{color:var(--accent)}
|
||||
button,input,select,textarea{font:inherit;color:inherit}
|
||||
:focus-visible{outline:2px solid var(--sig);outline-offset:2px}
|
||||
@@ -34,7 +53,7 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.brand .mark{position:relative;width:26px;height:26px;border-radius:50%;border:3px solid var(--accent);border-right-color:transparent;display:inline-block;flex:none}
|
||||
.brand .mark::after{content:"";position:absolute;right:-5px;top:-3px;width:8px;height:8px;border-radius:50%;background:var(--sig);box-shadow:0 0 0 3px rgba(255,106,26,.25)}
|
||||
.brand .word{font-family:var(--display);font-weight:700;font-size:22px;letter-spacing:.12em;text-transform:uppercase}
|
||||
.brand .word b{color:#8CC8FF;font-weight:700}
|
||||
.brand .word b{color:var(--chrome-hi);font-weight:700}
|
||||
.nav{display:flex;gap:18px;flex-wrap:wrap;margin-left:12px}
|
||||
.nav a{color:var(--chrome-sub);text-decoration:none;font-weight:700;font-size:13px;padding:6px 0}
|
||||
.nav a:hover{color:var(--chrome-ink)}
|
||||
@@ -44,38 +63,38 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.foot a{color:var(--chrome-sub);text-decoration:none}
|
||||
.foot a:hover{color:var(--chrome-ink)}
|
||||
.foot .word{font-family:var(--display);font-weight:700;font-size:16px;letter-spacing:.12em;text-transform:uppercase;color:var(--chrome-ink)}
|
||||
.foot .word b{color:#8CC8FF}
|
||||
.foot .word b{color:var(--chrome-hi)}
|
||||
|
||||
/* controls */
|
||||
.btn{font:700 13px var(--body);letter-spacing:.04em;padding:10px 16px;border-radius:7px;border:1px solid var(--line-strong);background:linear-gradient(180deg,#FFFFFF,#F3F6FB);color:var(--ink);display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;cursor:pointer;min-height:44px;box-shadow:0 1px 0 rgba(255,255,255,.9) inset,0 1px 2px rgba(15,27,46,.08);white-space:nowrap}
|
||||
.btn{font:700 13px var(--body);letter-spacing:.04em;padding:10px 16px;border-radius:7px;border:1px solid var(--line-strong);background:var(--btn-bg);color:var(--ink);display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;cursor:pointer;min-height:44px;box-shadow:0 1px 0 var(--hl) inset,0 1px 2px rgba(15,27,46,.08);white-space:nowrap}
|
||||
.btn:hover{border-color:var(--accent);color:var(--ink)}
|
||||
.btn.pri{font-family:var(--display);font-size:16px;letter-spacing:.08em;text-transform:uppercase;background:linear-gradient(180deg,#FF7A32,var(--sig));border-color:var(--sig-2);color:#fff;box-shadow:0 8px 18px -10px rgba(255,106,26,.9),0 1px 0 rgba(255,255,255,.35) inset}
|
||||
.btn.pri:hover{background:linear-gradient(180deg,#FF8A48,var(--sig));color:#fff}
|
||||
.btn.blue{background:linear-gradient(180deg,#3A83F0,var(--accent));border-color:var(--accent-hi);color:#fff;box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset}
|
||||
.btn.blue:hover{color:#fff}
|
||||
.btn.pri{font-family:var(--display);font-size:16px;letter-spacing:.08em;text-transform:uppercase;background:linear-gradient(180deg,#FF7A32,var(--sig));border-color:var(--sig-2);color:var(--sig-ink);box-shadow:0 8px 18px -10px rgba(255,106,26,.9),0 1px 0 rgba(255,255,255,.35) inset}
|
||||
.btn.pri:hover{background:linear-gradient(180deg,#FF8A48,var(--sig));color:var(--sig-ink)}
|
||||
.btn.blue{background:var(--btn-blue);border-color:var(--accent-hi);color:var(--accent-ink);box-shadow:0 8px 18px -10px rgba(31,111,235,.9),0 1px 0 rgba(255,255,255,.3) inset}
|
||||
.btn.blue:hover{color:var(--accent-ink)}
|
||||
.btn.ghost{background:transparent;box-shadow:none;border-color:var(--chrome-line);color:var(--chrome-ink)}
|
||||
.btn.ghost:hover{color:#fff;border-color:var(--chrome-sub)}
|
||||
.btn[disabled]{opacity:.55;cursor:default}
|
||||
.field{border:1px solid var(--line-strong);border-radius:6px;padding:10px 12px;background:#FFF;font:500 13px var(--mono);color:var(--ink);box-shadow:0 1px 2px rgba(15,27,46,.06) inset;width:100%;min-height:44px}
|
||||
.field:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px rgba(255,106,26,.18)}
|
||||
.field{border:1px solid var(--line-strong);border-radius:6px;padding:10px 12px;background:var(--field-bg);font:500 13px var(--mono);color:var(--ink);box-shadow:0 1px 2px rgba(15,27,46,.06) inset;width:100%;min-height:44px}
|
||||
.field:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--sig) 18%,transparent)}
|
||||
.lbl{display:grid;gap:5px;font:700 10.5px var(--body);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
|
||||
.led{display:inline-flex;align-items:baseline;gap:10px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;padding:10px 14px;color:var(--chrome-sub);font:500 12px var(--mono);max-width:100%;overflow-wrap:anywhere}
|
||||
.led b{font-family:var(--display);font-size:22px;line-height:1;color:var(--sig);letter-spacing:.04em;font-weight:700}
|
||||
.led .k{font-size:10px;letter-spacing:.1em;text-transform:uppercase}
|
||||
.tag{display:inline-flex;align-items:center;gap:5px;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:4px;border:1px solid var(--line-strong);color:var(--ink-2);background:var(--panel-2)}
|
||||
.tag.ok{border-color:rgba(14,138,92,.4);color:var(--ok);background:var(--ok-soft)}
|
||||
.tag.warn{border-color:rgba(194,65,12,.4);color:var(--warn);background:var(--warn-soft)}
|
||||
.tag.ok{border-color:var(--ok-line);color:var(--ok);background:var(--ok-soft)}
|
||||
.tag.warn{border-color:var(--warn-line);color:var(--warn);background:var(--warn-soft)}
|
||||
.tag.t{border-color:var(--accent-soft);background:var(--accent-soft);color:var(--accent-hi)}
|
||||
.note{font-size:12px;color:var(--muted);line-height:1.5}
|
||||
.err{font-size:13px;color:var(--bad);font-weight:700}
|
||||
|
||||
/* surfaces */
|
||||
.tile,.panel{position:relative;background:linear-gradient(180deg,#FFFFFF,#F6F8FC);border:1px solid var(--line);border-radius:8px;box-shadow:var(--sh);min-width:0}
|
||||
.tile,.panel{position:relative;background:var(--panel-grad);border:1px solid var(--line);border-radius:8px;box-shadow:var(--sh);min-width:0}
|
||||
.panel{background:var(--panel)}
|
||||
.tile::before,.tile::after{content:"";position:absolute;width:11px;height:11px;border:1.5px solid var(--line-strong);pointer-events:none}
|
||||
.tile::before{top:5px;left:5px;border-right:0;border-bottom:0}.tile::after{bottom:5px;right:5px;border-left:0;border-top:0}
|
||||
.tile.hi{background:linear-gradient(180deg,#FFFFFF,#EEF4FE)}.tile.hi::before,.tile.hi::after{border-color:var(--sig)}
|
||||
.ph{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,#EEF2F9 0 6px,#F5F7FC 6px 12px);border-radius:8px 8px 0 0}
|
||||
.tile.hi{background:var(--panel-grad-hi)}.tile.hi::before,.tile.hi::after{border-color:var(--sig)}
|
||||
.ph{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,var(--ph-a) 0 6px,var(--ph-b) 6px 12px);border-radius:8px 8px 0 0}
|
||||
.ph h3,.ph h2{font-family:var(--display);font-weight:700;font-size:14px;letter-spacing:.1em;text-transform:uppercase;margin:0;display:flex;align-items:center;gap:8px}
|
||||
.ph h3::before,.ph h2::before{content:"";width:8px;height:8px;background:var(--sig);transform:rotate(45deg);display:inline-block;flex:none}
|
||||
.ph .meta{font:500 10.5px var(--mono);color:var(--muted);letter-spacing:.04em}
|
||||
@@ -84,9 +103,9 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.split{display:flex;height:14px;border-radius:4px;overflow:hidden;background:var(--line)}.split i{display:block;height:100%}
|
||||
.ico{width:22px;height:22px;stroke:var(--accent);fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none}
|
||||
.check{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--ink-2)}
|
||||
.dot{width:7px;height:7px;border-radius:50%;background:var(--ok);display:inline-block;margin-right:8px;box-shadow:0 0 0 3px rgba(14,138,92,.22);animation:pulse 2.4s ease-in-out infinite}
|
||||
.dot{width:7px;height:7px;border-radius:50%;background:var(--ok);display:inline-block;margin-right:8px;box-shadow:0 0 0 3px color-mix(in srgb,var(--ok) 22%,transparent);animation:pulse 2.4s ease-in-out infinite}
|
||||
.dot.off{background:var(--muted);animation:none;box-shadow:none}
|
||||
@keyframes pulse{0%,100%{box-shadow:0 0 0 3px rgba(14,138,92,.22)}50%{box-shadow:0 0 0 5px rgba(14,138,92,.08)}}
|
||||
@keyframes pulse{0%,100%{box-shadow:0 0 0 3px color-mix(in srgb,var(--ok) 22%,transparent)}50%{box-shadow:0 0 0 5px color-mix(in srgb,var(--ok) 8%,transparent)}}
|
||||
@media (prefers-reduced-motion:reduce){.dot{animation:none}}
|
||||
|
||||
/* page sections */
|
||||
@@ -126,7 +145,7 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.pkg.hi .price{color:var(--accent-hi)}
|
||||
.pkg .cr{font-size:12px;color:var(--ink-2)}
|
||||
.ledger{background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;color:var(--chrome-sub);font:500 11px var(--mono);padding:10px 12px;line-height:1.6;overflow-x:auto}
|
||||
.ledger .b{color:#8CC8FF}.ledger .s{color:var(--sig)}
|
||||
.ledger .b{color:var(--chrome-hi)}.ledger .s{color:var(--sig)}
|
||||
.amts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:6px}
|
||||
.amts div{display:flex;gap:10px;align-items:baseline}
|
||||
.amts .n{font:700 22px var(--mono)}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Fuel Your Offers guide page (/refuel, 2026-10-24). Inside a traffic-exchange frame the session and sponsor cookies are
|
||||
// dropped, so sign-in, join, member screens and off-site links open in a new tab, and /join carries the ?ref= this page
|
||||
// was opened with.
|
||||
(function () {
|
||||
var framed = false; try { framed = window.top !== window.self; } catch (e) { framed = true; }
|
||||
if (!framed) return;
|
||||
var ref = ''; try { ref = new URLSearchParams(location.search).get('ref') || ''; } catch (e) {}
|
||||
ref = String(ref).toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 40);
|
||||
document.querySelectorAll('a[href]').forEach(function (a) {
|
||||
var h = a.getAttribute('href') || ''; if (h.charAt(0) === '#') return;
|
||||
var member = a.host === location.host && /^\/(join|credits|ads|links|signin|login)(\/|$)/.test(a.pathname);
|
||||
if (member && ref && a.pathname === '/join' && !/[?&]ref=/.test(a.search)) a.search = (a.search ? a.search + '&' : '?') + 'ref=' + ref;
|
||||
if (member || a.host !== location.host) { a.target = '_blank'; a.rel = 'noopener'; }
|
||||
});
|
||||
})();
|
||||
@@ -20,7 +20,10 @@
|
||||
CR.tile({ k: 'Bots dropped', v: fmt(t.bots), series: sb, delta: CR.delta(b1, b0, 'vs prior'), note: t.served ? Math.round(t.bots / (t.served + t.bots) * 100) + '% of hits' : '' }),
|
||||
CR.tile({ k: 'Joins', v: fmt(t.joins), note: t.unique ? (t.joins / t.unique * 100).toFixed(1) + '% of unique' : '' }),
|
||||
CR.tile({ k: 'Buyers', v: fmt(t.purchases), hi: true, note: t.joins ? Math.round(t.purchases / t.joins * 100) + '% of joins' : '' }),
|
||||
CR.tile({ k: 'Partner conversions', v: fmt(t.external) })].join('');
|
||||
CR.tile({ k: 'Partner conversions', v: fmt(t.external) }),
|
||||
// Banner Spin totals beside spin links (2026-10-20)
|
||||
CR.tile({ k: 'Banner views', v: fmt(((s.bannerSpins || {}).totals || {}).imps), note: ((s.bannerSpins || {}).count || 0) + ' Banner Spin' + (((s.bannerSpins || {}).count || 0) === 1 ? '' : 's') }),
|
||||
CR.tile({ k: 'Banner clicks', v: fmt(((s.bannerSpins || {}).totals || {}).clicks), note: ((s.bannerSpins || {}).totals || {}).ctr != null ? s.bannerSpins.totals.ctr + '% CTR' : '' })].join('');
|
||||
const days = s.days || []; const dmax = Math.max(1, ...days.map(d => Math.max(d.u, d.b)));
|
||||
$('dayBars').style.gridTemplateColumns = 'repeat(' + Math.max(1, days.length) + ',minmax(0,1fr))';
|
||||
$('dayBars').innerHTML = days.map(d => '<i class="' + (days.length >= 3 && d.u === dmax && d.u ? 'hi' : d.u ? '' : 'dim') + '" style="height:' + Math.round(d.u / dmax * 100) + '%" title="' + d.day + ' · ' + d.u + ' unique, ' + d.b + ' bots"></i>').join('');
|
||||
@@ -52,6 +55,18 @@
|
||||
const ts = s.sources || [], pl = s.placements || [];
|
||||
$('tsRows').innerHTML = ts.length ? ts.map(x => '<div class="rw"><a href="/sources#' + esc(x.id) + '" style="text-decoration:none;color:var(--ink)"><b>' + esc(x.name) + '</b>' + (x.site ? '<br><span class="mono muted" style="font-size:11px">' + esc(x.site) + '</span>' : '') + '</a><span class="r num">' + fmt(x.hits) + '</span><span class="r num">' + fmt(x.unique) + '</span><span class="r num">' + fmt(x.conv) + (x.unique ? ' <span class="muted" style="font-size:10px">' + (x.conv / x.unique * 100).toFixed(1) + '%</span>' : '') + '</span></div>').join('') : '<div class="rw"><span class="muted">No clicks from a traffic source yet. Point a link at one under <a href="/sources">Sources</a>.</span></div>';
|
||||
$('plRows').innerHTML = pl.length ? pl.map(x => '<div class="rw"><span><b>' + esc(x.source) + '</b><br><span class="mono muted" style="font-size:11px">' + esc(x.key) + ' = ' + esc(x.k) + '</span></span><span class="r num">' + fmt(x.n) + '</span><span class="r num">' + fmt(x.conv) + '</span></div>').join('') : '<div class="rw"><span class="muted">Nothing yet. Placements appear once a source\'s zone or placement macro rides in on clicks.</span></div>';
|
||||
// -- Banner Spins (2026-10-20): views by Central day (bots and servers as the lighter bar), per banner with the winner, per placement with the cache flag
|
||||
const bs = s.bannerSpins || { totals: {}, days: [], banners: [], placements: [], country: [], device: [] }; const bt = bs.totals || {};
|
||||
// outer bar = views + bot / server loads, inner lighter share = the bot / server part
|
||||
dayBars('bsBars', 'bsAxis', bs.days, d => d.imps + (d.bots || 0) + (d.servers || 0), d => (d.bots || 0) + (d.servers || 0), 'no banner views yet');
|
||||
$('bsTiles').innerHTML = mini([['Views', fmt(bt.imps)], ['Clicks', fmt(bt.clicks)], ['CTR', bt.ctr == null ? '-' : bt.ctr + '%'], ['Match rate', bt.matchRate == null ? '-' : bt.matchRate + '%'], ['Unique (daily)', fmt(bt.uniques)], ['Conversions', fmt(bt.conversions)]]);
|
||||
$('bsCountry').innerHTML = kv(bs.country, 0); $('bsDevice').innerHTML = kv(bs.device, 0);
|
||||
$('bsBotNote').textContent = 'Never counted as views or clicks, shown here so you can see them: ' + fmt(bt.bots) + ' bot and prefetch image loads, ' + fmt(bt.serverLoads) + ' loads by servers or mail image proxies, ' + fmt(bt.botClicks) + ' bot clicks.';
|
||||
$('bsRowsB').innerHTML = (bs.banners || []).length ? bs.banners.map(x => '<div class="rw"><a href="/links#b' + x.spinId + '" style="text-decoration:none;color:var(--ink)"><b>' + esc(x.label) + '</b>' + (x.winner ? '<span class="bswin" data-winner="' + x.spinId + ':' + x.id + '">WINNER</span>' : '') + '<br><span class="mono muted" style="font-size:11px">' + esc(x.spin) + ' · ' + esc(x.size) + (x.autoPaused ? ' · <span class="warn">auto-paused</span>' : x.active ? '' : ' · paused') + '</span></a><span class="r num">' + fmt(x.imps) + '</span><span class="r num">' + fmt(x.uniques) + '</span><span class="r num">' + fmt(x.clicks) + '</span><span class="r num">' + (x.ctr == null ? '-' : x.ctr + '%') + '</span><span class="r num">' + fmt(x.conversions) + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">' + (bs.count ? 'No banners yet.' : 'No Banner Spins yet. <a href="/links#b">Make one</a> (opens with your own $25 package).') + '</span></div>';
|
||||
$('bsWinNote').textContent = 'WINNER = the best click rate in its Banner Spin once two or more live banners have ' + fmt(bs.winMin || 1000) + ' views each. Unique viewers are counted per day from a sample.';
|
||||
$('bsRowsP').innerHTML = (bs.placements || []).length ? bs.placements.slice(0, 15).map(x => '<div class="rw"><span style="overflow-wrap:anywhere"><b>' + esc(x.host === '(none)' ? 'No referrer (email, apps)' : x.host) + '</b>' + (x.caches ? ' <span class="tag warn">CACHED</span><span class="bscache" data-caches="' + esc(x.host) + '">' + esc(x.caches) + '</span>' : '') + '</span><span class="r num">' + fmt(x.imps) + '</span><span class="r num">' + fmt(x.clicks) + '</span><span class="r num">' + (x.ctr == null ? '-' : x.ctr + '%') + '</span><span class="r num">' + (x.matchRate == null ? '-' : x.matchRate + '%') + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">No placements yet. Put a Banner Spin\'s code on a page and its host shows here.</span></div>';
|
||||
const zn = s.zones || { byDay: [], byZone: [] };
|
||||
// bar = all views, lighter inner share = the ones that were NOT viewable
|
||||
dayBars('znBars', 'znAxis', zn.byDay, d => d.views, d => d.views - d.viewable, 'no zone views yet');
|
||||
|
||||
+141
-108
@@ -26,7 +26,7 @@ a:hover{text-decoration:underline}
|
||||
.wrap{max-width:1100px;margin:0 auto;padding:0 22px}
|
||||
h1,h2,h3{font-family:var(--disp);letter-spacing:-.015em}
|
||||
/* ── nav: capsule pill ─────────────────────────────── */
|
||||
nav{position:sticky;top:0;z-index:10;background:rgba(4,8,7,.7);backdrop-filter:blur(16px);
|
||||
nav{position:sticky;top:0;z-index:10;background:var(--nav-bg);backdrop-filter:blur(16px);
|
||||
-webkit-backdrop-filter:blur(16px);border-bottom:1px solid var(--line)}
|
||||
nav .wrap{display:flex;align-items:center;gap:20px;min-height:66px;flex-wrap:wrap;padding-top:8px;padding-bottom:8px}
|
||||
.logo{font-family:var(--disp);font-weight:800;font-size:20px;color:var(--ink)}
|
||||
@@ -36,13 +36,13 @@ nav .wrap{display:flex;align-items:center;gap:20px;min-height:66px;flex-wrap:wra
|
||||
.byline b{color:var(--ink);font-weight:600}
|
||||
.bo-side .byline{padding:4px 8px 10px;white-space:normal}
|
||||
@media (max-width:560px){nav .byline{font-size:9.5px}}
|
||||
nav .links{display:flex;gap:4px;flex:1;flex-wrap:wrap;background:rgba(16,28,24,.7);border:1px solid var(--line);
|
||||
nav .links{display:flex;gap:4px;flex:1;flex-wrap:wrap;background:var(--pill-bg);border:1px solid var(--line);
|
||||
border-radius:999px;padding:5px 8px;width:fit-content;flex:0 1 auto;margin:0 auto}
|
||||
nav .links a{color:var(--muted);font-size:13.5px;font-weight:600;padding:7px 14px;border-radius:999px}
|
||||
nav .links a:hover{color:var(--ink);text-decoration:none}
|
||||
nav .links a.active{color:var(--mint);background:rgba(59,157,255,.1)}
|
||||
nav .links a.active{color:var(--mint);background:var(--mint-soft)}
|
||||
#navWallet{font-size:13px;margin-left:auto}
|
||||
.rehearsal{background:rgba(59,157,255,.07);border-bottom:1px solid var(--line);color:var(--muted);
|
||||
.rehearsal{background:var(--mint-faint);border-bottom:1px solid var(--line);color:var(--muted);
|
||||
text-align:center;font-size:12.5px;padding:7px 12px}
|
||||
.rehearsal b{color:var(--mint)}
|
||||
/* ── buttons ───────────────────────────────────────── */
|
||||
@@ -50,8 +50,8 @@ nav .links a.active{color:var(--mint);background:rgba(59,157,255,.1)}
|
||||
padding:13px 26px;font-weight:700;font-size:15px;cursor:pointer;font-family:var(--disp);
|
||||
box-shadow:0 4px 30px rgba(59,157,255,.35);transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
|
||||
.btn:hover{transform:translateY(-2px);background:var(--mint-hi);box-shadow:0 8px 44px rgba(59,157,255,.5);text-decoration:none}
|
||||
.btn.sec{background:transparent;color:var(--mint);border:1px solid rgba(59,157,255,.6);box-shadow:none}
|
||||
.btn.sec:hover{background:rgba(59,157,255,.08);box-shadow:0 4px 26px rgba(59,157,255,.2)}
|
||||
.btn.sec{background:transparent;color:var(--mint);border:1px solid var(--mint-line-2);box-shadow:none}
|
||||
.btn.sec:hover{background:var(--mint-faint);box-shadow:0 4px 26px rgba(59,157,255,.2)}
|
||||
.btn.small{padding:8px 17px;font-size:13px}
|
||||
.btn:disabled{opacity:.45;cursor:default;transform:none;box-shadow:none}
|
||||
/* ── hero: centered, light-trail set-piece ─────────── */
|
||||
@@ -68,7 +68,7 @@ nav .links a.active{color:var(--mint);background:rgba(59,157,255,.1)}
|
||||
.arc2{fill:none;stroke:url(#arcGrad);stroke-width:3;stroke-linecap:round;filter:url(#arcGlow);opacity:.8}
|
||||
/* falling glow streaks */
|
||||
.streak{position:absolute;top:-140px;width:1.5px;height:110px;pointer-events:none;
|
||||
background:linear-gradient(180deg,transparent,rgba(143,251,227,.8));border-radius:2px;opacity:0}
|
||||
background:linear-gradient(180deg,transparent,var(--mint-hi));border-radius:2px;opacity:0}
|
||||
@media(prefers-reduced-motion:no-preference){
|
||||
.streak{animation:fall 7s linear infinite}
|
||||
@keyframes fall{0%{transform:translateY(0);opacity:0}12%{opacity:.7}55%{opacity:.5}75%{transform:translateY(72vh);opacity:0}100%{transform:translateY(72vh);opacity:0}}
|
||||
@@ -85,7 +85,7 @@ section{padding:64px 0 8px}
|
||||
.cmp{width:100%;border-collapse:separate;border-spacing:0;font-size:15px;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
|
||||
.cmp th,.cmp td{padding:13px 16px;border-bottom:1px solid var(--line);vertical-align:top;text-align:left}
|
||||
.cmp th{font-family:var(--disp);font-size:13px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
|
||||
.cmp th:last-child,.cmp td:last-child{color:var(--ink);background:rgba(59,157,255,.06)}
|
||||
.cmp th:last-child,.cmp td:last-child{color:var(--ink);background:var(--mint-faint)}
|
||||
.cmp td:first-child{font-weight:700;white-space:nowrap}
|
||||
.cmp td:nth-child(2){color:var(--muted)}
|
||||
.cmp tr:last-child td{border-bottom:0}
|
||||
@@ -99,11 +99,11 @@ h3{font-size:16.5px;margin:0 0 8px;font-weight:700}
|
||||
/* icon-plate feature cards */
|
||||
.plates{display:grid;gap:16px;grid-template-columns:1fr}
|
||||
@media(min-width:760px){.plates{grid-template-columns:1fr 1fr 1fr}}
|
||||
.platecard{background:linear-gradient(170deg,rgba(22,38,32,.6),rgba(10,18,15,.7));border:1px solid var(--line);
|
||||
.platecard{background:var(--panel-grad);border:1px solid var(--line);
|
||||
border-radius:var(--radius);padding:26px 22px;text-align:center;transition:border-color .2s ease,transform .2s ease}
|
||||
.platecard:hover{border-color:var(--line-strong);transform:translateY(-4px)}
|
||||
.plate{width:88px;height:88px;margin:0 auto 18px;border-radius:22px;display:grid;place-items:center;
|
||||
background:linear-gradient(160deg,#12241e,#0a1411);border:1px solid var(--line-strong);
|
||||
background:var(--panel-grad-deep);border:1px solid var(--line-strong);
|
||||
box-shadow:0 0 34px rgba(59,157,255,.15),inset 0 1px 0 rgba(143,251,227,.15)}
|
||||
.plate svg{width:38px;height:38px;stroke:var(--mint);fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
|
||||
.platecard p{color:var(--muted);font-size:14px;margin:0}
|
||||
@@ -115,15 +115,15 @@ h3{font-size:16.5px;margin:0 0 8px;font-weight:700}
|
||||
.flankitem .plate svg{width:24px;height:24px}
|
||||
.flankitem p{color:var(--muted);font-size:13.5px;margin:0}
|
||||
/* ledger mockup frame */
|
||||
.mockup{background:linear-gradient(170deg,#0e1c17,#080f0c);border:1px solid var(--line-strong);border-radius:20px;
|
||||
.mockup{background:var(--panel-grad-deep);border:1px solid var(--line-strong);border-radius:20px;
|
||||
box-shadow:0 30px 80px rgba(0,0,0,.6),0 0 60px rgba(59,157,255,.08);overflow:hidden}
|
||||
.mockup .bar{display:flex;gap:6px;align-items:center;padding:11px 14px;border-bottom:1px solid var(--line)}
|
||||
.mockup .bar i{width:9px;height:9px;border-radius:50%;background:#1e3a31;display:inline-block}
|
||||
.mockup .bar .addr{font-family:var(--mono);font-size:11px;color:var(--muted);margin-left:8px;background:rgba(4,8,7,.6);
|
||||
.mockup .bar i{width:9px;height:9px;border-radius:50%;background:var(--line-strong);display:inline-block}
|
||||
.mockup .bar .addr{font-family:var(--mono);font-size:11px;color:var(--muted);margin-left:8px;background:var(--ground-soft);
|
||||
border-radius:999px;padding:3px 12px}
|
||||
.mockup .body{padding:6px 0}
|
||||
.mockup .mrow{display:flex;justify-content:space-between;gap:10px;padding:9px 16px;font-family:var(--mono);
|
||||
font-size:12px;border-bottom:1px solid rgba(84,150,128,.08)}
|
||||
font-size:12px;border-bottom:1px solid var(--line)}
|
||||
.mockup .mrow span:last-child{color:var(--mint)}
|
||||
.mockup .mrow.dim span:last-child{color:var(--muted)}
|
||||
/* 2-col story block: iso illustration + checklist */
|
||||
@@ -133,24 +133,24 @@ h3{font-size:16.5px;margin:0 0 8px;font-weight:700}
|
||||
.checks li{padding:7px 0 7px 30px;position:relative;color:var(--muted);font-size:14.5px}
|
||||
.checks li::before{content:"✓";position:absolute;left:0;top:6px;width:20px;height:20px;border-radius:50%;
|
||||
background:var(--mint-soft);color:var(--mint);font-size:12px;font-weight:700;display:grid;place-items:center;
|
||||
border:1px solid rgba(59,157,255,.35)}
|
||||
border:1px solid var(--mint-line)}
|
||||
.chips{display:flex;gap:8px;margin:14px 0 4px;flex-wrap:wrap}
|
||||
.chip-t{border:1px solid var(--line-strong);border-radius:999px;padding:5px 16px;font-size:12.5px;color:var(--muted);font-family:var(--disp);font-weight:600}
|
||||
.chip-t.on{background:var(--mint);color:var(--mint-ink);border-color:var(--mint)}
|
||||
.iso{filter:drop-shadow(0 24px 50px rgba(0,0,0,.5))}
|
||||
/* level cycler: light the paying generation */
|
||||
#genViz .edge path{stroke:#22523f;transition:stroke .5s ease}
|
||||
#genViz .node-o{fill:#122e25;stroke:#2f6b55;stroke-width:1.3;transition:stroke .5s ease,fill .5s ease}
|
||||
#genViz .node-d{fill:#3f8f74;transition:fill .5s ease}
|
||||
#genViz[data-lvl="1"] .e1 path,#genViz[data-lvl="2"] .e2 path,#genViz[data-lvl="3"] .e3 path{stroke:#3b9dff}
|
||||
#genViz[data-lvl="1"] .g1 .node-o,#genViz[data-lvl="2"] .g2 .node-o,#genViz[data-lvl="3"] .g3 .node-o{stroke:#3b9dff;fill:#11362b}
|
||||
#genViz[data-lvl="1"] .g1 .node-d,#genViz[data-lvl="2"] .g2 .node-d,#genViz[data-lvl="3"] .g3 .node-d{fill:#3b9dff}
|
||||
#genViz .edge path{stroke:var(--line-strong);transition:stroke .5s ease}
|
||||
#genViz .node-o{fill:var(--panel-solid);stroke:var(--line-strong);stroke-width:1.3;transition:stroke .5s ease,fill .5s ease}
|
||||
#genViz .node-d{fill:var(--muted);transition:fill .5s ease}
|
||||
#genViz[data-lvl="1"] .e1 path,#genViz[data-lvl="2"] .e2 path,#genViz[data-lvl="3"] .e3 path{stroke:var(--mint)}
|
||||
#genViz[data-lvl="1"] .g1 .node-o,#genViz[data-lvl="2"] .g2 .node-o,#genViz[data-lvl="3"] .g3 .node-o{stroke:var(--mint);fill:var(--mint-soft-2)}
|
||||
#genViz[data-lvl="1"] .g1 .node-d,#genViz[data-lvl="2"] .g2 .node-d,#genViz[data-lvl="3"] .g3 .node-d{fill:var(--mint)}
|
||||
.chips button{cursor:pointer;background:transparent;font:inherit}
|
||||
.chips button.chip-t{border:1px solid var(--line-strong);color:var(--muted)}
|
||||
.chips button.chip-t.on{background:var(--mint);color:var(--mint-ink);border-color:var(--mint)}
|
||||
/* pricing tiles: mint discipline */
|
||||
.tiles{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));align-items:stretch}
|
||||
.tile{position:relative;background:linear-gradient(170deg,rgba(22,38,32,.55),rgba(10,18,15,.65));border:1px solid var(--line);
|
||||
.tile{position:relative;background:var(--panel-grad);border:1px solid var(--line);
|
||||
border-radius:var(--radius);padding:26px 18px;text-align:center;display:flex;flex-direction:column;gap:6px;
|
||||
transition:transform .2s ease,border-color .2s ease}
|
||||
.tile:hover{transform:translateY(-5px);border-color:var(--line-strong)}
|
||||
@@ -159,7 +159,7 @@ h3{font-size:16.5px;margin:0 0 8px;font-weight:700}
|
||||
.tile .cr{color:var(--mint);font-weight:700;font-size:14.5px}
|
||||
.tile .bonus{font-size:12px;color:var(--mint-hi)}
|
||||
.tile .pol{font-family:var(--mono);font-size:12px;color:var(--muted);flex:1}
|
||||
.tile.hot{border:1px solid rgba(59,157,255,.65);box-shadow:0 0 44px rgba(59,157,255,.14)}
|
||||
.tile.hot{border:1px solid var(--mint-line-2);box-shadow:0 0 44px rgba(59,157,255,.14)}
|
||||
.tile.hot::before{content:"MOST POPULAR";position:absolute;top:-11px;left:50%;transform:translateX(-50%);
|
||||
background:var(--mint);color:var(--mint-ink);font-family:var(--disp);font-size:10px;font-weight:800;
|
||||
letter-spacing:.12em;border-radius:999px;padding:4px 14px}
|
||||
@@ -167,14 +167,14 @@ h3{font-size:16.5px;margin:0 0 8px;font-weight:700}
|
||||
.split{display:flex;gap:8px;margin:18px 0}
|
||||
.split div{border-radius:12px;padding:16px 6px;text-align:center;font-size:13px;font-weight:700;font-family:var(--disp);
|
||||
border:1px solid var(--line-strong);color:var(--mint)}
|
||||
.split .s50{flex:5;background:rgba(59,157,255,.16);box-shadow:0 0 30px rgba(59,157,255,.12)}
|
||||
.split .s20{flex:2;background:rgba(59,157,255,.09)}
|
||||
.split .s10{flex:1;background:rgba(59,157,255,.05)}
|
||||
.split .sa{flex:2;background:rgba(139,166,156,.08);color:var(--muted)}
|
||||
.split .s50{flex:5;background:var(--mint-soft-2);box-shadow:0 0 30px rgba(59,157,255,.12)}
|
||||
.split .s20{flex:2;background:var(--mint-soft)}
|
||||
.split .s10{flex:1;background:var(--mint-faint)}
|
||||
.split .sa{flex:2;background:var(--muted-soft);color:var(--muted)}
|
||||
section[id]{scroll-margin-top:84px} /* anchored menu targets clear the sticky nav */
|
||||
/* ticker */
|
||||
.ticker{overflow:hidden;contain:layout paint;border-top:1px solid var(--line);border-bottom:1px solid var(--line);
|
||||
background:rgba(59,157,255,.04);white-space:nowrap;padding:10px 0;
|
||||
background:var(--mint-faint);white-space:nowrap;padding:10px 0;
|
||||
-webkit-mask-image:linear-gradient(90deg,transparent,#000 6%,#000 94%,transparent);
|
||||
mask-image:linear-gradient(90deg,transparent,#000 6%,#000 94%,transparent)}
|
||||
.ticker .inner{display:inline-block;font-family:var(--mono);font-size:12.5px;padding-left:100%;animation:tick 120s linear infinite}
|
||||
@@ -202,32 +202,32 @@ tr:last-child td{border-bottom:0}
|
||||
.feed .t-TierPaid{color:var(--mint)}
|
||||
.feed .t-AdminPaid{color:var(--muted)}
|
||||
.feed .tx a{color:var(--muted);font-size:12px}
|
||||
.badge{display:inline-block;background:var(--mint-soft);color:var(--mint);border:1px solid rgba(59,157,255,.35);
|
||||
.badge{display:inline-block;background:var(--mint-soft);color:var(--mint);border:1px solid var(--mint-line);
|
||||
border-radius:999px;padding:3px 13px;font-size:12px;font-weight:700}
|
||||
.spend-banner{background:linear-gradient(160deg,rgba(242,201,76,.14),rgba(242,201,76,.04));border-color:rgba(242,201,76,.55);text-align:center;padding:22px 20px}
|
||||
.spend-banner .lbl{font-family:var(--disp);font-size:13px;letter-spacing:.14em;text-transform:uppercase;color:#f2c94c}
|
||||
.spend-banner .big{font-family:var(--disp);font-size:clamp(40px,6vw,64px);font-weight:800;color:#f2c94c;line-height:1.05;margin:6px 0 4px;font-variant-numeric:tabular-nums}
|
||||
.spend-banner{background:linear-gradient(160deg,var(--gold-soft),var(--gold-faint));border-color:var(--gold-line);text-align:center;padding:22px 20px}
|
||||
.spend-banner .lbl{font-family:var(--disp);font-size:13px;letter-spacing:.14em;text-transform:uppercase;color:var(--gold-2)}
|
||||
.spend-banner .big{font-family:var(--disp);font-size:clamp(40px,6vw,64px);font-weight:800;color:var(--gold-2);line-height:1.05;margin:6px 0 4px;font-variant-numeric:tabular-nums}
|
||||
.spend-banner .big .unit{font-size:20px;font-weight:700;color:var(--ink)}
|
||||
.spend-banner .sub{color:var(--ink);font-size:15px}
|
||||
.spend-banner .rates{display:flex;gap:8px 18px;flex-wrap:wrap;justify-content:center;margin-top:12px;font-size:12.5px;color:var(--muted)}
|
||||
.spend-banner .rates b{color:var(--ink)}
|
||||
.boot-spin{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;min-height:60vh}
|
||||
.boot-spin .ring{width:46px;height:46px;border-radius:50%;border:4px solid rgba(59,157,255,.18);border-top-color:var(--mint);animation:bootspin .9s linear infinite}
|
||||
.boot-spin .ring{width:46px;height:46px;border-radius:50%;border:4px solid var(--mint-soft-2);border-top-color:var(--mint);animation:bootspin .9s linear infinite}
|
||||
@keyframes bootspin{to{transform:rotate(360deg)}}
|
||||
.bo-top{flex-wrap:wrap}
|
||||
.ad-strip{flex:1 1 100%;font-size:13.5px;padding:8px 0 2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.ad-strip a{color:var(--ink)}
|
||||
.ad-strip b{color:var(--mint)}
|
||||
.ad-foot{text-align:center}
|
||||
.pv{border:1px solid var(--line);border-radius:14px;padding:16px 18px;margin:0 0 16px;background:rgba(4,8,7,.35)}
|
||||
.pv{border:1px solid var(--line);border-radius:14px;padding:16px 18px;margin:0 0 16px;background:var(--ground-soft)}
|
||||
.pv-head b{display:block;font-size:18px;margin:4px 0 2px}
|
||||
.done-big{display:flex;flex-direction:column;align-items:center;gap:6px;padding:26px 16px;text-align:center}
|
||||
.done-big .tick{width:84px;height:84px;border-radius:50%;display:grid;place-items:center;font-size:48px;font-weight:800;color:var(--mint-ink);background:var(--mint);box-shadow:0 0 0 10px rgba(59,157,255,.15),0 10px 30px rgba(59,157,255,.35)}
|
||||
.done-big b{font-family:var(--disp);font-size:22px;margin-top:8px}
|
||||
.badge.amber{background:rgba(139,166,156,.1);border-color:rgba(139,166,156,.4);color:var(--muted)}
|
||||
.badge.amber{background:var(--muted-soft);border-color:var(--line-strong);color:var(--muted)}
|
||||
/* faq */
|
||||
details{border:1px solid var(--line);border-radius:14px;margin:0 0 10px;background:var(--panel)}
|
||||
details[open]{border-color:rgba(59,157,255,.45)}
|
||||
details[open]{border-color:var(--mint-line)}
|
||||
summary{cursor:pointer;padding:16px 20px;font-weight:700;font-family:var(--disp);font-size:15px;list-style:none}
|
||||
summary::before{content:"+";color:var(--mint);font-weight:800;margin-right:12px}
|
||||
details[open] summary::before{content:"−"}
|
||||
@@ -235,16 +235,16 @@ details p{margin:0;padding:0 20px 18px 42px;color:var(--muted);font-size:14.5px}
|
||||
/* closing cta card */
|
||||
.closer{position:relative;display:grid;gap:26px;align-items:center;grid-template-columns:1fr;
|
||||
padding:44px 36px;border-radius:24px;overflow:hidden;margin:80px 0 0;
|
||||
background:linear-gradient(160deg,#0d1d17,#060c0a);border:1px solid var(--line-strong)}
|
||||
background:var(--panel-grad-deep);border:1px solid var(--line-strong)}
|
||||
@media(min-width:880px){.closer{grid-template-columns:1.2fr .8fr}}
|
||||
.closer::before{content:"";position:absolute;width:460px;height:460px;right:-140px;top:-260px;border-radius:50%;
|
||||
background:radial-gradient(circle,rgba(59,157,255,.2),transparent 65%);pointer-events:none}
|
||||
background:radial-gradient(circle,var(--mint-soft-2),transparent 65%);pointer-events:none}
|
||||
.closer h2{margin:0 0 12px}
|
||||
/* footer + ghost wordmark */
|
||||
footer{border-top:1px solid var(--line);margin-top:90px;padding:34px 0 0;color:var(--muted);font-size:13.5px;overflow:hidden}
|
||||
.ghost{font-family:var(--disp);font-weight:800;font-size:clamp(64px,13vw,170px);line-height:.9;text-align:center;
|
||||
margin:34px 0 -20px;letter-spacing:-.02em;user-select:none;
|
||||
background:linear-gradient(180deg,rgba(59,157,255,.14),transparent 78%);
|
||||
background:linear-gradient(180deg,var(--mint-soft-2),transparent 78%);
|
||||
-webkit-background-clip:text;background-clip:text;color:transparent;white-space:nowrap}
|
||||
/* misc */
|
||||
#status{position:fixed;left:50%;transform:translateX(-50%);bottom:22px;background:var(--panel-solid);
|
||||
@@ -252,7 +252,7 @@ footer{border-top:1px solid var(--line);margin-top:90px;padding:34px 0 0;color:v
|
||||
box-shadow:0 12px 40px rgba(0,0,0,.55)}
|
||||
#status.ok{border-color:var(--mint)}
|
||||
#status.bad{border-color:var(--bad)}
|
||||
input,select,textarea{background:rgba(4,8,7,.65);border:1px solid var(--line-strong);color:var(--ink);border-radius:11px;
|
||||
input,select,textarea{background:var(--field-bg);border:1px solid var(--line-strong);color:var(--ink);border-radius:11px;
|
||||
padding:11px 14px;font-size:14.5px;font-family:inherit}
|
||||
input[type=range]{padding:0;border:0;background:transparent;accent-color:var(--mint);height:28px;vertical-align:middle}
|
||||
input:focus,select:focus,textarea:focus{border-color:var(--mint)}
|
||||
@@ -263,15 +263,15 @@ textarea{resize:vertical;font:inherit}
|
||||
.bo-body{background:var(--ground)}
|
||||
.bo{display:grid;grid-template-columns:236px 1fr;min-height:100vh}
|
||||
.bo-side{position:sticky;top:0;height:100vh;overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none;display:flex;flex-direction:column;gap:22px;
|
||||
padding:22px 16px;background:rgba(10,18,15,.92);border-right:1px solid var(--line)}
|
||||
padding:22px 16px;background:var(--side-bg);border-right:1px solid var(--line)}
|
||||
.bo-side .logo{font-size:19px;padding:0 8px}
|
||||
.bo-menu{display:flex;flex-direction:column;gap:4px}
|
||||
.bo-menu button{display:flex;align-items:center;gap:11px;background:transparent;border:0;color:var(--muted);
|
||||
font:600 14px var(--disp);padding:11px 12px;border-radius:11px;cursor:pointer;text-align:left;
|
||||
border-left:3px solid transparent}
|
||||
.bo-menu button svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}
|
||||
.bo-menu button:hover{color:var(--ink);background:rgba(59,157,255,.05)}
|
||||
.bo-menu button.on{color:var(--mint);background:rgba(59,157,255,.09);border-left-color:var(--mint)}
|
||||
.bo-menu button:hover{color:var(--ink);background:var(--mint-faint)}
|
||||
.bo-menu button.on{color:var(--mint);background:var(--mint-soft);border-left-color:var(--mint)}
|
||||
.bo-links{display:flex;flex-direction:column;gap:2px;padding:14px 12px;border-top:1px solid var(--line)}
|
||||
.bo-cap{font-family:var(--mono);font-size:10.5px;letter-spacing:.18em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
|
||||
.bo-links a{color:var(--muted);font-size:13.5px;padding:5px 0}
|
||||
@@ -283,7 +283,7 @@ textarea{resize:vertical;font:inherit}
|
||||
.bo-pagefoot a{color:var(--muted)}
|
||||
.bo-pagefoot a:hover{color:var(--ink);text-decoration:none}
|
||||
.bo-top{display:flex;align-items:center;gap:16px;padding:16px 26px;border-bottom:1px solid var(--line);
|
||||
background:rgba(6,10,8,.75);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);position:sticky;top:0;z-index:5}
|
||||
background:var(--nav-bg);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);position:sticky;top:0;z-index:5}
|
||||
.bo-top h2{font-size:20px}
|
||||
#boBurger{display:none;background:transparent;border:1px solid var(--line-strong);color:var(--ink);
|
||||
border-radius:9px;font-size:17px;padding:5px 11px;cursor:pointer}
|
||||
@@ -320,11 +320,11 @@ textarea{resize:vertical;font:inherit}
|
||||
.feat-day .fd-occ{font-family:var(--mono);font-size:11px;color:var(--muted)}
|
||||
.feat-day.open2 .fd-occ{color:var(--mint)}
|
||||
/* ── featured rotation strip ── */
|
||||
.feat-top{max-width:760px;margin:16px auto;border:1px solid rgba(255,177,56,.5)}
|
||||
.feat-top{max-width:760px;margin:16px auto;border:1px solid var(--amber-line)}
|
||||
.feat-strip{display:flex;justify-content:center;margin-top:10px}
|
||||
.feat-strip a{max-width:728px;width:100%;display:flex;justify-content:space-between;gap:10px;padding:11px 14px;border-radius:10px;
|
||||
background:var(--panel);border:1px solid #ffb238;color:var(--ink);text-decoration:none;font-weight:600}
|
||||
.feat-strip a:hover{border-color:#ffd15c;box-shadow:0 0 0 1px rgba(255,177,56,.4)}
|
||||
background:var(--panel);border:1px solid var(--amber);color:var(--ink);text-decoration:none;font-weight:600}
|
||||
.feat-strip a:hover{border-color:var(--gold);box-shadow:0 0 0 1px var(--amber-line)}
|
||||
.feat-strip .by{font-size:12px;color:var(--muted);font-weight:500;white-space:nowrap}
|
||||
.feat-strip .by{font-size:12px;color:var(--muted);font-weight:500;white-space:nowrap}
|
||||
/* ── achievement badges ── */
|
||||
@@ -333,22 +333,22 @@ textarea{resize:vertical;font:inherit}
|
||||
.badge-a .badge-img{width:150px;height:150px;border-radius:14px;object-fit:cover;border:1px solid var(--line-strong)}
|
||||
.badge-a.locked .badge-img{filter:grayscale(.85) brightness(.5);opacity:.7}
|
||||
.badge-a .medal{width:76px;height:76px;border-radius:50%;display:grid;place-items:center;position:relative;
|
||||
background:radial-gradient(circle at 50% 35%,rgba(59,157,255,.28),rgba(9,26,19,.9));
|
||||
background:radial-gradient(circle at 50% 35%,var(--mint-soft-2),var(--panel-solid));
|
||||
border:2px solid var(--mint);box-shadow:0 0 18px rgba(59,157,255,.3)}
|
||||
.badge-a.locked .medal{background:rgba(139,166,156,.08);border-color:var(--line-strong);box-shadow:none;filter:grayscale(1);opacity:.5}
|
||||
.badge-a.locked .medal{background:var(--muted-soft);border-color:var(--line-strong);box-shadow:none;filter:grayscale(1);opacity:.5}
|
||||
.badge-a .medal svg{width:38px;height:38px;stroke:var(--mint);fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
|
||||
.badge-a.locked .medal svg{stroke:var(--muted)}
|
||||
.badge-a .bl{font-size:12px;font-weight:700;line-height:1.2}
|
||||
.badge-a .bs{font-size:10.5px;color:var(--muted)}
|
||||
.badge-a .share{font-size:11px;color:var(--mint);cursor:pointer;background:none;border:0;padding:0;text-decoration:underline}
|
||||
/* ── "Your next move": milestone stepper card ── */
|
||||
.next-card{position:relative;overflow:hidden;border-color:rgba(59,157,255,.28)}
|
||||
.next-card{position:relative;overflow:hidden;border-color:var(--mint-line)}
|
||||
.next-card::before{content:"";position:absolute;inset:0;pointer-events:none;background:
|
||||
radial-gradient(420px 150px at 10% 0%,rgba(59,157,255,.12),transparent 70%),
|
||||
radial-gradient(360px 130px at 90% 100%,rgba(157,125,255,.09),transparent 70%)}
|
||||
radial-gradient(420px 150px at 10% 0%,var(--mint-soft),transparent 70%),
|
||||
radial-gradient(360px 130px at 90% 100%,var(--violet-soft),transparent 70%)}
|
||||
.nc-head{display:flex;gap:14px;align-items:flex-start;position:relative}
|
||||
.nc-head .pl{flex:0 0 auto;width:44px;height:44px;border-radius:12px;display:grid;place-items:center;
|
||||
background:rgba(59,157,255,.12);border:1px solid rgba(59,157,255,.35)}
|
||||
background:var(--mint-soft);border:1px solid var(--mint-line)}
|
||||
.nc-head .pl svg{width:20px;height:20px;stroke:var(--mint);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.nc-steps{display:flex;margin-top:20px;position:relative;flex-wrap:wrap;row-gap:14px}
|
||||
.nc-step{flex:1;min-width:88px;display:flex;flex-direction:column;align-items:center;gap:7px;
|
||||
@@ -369,31 +369,31 @@ textarea{resize:vertical;font:inherit}
|
||||
.statx{display:flex;gap:14px;align-items:flex-start;background:var(--panel);border:1px solid var(--line);
|
||||
border-radius:var(--radius);padding:18px;position:relative;overflow:hidden}
|
||||
.statx .pl{flex:0 0 auto;width:46px;height:46px;border-radius:13px;display:grid;place-items:center;
|
||||
background:rgba(59,157,255,.1);border:1px solid rgba(59,157,255,.3)}
|
||||
background:var(--mint-soft);border:1px solid var(--mint-line)}
|
||||
.statx .pl svg{width:22px;height:22px;stroke:var(--mint);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.statx.c-cyan .pl{background:rgba(84,204,255,.1);border-color:rgba(84,204,255,.3)}
|
||||
.statx.c-cyan .pl{background:var(--cyan-soft);border-color:var(--cyan-line)}
|
||||
.statx.c-cyan .pl svg{stroke:var(--cyan)}
|
||||
.statx.c-violet .pl{background:rgba(157,125,255,.12);border-color:rgba(157,125,255,.32)}
|
||||
.statx.c-violet .pl{background:var(--violet-soft);border-color:var(--violet-line)}
|
||||
.statx.c-violet .pl svg{stroke:var(--violet)}
|
||||
.statx.c-amber .pl{background:rgba(255,178,56,.1);border-color:rgba(255,178,56,.3)}
|
||||
.statx.c-amber .pl{background:var(--amber-soft);border-color:var(--amber-line)}
|
||||
.statx.c-amber .pl svg{stroke:var(--amber)}
|
||||
.statx .nv{font-family:var(--disp);font-size:26px;font-weight:800;font-variant-numeric:tabular-nums;line-height:1.1}
|
||||
.statx .lb{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;margin-top:2px}
|
||||
.chip{display:inline-block;margin-top:7px;font-size:11.5px;font-weight:700;border-radius:999px;padding:2px 10px;
|
||||
background:rgba(59,157,255,.1);color:var(--mint)}
|
||||
.chip.flat{background:rgba(139,166,156,.12);color:var(--muted)}
|
||||
.chip.warm{background:rgba(255,178,56,.12);color:var(--amber)}
|
||||
background:var(--mint-soft);color:var(--mint)}
|
||||
.chip.flat{background:var(--muted-soft);color:var(--muted)}
|
||||
.chip.warm{background:var(--amber-soft);color:var(--amber)}
|
||||
.card-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
|
||||
.card-head .sub{font-size:12px;color:var(--muted)}
|
||||
/* bar chart (divs, real data) */
|
||||
.barchart{display:flex;align-items:flex-end;gap:6px;height:120px;margin-top:14px}
|
||||
.barchart .bar{flex:1;min-width:6px;background:linear-gradient(180deg,var(--mint),rgba(59,157,255,.25));
|
||||
.barchart .bar{flex:1;min-width:6px;background:linear-gradient(180deg,var(--mint),var(--mint-soft-2));
|
||||
border-radius:5px 5px 2px 2px;position:relative;transition:height .5s ease}
|
||||
.barchart .bar.alt{background:linear-gradient(180deg,var(--violet),rgba(157,125,255,.25))}
|
||||
.barchart .bar.alt{background:linear-gradient(180deg,var(--violet),var(--violet-soft))}
|
||||
.barchart .bar:hover::after{content:attr(data-v);position:absolute;bottom:calc(100% + 4px);left:50%;
|
||||
transform:translateX(-50%);background:var(--panel-solid);border:1px solid var(--line-strong);border-radius:7px;
|
||||
padding:2px 8px;font-family:var(--mono);font-size:11px;white-space:nowrap;z-index:3}
|
||||
.barchart .bar.empty{background:rgba(139,166,156,.15);height:4px!important}
|
||||
.barchart .bar.empty{background:var(--muted-soft);height:4px!important}
|
||||
.chart-x{display:flex;gap:6px;margin-top:6px}
|
||||
.chart-x span{flex:1;text-align:center;font-family:var(--mono);font-size:10px;color:var(--muted);overflow:hidden;white-space:nowrap}
|
||||
/* donut + ring (SVG) */
|
||||
@@ -434,7 +434,7 @@ textarea{resize:vertical;font:inherit}
|
||||
.bio-socials a svg{flex:0 0 auto}
|
||||
.bio-socials a:hover{border-color:var(--mint)}
|
||||
.bio-qr{flex:0 0 auto;background:var(--panel);border:1px solid var(--line-strong);border-radius:14px;padding:10px}
|
||||
.bio-qr img{display:block;border-radius:8px;background:#eef7f3}
|
||||
.bio-qr img{display:block;border-radius:8px;background:#fff} /* a QR code stays on white in both themes so it scans */
|
||||
/* ── wall page ── */
|
||||
.wall-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:16px;text-align:center}
|
||||
.wall-card img{max-width:100%;border-radius:10px;border:1px solid var(--line-strong)}
|
||||
@@ -461,9 +461,9 @@ textarea{resize:vertical;font:inherit}
|
||||
.lin-row .dt{font-size:12px;color:var(--muted);text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
|
||||
.lin-row .chat-msg-btn{justify-self:end}
|
||||
.lin-row .lin-act-btn{justify-self:end;white-space:nowrap}
|
||||
.lin-act{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:8px 10px 10px;margin:-1px 0 6px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.025);border-radius:0 0 10px 10px}
|
||||
.lin-chip{font-size:12px;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:3px 10px;white-space:nowrap} .lin-chip b{font-weight:600;color:var(--ink);margin-right:5px} .lin-chip.on{border-color:rgba(59,157,255,.45);color:var(--ink)} .lin-chip.warn{border-color:rgba(255,209,92,.5)}
|
||||
.lin-verdict{margin-left:auto;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#ffd15c} .lin-verdict.on{color:var(--mint)}
|
||||
.lin-act{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:8px 10px 10px;margin:-1px 0 6px;border-bottom:1px solid var(--line);background:var(--ink-faint);border-radius:0 0 10px 10px}
|
||||
.lin-chip{font-size:12px;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:3px 10px;white-space:nowrap} .lin-chip b{font-weight:600;color:var(--ink);margin-right:5px} .lin-chip.on{border-color:var(--mint-line);color:var(--ink)} .lin-chip.warn{border-color:var(--gold-line)}
|
||||
.lin-verdict{margin-left:auto;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--gold)} .lin-verdict.on{color:var(--mint)}
|
||||
@media (max-width:560px){.lin-chip{white-space:normal}.lin-act{padding:8px 4px 10px}}
|
||||
@media (max-width:560px){.lin-row{grid-template-columns:1fr auto;gap:2px 10px}
|
||||
.lin-row .em{grid-column:1/2}.lin-row .dt{grid-column:1/2;text-align:left}.lin-row .chat-msg-btn{grid-row:1/3;grid-column:2}
|
||||
@@ -473,7 +473,7 @@ textarea{resize:vertical;font:inherit}
|
||||
.ed-bar button{background:var(--panel);color:var(--ink);border:1px solid var(--line-strong);border-radius:8px;
|
||||
padding:5px 11px;font-size:12.5px;cursor:pointer}
|
||||
.ed-bar button:hover,.ed-bar button:focus-visible{border-color:var(--mint);outline:none}
|
||||
.ed-body{background:rgba(4,8,7,.65);border:1px solid var(--line-strong);border-radius:11px;
|
||||
.ed-body{background:var(--field-bg);border:1px solid var(--line-strong);border-radius:11px;
|
||||
min-height:180px;padding:12px 14px;outline:none;overflow-wrap:anywhere}
|
||||
.ed-body:focus{border-color:var(--mint)}
|
||||
.ed-body:empty::before{content:attr(data-ph);color:var(--muted)}
|
||||
@@ -493,11 +493,11 @@ textarea.ed-body{width:100%;min-height:180px;resize:vertical}
|
||||
.subtab.on{color:var(--mint);border-bottom-color:var(--mint)}
|
||||
.subtab .pill{position:static}
|
||||
/* ── solo-ads inbox ── */
|
||||
.bo-menu .pill{margin-left:auto;background:var(--amber);color:#1a1206;font-size:11px;font-weight:800;
|
||||
.bo-menu .pill{margin-left:auto;background:var(--amber);color:var(--amber-ink);font-size:11px;font-weight:800;
|
||||
border-radius:999px;padding:1px 8px;line-height:1.5}
|
||||
.ib-row{display:flex;gap:10px;align-items:baseline;padding:11px 6px;border-bottom:1px solid var(--line);
|
||||
cursor:pointer;flex-wrap:wrap}
|
||||
.ib-row:hover{background:rgba(59,157,255,.05)}
|
||||
.ib-row:hover{background:var(--mint-faint)}
|
||||
.ib-row .sub{font-weight:700;flex:1;min-width:160px;overflow-wrap:anywhere}
|
||||
.ib-row.unread .sub{color:var(--mint)}
|
||||
.ib-row .from,.ib-row .when{font-size:12px;color:var(--muted);white-space:nowrap}
|
||||
@@ -518,9 +518,9 @@ textarea.ed-body{width:100%;min-height:180px;resize:vertical}
|
||||
#pane-earn .card h3::before,#pane-earnings .card h3::before{background:var(--violet)}
|
||||
#pane-promo .card h3::before{background:var(--cyan)}
|
||||
#pane-wallet .card h3::before,#pane-profile .card h3::before{background:var(--mint)}
|
||||
.bo .card{background:linear-gradient(165deg,rgba(24,36,31,.6),rgba(13,19,17,.66))}
|
||||
#pane-line .qualbar,#nextCard{border-left:3px solid rgba(59,157,255,.4)}
|
||||
.promo-block{background:rgba(4,8,7,.55);border:1px solid var(--line);border-radius:12px;
|
||||
.bo .card{background:var(--panel-grad)}
|
||||
#pane-line .qualbar,#nextCard{border-left:3px solid var(--mint-line)}
|
||||
.promo-block{background:var(--ground-soft);border:1px solid var(--line);border-radius:12px;
|
||||
padding:14px 16px;margin:0 0 12px;font-size:13.5px;line-height:1.6;white-space:pre-wrap}
|
||||
.promo-block .btn{margin-top:10px}
|
||||
/* back-office polish: pane transitions, quick actions */
|
||||
@@ -529,19 +529,19 @@ textarea.ed-body{width:100%;min-height:180px;resize:vertical}
|
||||
@keyframes panein{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
||||
}
|
||||
.qa{display:flex;flex-direction:column;gap:8px}
|
||||
.qa button{display:flex;align-items:center;gap:10px;background:rgba(59,157,255,.05);border:1px solid var(--line);
|
||||
.qa button{display:flex;align-items:center;gap:10px;background:var(--mint-faint);border:1px solid var(--line);
|
||||
color:var(--ink);font:600 14px var(--disp);padding:11px 14px;border-radius:11px;cursor:pointer;text-align:left;
|
||||
transition:border-color .15s ease,background .15s ease}
|
||||
.qa button:hover{border-color:var(--mint);background:rgba(59,157,255,.1)}
|
||||
.qa button:hover{border-color:var(--mint);background:var(--mint-soft)}
|
||||
/* member sub-navigation */
|
||||
.subnav{display:flex;gap:6px;flex-wrap:wrap;background:rgba(16,28,24,.7);border:1px solid var(--line);
|
||||
.subnav{display:flex;gap:6px;flex-wrap:wrap;background:var(--pill-bg);border:1px solid var(--line);
|
||||
border-radius:999px;padding:6px 8px;width:fit-content;margin:0 0 22px}
|
||||
.subnav button{background:transparent;border:0;color:var(--muted);font:600 13.5px var(--disp);
|
||||
padding:8px 16px;border-radius:999px;cursor:pointer}
|
||||
.subnav button:hover{color:var(--ink)}
|
||||
.subnav button.on{color:var(--mint-ink);background:var(--mint)}
|
||||
/* member dashboard: qualification progress + roster */
|
||||
.qualbar{position:relative;height:12px;border-radius:999px;background:rgba(4,8,7,.7);border:1px solid var(--line-strong);
|
||||
.qualbar{position:relative;height:12px;border-radius:999px;background:var(--ground-soft);border:1px solid var(--line-strong);
|
||||
margin:26px 0 30px;max-width:520px}
|
||||
.qualbar #qualFill{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--mint),var(--mint-hi));
|
||||
box-shadow:0 0 18px rgba(59,157,255,.4);width:0;transition:width .6s ease}
|
||||
@@ -567,8 +567,8 @@ img{max-width:100%}
|
||||
font-size:22px;cursor:pointer;line-height:1}
|
||||
.ch-msgs{padding:14px;overflow-y:auto;max-height:340px;display:flex;flex-direction:column;gap:10px}
|
||||
.ch-m{border-radius:12px;padding:9px 13px;font-size:13.5px;line-height:1.5;max-width:86%}
|
||||
.ch-m.bot{background:rgba(59,157,255,.08);border:1px solid rgba(59,157,255,.2);align-self:flex-start}
|
||||
.ch-m.me{background:rgba(130,148,196,.12);border:1px solid var(--line);align-self:flex-end}
|
||||
.ch-m.bot{background:var(--mint-faint);border:1px solid var(--mint-line);align-self:flex-start}
|
||||
.ch-m.me{background:var(--muted-soft);border:1px solid var(--line);align-self:flex-end}
|
||||
.ch-m a{word-break:break-all}
|
||||
.ch-input{display:flex;gap:8px;padding:11px;border-top:1px solid var(--line)}
|
||||
.ch-input input{flex:1;min-width:0}
|
||||
@@ -576,7 +576,7 @@ img{max-width:100%}
|
||||
font-weight:700;cursor:pointer;font-family:var(--disp)}
|
||||
@media(prefers-reduced-motion:no-preference){
|
||||
.feed .row:first-child{animation:landed .9s ease}
|
||||
@keyframes landed{from{background:rgba(59,157,255,.3)}to{background:var(--mint-soft)}}
|
||||
@keyframes landed{from{background:var(--mint-soft-2)}to{background:var(--mint-soft)}}
|
||||
}
|
||||
|
||||
/* ── Sponsor chat: FAB, slide-in drawer, threads, bubbles, presence ── */
|
||||
@@ -630,12 +630,12 @@ img{max-width:100%}
|
||||
.lt-nodes{display:flex;gap:8px;flex-wrap:wrap}
|
||||
.lt-node{background:var(--panel);border:1px solid var(--line-strong);border-radius:10px;padding:6px 12px;font-size:13px;font-weight:600;white-space:nowrap}
|
||||
.lt-node.deep{color:var(--muted)}
|
||||
.lt-node.qualified{border-color:#ffb238;color:#ffd15c;box-shadow:0 0 0 1px rgba(255,177,56,.35)}
|
||||
.lt-node.qualified{border-color:var(--amber);color:var(--gold);box-shadow:0 0 0 1px var(--amber-line)}
|
||||
.lt-node.open{border-style:dashed;color:var(--muted);background:transparent}
|
||||
.lt-node .lt-n{display:inline-block;font-style:normal;font-size:10px;line-height:16px;min-width:16px;text-align:center;border-radius:8px;background:rgba(255,177,56,.18);color:#ffd15c;margin-left:6px;padding:0 4px;font-variant-numeric:tabular-nums}
|
||||
.lt-node .lt-n{display:inline-block;font-style:normal;font-size:10px;line-height:16px;min-width:16px;text-align:center;border-radius:8px;background:var(--amber-soft);color:var(--gold);margin-left:6px;padding:0 4px;font-variant-numeric:tabular-nums}
|
||||
|
||||
.sh-report{display:block;text-align:center;margin-top:10px;color:rgba(255,255,255,.45);font-size:12px}
|
||||
.sh-report:hover{color:rgba(255,255,255,.8)}
|
||||
.sh-report{display:block;text-align:center;margin-top:10px;color:var(--muted);font-size:12px}
|
||||
.sh-report:hover{color:var(--ink)}
|
||||
|
||||
/* ── promo tools (2026-09-09) ── */
|
||||
.promo-strip{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;padding:16px 20px}
|
||||
@@ -666,7 +666,7 @@ img{max-width:100%}
|
||||
.promo-bv{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:16px;padding:14px 16px;border:1px dashed var(--line-strong);border-radius:12px}
|
||||
.promo-bv b{font-family:var(--disp)}
|
||||
.obj-wrap{display:flex;flex-direction:column;gap:8px}
|
||||
.obj{border:1px solid var(--line);border-radius:12px;background:rgba(4,8,7,.4)}
|
||||
.obj{border:1px solid var(--line);border-radius:12px;background:var(--ground-soft)}
|
||||
.obj summary{cursor:pointer;padding:12px 16px;font-family:var(--disp);font-weight:700;font-size:15px;list-style:none;display:flex;justify-content:space-between;gap:10px}
|
||||
.obj summary::after{content:"+";color:var(--mint);font-weight:800}
|
||||
.obj[open] summary::after{content:"–"}
|
||||
@@ -688,12 +688,12 @@ img{max-width:100%}
|
||||
.wo-slot img{max-width:100%;border-radius:8px}
|
||||
|
||||
/* getting-started stepper on the Overview (Jim could not find the wallet step, 2026-09-14) */
|
||||
.gs{border-color:rgba(59,157,255,.45)}
|
||||
.gs{border-color:var(--mint-line)}
|
||||
.gs-steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin:4px 0 12px}
|
||||
.gs-step{display:flex;gap:10px;align-items:center;border:1px solid var(--line);border-radius:12px;padding:10px 12px;color:var(--muted);font-size:14px}
|
||||
.gs-step .n{flex:0 0 26px;width:26px;height:26px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-weight:700;border:1px solid var(--line);font-size:13px}
|
||||
.gs-step.done{color:var(--ink)} .gs-step.done .n{background:var(--mint);color:var(--mint-ink);border-color:var(--mint)}
|
||||
.gs-step.now{color:var(--ink);border-color:var(--mint);background:rgba(59,157,255,.07)} .gs-step.now .n{border-color:var(--mint);color:var(--mint)}
|
||||
.gs-step.now{color:var(--ink);border-color:var(--mint);background:var(--mint-faint)} .gs-step.now .n{border-color:var(--mint);color:var(--mint)}
|
||||
.gs-now{display:flex;gap:14px;align-items:center;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:12px}
|
||||
.gs-now p{margin:0;flex:1;min-width:240px;max-width:60ch} .gs-now p b{display:block;font-family:var(--disp);font-size:16px;margin-bottom:2px}
|
||||
@keyframes gsPulse{0%{box-shadow:0 0 0 0 rgba(59,157,255,.7)}70%{box-shadow:0 0 0 14px rgba(59,157,255,0)}100%{box-shadow:0 0 0 0 rgba(59,157,255,0)}}
|
||||
@@ -702,16 +702,16 @@ img{max-width:100%}
|
||||
/* promo toolkit tiers */
|
||||
.tk-tiers{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px}
|
||||
.tk-tier{border:1px solid var(--line);border-radius:12px;padding:12px 14px;font-size:13.5px;color:var(--muted)}
|
||||
.tk-tier.reached{border-color:rgba(59,157,255,.5);color:var(--ink)} .tk-tier.current{background:rgba(59,157,255,.07)}
|
||||
.tk-tier.reached{border-color:var(--mint-line-2);color:var(--ink)} .tk-tier.current{background:var(--mint-faint)}
|
||||
.tk-tier b{display:block;font-family:var(--disp);font-size:15px;color:var(--ink)} .tk-tier .need{font-size:12px;margin:2px 0 8px;color:var(--muted)}
|
||||
.tk-tier ul{margin:0;padding-left:16px} .tk-tier li{margin:3px 0} .tk-tier li.soon{opacity:.65} .tk-tier li.soon::after{content:' (coming)';font-size:11px;color:var(--muted)}
|
||||
.tk-tier .lock{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#ffd15c}
|
||||
.tk-tier .lock{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--gold)}
|
||||
.tk-hist{border-top:1px solid var(--line);padding:8px 0;font-size:13px} .tk-hist .muted{font-size:12px}
|
||||
.tk-sec{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)} .tk-grid{display:flex;gap:8px;flex-wrap:wrap}
|
||||
.tk-vids{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px} .tk-vid{border:1px solid var(--line);border-radius:10px;padding:10px 12px;font-size:13px} .tk-vid b{display:block;font-weight:600;margin-bottom:4px} .tk-vid .st{font-size:12px;color:var(--muted)}
|
||||
.tk-bar{height:8px;border-radius:99px;background:rgba(255,255,255,.08);overflow:hidden;margin:6px 0 4px} .tk-bar i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,#1fb894,#3b9dff);transition:width .6s ease;min-width:4px}
|
||||
.tk-bar{height:8px;border-radius:99px;background:var(--ink-faint);overflow:hidden;margin:6px 0 4px} .tk-bar i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,var(--cyan),var(--mint));transition:width .6s ease;min-width:4px}
|
||||
.tk-table{width:100%;border-collapse:collapse;font-size:13px} .tk-table th,.tk-table td{text-align:left;padding:6px 8px;border-bottom:1px solid var(--line)} .tk-table th{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)} .tk-table td.n{font-variant-numeric:tabular-nums;text-align:right} .tk-table th.n{text-align:right} .tk-table tr.best td{color:var(--mint)}
|
||||
.tk-team{border:1px solid var(--line);border-radius:10px;padding:8px 12px;margin:6px 0;font-size:13px;display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:space-between} .tk-team .who b{font-weight:600} .tk-team .who span{color:var(--muted);font-size:12px} .tk-team.stalled{border-color:rgba(255,209,92,.45)}
|
||||
.tk-team{border:1px solid var(--line);border-radius:10px;padding:8px 12px;margin:6px 0;font-size:13px;display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:space-between} .tk-team .who b{font-weight:600} .tk-team .who span{color:var(--muted);font-size:12px} .tk-team.stalled{border-color:var(--gold-line)}
|
||||
.tk-nudge{width:100%;margin:8px 0 0;padding:8px 12px;border:1px dashed var(--line);border-radius:10px;font-size:13px}
|
||||
/* click sources stack one per line so the Clicks column stays narrow (Marty, 2026-09-15) */
|
||||
.clk-src span{display:block;white-space:nowrap} .camp-table td{white-space:normal} .camp-table td:first-child{max-width:260px}
|
||||
@@ -733,13 +733,13 @@ img{max-width:100%}
|
||||
|
||||
/* Pipeline board (Marty, 2026-09-15): columns scroll sideways inside their own box, never the page */
|
||||
.pipe-board{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 10px;scroll-snap-type:x proximity}
|
||||
.pipe-col{flex:0 0 220px;scroll-snap-align:start;background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:12px;padding:10px;min-height:120px}
|
||||
.pipe-col{flex:0 0 220px;scroll-snap-align:start;background:var(--ground-soft);border:1px solid var(--line);border-radius:12px;padding:10px;min-height:120px}
|
||||
.pipe-col h4{margin:0 0 2px;font-size:13px;letter-spacing:.06em;text-transform:uppercase;color:var(--mint);display:flex;justify-content:space-between;gap:8px}
|
||||
.pipe-col h4 span{color:var(--muted);font-variant-numeric:tabular-nums}
|
||||
.pipe-col .hint{font-size:11.5px;color:var(--muted);margin:0 0 8px;line-height:1.35}
|
||||
.pipe-card{background:rgba(255,255,255,.04);border:1px solid var(--line);border-radius:10px;padding:8px 10px;margin:0 0 8px;cursor:pointer;transition:border-color .15s}
|
||||
.pipe-card{background:var(--ink-faint);border:1px solid var(--line);border-radius:10px;padding:8px 10px;margin:0 0 8px;cursor:pointer;transition:border-color .15s}
|
||||
.pipe-card:hover,.pipe-card:focus-visible{border-color:var(--mint);outline:none}
|
||||
.pipe-card.on{border-color:var(--gold,#e6c15a)}
|
||||
.pipe-card.on{border-color:var(--gold)}
|
||||
.pipe-card .nm{font-weight:700;font-size:14px;display:flex;justify-content:space-between;gap:6px;align-items:baseline}
|
||||
.pipe-card .nm small{font-weight:400;font-size:11px;color:var(--muted);white-space:nowrap}
|
||||
.pipe-card .sub{font-size:12px;color:var(--muted);margin-top:3px;line-height:1.35}
|
||||
@@ -761,27 +761,60 @@ img{max-width:100%}
|
||||
--cyan:#6fd3ff; --violet:#a48cff; --amber:#ffcf5a; --bad:#ff8f8f;
|
||||
--chrome:linear-gradient(180deg,#f4f9ff 0%,#bcd6f7 38%,#7fa9dc 52%,#dbe9fb 68%,#9cc0ec 100%);
|
||||
--disp:"Rajdhani","Segoe UI",system-ui,sans-serif;
|
||||
/* 2026-11-01 theme tokens: every surface, text, border and soft fill that used to be a literal (tools.css maps
|
||||
them onto Control Room tokens inside /tools and /admin). Light values live in :root[data-theme="light"] below. */
|
||||
--mint-deep:#1f7be0; --mint-pale:#bcd6f7;
|
||||
--mint-faint:rgba(59,157,255,.06); --mint-soft-2:rgba(59,157,255,.16); --mint-line:rgba(59,157,255,.38); --mint-line-2:rgba(59,157,255,.6);
|
||||
--gold:#ffd15c; --gold-2:#f2c94c; --gold-soft:rgba(242,201,76,.14); --gold-faint:rgba(242,201,76,.04); --gold-line:rgba(242,201,76,.5);
|
||||
--amber-soft:rgba(255,207,90,.12); --amber-line:rgba(255,207,90,.4); --amber-ink:#1a1206;
|
||||
--cyan-soft:rgba(111,211,255,.1); --cyan-line:rgba(111,211,255,.3); --violet-soft:rgba(164,140,255,.12); --violet-line:rgba(164,140,255,.32);
|
||||
--muted-soft:rgba(143,166,200,.12); --ink-faint:rgba(255,255,255,.04);
|
||||
--ground-soft:rgba(2,10,36,.5); --field-bg:rgba(2,10,36,.65); --nav-bg:rgba(2,10,36,.78); --side-bg:rgba(4,16,48,.92); --pill-bg:rgba(10,26,60,.7);
|
||||
--panel-grad:linear-gradient(165deg,rgba(14,34,74,.6),rgba(6,18,46,.66)); --panel-grad-deep:linear-gradient(170deg,#0a1c44,#040d2a);
|
||||
--glow:#0a2a6b; --sh-lg:0 0 0 1px rgba(59,157,255,.06),0 18px 50px rgba(1,6,24,.55);
|
||||
color-scheme:dark;
|
||||
}
|
||||
body{background:radial-gradient(1200px 600px at 50% -10%,#0a2a6b 0%,rgba(10,42,107,0) 60%),var(--ground);font-family:"Manrope","Segoe UI",system-ui,sans-serif}
|
||||
body{background:radial-gradient(1200px 600px at 50% -10%,var(--glow) 0%,transparent 60%),var(--ground);font-family:"Manrope","Segoe UI",system-ui,sans-serif}
|
||||
body::before{opacity:1;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='none' stroke='%233b9dff' stroke-opacity='.10' stroke-width='1.2'%3E%3Cpath d='M0 60h120l30 30h90v60l40 40h140'/%3E%3Cpath d='M60 420V300l40-40h80V180l40-40h200'/%3E%3Cpath d='M420 340H300l-30-30h-90V220'/%3E%3Cpath d='M0 200h60l20 20v80'/%3E%3C/g%3E%3Cg fill='%233b9dff' fill-opacity='.22'%3E%3Ccircle cx='120' cy='60' r='2.4'/%3E%3Ccircle cx='240' cy='150' r='2.4'/%3E%3Ccircle cx='420' cy='190' r='2.4'/%3E%3Ccircle cx='60' cy='300' r='2.4'/%3E%3Ccircle cx='300' cy='340' r='2.4'/%3E%3Ccircle cx='180' cy='180' r='2.4'/%3E%3Ccircle cx='80' cy='300' r='2.4'/%3E%3C/g%3E%3C/svg%3E")}
|
||||
h1,h2,h3{font-family:var(--disp);letter-spacing:.005em;font-weight:700}
|
||||
.hero h1{font-size:clamp(40px,6vw,70px);text-transform:uppercase;letter-spacing:.02em;line-height:1.02}
|
||||
.hero h1 em{background:var(--chrome);-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:none}
|
||||
.btn{background:linear-gradient(180deg,#8cc8ff 0%,#3b9dff 55%,#1f7be0 100%);color:#03122e;border:1px solid rgba(220,236,255,.55);box-shadow:0 6px 28px rgba(59,157,255,.35),inset 0 1px 0 rgba(255,255,255,.55);text-transform:uppercase;letter-spacing:.06em;font-size:14px}
|
||||
.btn:hover{background:linear-gradient(180deg,#a6d6ff 0%,#4ea9ff 55%,#2a86ea 100%);box-shadow:0 10px 40px rgba(59,157,255,.5),inset 0 1px 0 rgba(255,255,255,.6)}
|
||||
.btn.sec{background:rgba(59,157,255,.06);color:#bcd6f7;border:1px solid rgba(140,200,255,.45);box-shadow:none;text-transform:none;letter-spacing:0}
|
||||
.btn.sec:hover{background:rgba(59,157,255,.14)}
|
||||
.card,.promo-block,.stat{border-color:var(--line);box-shadow:0 0 0 1px rgba(59,157,255,.06),0 18px 50px rgba(1,6,24,.55)}
|
||||
.btn{background:linear-gradient(180deg,var(--mint-hi) 0%,var(--mint) 55%,var(--mint-deep) 100%);color:var(--mint-ink);border:1px solid var(--mint-line-2);box-shadow:0 6px 28px rgba(59,157,255,.35),inset 0 1px 0 rgba(255,255,255,.55);text-transform:uppercase;letter-spacing:.06em;font-size:14px}
|
||||
.btn:hover{background:linear-gradient(180deg,var(--mint-hi) 0%,var(--mint) 40%,var(--mint-deep) 100%);filter:brightness(1.07);box-shadow:0 10px 40px rgba(59,157,255,.5),inset 0 1px 0 rgba(255,255,255,.6)}
|
||||
.btn.sec{background:var(--mint-faint);color:var(--mint-pale);border:1px solid var(--mint-line);box-shadow:none;text-transform:none;letter-spacing:0}
|
||||
.btn.sec:hover{background:var(--mint-soft-2);filter:none}
|
||||
.card,.promo-block,.stat{border-color:var(--line);box-shadow:var(--sh-lg)}
|
||||
.card h3,.card-head h3{font-family:var(--disp);font-size:20px;letter-spacing:.02em;text-transform:uppercase}
|
||||
.stat .n{background:var(--chrome);-webkit-background-clip:text;background-clip:text;color:transparent;font-family:var(--disp);font-size:34px}
|
||||
nav{background:rgba(2,10,36,.78);border-bottom:1px solid rgba(88,150,255,.2)}
|
||||
nav .links a.active{color:#eaf2ff;background:rgba(59,157,255,.16);box-shadow:inset 0 0 0 1px rgba(140,200,255,.35)}
|
||||
.wordmark{font-family:var(--disp);font-weight:700;font-size:24px;letter-spacing:.06em;text-transform:uppercase;color:#eaf2ff;display:inline-flex;align-items:center;gap:8px;line-height:1}
|
||||
nav{background:var(--nav-bg);border-bottom:1px solid var(--line)}
|
||||
nav .links a.active{color:var(--ink);background:var(--mint-soft-2);box-shadow:inset 0 0 0 1px var(--mint-line)}
|
||||
.wordmark{font-family:var(--disp);font-weight:700;font-size:24px;letter-spacing:.06em;text-transform:uppercase;color:var(--ink);display:inline-flex;align-items:center;gap:8px;line-height:1}
|
||||
.wordmark b{background:var(--chrome);-webkit-background-clip:text;background-clip:text;color:transparent;font-weight:700}
|
||||
.wordmark svg{width:26px;height:26px;flex:none}
|
||||
.rehearsal{background:rgba(255,207,90,.08);border-bottom:1px solid rgba(255,207,90,.25);color:#cbb677}
|
||||
.rehearsal b{color:#ffcf5a}
|
||||
.rehearsal{background:var(--amber-soft);border-bottom:1px solid var(--amber-line);color:var(--amber)}
|
||||
.rehearsal b{color:var(--amber)}
|
||||
.bo-side,.bo-menu button.on{border-color:var(--line)}
|
||||
.bo-menu button.on{background:rgba(59,157,255,.14);color:#eaf2ff}
|
||||
.chip-t.on{background:linear-gradient(180deg,#8cc8ff,#3b9dff);color:#03122e;border-color:transparent}
|
||||
.pill{background:linear-gradient(180deg,#8cc8ff,#3b9dff);color:#03122e}
|
||||
.bo-menu button.on{background:var(--mint-soft-2);color:var(--ink)}
|
||||
.chip-t.on{background:linear-gradient(180deg,var(--mint-hi),var(--mint));color:var(--mint-ink);border-color:transparent}
|
||||
.pill{background:linear-gradient(180deg,var(--mint-hi),var(--mint));color:var(--mint-ink)}
|
||||
/* ── Light theme for the sapphire pages (2026-11-01): light ground, white panels, dark ink, the same blue family
|
||||
darkened so it reads as text on white; the chrome headline gradient turns blue steel so it still shows. ── */
|
||||
:root[data-theme="light"]{
|
||||
--ground:#E9EEF5; --ground2:#F3F6FB; --panel:#FFFFFF; --panel-solid:#FFFFFF;
|
||||
--line:#CDD7E5; --line-strong:#AEBED4; --ink:#0F1B2E; --muted:#596984;
|
||||
--mint:#175FD8; --mint-hi:#0B4BB3; --mint-deep:#0A3F96; --mint-ink:#FFFFFF; --mint-pale:#0B4BB3;
|
||||
--mint-faint:#EEF4FE; --mint-soft:#E1ECFC; --mint-soft-2:#CFE0FB; --mint-line:#A9C6F2; --mint-line-2:#5F93E6;
|
||||
--cyan:#0A6F8C; --violet:#5B3FD6; --amber:#8F5400; --bad:#B91C1C;
|
||||
--gold:#7A5200; --gold-2:#8A6400; --gold-soft:#FFF4D1; --gold-faint:#FFFBEB; --gold-line:#E6C25E;
|
||||
--amber-soft:#FFF1D6; --amber-line:#E8C27A; --amber-ink:#FFFFFF;
|
||||
--cyan-soft:#DDF1F8; --cyan-line:#9FD3E6; --violet-soft:#EEE9FF; --violet-line:#C4B5FF;
|
||||
--muted-soft:rgba(94,110,136,.12); --ink-faint:rgba(15,27,46,.05);
|
||||
--ground-soft:#F3F6FB; --field-bg:#FFFFFF; --nav-bg:rgba(243,246,251,.88); --side-bg:rgba(243,246,251,.97); --pill-bg:rgba(255,255,255,.85);
|
||||
--panel-grad:linear-gradient(180deg,#FFFFFF,#F6F8FC); --panel-grad-deep:linear-gradient(180deg,#F3F6FB,#E3EAF4);
|
||||
--glow:#E3EDFB; --sh-lg:0 0 0 1px rgba(15,27,46,.03),0 14px 34px -20px rgba(15,27,46,.35);
|
||||
--chrome:linear-gradient(180deg,#0B4BB3 0%,#1F6FEB 40%,#5A97F0 52%,#1F6FEB 66%,#0B4BB3 100%);
|
||||
color-scheme:light;
|
||||
}
|
||||
:root[data-theme="light"] body::before{opacity:.6}
|
||||
:root[data-theme="light"] .ghost{background:linear-gradient(180deg,rgba(23,95,216,.22),transparent 78%);-webkit-background-clip:text;background-clip:text}
|
||||
:root[data-theme="light"] .mockup,:root[data-theme="light"] .modal-card,:root[data-theme="light"] #status,:root[data-theme="light"] #iapChatPanel,:root[data-theme="light"] .chat-drawer{box-shadow:0 18px 50px -20px rgba(15,27,46,.35)}
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt, api = CR.api, toast = CR.toast, dialog = CR.dialog;
|
||||
let S = [], CAT = [], ROT = [], SEL = null, DET = null, FILTER = '', KEYS = [], EVENTS = ['join', 'lead', 'wallet', 'purchase', 'external'], LIMITS = {}, URL_ROT = null, PE = [];
|
||||
CR.mount({ active: 'sources', title: 'Traffic sources', sub: 'loading', actions: '<button class="btn pri" type="button" id="newBtn">+ New source</button>' });
|
||||
CR.mount({ active: 'sources', title: 'Traffic sources', sub: 'loading', actions: '<a class="btn sm" href="/traffic-guide" title="Which traffic works for which kind of offer">Traffic guide</a> <button class="btn pri" type="button" id="newBtn">+ New source</button>' });
|
||||
// traffic guide (2026-10-28): formats each network sells, adult-heavy / strict-policy flags, what it suits best
|
||||
const TG = window.TRAFFIC_GUIDE || null;
|
||||
const gTags = key => { const n = TG && TG.NETWORKS[key]; if (!n) return ''; return n.f.map(f => '<span class="tag plain">' + esc(TG.fmtName(f)) + '</span>').join('') + (n.adult === 'adult' ? '<span class="tag warn">adult sites</span>' : n.adult === 'mixed' ? '<span class="tag dim" title="Big adult inventory; target its mainstream sites">adult-heavy</span>' : '') + (n.strict ? '<span class="tag warn" title="Strict ad policy: crypto, income claims and MLM are restricted or need approval">strict policy</span>' : ''); };
|
||||
const gText = key => { const n = TG && TG.NETWORKS[key]; return n ? n.f.map(f => (TG.FORMATS[f] || {}).name || f).join(' ') : ''; };
|
||||
const ago = ts => { if (!ts) return 'never'; const s = Math.max(0, Math.round((Date.now() - ts) / 1000)); return s < 60 ? 'just now' : s < 3600 ? Math.round(s / 60) + ' min ago' : s < 86400 ? Math.round(s / 3600) + ' h ago' : Math.round(s / 86400) + ' d ago'; };
|
||||
const netOf = s => CAT.find(c => c.key === s.template) || null;
|
||||
const netName = s => { const n = netOf(s); return n ? n.name : (s.template === 'custom' ? 'Custom' : s.template); };
|
||||
const EV_LABEL = { join: 'Join', lead: 'Lead', wallet: 'Wallet', purchase: 'Purchase', external: 'Partner-reported' };
|
||||
const EV_LABEL = { join: 'Join', lead: 'Lead', wallet: 'Wallet', purchase: 'Purchase', external: 'Partner-reported', goal: 'Any goal (pixel)' };
|
||||
|
||||
async function load(keep) {
|
||||
let r; try { r = await CR.get('/api/my/sources'); } catch (e) { CR.sub('could not load'); return; }
|
||||
@@ -43,6 +47,9 @@
|
||||
$('dOn').innerHTML = s.enabled ? '<span class="ok"><span class="dot"></span>ON</span>' : '<span class="warn"><span class="dot"></span>OFF' + (s.fails >= 10 ? ' (postback failed 10 times)' : '') + '</span>';
|
||||
$('togBtn').textContent = s.enabled ? 'Disable' : 'Enable';
|
||||
$('tiles').innerHTML = [CR.tile({ k: 'Clicks, 30 d', v: fmt(s.hits30 || 0), hi: true }), CR.tile({ k: 'Unique, 30 d', v: fmt(s.unique30 || 0) }), CR.tile({ k: 'Conversions, 30 d', v: fmt(s.conv30 || 0) }), CR.tile({ k: 'Postbacks sent', v: fmt(s.sent || 0), note: s.lastAt ? 'last ' + ago(s.lastAt) + ' · ' + s.lastStatus : 'none yet' }), CR.tile({ k: 'Links using it', v: fmt(s.links || 0) })].join('');
|
||||
const gb = TG && TG.NETWORKS[s.template], bf = gb ? TG.bestFor(s.template) : [];
|
||||
$('dGuide').hidden = !gb;
|
||||
if (gb) $('dGuide').innerHTML = (gb.f.length ? '<span>Sells</span>' + gTags(s.template) : gTags(s.template)) + (bf.length ? '<span>· Best for: <b>' + esc(bf.join(', ')) + '</b></span>' : (gb.note ? '<span>' + esc(gb.note) + '</span>' : '')) + '<span class="grow"></span><a href="/traffic-guide">Which traffic for which offer →</a>';
|
||||
renderUrl(s); renderPb(s, null); renderSettings(s);
|
||||
if (!quiet) window.scrollTo({ top: 0 });
|
||||
try { DET = await CR.get('/api/my/sources/' + id); } catch (e) { DET = null; }
|
||||
@@ -102,14 +109,14 @@
|
||||
async function newSource() {
|
||||
if (!CAT.length) { try { CAT = (await CR.get('/api/sources/catalog')).catalog || []; } catch (e) {} }
|
||||
let chosen = null;
|
||||
const row = c => '<div class="cat" data-key="' + esc(c.key) + '" role="button" tabindex="0"><div><b>' + esc(c.name) + '</b><span class="site">' + esc(c.site || '') + (c.costModel ? ' · ' + esc(c.costModel) : '') + '</span></div><div class="tags">' + (c.hasClickId ? '' : '<span class="tag warn" title="This network has no click id macro and no postback. The source still tags your campaign URL and shows in Reports.">no click id</span>') + (c.hasPostback ? '<span class="tag ok">postback</span>' : (c.hasClickId ? '<span class="tag dim">no postback</span>' : '')) + (c.verified ? '' : '<span class="tag dim" title="Macros copied from public docs, not yet checked against a live account">unverified</span>') + '</div></div>';
|
||||
const p1 = dialog({ title: 'New source', text: 'Pick the network you buy traffic on. Its macros and postback come prefilled; you can change anything later under Settings.',
|
||||
const row = c => '<div class="cat" data-key="' + esc(c.key) + '" role="button" tabindex="0"><div><b>' + esc(c.name) + '</b><span class="site">' + esc(c.site || '') + (c.costModel ? ' · ' + esc(c.costModel) : '') + '</span>' + (gTags(c.key) ? '<div class="fm">' + gTags(c.key) + '</div>' : '') + '</div><div class="tags">' + (c.hasClickId ? '' : '<span class="tag warn" title="This network has no click id macro and no postback. The source still tags your campaign URL and shows in Reports.">no click id</span>') + (c.hasPostback ? '<span class="tag ok">postback</span>' : (c.hasClickId ? '<span class="tag dim">no postback</span>' : '')) + (c.verified ? '' : '<span class="tag dim" title="Macros copied from public docs, not yet checked against a live account">unverified</span>') + '</div></div>';
|
||||
const p1 = dialog({ title: 'New source', text: 'Pick the network you buy traffic on. Its macros and postback come prefilled; you can change anything later under Settings. Search by name or by format (pop, push, native...). Not sure which fits your offer? See the Traffic guide.',
|
||||
html: '<input class="field catf" id="catFilter" type="search" placeholder="Search ' + CAT.length + ' networks by name or site" aria-label="Search networks"><div class="catlist" id="catList">' + CAT.map(row).join('') + '</div>', ok: 'Custom (define your own)', no: 'Cancel' });
|
||||
const host = $('crModalHost');
|
||||
const wire = () => host.querySelectorAll('.cat').forEach(el => { const go = () => { chosen = el.dataset.key; host.querySelector('#dlgOk').click(); }; el.addEventListener('click', go); el.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); go(); } }); });
|
||||
wire();
|
||||
const flt = host.querySelector('#catFilter'); flt.focus();
|
||||
flt.addEventListener('input', () => { const q = flt.value.trim().toLowerCase(); const list = CAT.filter(c => !q || c.name.toLowerCase().includes(q) || (c.site || '').toLowerCase().includes(q) || c.key.includes(q)); host.querySelector('#catList').innerHTML = list.length ? list.map(row).join('') : '<div class="cat"><span class="muted">No network by that name. Use Custom and paste its macros yourself.</span></div>'; wire(); });
|
||||
flt.addEventListener('input', () => { const q = flt.value.trim().toLowerCase(); const list = CAT.filter(c => !q || c.name.toLowerCase().includes(q) || (c.site || '').toLowerCase().includes(q) || c.key.includes(q) || gText(c.key).toLowerCase().includes(q)); host.querySelector('#catList').innerHTML = list.length ? list.map(row).join('') : '<div class="cat"><span class="muted">No network by that name. Use Custom and paste its macros yourself.</span></div>'; wire(); });
|
||||
flt.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); const first = host.querySelector('.cat[data-key]'); if (first) first.click(); } });
|
||||
const ok = await p1; if (!ok) return;
|
||||
const tpl = chosen ? CAT.find(c => c.key === chosen) : null;
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
const dayStart = () => { const d = new Date(); d.setHours(0, 0, 0, 0); return d.getTime(); };
|
||||
const ago = t => { if (!t) return 'never'; const d = Date.now() - t; if (d < 3600e3) return Math.max(1, Math.round(d / 60e3)) + ' min ago'; if (d < 86400e3) return Math.round(d / 3600e3) + ' h ago'; const days = Math.floor(d / 86400e3); return days === 1 ? 'yesterday' : days + ' d ago'; };
|
||||
const pol = wei => { try { return (Number(BigInt(wei || '0') / 10000000000000000n) / 100).toFixed(2); } catch (e) { return '0.00'; } };
|
||||
// same stage names and colours as the Pipeline board; quiet = not seen in 3+ days and not yet building
|
||||
const STAGE = { joined: 'Joined', wallet: 'Wallet linked', payouts: 'Payouts on', bought: 'Bought', building: 'Building' };
|
||||
const stageOf = m => m.buyers ? 'building' : m.bought ? 'bought' : m.activated ? 'payouts' : m.wallet ? 'wallet' : 'joined';
|
||||
const quiet = m => stageOf(m) !== 'building' && (!m.lastSeen || Date.now() - m.lastSeen > 3 * 86400e3);
|
||||
function rows() {
|
||||
const L = (LINE && LINE.levels || []).find(x => x.level === LEVEL); let ms = L ? L.members.slice() : [];
|
||||
const f = { today: m => (m.lastSeen || 0) >= dayStart(), wallet: m => !!m.wallet, nopay: m => !!m.wallet && !m.activated, nowallet: m => !m.wallet };
|
||||
const f = { today: m => (m.lastSeen || 0) >= dayStart(), wallet: m => !!m.wallet, nopay: m => !!m.wallet && !m.activated, nowallet: m => !m.wallet, quiet: m => quiet(m) };
|
||||
for (const k of FILTERS) ms = ms.filter(f[k]);
|
||||
ms.sort((a, b) => (b.lastSeen || 0) - (a.lastSeen || 0));
|
||||
return ms;
|
||||
@@ -16,9 +20,10 @@
|
||||
function render() {
|
||||
const ms = rows(); const L = (LINE && LINE.levels || []).find(x => x.level === LEVEL); const total = L ? L.members.length : 0;
|
||||
$('rows').innerHTML = ms.length ? ms.map(m => { const today = (m.lastSeen || 0) >= dayStart();
|
||||
return '<div class="rw"><div><b>' + esc(m.name) + (m.own ? ' <span class="tag dim">YOURS</span>' : '') + '</b><br><span class="mono muted" style="font-size:11px">' + (m.memberId ? '#' + m.memberId + ' · ' : '') + 'joined ' + new Date(m.joined).toLocaleDateString() + (m.bought ? ' · $20+ buy' : '') + (m.buyers ? ' · ' + m.buyers + ' qualifying' : '') + '</span></div>'
|
||||
const sg = stageOf(m), q = quiet(m);
|
||||
return '<div class="rw st-row' + (q ? ' stalled' : '') + '" data-st="' + sg + '"><div><b>' + esc(m.name) + (m.own ? ' <span class="tag dim">YOURS</span>' : '') + '</b><br><span class="mono muted" style="font-size:11px">' + (m.memberId ? '#' + m.memberId + ' · ' : '') + 'joined ' + new Date(m.joined).toLocaleDateString() + (m.bought ? ' · $25+ buy' : '') + (m.buyers ? ' · ' + m.buyers + ' qualifying' : '') + '</span></div>'
|
||||
+ '<span class="mono ' + (today ? 'ok' : (m.lastSeen && Date.now() - m.lastSeen > 3 * 86400e3 ? 'warn' : '')) + '" style="font-size:12px">' + (today ? 'today' : ago(m.lastSeen)) + '</span>'
|
||||
+ '<span class="mono" style="font-size:11px">' + (m.activated ? '<span class="ok">payouts on</span>' : m.wallet ? '<span class="warn">wallet, payouts off</span>' : '<span class="muted">no wallet</span>') + '</span>'
|
||||
+ '<span><span class="stg" data-st="' + sg + '">' + STAGE[sg] + '</span>' + (q ? '<br><span class="stg quiet">' + (m.lastSeen ? 'quiet ' + Math.floor((Date.now() - m.lastSeen) / 86400e3) + 'd' : 'never signed in') + '</span>' : '') + '</span>'
|
||||
+ '<span class="r num">' + (m.earnedWei && m.earnedWei !== '0' ? '+' + pol(m.earnedWei) + ' POL' : '<span class="muted">0</span>') + '</span>'
|
||||
+ '<span class="muted" style="font-size:12px">' + (m.sponsor ? 'via ' + esc(m.sponsor) : (m.email ? esc(m.email) : '')) + '</span></div>'; }).join('')
|
||||
: '<div class="rw"><span class="muted">' + (total ? 'Nobody matches those filters.' : 'Nobody on this level yet. Share your link, or put it in a spin.') + '</span></div>';
|
||||
|
||||
+54
-12
@@ -1,7 +1,12 @@
|
||||
/* /tools: the legacy member panes inside the Control Room. site.css sits in the "legacy" layer under cr.css, so the
|
||||
shared classes (.btn .chip .chips .muted .mono .tile) already take the Control Room look; this file restyles the
|
||||
pane internals that only site.css knows about, to the INSTRUMENT light scheme. */
|
||||
:root{--mint:var(--accent-hi);--mint-ink:#fff;--mint-hi:var(--accent);--mint-soft:var(--accent-soft);--cyan:var(--ok);--violet:#6D4AFF;--amber:var(--warn);--gold:var(--sig);--disp:var(--display);--radius:8px;--ground:var(--bg);--ground2:var(--panel-2);--panel-solid:var(--panel);--ink:#0F1B2E}
|
||||
/* every site.css token maps onto a Control Room token here, so both themes flow through (2026-11-01) */
|
||||
:root{--mint:var(--accent-hi);--mint-ink:var(--accent-ink);--mint-hi:var(--accent);--mint-deep:var(--accent-hi);--mint-pale:var(--accent-hi);--mint-soft:var(--accent-soft);--mint-faint:var(--accent-soft);--mint-soft-2:var(--accent-soft);--mint-line:var(--accent-dim);--mint-line-2:var(--accent);
|
||||
--cyan:var(--ok);--cyan-soft:var(--ok-soft);--cyan-line:var(--ok-line);--amber:var(--warn);--amber-soft:var(--warn-soft);--amber-line:var(--warn-line);--amber-ink:var(--accent-ink);
|
||||
--gold:var(--sig);--gold-2:var(--sig-2);--gold-soft:var(--sig-soft);--gold-faint:var(--sig-soft);--gold-line:var(--sig-line);--muted-soft:var(--panel-2);--ink-faint:var(--row-hover);
|
||||
--ground:var(--bg);--ground2:var(--panel-2);--ground-soft:var(--panel-2);--panel-solid:var(--panel);--nav-bg:var(--panel);--side-bg:var(--panel);--pill-bg:var(--panel-2);--panel-grad-deep:var(--panel-grad);--glow:transparent;
|
||||
--disp:var(--display);--radius:8px}
|
||||
#page{color:var(--ink)}
|
||||
#memberArea.bo{display:block;min-height:0}
|
||||
.bo-main{display:block}
|
||||
@@ -12,7 +17,7 @@
|
||||
.tabs.bo-menu button.on{background:var(--panel);border-color:var(--accent);color:var(--accent-hi);box-shadow:0 1px 2px rgba(15,27,46,.08)}
|
||||
.tabs.bo-menu button svg{display:none}
|
||||
.tools-right{margin-left:auto;display:flex;gap:8px;align-items:center}
|
||||
.chat-badge{display:inline-grid;place-items:center;min-width:16px;height:16px;border-radius:8px;background:var(--sig);color:#fff;font:700 10px var(--mono);padding:0 4px}
|
||||
.chat-badge{display:inline-grid;place-items:center;min-width:16px;height:16px;border-radius:8px;background:var(--sig);color:var(--sig-ink);font:700 10px var(--mono);padding:0 4px}
|
||||
.ad-strip{padding:8px 24px 0}
|
||||
.card{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:14px 16px;margin:0 0 14px;box-shadow:var(--sh);color:var(--ink)}
|
||||
.card h3,.card-head h3{font-family:var(--display);font-size:15px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;margin:0 0 8px;color:var(--ink)}
|
||||
@@ -20,20 +25,20 @@
|
||||
.card-head .sub{font-family:var(--mono);font-size:10.5px;color:var(--muted);letter-spacing:.04em}
|
||||
.card p{color:var(--ink-2)} .card .muted{color:var(--muted)}
|
||||
.small{font-size:12.5px} .eyebrow{font-family:var(--mono);font-size:10px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
|
||||
#page input:not([type=checkbox]):not([type=radio]):not([type=file]),#page select,#page textarea{background:#fff;border:1px solid var(--line-strong);border-radius:6px;padding:7px 10px;color:var(--ink);font:inherit;box-shadow:0 1px 2px rgba(15,27,46,.06) inset}
|
||||
#page input:focus,#page select:focus,#page textarea:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px rgba(255,106,26,.18)}
|
||||
#page input::placeholder,#page textarea::placeholder{color:#8E9BB1}
|
||||
#page input:not([type=checkbox]):not([type=radio]):not([type=file]),#page select,#page textarea{background:var(--field-bg);border:1px solid var(--line-strong);border-radius:6px;padding:7px 10px;color:var(--ink);font:inherit;box-shadow:0 1px 2px rgba(15,27,46,.06) inset}
|
||||
#page input:focus,#page select:focus,#page textarea:focus{border-color:var(--sig);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--sig) 18%,transparent)}
|
||||
#page input::placeholder,#page textarea::placeholder{color:var(--muted)}
|
||||
.btn.sec{background:transparent;color:var(--ink);box-shadow:none}
|
||||
.btn.small{padding:4px 9px;font-size:11px}
|
||||
.btn.disabled,.btn[disabled]{opacity:.5}
|
||||
.chip-t,.chips button.chip-t{border:1px solid var(--line-strong);border-radius:999px;padding:4px 12px;font:700 11.5px var(--body);color:var(--ink-2);background:#fff;cursor:pointer}
|
||||
.chip-t,.chips button.chip-t{border:1px solid var(--line-strong);border-radius:999px;padding:4px 12px;font:700 11.5px var(--body);color:var(--ink-2);background:var(--panel);cursor:pointer}
|
||||
.chip-t.on,.chips button.chip-t.on{border-color:var(--accent);color:var(--accent-hi);background:var(--accent-soft)}
|
||||
.chip,.chip.flat{font-size:10.5px;padding:2px 8px}
|
||||
.pill{display:inline-block;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;border:1px solid var(--line-strong);border-radius:4px;padding:1px 7px;color:var(--ink-2);background:var(--panel-2)}
|
||||
.statx{background:linear-gradient(180deg,#FFFFFF,#F6F8FC);border:1px solid var(--line);border-radius:8px;padding:12px 14px;box-shadow:var(--sh)}
|
||||
.statx{background:var(--panel-grad);border:1px solid var(--line);border-radius:8px;padding:12px 14px;box-shadow:var(--sh)}
|
||||
.statx .pl{background:var(--accent-soft);border:1px solid var(--line)} .statx .pl svg{stroke:var(--accent-hi)}
|
||||
.statx.c-cyan .pl{background:var(--ok-soft)} .statx.c-cyan .pl svg{stroke:var(--ok)}
|
||||
.statx.c-violet .pl{background:#EEE9FF} .statx.c-violet .pl svg{stroke:#6D4AFF}
|
||||
.statx.c-violet .pl{background:var(--violet-soft)} .statx.c-violet .pl svg{stroke:var(--violet)}
|
||||
.statx.c-amber .pl{background:var(--warn-soft)} .statx.c-amber .pl svg{stroke:var(--warn)}
|
||||
.statx .nv{font-family:var(--display);font-size:28px;color:var(--ink)} .statx .lb{font-size:10.5px;letter-spacing:.1em}
|
||||
.promo-block,.pv,.obj,.gs,.next-card,.wo-slot,.lin-row,.tk-sec,.pipe-col,.pipe-card,.angle-row,.pb-acc{background:var(--panel-2);border:1px solid var(--line);border-radius:8px}
|
||||
@@ -45,18 +50,55 @@
|
||||
.pb-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:6px} .pb-size{font-family:var(--mono);font-size:11px;color:var(--muted);flex:1}
|
||||
.obj>summary{padding:10px 14px;font-weight:700;cursor:pointer;color:var(--ink)} .obj-body{padding:0 14px 14px} .obj-truth p{color:var(--ink-2)}
|
||||
.next-card{border-color:var(--accent-soft)} .next-card::before{display:none}
|
||||
.callout{background:var(--sig-soft);border:1px solid #F7C7A9;border-radius:8px;padding:10px 12px;color:var(--ink)}
|
||||
.callout{background:var(--sig-soft);border:1px solid var(--sig-line);border-radius:8px;padding:10px 12px;color:var(--ink)}
|
||||
table{font-size:13px;color:var(--ink)} th{font-family:var(--mono);font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);text-align:left;padding:8px 10px;border-bottom:1px solid var(--line)} td{padding:8px 10px;border-bottom:1px solid var(--line)}
|
||||
.feed .row{color:var(--ink)} .feed .row:first-child{background:var(--accent-soft)} .feed .t-TierPaid,.feed .t-Purchase,.feed .t-AwardPaid{color:var(--accent-hi)}
|
||||
.badge{background:var(--accent-soft);color:var(--accent-hi);border-color:var(--accent-soft)}
|
||||
.qa button{display:block;width:100%;text-align:left;background:#fff;border:1px solid var(--line-strong);border-radius:var(--r);padding:8px 12px;margin:0 0 6px;font:700 12px var(--body);color:var(--ink);cursor:pointer} .qa button:hover{border-color:var(--accent)}
|
||||
.line-tree,.lt-node{color:var(--ink)} .lt-node{background:#fff;border:1px solid var(--line-strong);border-radius:6px;padding:4px 10px} .lt-node.qualified{border-color:var(--sig);color:var(--sig-2)}
|
||||
.qa button{display:block;width:100%;text-align:left;background:var(--panel);border:1px solid var(--line-strong);border-radius:var(--r);padding:8px 12px;margin:0 0 6px;font:700 12px var(--body);color:var(--ink);cursor:pointer} .qa button:hover{border-color:var(--accent)}
|
||||
.line-tree,.lt-node{color:var(--ink)} .lt-node{background:var(--panel);border:1px solid var(--line-strong);border-radius:6px;padding:4px 10px} .lt-node.qualified{border-color:var(--sig);color:var(--sig-2)}
|
||||
.boot-spin .ring{border-color:var(--accent-soft);border-top-color:var(--accent)}
|
||||
.bo-pagefoot{margin:8px 0 0;padding:14px 24px;border-top:1px solid var(--line);display:flex;gap:18px;flex-wrap:wrap;align-items:center;font-size:12px} .bo-pagefoot a{color:var(--muted)} .bo-pagefoot a:hover{color:var(--ink)}
|
||||
#status{position:fixed;left:50%;transform:translateX(-50%);bottom:20px;background:var(--chrome);color:var(--chrome-ink);border:1px solid var(--chrome-line);border-left:3px solid var(--ok);padding:9px 14px;border-radius:6px;font-size:12px;font-weight:600;z-index:60;max-width:min(560px,92vw)}
|
||||
#status.bad{border-left-color:var(--sig)}
|
||||
.ed-body{background:#fff;border:1px solid var(--line-strong);border-radius:6px;min-height:110px;padding:10px;color:var(--ink)} .ed-bar button{background:#fff;border:1px solid var(--line-strong);border-radius:5px;color:var(--ink);padding:3px 8px;cursor:pointer}
|
||||
.ed-body{background:var(--field-bg);border:1px solid var(--line-strong);border-radius:6px;min-height:110px;padding:10px;color:var(--ink)} .ed-bar button{background:var(--panel);border:1px solid var(--line-strong);border-radius:5px;color:var(--ink);padding:3px 8px;cursor:pointer}
|
||||
.chat-drawer{background:var(--panel);color:var(--ink);border-left:1px solid var(--line);box-shadow:-20px 0 40px -30px rgba(15,27,46,.5)} .chat-head{border-bottom:1px solid var(--line)} .chat-msgs,.chat-threads{color:var(--ink)}
|
||||
.grid.c2{grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}
|
||||
.tr-group{color:var(--muted)!important}
|
||||
@media (max-width:760px){.bo-content{padding:12px 14px 20px}.tools-tabs{padding:10px 14px 0}.tabs{flex-wrap:wrap}}
|
||||
|
||||
/* Pipeline board colour (Marty 2026-10-18: "bland and bright and difficult to read"): one colour per stage on the column
|
||||
(tinted body, solid top bar, coloured title, count pill) and the same colour as a stripe on each card; white cards with
|
||||
dark names; stalled cards get an amber chip and edge so they stand out. */
|
||||
:where(.pipe-board .pipe-col,.pipe-due .pipe-card,.pipe-board .pipe-card){--st:#64748b}
|
||||
.pipe-board [data-stage="talking"],.pipe-due [data-stage="talking"]{--st:#7c3aed}
|
||||
.pipe-board [data-stage="joined"],.pipe-due [data-stage="joined"]{--st:#2563eb}
|
||||
.pipe-board [data-stage="wallet"],.pipe-due [data-stage="wallet"]{--st:#0891b2}
|
||||
.pipe-board [data-stage="payouts"],.pipe-due [data-stage="payouts"]{--st:#ea580c}
|
||||
.pipe-board [data-stage="bought"],.pipe-due [data-stage="bought"]{--st:#16a34a}
|
||||
.pipe-board [data-stage="building"],.pipe-due [data-stage="building"]{--st:#b7791f}
|
||||
.pipe-board [data-stage="later"],.pipe-due [data-stage="later"]{--st:#64748b}
|
||||
.pipe-board .pipe-col{background:color-mix(in srgb,var(--st) 7%,var(--panel-2));border:1px solid color-mix(in srgb,var(--st) 28%,var(--line));border-top:4px solid var(--st);border-radius:10px}
|
||||
.pipe-board .pipe-col h4{color:color-mix(in srgb,var(--st) 72%,var(--ink));font-weight:800}
|
||||
.pipe-board .pipe-col h4 span{background:var(--st);color:var(--on-ink);border-radius:999px;padding:0 8px;font-size:12px;line-height:20px;min-width:22px;text-align:center}
|
||||
.pipe-board .pipe-col .hint{color:var(--ink-2)}
|
||||
.pipe-board .pipe-card,.pipe-due .pipe-card{background:var(--panel);border:1px solid color-mix(in srgb,var(--st) 22%,var(--line));border-left:4px solid var(--st);border-radius:8px;box-shadow:0 1px 2px rgba(15,23,42,.06)}
|
||||
.pipe-board .pipe-card:hover,.pipe-board .pipe-card:focus-visible,.pipe-due .pipe-card:hover{border-color:var(--st);box-shadow:0 2px 8px color-mix(in srgb,var(--st) 25%,transparent)}
|
||||
.pipe-board .pipe-card.on{box-shadow:0 0 0 2px var(--st)}
|
||||
.pipe-card .nm{color:var(--ink)}
|
||||
.pipe-card .nm small{color:var(--muted)}
|
||||
.pipe-card .sub{color:var(--ink-2)}
|
||||
.pipe-card .note{color:var(--ink)}
|
||||
.pipe-card.stalled{background:var(--note-bg)}
|
||||
.pipe-card .chip.warm{background:var(--note-soft);border-color:var(--note-line);color:var(--note-ink);font-weight:700}
|
||||
.pipe-card .chip.flat{background:var(--panel-2);border-color:var(--line-strong);color:var(--ink-2)}
|
||||
/* dark theme: pipeline stage colours lifted for dark panels (titles, stripes, count pills) */
|
||||
:root[data-theme="dark"] :where(.pipe-board .pipe-col,.pipe-due .pipe-card,.pipe-board .pipe-card){--st:#8E9FB8}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="talking"],:root[data-theme="dark"] .pipe-due [data-stage="talking"]{--st:#B59CFF}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="joined"],:root[data-theme="dark"] .pipe-due [data-stage="joined"]{--st:#7AAAFF}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="wallet"],:root[data-theme="dark"] .pipe-due [data-stage="wallet"]{--st:#4FC3E6}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="payouts"],:root[data-theme="dark"] .pipe-due [data-stage="payouts"]{--st:#FF9A5C}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="bought"],:root[data-theme="dark"] .pipe-due [data-stage="bought"]{--st:#4CCB7A}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="building"],:root[data-theme="dark"] .pipe-due [data-stage="building"]{--st:#D9A441}
|
||||
:root[data-theme="dark"] .pipe-board [data-stage="later"],:root[data-theme="dark"] .pipe-due [data-stage="later"]{--st:#8E9FB8}
|
||||
/* Appearance card on the Profile pane */
|
||||
.theme-card .seg{margin-top:4px} .theme-card .seg button.on{background:var(--accent);color:var(--accent-ink)}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
// LinkSpin traffic guide data (2026-10-28, Marty: members ask "what traffic for what kind of offer?").
|
||||
// Shared by the Traffic guide page (/traffic-guide) and the Sources screen (format tags, "good for" line).
|
||||
// Network formats are what each network is known to sell; members should still confirm in their own ad panel.
|
||||
window.TRAFFIC_GUIDE = (function () {
|
||||
const FORMATS = {
|
||||
pop: {
|
||||
name: 'Popunder', short: 'Pop',
|
||||
what: 'Your page opens in a new window or tab behind (or over) the site the visitor was reading.',
|
||||
buy: 'Usually CPM or CPV (per thousand views). The cheapest clicks you can buy, and the most of them.',
|
||||
wins: 'One-step offers that need no trust: free sign-ups, email capture, giveaways, games, app installs.',
|
||||
fails: 'Anything that needs explaining or trust first: long sales letters, high-ticket offers, a cold opportunity pitch.',
|
||||
page: 'Fast, mobile, one headline and one big button. If it takes more than a few seconds to load, the visitor is gone.',
|
||||
},
|
||||
push: {
|
||||
name: 'Push notifications', short: 'Push',
|
||||
what: 'A short notification with an icon and a headline, sent to people who allowed notifications from some site.',
|
||||
buy: 'CPC (per click). You only pay when someone taps.',
|
||||
wins: 'Curiosity and news-style hooks: lead capture, giveaways, games, "how I..." stories, free tools.',
|
||||
fails: 'Sending the click straight to a checkout or a signup that asks for a lot. Push readers want a quick payoff.',
|
||||
page: 'Use a short pre-lander that continues the headline, then the sign-up. Refresh the headline and icon often; push audiences tire fast.',
|
||||
},
|
||||
inpage: {
|
||||
name: 'In-page push', short: 'In-page',
|
||||
what: 'An ad that looks like a push notification but shows inside the web page (works on iPhones too).',
|
||||
buy: 'CPC or CPM.',
|
||||
wins: 'The same offers as push and pop: free sign-ups, giveaways, games, quick lead forms.',
|
||||
fails: 'Offers that need a long read before anyone acts.',
|
||||
page: 'Same as push: a headline that promises one thing, and a page that delivers it right away.',
|
||||
},
|
||||
native: {
|
||||
name: 'Native ads', short: 'Native',
|
||||
what: 'A thumbnail and headline inside "recommended stories" boxes on news and content sites.',
|
||||
buy: 'CPC. Clicks cost more than pop or push, but readers are in reading mode.',
|
||||
wins: 'Story-style pre-sells: courses and info products, software, an opportunity explained through your own story.',
|
||||
fails: 'Hard sells and hype. Mainstream native networks reject income claims and are strict about crypto.',
|
||||
page: 'An article or "my story" page that warms the reader up, then sends them to the sign-up. Never a bare sign-up form.',
|
||||
},
|
||||
search: {
|
||||
name: 'Search ads', short: 'Search',
|
||||
what: 'Text ads next to search results, shown to people typing a keyword you bid on.',
|
||||
buy: 'CPC on keywords. Can be pricey on popular words, cheap on specific ones.',
|
||||
wins: 'Things people already look for: advertising tools, buying website traffic, software, how-to courses.',
|
||||
fails: 'Offers nobody searches for. Google and Microsoft also restrict crypto, income opportunities and MLM.',
|
||||
page: 'Match the keyword in your headline. A searcher wants the answer to what they typed, not a detour.',
|
||||
},
|
||||
social: {
|
||||
name: 'Social ads', short: 'Social',
|
||||
what: 'Ads in social feeds and stories, aimed by interests, age and location.',
|
||||
buy: 'CPM or CPC, set by auction.',
|
||||
wins: 'Video and story content, free lead magnets, community and webinar invites, software and courses.',
|
||||
fails: 'Direct crypto or "make money" pitches: Facebook restricts them, and accounts get banned for it.',
|
||||
page: 'Lead with something free and useful (a guide, a video, a webinar), then follow up by email.',
|
||||
},
|
||||
display: {
|
||||
name: 'Banners', short: 'Banner',
|
||||
what: 'Image ads in fixed spots on websites (728x90, 300x250 and so on).',
|
||||
buy: 'CPM or CPC.',
|
||||
wins: 'Retargeting people who already know you, brand reminders, simple free offers.',
|
||||
fails: 'Cold, complex offers. Banner click rates are low, so the offer has to be obvious at a glance.',
|
||||
page: 'Bold, simple creative with one message. Test several sizes; some spots convert far better than others.',
|
||||
},
|
||||
redirect: {
|
||||
name: 'Domain redirect', short: 'Redirect',
|
||||
what: 'Visitors who typed a parked or expired domain are sent straight to your page (also called zero-click).',
|
||||
buy: 'CPV (per visit).',
|
||||
wins: 'Lead capture, giveaways, simple sign-ups in the right niche.',
|
||||
fails: 'Offers that need a pre-sell. The visitor did not choose your ad.',
|
||||
page: 'Fast and simple, like pop traffic.',
|
||||
},
|
||||
};
|
||||
|
||||
// offer types LinkSpin members promote; rating per format: best / good / weak / avoid, with a one-line why
|
||||
const OFFERS = [
|
||||
{ key: 'join', name: 'Free sign-up or email capture', ex: 'a free join page, a squeeze page, a lead magnet',
|
||||
fit: { pop: ['best', 'Cheap volume for a one-field page'], inpage: ['best', 'Works on every phone, fast decision'], push: ['good', 'Use a short pre-lander first'], native: ['good', 'Pre-sell with a story, then the form'], redirect: ['good', 'Simple page, quick decision'], social: ['good', 'Offer something free and useful'], display: ['weak', 'Low click rates for cold sign-ups'], search: ['weak', 'Few people search for a page they have never heard of'] },
|
||||
tip: 'Ask for the email only. Every extra field costs sign-ups. Follow up by email; most people join on a later message.' },
|
||||
{ key: 'opp', name: 'Crypto or team-build opportunity', ex: 'an on-chain team build, a crypto earning program',
|
||||
fit: { native: ['good', 'Explain it through your story, check each network\'s crypto rules first'], push: ['good', 'Curiosity hook to a pre-sell or squeeze page, never straight to a buy'], inpage: ['good', 'Same as push'], pop: ['weak', 'Cold and skimming; only to a free squeeze page'], display: ['weak', 'Too much to explain in a banner'], redirect: ['weak', 'No pre-sell'], search: ['avoid', 'Google and Microsoft restrict crypto and income offers'], social: ['avoid', 'Facebook restricts crypto and money-making ads; accounts get banned'] },
|
||||
tip: 'Capture the email first and explain by email or video. No income promises in ads or pages; networks reject them and they draw complaints.' },
|
||||
{ key: 'ads', name: 'Advertising tools and ad credits', ex: 'InstantAdPay, LinkSpin, traffic tools',
|
||||
fit: { search: ['best', 'People search for "buy website traffic" and "advertise my site"'], push: ['good', '"Free ad credits" is a strong hook'], pop: ['good', 'Send to a free join that gives credits'], inpage: ['good', 'Same as push'], native: ['good', 'A how-I-get-traffic story'], social: ['good', 'Target small business owners and marketers'], display: ['weak', 'Fine for retargeting'], redirect: ['weak', 'Rarely the right audience'] },
|
||||
tip: 'Sell the free starting credits, not the plan. "Get your first ads seen free" beats "join my business".' },
|
||||
{ key: 'games', name: 'Games and play-to-earn', ex: 'browser games, game rewards',
|
||||
fit: { pop: ['best', 'Gamers click fast; send to the game itself'], inpage: ['best', 'Mobile-heavy, quick tap to play'], push: ['good', 'Short, playful headlines'], social: ['good', 'Short gameplay video'], native: ['weak', 'Readers are not in play mode'], display: ['weak', 'Only with an eye-catching game image'], redirect: ['weak', 'Hit and miss'], search: ['weak', 'Only for the game\'s own name'] },
|
||||
tip: 'Land them in the game, not on a sign-up wall. Let them play first and ask for an account when they win something.' },
|
||||
{ key: 'software', name: 'Software, apps and AI tools', ex: 'an AI writer, a page builder, an app',
|
||||
fit: { search: ['best', 'High intent: people search for the job the tool does'], native: ['good', 'Review-style or how-to articles'], social: ['good', 'Show the tool working in a short video'], push: ['good', 'A free trial or free tool hook'], inpage: ['good', 'Same as push'], display: ['weak', 'Retargeting only'], pop: ['weak', 'Low attention for a tool that needs a demo'], redirect: ['weak', 'Rarely the right audience'] },
|
||||
tip: 'Lead with the free trial or free version and one clear result ("write a week of posts in 5 minutes").' },
|
||||
{ key: 'info', name: 'Courses and info products', ex: 'a course, an ebook, a coaching program',
|
||||
fit: { native: ['best', 'Story pre-sell to a free lesson'], social: ['good', 'Free lesson or webinar invite'], search: ['good', 'How-to keywords'], push: ['good', 'Only through a pre-lander'], inpage: ['good', 'Only through a pre-lander'], pop: ['weak', 'Too cold for a paid course'], display: ['weak', 'Retargeting only'], redirect: ['weak', 'No pre-sell'] },
|
||||
tip: 'Give a free first lesson for an email, then sell by email. Cold traffic rarely buys a course on the first visit.' },
|
||||
{ key: 'sweeps', name: 'Giveaways and freebies', ex: 'a contest, a free gift, a spin-to-win',
|
||||
fit: { pop: ['best', 'The classic pop offer'], push: ['best', '"You could win" headlines work'], inpage: ['best', 'Same as push'], redirect: ['good', 'Quick entry form'], display: ['good', 'A clear prize image'], native: ['weak', 'Pricey clicks for a freebie'], social: ['weak', 'Strict contest rules on social'], search: ['avoid', 'Almost nobody searches for it'] },
|
||||
tip: 'Show the prize and the deadline. Keep the entry to one field and say clearly what happens next.' },
|
||||
];
|
||||
|
||||
// formats each catalog network sells (by catalog key). adult: 'mixed' = big adult inventory with mainstream
|
||||
// options (pick mainstream / non-adult in the targeting), 'adult' = mostly adult sites.
|
||||
// strict: mainstream ad policies (crypto, income claims, MLM are restricted or need approval).
|
||||
const NETWORKS = {
|
||||
'7search-ppc': { f: ['search', 'display'], note: 'Small search network, cheaper and less strict than Google' },
|
||||
activerevenue: { f: ['pop', 'push', 'inpage', 'native'] },
|
||||
adskeeper: { f: ['native'], note: 'Native network from the MGID family' },
|
||||
adsterra: { f: ['pop', 'inpage', 'display', 'native'], note: 'Social Bar is its in-page push format' },
|
||||
bidvertiser: { f: ['pop', 'push', 'native', 'display'] },
|
||||
clickadu: { f: ['pop', 'inpage', 'push', 'display'] },
|
||||
exoclick: { f: ['pop', 'display', 'native', 'push', 'inpage'], adult: 'mixed' },
|
||||
ezmob: { f: ['pop', 'push', 'native', 'display'] },
|
||||
facebook: { f: ['social'], strict: true },
|
||||
froggyads: { f: ['pop', 'push', 'inpage', 'display'] },
|
||||
'google-adwords': { f: ['search', 'display'], strict: true, note: 'Also YouTube video ads' },
|
||||
hilltopads: { f: ['pop', 'inpage', 'display'] },
|
||||
mgid: { f: ['native'], strict: true },
|
||||
'microsoft-advertising': { f: ['search'], strict: true, note: 'Bing, Yahoo and partner search' },
|
||||
mondiad: { f: ['push', 'inpage', 'native'] },
|
||||
mybid: { f: ['pop', 'push', 'native', 'display'] },
|
||||
plugrush: { f: ['pop', 'display', 'native'], adult: 'mixed' },
|
||||
popads: { f: ['pop'] },
|
||||
popcash: { f: ['pop'] },
|
||||
propellerads: { f: ['pop', 'push', 'inpage'] },
|
||||
pushground: { f: ['push', 'inpage'] },
|
||||
reacheffect: { f: ['push', 'pop'] },
|
||||
revcontent: { f: ['native'], strict: true },
|
||||
taboola: { f: ['native'], strict: true },
|
||||
tonic: { f: [], note: 'Mostly a search-monetization partner; confirm what traffic they sell before you spend' },
|
||||
trafficjunky: { f: ['display', 'native'], adult: 'adult', note: 'Adult sites; also video pre-roll' },
|
||||
trafficshop: { f: ['pop', 'display'], adult: 'mixed' },
|
||||
trafficstars: { f: ['pop', 'display', 'native', 'push', 'inpage'], adult: 'mixed' },
|
||||
ungads: { f: [], note: 'Check the ad formats in your account' },
|
||||
zeropark: { f: ['pop', 'push', 'redirect', 'search'] },
|
||||
};
|
||||
|
||||
const RULES = [
|
||||
['Test small, then scale', 'Start each network with a small daily budget and one offer. Keep what converts, cut what does not, then raise the budget on the winners.'],
|
||||
['Track every click', 'Set the network up under Sources so its click id and postback are on the link. Then Reports shows which network, zone and creative actually converts.'],
|
||||
['Change one thing at a time', 'New headline or new page or new network, not all three at once, or you will not know what made the difference.'],
|
||||
['Block the zones that waste money', 'Pop, push and native networks sell from thousands of sites. After a day or two, block the sites and zones with clicks and no sign-ups.'],
|
||||
['No income promises', 'Ads and pages that promise earnings get rejected and draw complaints. Show what the program is and let people decide.'],
|
||||
['Mainstream vs adult inventory', 'Networks marked adult-heavy sell a lot of adult traffic. Target their mainstream (non-adult) sites unless your offer fits that audience.'],
|
||||
];
|
||||
|
||||
const fmtName = k => (FORMATS[k] || {}).short || k;
|
||||
// the formats a source sells, and the offers those formats suit best (for the Sources screen line)
|
||||
function bestFor(key) {
|
||||
const n = NETWORKS[key]; if (!n || !n.f.length) return [];
|
||||
return OFFERS.filter(o => n.f.some(f => o.fit[f] && o.fit[f][0] === 'best') && !(n.strict && o.key === 'opp') && !(n.adult === 'adult' && !['games', 'sweeps'].includes(o.key))).map(o => o.name);
|
||||
}
|
||||
return { FORMATS, OFFERS, NETWORKS, RULES, fmtName, bestFor };
|
||||
})();
|
||||
@@ -0,0 +1,53 @@
|
||||
// LinkSpin Traffic guide page (2026-10-28): offer picker, the ad formats, the networks, ground rules.
|
||||
(function () {
|
||||
const G = window.TRAFFIC_GUIDE, $ = id => document.getElementById(id), esc = CR.esc;
|
||||
CR.mount({ active: 'sources', crumb: 'Control room · Sources', title: 'Traffic guide', sub: 'which traffic for which offer', actions: '<a class="btn sm" href="/sources">← Sources</a>' });
|
||||
let CAT = [], OFF = null, NF = '';
|
||||
const nameOf = k => { const c = CAT.find(x => x.key === k); return c ? c.name : k; };
|
||||
const ORDER = ['best', 'good', 'weak', 'avoid'];
|
||||
function tags(k) {
|
||||
const n = G.NETWORKS[k] || { f: [] };
|
||||
return n.f.map(f => '<span class="tag plain">' + esc(G.fmtName(f)) + '</span>').join('')
|
||||
+ (n.adult === 'adult' ? '<span class="tag warn">adult sites</span>' : n.adult === 'mixed' ? '<span class="tag dim" title="Big adult inventory; target its mainstream sites">adult-heavy</span>' : '')
|
||||
+ (n.strict ? '<span class="tag warn" title="Strict ad policy: crypto, income claims and MLM are restricted or need approval">strict policy</span>' : '');
|
||||
}
|
||||
function renderOffers() {
|
||||
$('offers').innerHTML = G.OFFERS.map(o => '<button type="button" class="chip' + (OFF === o.key ? ' on' : '') + '" data-k="' + o.key + '">' + esc(o.name) + '</button>').join('');
|
||||
$('offers').querySelectorAll('.chip').forEach(b => b.addEventListener('click', () => { OFF = OFF === b.dataset.k ? null : b.dataset.k; try { history.replaceState(null, '', OFF ? '#' + OFF : location.pathname); } catch (e) {} renderOffers(); renderResult(); }));
|
||||
}
|
||||
function renderResult() {
|
||||
const o = G.OFFERS.find(x => x.key === OFF);
|
||||
if (!o) { $('result').innerHTML = '<div class="muted">Pick one above.</div>'; return; }
|
||||
const rows = Object.keys(o.fit).sort((a, b) => ORDER.indexOf(o.fit[a][0]) - ORDER.indexOf(o.fit[b][0]));
|
||||
const good = rows.filter(f => o.fit[f][0] === 'best' || o.fit[f][0] === 'good');
|
||||
// networks that sell at least one best/good format; strict-policy networks are left out for the opportunity offer
|
||||
// adult-only sites suit few offers
|
||||
const nets = Object.keys(G.NETWORKS).filter(k => { const n = G.NETWORKS[k]; if (n.strict && o.key === 'opp') return false; if (n.adult === 'adult' && !['games', 'sweeps'].includes(o.key)) return false; return n.f.some(f => good.includes(f)); })
|
||||
.map(k => ({ k, score: G.NETWORKS[k].f.reduce((s, f) => s + (o.fit[f] ? (o.fit[f][0] === 'best' ? 3 : o.fit[f][0] === 'good' ? 1 : 0) : 0), 0) }))
|
||||
.sort((a, b) => b.score - a.score || nameOf(a.k).localeCompare(nameOf(b.k)));
|
||||
$('result').innerHTML = '<div class="res"><div class="fit">'
|
||||
+ rows.map(f => '<div class="r"><span class="fn">' + esc(G.FORMATS[f].name) + '</span><span class="rate ' + o.fit[f][0] + '">' + o.fit[f][0] + '</span><span class="why">' + esc(o.fit[f][1]) + '</span></div>').join('')
|
||||
+ '</div><div style="display:grid;gap:12px;align-content:start"><div class="tipbox"><b>Tip.</b> ' + esc(o.tip) + '</div>'
|
||||
+ '<div><div class="sec" style="margin-bottom:6px">Networks that sell those formats</div><div class="nets">' + nets.map(x => '<a href="#net-' + esc(x.k) + '">' + esc(nameOf(x.k)) + '</a>').join('') + '</div></div>'
|
||||
+ (o.key === 'opp' ? '<div class="muted" style="font-size:12px">Google, Microsoft, Facebook, Taboola, Revcontent and MGID are left out: their policies restrict crypto and income offers.</div>' : '')
|
||||
+ '</div></div>';
|
||||
}
|
||||
function renderFormats() {
|
||||
$('fmts').innerHTML = Object.keys(G.FORMATS).map(k => { const f = G.FORMATS[k];
|
||||
return '<div class="fmt" id="fmt-' + k + '"><h3>' + esc(f.name) + '</h3><p>' + esc(f.what) + '</p><p><b>How you pay:</b> ' + esc(f.buy) + '</p><p><b>Converts:</b> ' + esc(f.wins) + '</p><p><b>Struggles:</b> ' + esc(f.fails) + '</p><p><b>Landing page:</b> ' + esc(f.page) + '</p></div>'; }).join('');
|
||||
}
|
||||
function renderNets() {
|
||||
const fs = Object.keys(G.FORMATS);
|
||||
$('nfilter').innerHTML = '<button type="button" class="chip' + (NF ? '' : ' on') + '" data-f="">All</button>' + fs.map(f => '<button type="button" class="chip' + (NF === f ? ' on' : '') + '" data-f="' + f + '">' + esc(G.FORMATS[f].name) + '</button>').join('');
|
||||
$('nfilter').querySelectorAll('.chip').forEach(b => b.addEventListener('click', () => { NF = b.dataset.f; renderNets(); }));
|
||||
const keys = Array.from(new Set(CAT.map(c => c.key).concat(Object.keys(G.NETWORKS)))).filter(k => !NF || ((G.NETWORKS[k] || {}).f || []).includes(NF)).sort((a, b) => nameOf(a).localeCompare(nameOf(b)));
|
||||
$('nrows').innerHTML = keys.length ? keys.map(k => { const n = G.NETWORKS[k] || { f: [] }, c = CAT.find(x => x.key === k) || {}, bf = G.bestFor(k);
|
||||
return '<div class="rw" id="net-' + esc(k) + '"><div class="nm"><b>' + esc(nameOf(k)) + '</b><span>' + esc(c.site || '') + '</span></div><div class="tg2">' + (tags(k) || '<span class="muted" style="font-size:12px">check in your account</span>') + '</div>'
|
||||
+ '<div class="note">' + (bf.length ? 'Best for: ' + esc(bf.join(', ')) + '. ' : '') + esc(n.note || '') + '</div></div>'; }).join('')
|
||||
: '<div class="rw"><span class="muted">No network sells that format.</span></div>';
|
||||
}
|
||||
$('rules').innerHTML = G.RULES.map(r => '<div><b>' + esc(r[0]) + '</b><span>' + esc(r[1]) + '</span></div>').join('');
|
||||
OFF = (location.hash.slice(1) && G.OFFERS.some(o => o.key === location.hash.slice(1))) ? location.hash.slice(1) : null;
|
||||
renderOffers(); renderResult(); renderFormats(); renderNets();
|
||||
CR.get('/api/sources/catalog').then(r => { CAT = r.catalog || []; renderResult(); renderNets(); }).catch(() => {});
|
||||
})();
|
||||
@@ -17,9 +17,11 @@
|
||||
title.innerHTML = safeName;
|
||||
if (hostEl) hostEl.innerHTML = safeName;
|
||||
IAP.$('bioHead').hidden = false;
|
||||
if (w.avatarUrl) { const av = IAP.$('bioAvatar'); av.src = w.avatarUrl; av.hidden = false; }
|
||||
// profile fields (avatar, bio, socials, intro video) are rendered only when the server says the member has bought (w.bought);
|
||||
// a free member's wall shows the name, the line's ads and the join call, nothing from the profile (2026-10-30)
|
||||
if (w.bought && w.avatarUrl) { const av = IAP.$('bioAvatar'); av.src = w.avatarUrl; av.hidden = false; }
|
||||
if (w.badge) { const bb = IAP.$('bioBadge'); if (bb) { bb.src = w.badge.img; bb.title = w.badge.label + ' badge'; bb.hidden = false; } }
|
||||
IAP.$('bioText').textContent = w.bio || 'Building a team on LinkSpin — join through this page and you\'re in my line.';
|
||||
IAP.$('bioText').textContent = (w.bought && w.bio) || 'Building a team on LinkSpin. Join through this page and you are in my line.';
|
||||
if (w.qrUrl) IAP.$('bioQr').src = w.qrUrl;
|
||||
// social links
|
||||
const SOC = { facebook: 'Facebook', twitter: 'X', youtube: 'YouTube', instagram: 'Instagram', tiktok: 'TikTok', telegram: 'Telegram', linkedin: 'LinkedIn', website: 'Website' };
|
||||
@@ -36,14 +38,15 @@
|
||||
website: svg('<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18"/>')
|
||||
};
|
||||
const sc = IAP.$('bioSocials');
|
||||
if (sc && w.socials && typeof w.socials === 'object') {
|
||||
if (sc && w.bought && w.socials && typeof w.socials === 'object') {
|
||||
// paid placement: Google wants these marked sponsored (plus ugc), never a plain dofollow (2026-10-30)
|
||||
const links = Object.keys(SOC).filter(k => w.socials[k]).map(k =>
|
||||
'<a href="' + String(w.socials[k]).replace(/"/g, '%22') + '" target="_blank" rel="noopener nofollow me">' + (ICON[k] || '') + '<span>' + SOC[k] + '</span></a>');
|
||||
'<a href="' + String(w.socials[k]).replace(/"/g, '%22') + '" target="_blank" rel="sponsored ugc noopener">' + (ICON[k] || '') + '<span>' + SOC[k] + '</span></a>');
|
||||
sc.innerHTML = links.join('');
|
||||
}
|
||||
// intro video under the bio: YouTube / Vimeo embed, or a direct file
|
||||
const bv = IAP.$('bioVideo');
|
||||
const vurl = w.socials && typeof w.socials === 'object' ? String(w.socials.video || '') : '';
|
||||
const vurl = w.bought && w.socials && typeof w.socials === 'object' ? String(w.socials.video || '') : '';
|
||||
if (bv && vurl) {
|
||||
let yt = /(?:youtube\.com\/(?:watch\?(?:.*&)?v=|shorts\/|embed\/)|youtu\.be\/)([A-Za-z0-9_-]{6,})/.exec(vurl);
|
||||
let vm = /vimeo\.com\/(?:video\/)?(\d+)/.exec(vurl);
|
||||
|
||||
@@ -8,18 +8,21 @@
|
||||
try { [D, ME] = await Promise.all([CR.get('/api/my/dashboard'), CR.me()]); } catch (e) { CR.sub('could not load'); return; }
|
||||
try { POS = await CR.get('/api/my/positions'); } catch (e) {}
|
||||
try { E = await CR.get('/api/my/activity'); } catch (e) {}
|
||||
// dollar value at today's POL price (Marty, 2026-10-22): one cached rate from our own server, US dollars
|
||||
let U = { usd: 0, at: 0 }; try { U = await CR.get('/api/public/polusd'); } catch (e) {}
|
||||
const usd = wei => { if (!(U.usd > 0)) return ''; let p = 0; try { p = Number(BigInt(wei || '0') / 10n ** 12n) / 1e6; } catch (e) {} return '≈ $' + (p * U.usd).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); };
|
||||
const addr = ME.address || ''; const on = !!ME.memberId;
|
||||
CR.sub(addr ? addr.slice(0, 6) + '…' + addr.slice(-4) + (on ? ' · payouts on' : ' · payouts off') : 'no wallet linked');
|
||||
$('tiles').innerHTML = [['Paid to this wallet', pol(D.earnedWei || '0') + ' POL', (D.earnCount || 0) + ' transactions'], ['Credits', fmt((D.credits || 0) + (D.earnedCredits || 0)), fmt(D.credits || 0) + ' purchased · ' + fmt(D.earnedCredits || 0) + ' earned'], ['In campaigns', fmt(D.inCampaigns || 0), 'reserved by live campaigns'], ['Qualifying buyers', fmt(D.buyerCount || 0), (D.buyerCount || 0) >= 5 ? 'level 3 open' : (D.buyerCount || 0) >= 2 ? 'level 2 open' : 'level 2 at 2 buyers']]
|
||||
$('tiles').innerHTML = [['Paid to this wallet', pol(D.earnedWei || '0') + ' POL', (D.earnCount || 0) + ' transactions' + (U.usd > 0 && D.earnedWei && D.earnedWei !== '0' ? ' · ' + usd(D.earnedWei) + ' today' : '')], ['Credits', fmt((D.credits || 0) + (D.earnedCredits || 0)), fmt(D.credits || 0) + ' purchased · ' + fmt(D.earnedCredits || 0) + ' earned'], ['In campaigns', fmt(D.inCampaigns || 0), 'reserved by live campaigns'], ['Qualifying buyers', fmt(D.buyerCount || 0), (D.buyerCount || 0) >= 5 ? 'level 3 open' : (D.buyerCount || 0) >= 2 ? 'level 2 open' : 'level 2 at 2 buyers']]
|
||||
.map(([k, v, n], i) => '<div class="tile' + (i === 0 ? ' hi' : '') + '"><span class="k">' + k + '</span><span class="v">' + v + '</span><span class="muted mono" style="font-size:11px">' + n + '</span></div>').join('');
|
||||
$('walletBox').innerHTML = addr ? '<div class="code" style="display:block">' + esc(addr) + '</div><div style="margin-top:8px">' + (on ? '<span class="ok"><span class="dot"></span>PAYOUTS ON · member #' + ME.memberId + '</span>' : '<span class="warn"><span class="dot"></span>WALLET LINKED · PAYOUTS OFF</span><div class="muted" style="margin-top:4px">Switch payouts on so the people you bring pay you from their first purchase.</div>') + '</div>' : '<span class="warn">No wallet linked yet.</span><div class="muted" style="margin-top:4px">Link one to be paid. Your email account keeps working either way.</div>';
|
||||
const pays = E && Array.isArray(E.earnings) ? E.earnings : [];
|
||||
$('payRows').innerHTML = pays.length ? pays.slice(0, 25).map(x => '<div class="rw"><span class="mono muted" style="font-size:12px">' + new Date((x.ts || 0) * (x.ts > 1e12 ? 1 : 1000)).toLocaleString() + '</span><span><b>' + esc(x.buyerName || x.fromName || (x.names && x.buyerId && x.names[x.buyerId] ? '@' + x.names[x.buyerId] : x.buyerId ? 'member #' + x.buyerId : x.type === 'AwardPaid' ? 'award' : 'member')) + '</b></span><span class="mono">' + (x.tier ? 'L' + x.tier + ' · ' + (x.tier === 1 ? '50%' : x.tier === 2 ? '20%' : '10%') : (x.type === 'AwardPaid' ? 'award' : '')) + '</span><span class="mono">' + (x.priceCents ? '$' + (x.priceCents / 100) : '') + '</span><span class="r num ok">+' + pol(x.amountWei || '0') + ' POL</span>' + (x.tx ? '<a class="mono" style="font-size:11px" href="/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">' + esc(String(x.tx).slice(0, 10)) + '…</a>' : '<span></span>') + '</div>').join('')
|
||||
$('payRows').innerHTML = pays.length ? pays.slice(0, 25).map(x => '<div class="rw"><span class="mono muted" style="font-size:12px">' + new Date((x.ts || 0) * (x.ts > 1e12 ? 1 : 1000)).toLocaleString() + '</span><span><b>' + esc(x.buyerName || x.fromName || (x.names && x.buyerId && x.names[x.buyerId] ? '@' + x.names[x.buyerId] : x.buyerId ? 'member #' + x.buyerId : x.type === 'AwardPaid' ? (x.override ? 'Level 4 override' : 'award') : 'member')) + '</b></span><span class="mono">' + (x.tier ? 'L' + x.tier + ' · ' + (x.tier === 1 ? '50%' : x.tier === 2 ? '20%' : '10%') : (x.type === 'AwardPaid' ? (x.override ? 'L4 · 3%' : 'award') : '')) + '</span><span class="mono">' + (x.priceCents ? '$' + (x.priceCents / 100) : '') + '</span><span class="r num ok">+' + pol(x.amountWei || '0') + ' POL' + (U.usd > 0 ? '<br><span class="muted" style="font-size:11px">' + usd(x.amountWei) + '</span>' : '') + '</span>' + (x.tx ? '<a class="mono" style="font-size:11px" href="/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">' + esc(String(x.tx).slice(0, 10)) + '…</a>' : '<span></span>') + '</div>').join('')
|
||||
: '<div class="rw"><span class="muted">No payouts yet. They appear here the moment someone in your line buys.</span></div>';
|
||||
$('payFoot').textContent = 'every line is a Polygon transaction · nothing is held by the site';
|
||||
$('payFoot').textContent = 'every line is a Polygon transaction · nothing is held by the site' + (U.usd > 0 ? ' · 1 POL ≈ $' + U.usd.toFixed(4) + ' at today’s price (updated ' + Math.max(0, Math.round((Date.now() - U.at) / 60000)) + ' min ago); dollar amounts are today’s value, not the value on the payout day' : '');
|
||||
const rows = Array.isArray(POS) ? POS : (POS && (POS.positions || POS.list)) || [];
|
||||
$('posRows').innerHTML = rows.length ? rows.map(p => '<div class="rw"><span><b>' + (p.main ? 'Main position' : 'Position') + '</b> <span class="mono muted">' + (p.memberId ? '#' + p.memberId : 'not on chain yet') + '</span><br><span class="mono muted" style="font-size:11px">' + esc(String(p.address || '').slice(0, 10)) + '…</span></span><span class="num">' + fmt(p.avail || 0) + '</span><span>' + (p.memberId ? '<span class="tag ok">ACTIVE</span>' : '<span class="tag dim">PENDING</span>') + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">' + (addr ? 'Main wallet only.' : 'No positions yet.') + '</span></div>';
|
||||
: '<div class="rw" style="grid-template-columns:1fr"><span class="muted">' + (addr ? 'Main wallet only. Own another wallet? <a href="/credits">Add it as a position on Credits</a> and buy from it to self-qualify.' : 'No positions yet.') + '</span></div>';
|
||||
}
|
||||
CR.requireSession(load);
|
||||
})();
|
||||
|
||||
+40
-9
@@ -18,6 +18,16 @@ window.IAPWallet = (function () {
|
||||
const APPKIT_URL = 'https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@1.8.23/dist/appkit.js';
|
||||
|
||||
let modal = null, akPromise = null, provider = null;
|
||||
// EIP-6963 discovery (2026-10-21, Michael's Chrome: Phantom held window.ethereum, so every "pick an account" prompt went
|
||||
// to Phantom and failed). Every installed wallet announces itself here; with more than one, never assume the default
|
||||
// slot is the wallet the member means: send them through the wallet list, where each one is named.
|
||||
const announced = [];
|
||||
try {
|
||||
window.addEventListener('eip6963:announceProvider', e => { const d = e && e.detail; if (d && d.provider && !announced.some(x => x.provider === d.provider)) announced.push(d); });
|
||||
window.dispatchEvent(new Event('eip6963:requestProvider'));
|
||||
} catch (e) {}
|
||||
// the default-slot wallet, only when it is the ONLY wallet installed (older wallets that never announce count as one)
|
||||
const soleInjected = () => (window.ethereum && window.ethereum.request && announced.length <= 1) ? window.ethereum : null;
|
||||
|
||||
async function initAppKit(c) {
|
||||
if (modal) return modal;
|
||||
@@ -108,18 +118,24 @@ window.IAPWallet = (function () {
|
||||
async function pickAccount() {
|
||||
const c = await IAP.getConfig();
|
||||
await initAppKit(c);
|
||||
const inj = window.ethereum;
|
||||
const inj = soleInjected(); // several wallets installed: go straight to the named wallet list below
|
||||
if (inj && inj.request) {
|
||||
try {
|
||||
await inj.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] });
|
||||
const accs = await inj.request({ method: 'eth_accounts' });
|
||||
if (accs && accs[0]) { provider = inj; await ensureChain(c).catch(() => {}); return accs[0]; }
|
||||
if (accs && accs[0]) { provider = inj; clearPick(); await ensureChain(c).catch(() => {}); return accs[0]; }
|
||||
} catch (e) {
|
||||
if (e && (e.code === 4001 || /reject|denied/i.test(String(e.message || '')))) throw new Error('You closed the account picker. Pick the account you want and try again.');
|
||||
// closed the picker right after a Disconnect: they may want a different wallet app, so offer the full wallet list
|
||||
if (e && (e.code === 4001 || /reject|denied/i.test(String(e.message || ''))) && !pickPending()) throw new Error('You closed the account picker. Pick the account you want and try again.');
|
||||
}
|
||||
}
|
||||
return freshConnect(c);
|
||||
const a = await freshConnect(c, 'Pick the wallet to connect…'); clearPick(); return a;
|
||||
}
|
||||
// After Disconnect the next connect is a fresh choice (testers 2026-10-18: Disconnect, then the site snapped straight
|
||||
// back to the first MetaMask account, so a second wallet could never buy). The flag survives the reload some screens do.
|
||||
const PICK_KEY = 'ls.wallet.pick';
|
||||
const pickPending = () => { try { return localStorage.getItem(PICK_KEY) === '1'; } catch (e) { return false; } };
|
||||
function clearPick() { try { localStorage.removeItem(PICK_KEY); } catch (e) {} }
|
||||
|
||||
// A WalletConnect session can die underneath AppKit's cached "connected"
|
||||
// state: the wallet app rejects or kills it (Trust does this after its own
|
||||
@@ -128,9 +144,9 @@ window.IAPWallet = (function () {
|
||||
// Detect that, wipe the stale session, and re-open the picker for a fresh one.
|
||||
const DEAD_RE = /disconnect|not connected|no matching key|session (topic|expired|deleted|not found)|call connect|please call connect|missing or invalid|relay/i;
|
||||
const isDead = e => DEAD_RE.test(String((e && e.message) || e || ''));
|
||||
async function freshConnect(c) {
|
||||
try { IAP.status('Your wallet session dropped. Reconnect in the picker…'); } catch (e) {}
|
||||
await disconnect();
|
||||
async function freshConnect(c, msg) {
|
||||
try { IAP.status(msg || 'Your wallet session dropped. Reconnect in the picker…'); } catch (e) {}
|
||||
await dropSession();
|
||||
try { await modal.open(); } catch (e) {}
|
||||
const addr = await waitForConnection(180000);
|
||||
try { if (modal && modal.close) await modal.close(); } catch (e) {}
|
||||
@@ -142,6 +158,9 @@ window.IAPWallet = (function () {
|
||||
async function connect() {
|
||||
const c = await IAP.getConfig();
|
||||
await initAppKit(c);
|
||||
if (pickPending()) return pickAccount(); // the member pressed Disconnect: open the account picker, never the old session
|
||||
// an injected account chosen through pickAccount() is driven directly; AppKit may still hold (or lack) another one
|
||||
if (provider && provider === window.ethereum) { try { const a = await provider.request({ method: 'eth_accounts' }); if (a && a[0]) return a[0]; } catch (e) {} }
|
||||
let addr = currentAddress();
|
||||
if (!addr) {
|
||||
// give AppKit a moment to rehydrate an existing session before popping the
|
||||
@@ -269,12 +288,24 @@ window.IAPWallet = (function () {
|
||||
return { hash, receipt: await waitTx(hash) };
|
||||
}
|
||||
|
||||
async function disconnect() {
|
||||
// end the wallet session (a dead WalletConnect session, or the first half of a user Disconnect)
|
||||
async function dropSession() {
|
||||
// AppKit's disconnect can hang on the WalletConnect relay (esp. mobile) —
|
||||
// never block on it, so the UI can't get stuck "disconnecting".
|
||||
try { if (modal && modal.disconnect) await Promise.race([modal.disconnect(), new Promise(r => setTimeout(r, 1200))]); } catch (e) {}
|
||||
provider = null;
|
||||
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
|
||||
// keep wagmi/AppKit's own "user disconnected" markers: wiping them made the next page load auto-reconnect the
|
||||
// injected wallet (MetaMask still trusts the site), the snap-back testers hit on 2026-10-18
|
||||
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k) && !/disconnected|connection_status/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
|
||||
}
|
||||
// the member's Disconnect: let go for real, so the next connect can be a different account or wallet.
|
||||
// MetaMask keeps the site's permission across a plain disconnect; wallet_revokePermissions drops it
|
||||
// (wallets without it just ignore the call), and the pick flag makes the next connect open the picker.
|
||||
async function disconnect() {
|
||||
try { localStorage.setItem(PICK_KEY, '1'); } catch (e) {}
|
||||
const inj = (provider && provider.request && isInjected()) ? provider : soleInjected(); // revoke on the wallet actually in use
|
||||
if (inj && inj.request) { try { await Promise.race([inj.request({ method: 'wallet_revokePermissions', params: [{ eth_accounts: {} }] }), new Promise(r => setTimeout(r, 1000))]); } catch (e) {} }
|
||||
await dropSession();
|
||||
}
|
||||
|
||||
// native balance of the connected wallet (pre-flight check before a buy)
|
||||
|
||||
@@ -7,17 +7,4 @@
|
||||
document.getElementById('gate').style.display = signedIn ? 'none' : 'block';
|
||||
document.getElementById('body').style.display = signedIn ? 'block' : 'none';
|
||||
if (!signedIn) return;
|
||||
// MoonPay: same signed link the Buy pane uses, prefilled with this member's wallet when one is linked
|
||||
const mb = document.getElementById('wlMoonpay'), note = document.getElementById('wlMoonpayNote');
|
||||
if (note && !me.address) note.textContent = 'Link your wallet first (Wallet tab) and MoonPay opens with your address already filled in. Without it you paste the address yourself.';
|
||||
if (mb) mb.addEventListener('click', async () => {
|
||||
let pol = 30;
|
||||
try { const { products } = await (await fetch('/api/catalog')).json(); const p20 = (products || []).find(p => p.priceCents === 2000); if (p20 && p20.costWei) pol = Math.max(30, Math.ceil(Number(p20.costWei) / 1e18) + 3); } catch (e) {}
|
||||
try {
|
||||
const r = await (await fetch('/api/moonpay-url?pol=' + pol + (me.address ? '&address=' + encodeURIComponent(me.address) : ''))).json();
|
||||
if (!r.url) throw new Error('no url');
|
||||
window.open(r.url, '_blank', 'noopener');
|
||||
IAP.status(r.signed ? 'MoonPay opened with your wallet address pre-filled. Choose the amount, pay, and the POL lands in your wallet.' : 'MoonPay opened. Choose POL on the Polygon network and paste your own wallet address as the destination.', 'ok');
|
||||
} catch (e) { IAP.status('Could not open MoonPay. Try again in a minute.', 'bad'); }
|
||||
});
|
||||
})();
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
+16
-4
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>The contract | LinkSpin</title>
|
||||
@@ -16,9 +16,10 @@
|
||||
<meta name="twitter:image" content="{{SITE_URL}}/banners/linkspin-og-1200x630.png">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
<style>
|
||||
.rule{display:grid;grid-template-columns:150px minmax(0,1fr);gap:14px;padding:10px 0;border-bottom:1px solid var(--line);font-size:14px;color:var(--ink-2)}
|
||||
.rule:last-child{border-bottom:0}
|
||||
@@ -49,7 +50,7 @@
|
||||
<h1 class="disp" style="margin:0;font-size:44px;line-height:1.04">The contract, in plain words</h1>
|
||||
<p style="font-size:16px">Every dollar on this platform moves through one smart contract on Polygon. It takes a package payment and splits it to real wallets in the same transaction. It has no balance to drain, no pause button, and no owner power over money. This page says what it does, with the source beside it. Verify every claim yourself. That is the point.</p>
|
||||
<div class="ctas">
|
||||
<span class="mono" id="cAddr" style="font-size:12px;padding:10px 12px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;color:#8CC8FF;overflow-wrap:anywhere">…</span>
|
||||
<span class="mono" id="cAddr" style="font-size:12px;padding:10px 12px;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;color:var(--chrome-hi);overflow-wrap:anywhere">…</span>
|
||||
<span class="tag" id="cChain">…</span>
|
||||
</div>
|
||||
<div class="ctas">
|
||||
@@ -104,6 +105,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" id="ovPanel" hidden><!-- Level 4 override: shown only when overrideMode is live (contract.js) -->
|
||||
<div class="ph"><h2>Level 4 override</h2><span class="meta">company paid · weekly · not in the contract</span></div>
|
||||
<div class="pb" style="padding-top:6px">
|
||||
<div class="rule"><b>What</b><span>On top of the three levels above, the company pays 3% of every package bought four levels below you. It goes to the 4th sponsor up from the buyer, as long as that member has 5 or more qualifying buyers (referrals who bought a package of $25 or more), the same bar that opens level 3.</span></div>
|
||||
<div class="rule"><b>Hunts upward</b><span>If the 4th sponsor up is not qualified yet, the override moves up the line to the next member who is, up to 25 steps. One override per purchase, to one person. If it reaches the company account first, or nobody qualifies, the company keeps it.</span></div>
|
||||
<div class="rule"><b>Paid weekly</b><span>Every Monday after 9 AM Central, in POL, from a company wallet through this contract's public award function, for the Monday to Sunday week before. Every payment has its own Polygon link and shows on your Wallet screen as "Level 4 override". Weekly totals under 0.01 POL carry to the next week.</span></div>
|
||||
<div class="rule"><b>Start date</b><span>Purchases from <span data-ov-start>the start date</span> on. Earlier purchases are not paid.</span></div>
|
||||
<div class="rule"><b>Funding</b><span>It comes out of the platform's 20% share. The split the contract enforces does not change for anyone.</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>What this is and is not</h2><span class="meta">read before you buy</span></div>
|
||||
<div class="pb grid3" style="font-size:14px;color:var(--ink-2)">
|
||||
@@ -136,6 +148,6 @@
|
||||
<span class="mono" style="font-size:11px">Advertising services with a performance referral program. Not an investment. Crypto transactions are irreversible.</span>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/assets/contract.js?v=20261007a"></script>
|
||||
<script src="/assets/contract.js?v=20261023ov"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,285 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Conversion tracking: see which ad, link and page bring sign-ups | LinkSpin</title>
|
||||
<meta name="description" content="How to set up the LinkSpin conversion pixel: create a goal under Conversions, put the landing tag on the page your ad or spin link points to and the goal pixel on your thank-you page, then read conversions and cost per goal by campaign, spin link, page and traffic source. Copy-paste examples for HTML, WordPress, page builders, Aweber and GetResponse.">
|
||||
<link rel="canonical" href="{{SITE_URL}}/conversion-tracking">
|
||||
<meta property="og:type" content="website"><meta property="og:site_name" content="LinkSpin">
|
||||
<meta property="og:url" content="{{SITE_URL}}/conversion-tracking">
|
||||
<meta property="og:title" content="Conversion tracking: see which ad, link and page bring sign-ups">
|
||||
<meta property="og:description" content="Clicks tell you who looked. The LinkSpin conversion pixel tells you which ad, spin link, page and traffic source brought a subscriber or a sale. Free for every member. Set it up in four steps.">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
<style>
|
||||
.rg{max-width:980px}
|
||||
.rg p{margin:0}
|
||||
.pb{padding:14px 16px}
|
||||
.rg-two{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,400px),1fr));gap:12px}
|
||||
.rg-two .tile{display:grid;gap:4px;padding:12px 14px;font-size:14.5px;align-content:start;min-width:0}
|
||||
.rg-two .tile span{color:var(--ink-2)}
|
||||
/* the flow: across on a wide screen, down on a phone */
|
||||
.cg-flow{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:26px}
|
||||
.cg-flow li{position:relative;border:1px solid var(--line-strong);border-radius:8px;padding:10px 12px;font-size:13.5px;line-height:1.45;background:var(--panel);color:var(--ink-2);min-width:0}
|
||||
.cg-flow li b{display:block;font-weight:800;color:var(--ink);margin-bottom:3px}
|
||||
.cg-flow li .k{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;font:700 12px var(--mono);margin-bottom:6px;background:var(--chrome);color:var(--chrome-ink)}
|
||||
.cg-flow li code{font:500 12px var(--mono);color:var(--accent-hi);overflow-wrap:anywhere}
|
||||
.cg-flow li.f-ad{border-color:var(--accent);background:var(--accent-soft)}
|
||||
.cg-flow li.f-tag{border-color:var(--ok);background:var(--ok-soft)}
|
||||
.cg-flow li.f-px{border-color:var(--sig);background:var(--sig-soft)}
|
||||
.cg-flow li.f-win{border-color:var(--ok);background:var(--ok-soft)}
|
||||
.cg-flow li:not(:last-child)::after{content:"";position:absolute;right:-20px;top:50%;margin-top:-7px;border:7px solid transparent;border-left:9px solid var(--line-strong);border-right:0}
|
||||
@media (max-width:820px){
|
||||
.cg-flow{grid-template-columns:1fr;gap:24px}
|
||||
.cg-flow li:not(:last-child)::after{right:auto;left:22px;top:auto;bottom:-19px;margin-top:0;border:7px solid transparent;border-top:9px solid var(--line-strong);border-bottom:0}
|
||||
}
|
||||
/* member route */
|
||||
.rg-route{list-style:none;counter-reset:s;margin:0;padding:0;display:grid;gap:12px}
|
||||
.rg-route > li{counter-increment:s;display:grid;grid-template-columns:40px minmax(0,1fr);gap:14px;align-items:start;padding:12px 0;border-bottom:1px solid var(--line)}
|
||||
.rg-route > li:last-child{border-bottom:0}
|
||||
.rg-route > li::before{content:counter(s);font:700 20px var(--display);width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(180deg,#FF7A32,var(--sig));color:var(--sig-ink)}
|
||||
.rg-route > li > div{min-width:0;display:grid;gap:8px}
|
||||
.rg-route h3{font:700 17px var(--display);letter-spacing:.04em;text-transform:uppercase;margin:0;color:var(--ink)}
|
||||
.rg-route p{font-size:14px;color:var(--ink-2)}
|
||||
.rg-where{display:flex;flex-wrap:wrap;gap:6px}
|
||||
.rg-chip{font:700 11.5px var(--body);padding:3px 10px;border-radius:999px;background:var(--accent-soft);color:var(--accent-hi);border:1px solid var(--accent-dim)}
|
||||
.rg-chip.iap{background:var(--ok-soft);color:var(--ok);border-color:var(--ok-line)}
|
||||
/* code */
|
||||
.cg-code{border:1px solid var(--chrome-line);border-radius:8px;background:var(--inset);padding:10px 12px;min-width:0}
|
||||
.cg-code pre{margin:0;font:500 12.5px/1.6 var(--mono);color:var(--chrome-ink);white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
|
||||
.cg-lbl{display:flex;justify-content:space-between;align-items:center;gap:8px;font:700 10.5px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--chrome-sub);margin:0 0 6px}
|
||||
.cg-copy{font:700 12px var(--body);background:transparent;color:var(--chrome-ink);border:1px solid var(--chrome-sub);border-radius:6px;padding:2px 10px;cursor:pointer}
|
||||
.cg-copy:hover{background:var(--chrome-2)}
|
||||
.cg-ph{color:var(--chrome-warm);font-weight:700}
|
||||
.rg code.i{font:500 13px var(--mono);color:var(--accent-hi);background:var(--accent-soft);padding:1px 5px;border-radius:4px;overflow-wrap:anywhere}
|
||||
.cg-ex{display:grid;gap:8px}
|
||||
.cg-ex p,.cg-ex li{font-size:14px;color:var(--ink-2)}
|
||||
.cg-ex ol,.cg-ex ul{margin:0;padding-left:20px;display:grid;gap:5px}
|
||||
.cg-warn{border-left:4px solid var(--sig);background:var(--sig-soft);padding:10px 14px;border-radius:0 8px 8px 0;font-size:14px;color:var(--ink-2)}
|
||||
/* numbers */
|
||||
.rg-tbl table{width:100%;border-collapse:collapse;font-size:14px;table-layout:fixed}
|
||||
.rg-tbl th,.rg-tbl td{padding:9px 14px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}
|
||||
.rg-tbl th{font:700 10.5px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
|
||||
.rg-tbl td:first-child{width:32%;font-weight:700}
|
||||
.rg-tbl tr:last-child td{border-bottom:0}
|
||||
.cg-check{list-style:none;margin:0;padding:0;display:grid;gap:8px}
|
||||
.cg-check li{position:relative;padding:10px 12px 10px 40px;border:1px solid var(--line);border-radius:8px;background:var(--panel-2);font-size:14px;color:var(--ink-2)}
|
||||
.cg-check li::before{content:"";position:absolute;left:12px;top:12px;width:16px;height:16px;border-radius:4px;border:2px solid var(--accent)}
|
||||
.cg-check li b{color:var(--ink)}
|
||||
.rg-faq{display:grid;gap:14px;margin:0}
|
||||
.rg-faq dt{font-weight:800;color:var(--ink)}
|
||||
.rg-faq dd{margin:4px 0 0;color:var(--ink-2);font-size:14px}
|
||||
@media (max-width:640px){.rg h1{font-size:34px!important}.rg-route > li{grid-template-columns:34px minmax(0,1fr);gap:10px}.rg-route > li::before{width:34px;height:34px;font-size:17px}.rg-tbl th,.rg-tbl td{padding:8px 10px}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<div class="wrap">
|
||||
<a class="brand" href="/" aria-label="LinkSpin home"><span class="mark"></span><span class="word">Link<b>Spin</b></span></a>
|
||||
<span class="eyebrow" style="color:var(--chrome-sub);padding-left:14px;border-left:1px solid var(--chrome-line)">Conversion tracking</span>
|
||||
<span class="grow"></span>
|
||||
<a href="/conversions" class="btn ghost">Open Conversions</a>
|
||||
<a href="/join" class="btn pri">Start free</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="sec" style="padding-top:44px">
|
||||
<div class="wrap rg" style="display:grid;gap:22px">
|
||||
<div class="text" style="display:grid;gap:12px">
|
||||
<span class="eyebrow">LinkSpin + InstantAdPay · free for every member</span>
|
||||
<h1 class="disp" style="margin:0;font-size:44px;line-height:1.04">Conversion tracking: see which ad, link and page bring sign-ups</h1>
|
||||
<p style="font-size:16px;color:var(--ink-2)">Clicks tell you who looked. The conversion pixel tells you which ad, which spin link, which page and which traffic source brought a subscriber or a sale, and what each one cost you in credits. You paste two small tags on your own site, one time. After that, Conversions in your Control Room counts every goal against the click that sent it.</p>
|
||||
<div class="ctas"><a class="btn pri" href="/conversions">Open Conversions</a><a class="btn blue" href="/join">Not a member yet? Start free</a></div>
|
||||
</div>
|
||||
|
||||
<video src="https://coolify-saasytop.nyc3.digitaloceanspaces.com/training/conversion-tracking-ls.mp4?v=20261026" poster="https://coolify-saasytop.nyc3.digitaloceanspaces.com/training/conversion-tracking-ls.jpg?v=20261026" controls playsinline preload="metadata" width="1200" height="675" style="display:block;width:100%;height:auto;max-width:860px;background:#000;border-radius:16px;border:1px solid var(--line);margin:0 auto" aria-label="Video: Marty walks through setting up conversion tracking, about 3 minutes"></video>
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>Why track conversions</h2><span class="meta">why it matters</span></div>
|
||||
<div class="pb" style="display:grid;gap:12px">
|
||||
<div class="rg-two">
|
||||
<div class="tile"><b>Clicks are not sign-ups</b><span>One banner can get lots of clicks from people who never sign up. Another gets fewer clicks and brings you subscribers. Without tracking, both look the same, or the wrong one looks better.</span></div>
|
||||
<div class="tile"><b>Find the winner</b><span>Every goal is counted against the click that sent the visitor, so you see which ad campaign, spin link, destination page and traffic source produced it.</span></div>
|
||||
<div class="tile"><b>A cost per goal, in credits</b><span>Each ad campaign shows its goals, its rate and what each goal cost: the credits the campaign has spent, divided by its goals. Lower is better.</span></div>
|
||||
<div class="tile"><b>Put next month's fuel behind it</b><span>This is the "your numbers get useful" part of <a href="/refuel">Fuel Your Offers</a>. Run your traffic all month, let the goals come in, then put next month's refuel behind the ad, link and page that convert, instead of guessing. Your goals also feed the goals dial in the Engine Room.</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>How a conversion gets counted</h2><span class="meta">the flow</span></div>
|
||||
<div class="pb" style="display:grid;gap:12px">
|
||||
<ol class="cg-flow" aria-label="How a conversion gets counted, step by step">
|
||||
<li class="f-ad"><span class="k">1</span><b>Someone clicks</b>Your ad or your spin link. The click gets a random id, added to your page's address as <code>?lsclk=…</code></li>
|
||||
<li class="f-tag"><span class="k">2</span><b>They land on your page</b>The landing tag keeps that id on your own site for 30 days.</li>
|
||||
<li><span class="k">3</span><b>They sign up or buy</b>Through your form or your checkout. Nothing changes for them.</li>
|
||||
<li class="f-px"><span class="k">4</span><b>Your thank-you page loads</b>The goal pixel there reads the kept id and sends it to LinkSpin.</li>
|
||||
<li class="f-win"><span class="k">5</span><b>Counted in Conversions</b>Against the ad, spin link, page and source that sent them, with cost per goal.</li>
|
||||
</ol>
|
||||
<p class="muted" style="font-size:13px">The id is random. It identifies the click, not the person. Nothing personal is read from your page or sent anywhere. An ad click and the spin-link click it led to count as one click.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>Set it up in four steps</h2><span class="meta">one time</span></div>
|
||||
<div class="pb">
|
||||
<ol class="rg-route">
|
||||
<li><div>
|
||||
<h3>Create a goal</h3>
|
||||
<p>Open <b>Conversions</b> in your Control Room and press <b>Add a goal</b>. Name it with one word for what you count: <b>subscriber</b>, <b>sale</b>, <b>signup</b> (letters, numbers, - or _, up to 32). The default value is optional, in US dollars, used when the pixel carries none. Up to 20 goals per account.</p>
|
||||
<p>Each goal gets its own pixel id: <b>px</b> plus 10 letters and numbers. It is public and safe to paste: it can only count clicks that are yours. Once you have a goal, your spin links and Banner Spins add the click id to your destinations automatically.</p>
|
||||
<div class="rg-where"><span class="rg-chip">LinkSpin: Control Room, Conversions</span><span class="rg-chip iap">InstantAdPay: Campaigns, Conversion tracking</span></div>
|
||||
</div></li>
|
||||
<li><div>
|
||||
<h3>Landing tag on the page your traffic lands on</h3>
|
||||
<p>Under <b>Snippets for</b>, pick your goal and copy <b>1. Landing tag</b>. Paste it once on your landing page (the address your ad or spin link sends people to), just before <code class="i"></body></code>. It keeps the click id on your site for 30 days, fills hidden form fields named <code class="i">lsclk</code>, and adds the id to links that stay on your site.</p>
|
||||
<div class="cg-code"><div class="cg-lbl"><span>1. Landing tag</span><button class="cg-copy" type="button" data-copy>Copy</button></div><pre><script async src="https://linkspin.app/t.js?px=<span class="cg-ph">YOUR_PIXEL_ID</span>"></script></pre></div>
|
||||
<p>It is fine on every page of your site (in a site-wide footer). It never slows or breaks the page, even if LinkSpin cannot be reached, and it works inside traffic-exchange frames.</p>
|
||||
</div></li>
|
||||
<li><div>
|
||||
<h3>Goal pixel on your thank-you page</h3>
|
||||
<p>Copy the goal pixel and paste it on the page people see only after they sign up or buy. Use the script version (<b>2b</b>) wherever your page allows scripts: it reads the id the landing tag kept, the surest match. Use the image version (<b>2</b>) where scripts are not allowed.</p>
|
||||
<div class="cg-code"><div class="cg-lbl"><span>2b. Goal pixel, script (surest)</span><button class="cg-copy" type="button" data-copy>Copy</button></div><pre><script async src="https://linkspin.app/cv.js?px=<span class="cg-ph">YOUR_PIXEL_ID</span>&goal=<span class="cg-ph">subscriber</span>"></script></pre></div>
|
||||
<div class="cg-code"><div class="cg-lbl"><span>2. Goal pixel, image</span><button class="cg-copy" type="button" data-copy>Copy</button></div><pre><img src="https://linkspin.app/cv.gif?px=<span class="cg-ph">YOUR_PIXEL_ID</span>&goal=<span class="cg-ph">subscriber</span>" width="1" height="1" alt="" style="display:none"></pre></div>
|
||||
<p>Recording what a sale was worth? Add <code class="i">&value=19.95</code> to the pixel address. Without it, the goal's default value is used.</p>
|
||||
<div class="cg-warn"><b>Only on the thank-you page.</b> Never put the goal pixel on your landing page. Everyone who lands would count as a goal.</div>
|
||||
</div></li>
|
||||
<li><div>
|
||||
<h3>Send a test conversion</h3>
|
||||
<p>Press <b>Send a test conversion</b> next to the snippets. It loads your real pixel, is recorded apart and never counted, and the goal row shows when the last test arrived. That proves your pixel id works.</p>
|
||||
<p>To check the pixel on your real thank-you page, add <code class="i">&test=1</code> to the end of the pixel address, open your thank-you page once, then reload Conversions: the last test time updates. Take <code class="i">&test=1</code> back out afterwards. Last, open your own spin link, Banner Spin click link or ad and look at the address bar on your landing page: you should see <code class="i">lsclk=</code> in it. That click is yours, so anything you finish after it is kept as a test, never counted.</p>
|
||||
</div></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>Where the code goes, by platform</h2><span class="meta">copy and paste</span></div>
|
||||
<div class="pb" style="display:grid;gap:18px">
|
||||
<p class="muted" style="font-size:13.5px">In every example, replace <span class="mono" style="color:var(--sig-2);font-weight:700">YOUR_PIXEL_ID</span> with your goal's pixel id and <span class="mono" style="color:var(--sig-2);font-weight:700">subscriber</span> with your goal's name. The snippets on your Conversions screen come with both filled in.</p>
|
||||
<div class="cg-ex">
|
||||
<h3 style="margin:0">A plain HTML page</h3>
|
||||
<p>Landing page: the landing tag right before the closing body tag.</p>
|
||||
<div class="cg-code"><div class="cg-lbl"><span>landing.html</span><button class="cg-copy" type="button" data-copy>Copy</button></div><pre> ...your page...
|
||||
<script async src="https://linkspin.app/t.js?px=<span class="cg-ph">YOUR_PIXEL_ID</span>"></script>
|
||||
</body></pre></div>
|
||||
<p>Thank-you page: the goal pixel.</p>
|
||||
<div class="cg-code"><div class="cg-lbl"><span>thank-you.html</span><button class="cg-copy" type="button" data-copy>Copy</button></div><pre> ...your thank-you message...
|
||||
<script async src="https://linkspin.app/cv.js?px=<span class="cg-ph">YOUR_PIXEL_ID</span>&goal=<span class="cg-ph">subscriber</span>"></script>
|
||||
</body></pre></div>
|
||||
<p>Your own form on the landing page? Add a hidden field and the landing tag fills it with the click id, so your own system can keep it with the lead:</p>
|
||||
<div class="cg-code"><div class="cg-lbl"><span>hidden field</span><button class="cg-copy" type="button" data-copy>Copy</button></div><pre><input type="hidden" name="lsclk" value=""></pre></div>
|
||||
</div>
|
||||
<div class="cg-ex">
|
||||
<h3 style="margin:0">WordPress</h3>
|
||||
<ol>
|
||||
<li><b>Landing tag, site-wide:</b> with a header and footer plugin (WPCode, for example), paste the landing tag into the <b>footer</b> box and save. It now runs on every page, landing page included.</li>
|
||||
<li><b>Goal pixel, thank-you page only:</b> edit your thank-you page, add a <b>Custom HTML</b> block, paste the goal pixel into it and update the page. Do not put the goal pixel in the site-wide footer.</li>
|
||||
<li>If your WordPress plan or theme strips scripts out of blocks (some hosted plans do), use the image version of the goal pixel in the Custom HTML block.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="cg-ex">
|
||||
<h3 style="margin:0">Funnel and page builders</h3>
|
||||
<p>Most builders that allow custom code give you one of two places, and either works:</p>
|
||||
<ul>
|
||||
<li>A <b>tracking code</b> or <b>footer code</b> box in the page or funnel settings. Landing tag in the landing page's box, goal pixel in the thank-you page's box.</li>
|
||||
<li>A <b>custom HTML</b> or <b>code</b> element you drop onto the page. One on each page with the matching line.</li>
|
||||
</ul>
|
||||
<p>If a page only accepts images and no scripts, use the image version of the goal pixel there. Keep the landing page and the thank-you page on the same domain.</p>
|
||||
</div>
|
||||
<div class="cg-ex">
|
||||
<h3 style="margin:0">Autoresponders: Aweber, GetResponse and others</h3>
|
||||
<p>If your list provider shows its own thank-you page after someone subscribes, you cannot paste the pixel there. Point the provider at a thank-you page on <b>your</b> site instead, and put the goal pixel on that page.</p>
|
||||
<ul>
|
||||
<li><b>Aweber:</b> open your sign-up form's settings, set <b>Thank You Page</b> to a custom page, and paste your own page's address.</li>
|
||||
<li><b>GetResponse:</b> in the form or landing page settings, set the <b>thank-you page</b> to a custom URL, and paste your own page's address.</li>
|
||||
<li><b>Any other provider:</b> look for "thank-you page", "success page" or "redirect after sign-up" and give it your own page's address.</li>
|
||||
</ul>
|
||||
<p>Your own thank-you page needs only your message and the goal pixel. Keep the form on your landing page (where the landing tag runs) and use the same domain for both pages.</p>
|
||||
</div>
|
||||
<div class="cg-ex">
|
||||
<h3 style="margin:0">What if I can't put code on the thank-you page?</h3>
|
||||
<p>Best fix: send people to a thank-you page you control, as above. If that is not possible:</p>
|
||||
<ul>
|
||||
<li><b>The pixel can go on the thank-you page, but it is on another domain, or only images are allowed.</b> Use the image version. It cannot read the id your landing tag kept, so it counts through LinkSpin's cookie or the 24-hour match (the same network and browser within a day of the click). Both work, just less surely, and Conversions labels them so you can tell. Keep the landing tag on your landing page: it is what sets up both of these for spin-link clicks.</li>
|
||||
<li><b>No code of any kind after the sign-up.</b> Then nothing can tell LinkSpin the sign-up happened. You can still keep the click id with each lead through the hidden <code class="i">lsclk</code> field, if your provider stores custom fields.</li>
|
||||
<li><b>Your page signs people up without leaving the page</b> (a pop-up form). With the landing tag on that page, your page's own code can count the goal with one line after a successful sign-up: <code class="i">if (window.LinkSpin) LinkSpin.goal('YOUR_PIXEL_ID', 'subscriber');</code></li>
|
||||
<li><b>A tracker or traffic network wants the conversion too.</b> Set a postback to the event <code class="i">goal</code> on <a href="/links">Links</a> or on a <a href="/sources">traffic source</a>. It fires for every counted goal, with <code class="i">{event}</code> set to the goal's name.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel rg-tbl">
|
||||
<div class="ph"><h2>How to read Conversions</h2><span class="meta">your numbers</span></div>
|
||||
<table>
|
||||
<thead><tr><th>You see</th><th>What it means</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Counted</td><td>Goals counted in the range you picked (7, 30 or 90 days), tests and your own clicks (ads, spin links, Banner Spins) left out.</td></tr>
|
||||
<tr><td>Cost / goal</td><td>The credits the ad campaign has spent so far, divided by its goals of this goal type, in that site's ad credits. Clicks and goals follow the range; spend is the campaign's total, so on an older campaign the figure reads high.</td></tr>
|
||||
<tr><td>Rate</td><td>Goals divided by the campaign's tracked clicks in the range.</td></tr>
|
||||
<tr><td>Address</td><td>Surest. The thank-you page's own address still carried the click id.</td></tr>
|
||||
<tr><td>Kept</td><td>Exact. The landing tag kept the click id on your site and the goal pixel read it back.</td></tr>
|
||||
<tr><td>Cookie</td><td>Exact, through LinkSpin's own cookie. Some browsers block it.</td></tr>
|
||||
<tr><td>24 h match</td><td>The same network and browser within a day of the click. A good guess, not proof.</td></tr>
|
||||
<tr><td>Test / last test</td><td>When your last test conversion arrived. Tests are recorded apart and never counted.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pb" style="border-top:1px solid var(--line)"><p class="muted" style="font-size:13px">Each goal gets its own report: by ad campaign (LinkSpin and InstantAdPay), by spin link, by Banner Spin, by destination page and by traffic source (a source you named under Sources, or else the referring site or ad placement). Press CSV for every conversion with its time in Central time, goal, value, match method, campaign, spin link, page, source, country and device. The counting rules: each goal counts once per click, only within 30 days of a real click, and only for clicks on your own ads, links and Banner Spins. Your own clicks on any of them (made while signed in, or from a browser you sign in from) are kept as tests: the note at the top of "How sure is each count" says how many.</p></div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>Troubleshooting checklist</h2><span class="meta">not counting?</span></div>
|
||||
<div class="pb">
|
||||
<ul class="cg-check">
|
||||
<li><b>Is the pixel id right?</b> It is <code class="i">px</code> plus 10 letters and numbers, copied from Snippets. A removed goal's pixel stops counting.</li>
|
||||
<li><b>Did the test arrive?</b> Press Send a test conversion. If the last test time updates, the goal is live. If the <code class="i">&test=1</code> check on your real page does not update it, the pixel is not on that page or the page strips it.</li>
|
||||
<li><b>Does the click id reach your page?</b> Open your own spin link, Banner Spin or ad: your landing page's address should show <code class="i">lsclk=</code>. If it does not, something between the click and your page (another redirect or a link shortener) is dropping it. Point the link straight at the page with the landing tag.</li>
|
||||
<li><b>Banner Spin straight to a page?</b> That works too. Once you have a goal, a Banner Spin banner that points straight at a page adds its own click id (<code class="i">lsclk=</code>) to the page address, and its goals show under By Banner Spin. A banner that points at one of your spin links is counted under that spin link.</li>
|
||||
<li><b>Is the landing tag on the page the click lands on?</b> Exactly that address, not another page of your site.</li>
|
||||
<li><b>Same domain for both pages?</b> The landing tag keeps the id on one domain. If the landing page is on <code class="i">www.yoursite.com</code> and the thank-you page on <code class="i">yoursite.com</code> (or another site), the script pixel cannot read it and only the cookie or 24-hour match is left.</li>
|
||||
<li><b>Goal pixel only on the thank-you page?</b> Not in a site-wide footer, not on the landing page.</li>
|
||||
<li><b>Scripts stripped?</b> Some builders and hosted blogs remove scripts. Use the image version of the goal pixel there.</li>
|
||||
<li><b>Testing with your own clicks?</b> Your own clicks on your own ads, spin links and Banner Spins are kept as tests and never show in the counts, whether you are signed in or not on that browser (LinkSpin knows the browsers you sign in from). Use Send a test conversion and the <code class="i">&test=1</code> check above to test.</li>
|
||||
<li><b>Older than 30 days, or the same click twice?</b> A sign-up more than 30 days after the click does not count, and each click counts once per goal.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="ph"><h2>Questions members ask</h2><span class="meta">quick answers</span></div>
|
||||
<div class="pb">
|
||||
<dl class="rg-faq">
|
||||
<div><dt>Does it cost anything?</dt><dd>No. The conversion pixel is free for every member and uses no credits.</dd></div>
|
||||
<div><dt>Will the tags slow down or break my page?</dt><dd>No. Both load in the background, never stop your page from showing and do nothing visible. If LinkSpin cannot be reached, your page works exactly as before.</dd></div>
|
||||
<div><dt>Do I need a separate goal for each link or ad?</dt><dd>No. One goal covers every ad and spin link you own. Each conversion is counted against whichever click sent that visitor.</dd></div>
|
||||
<div><dt>I advertise on InstantAdPay too. Do I set it up twice?</dt><dd>No. Your InstantAdPay goals are these same goals, held on your LinkSpin account under the same email. One landing tag and one goal pixel count clicks from both sites.</dd></div>
|
||||
<div><dt>Is any personal data sent?</dt><dd>No. The click id is random. No name or email from your page is read or sent.</dd></div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="muted" style="font-size:12.5px">One credit is one cent of ad delivery. Credits are not money and cannot be withdrawn. Conversion tracking shows what your own ads and pages produce; it does not promise any number of sign-ups or sales. No income is guaranteed; any commissions depend on real purchases in your line and on your own effort. Cryptocurrency involves risk of loss. (<a href="https://instantadpay.com/conversion-tracking">The InstantAdPay side</a>.)</p>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="foot">
|
||||
<div class="wrap">
|
||||
<span class="word">Link<b>Spin</b></span>
|
||||
<a href="/">Home</a>
|
||||
<a href="/refuel">Fuel Your Offers</a>
|
||||
<a href="/support">Support</a>
|
||||
<a href="/terms">Terms</a>
|
||||
<a href="/privacy">Privacy</a>
|
||||
<a href="/disclaimer">Disclaimer</a>
|
||||
<span class="grow"></span>
|
||||
<span class="mono" style="font-size:11px">Advertising services with a performance referral program. Not an investment. Crypto transactions are irreversible.</span>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/assets/conversion-guide.js?v=20261024ct"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,75 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Conversions · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start}
|
||||
.panel{align-content:start}
|
||||
.range{display:flex;border:1px solid var(--line-strong);border-radius:var(--r);overflow:hidden;background:var(--panel-2)} .range button{background:transparent;border:0;color:var(--muted);font-family:var(--mono);font-size:12px;padding:5px 10px;cursor:pointer} .range button.on{background:var(--ink);color:var(--on-ink)}
|
||||
.goals .hd,.goals .rw{grid-template-columns:minmax(0,1fr) 120px 70px 90px 150px;gap:8px;align-items:center}
|
||||
.camps .hd,.camps .rw{grid-template-columns:minmax(0,1fr) 92px 60px 56px 60px 90px;gap:8px}
|
||||
.lst .hd,.lst .rw{grid-template-columns:minmax(0,1fr) 60px;gap:8px}
|
||||
.meth{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
|
||||
.meth .m{background:var(--panel-2);border:1px solid var(--line);border-radius:6px;padding:8px 10px;display:grid;gap:2px}
|
||||
.meth .m .k{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)} .meth .m .v{font-family:var(--display);font-weight:700;font-size:20px}
|
||||
.snip{display:grid;gap:6px;margin-top:10px} .snip .code{display:block;font-size:12px;line-height:1.6;padding:10px 12px;overflow-wrap:anywhere;white-space:pre-wrap}
|
||||
.steps{margin:6px 0 0;padding-left:20px;display:grid;gap:6px}
|
||||
.gsel{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
|
||||
.pill{font-family:var(--mono);font-size:11px;padding:1px 7px;border-radius:3px;background:var(--panel-2);border:1px solid var(--line)}
|
||||
@media (max-width:900px){.two{grid-template-columns:1fr}.body{padding:12px 16px}.goals .hd{display:none}.goals .rw{grid-template-columns:minmax(0,1fr) auto;row-gap:4px}.camps .hd,.camps .rw{grid-template-columns:minmax(0,1fr) 60px 44px 44px 64px;font-size:12px}.camps .hd span:nth-child(2),.camps .rw span:nth-child(2){display:none}.meth{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div class="body">
|
||||
<div class="panel">
|
||||
<div class="ph" style="display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px"><h2>Your goals</h2><button class="btn pri" type="button" id="addGoal">Add a goal</button></div>
|
||||
<div class="muted" style="margin:4px 0 10px">A goal is something you want counted: a subscriber, a sale, a sign-up. Each goal has its own pixel id. The id is public and safe to paste: it can only count clicks that are yours.</div>
|
||||
<div class="tbl goals"><div class="hd"><span>Goal</span><span>Pixel id</span><span class="r">Value</span><span class="r">Counted</span><span></span></div><div id="goalRows"></div></div>
|
||||
</div>
|
||||
<div class="two">
|
||||
<div class="panel">
|
||||
<h2>Set it up in 3 steps</h2>
|
||||
<div style="margin:2px 0 6px"><a href="/conversion-tracking" target="_blank" rel="noopener">How to set it up: the step-by-step guide with copy-paste examples (WordPress, page builders, Aweber, GetResponse)</a></div>
|
||||
<ol class="steps">
|
||||
<li><b>Landing page:</b> paste the landing tag once, before </body>. It keeps the click id on your own site for 30 days.</li>
|
||||
<li><b>Thank-you page:</b> paste the goal pixel for the goal (the image works anywhere; the script version is surer).</li>
|
||||
<li><b>Test it:</b> press <b>Send a test conversion</b> below. To check your real thank-you page, add <span class="mono">&test=1</span> to its pixel, open the page once, and the last test time updates (take it back out afterwards). Your own clicks on your ads, spin links and Banner Spins are kept as tests and never counted, so finishing your own form proves nothing in the counts.</li>
|
||||
</ol>
|
||||
<div class="gsel" style="margin-top:12px"><span class="muted">Snippets for</span><select class="field" id="goalPick" style="width:auto;min-width:160px"></select><button class="btn" type="button" id="testBtn">Send a test conversion</button><span class="muted" id="testNote"></span></div>
|
||||
<div class="snip"><span class="sec">1. Landing tag</span><code class="code mono" id="snTag"></code><div><button class="btn sm" type="button" data-copy="snTag">Copy</button></div></div>
|
||||
<div class="snip"><span class="sec">2. Goal pixel (image)</span><code class="code mono" id="snImg"></code><div><button class="btn sm" type="button" data-copy="snImg">Copy</button></div></div>
|
||||
<div class="snip"><span class="sec">2b. Goal pixel (script, reads what the landing tag kept)</span><code class="code mono" id="snJs"></code><div><button class="btn sm" type="button" data-copy="snJs">Copy</button></div></div>
|
||||
<div class="muted" style="margin-top:8px">Add <span class="mono">&value=19.95</span> to the pixel to record what the sale was worth. Without it, the goal's default value is used.</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<h2>Autoresponders and hosted thank-you pages</h2>
|
||||
<div class="ink2" style="display:grid;gap:8px">
|
||||
<p style="margin:0">If your list provider shows its own thank-you page, you cannot paste the pixel there. Point the provider at a page on <b>your</b> site instead, and put the pixel on that page.</p>
|
||||
<p style="margin:0"><b>Aweber:</b> open your sign-up form, go to its settings, set <b>Thank You Page</b> to a custom page and paste your page's address.</p>
|
||||
<p style="margin:0"><b>GetResponse:</b> in the form or landing page settings, set the <b>thank-you page</b> to a custom URL and paste your page's address.</p>
|
||||
<p style="margin:0">If you cannot change it, the pixel can still count through LinkSpin's cookie or the 24-hour match, just less surely.</p>
|
||||
<p style="margin:0"><b>Forms on your own page:</b> add a hidden field named <span class="mono">lsclk</span> and the landing tag fills it with the click id, so your own system can pass it on.</p>
|
||||
<p style="margin:0"><b>Postbacks:</b> a postback set to the event <span class="mono">goal</span> (on <a href="/links">Links</a> or a <a href="/sources">traffic source</a>) fires for every goal, with <span class="mono">{event}</span> = the goal's name.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="ph" style="display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px"><h2>How sure is each count</h2><span class="muted" id="totalNote"></span></div>
|
||||
<div class="meth" id="methRows"></div>
|
||||
<div class="muted" style="margin-top:8px"><b>Address</b>: the click id was on the thank-you page's address. <b>Kept</b>: the landing tag kept it on your site. Both are exact. <b>Cookie</b>: LinkSpin's own cookie, exact but some browsers block it. <b>24 h match</b>: same network and browser within a day of the click, a good guess, not proof. Each goal counts once per click, only within 30 days of the click, and only for clicks on your own ads and links.</div>
|
||||
</div>
|
||||
<div id="goalReports"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/conversions.js?v=20261026a"></script>
|
||||
</body>
|
||||
</html>
|
||||
+14
-10
@@ -1,19 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Credits · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
|
||||
.pkgs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
|
||||
.pk{border:1px solid var(--line);border-radius:8px;padding:12px 12px 10px;background:#FFF;display:flex;flex-direction:column;gap:4px;cursor:pointer;text-align:left;font:inherit;color:inherit;min-height:44px;box-shadow:var(--sh)}
|
||||
.pk{border:1px solid var(--line);border-radius:8px;padding:12px 12px 10px;background:var(--panel);display:flex;flex-direction:column;gap:4px;cursor:pointer;text-align:left;font:inherit;color:inherit;min-height:44px;box-shadow:var(--sh)}
|
||||
.pk:hover{border-color:var(--accent)}
|
||||
.pk.on{border-color:var(--sig);box-shadow:0 0 0 3px rgba(255,106,26,.18);background:linear-gradient(180deg,#FFFFFF,var(--hi-row))}
|
||||
.pk.on{border-color:var(--sig);box-shadow:0 0 0 3px color-mix(in srgb,var(--sig) 18%,transparent);background:linear-gradient(180deg,var(--panel),var(--hi-row))}
|
||||
.pk .k{font:700 10px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
|
||||
.pk.on .k{color:var(--sig-2)}
|
||||
.pk .price{font-family:var(--display);font-weight:700;font-size:28px;line-height:1;letter-spacing:.02em}
|
||||
@@ -24,6 +25,7 @@
|
||||
.row:last-child{border-bottom:0}
|
||||
.buys .hd,.buys .rw{grid-template-columns:150px 110px 130px minmax(0,1fr)}
|
||||
.acts{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
|
||||
.acts[hidden]{display:none}
|
||||
@media (max-width:900px){.two{grid-template-columns:1fr}.pkgs{grid-template-columns:repeat(2,minmax(0,1fr))}.buys .hd{display:none}.buys .rw{grid-template-columns:1fr 1fr}.body{padding:12px 16px}}
|
||||
</style>
|
||||
</head>
|
||||
@@ -33,7 +35,7 @@
|
||||
<div class="tiles" id="tiles"></div>
|
||||
<div class="two">
|
||||
<div style="display:grid;gap:16px;align-content:start">
|
||||
<div class="panel" style="padding:0">
|
||||
<div class="panel" id="buyPanel" style="padding:0">
|
||||
<div class="ph"><h3>Buy a package</h3><span class="meta" id="buyMeta">priced in dollars · settled in POL at the live rate · one transaction</span></div>
|
||||
<div style="padding:14px 16px 16px;display:grid;gap:14px">
|
||||
<div class="pkgs" id="pkgs"><div class="muted">loading packages…</div></div>
|
||||
@@ -41,9 +43,9 @@
|
||||
<span class="led"><span style="font-size:10px;letter-spacing:.1em;text-transform:uppercase">you pay</span><b id="payPol">·</b><span id="payUsd"></span></span>
|
||||
<span class="mono muted" style="font-size:11px" id="rateLine"></span>
|
||||
</div>
|
||||
<div class="acts" id="fromWrap" hidden><label class="lbl" style="min-width:min(100%,320px)">Buy from<select class="field" id="buyFrom"></select></label><span class="muted" style="font-size:12px" id="fromHint"></span></div>
|
||||
<div class="acts" id="buyActs">
|
||||
<button class="btn pri" type="button" id="buyBtn" disabled>Connect a wallet to buy</button>
|
||||
<button class="btn" type="button" id="cardBtn">Buy POL with a card</button>
|
||||
<span class="muted" style="font-size:12px">SafePal recommended. MetaMask, Phantom and WalletConnect wallets also work.</span>
|
||||
</div>
|
||||
<div id="holdBox" class="warn" style="font-size:13px" hidden></div>
|
||||
@@ -58,6 +60,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:grid;gap:16px;align-content:start">
|
||||
<div class="panel" id="rfPanel" hidden style="padding:0" aria-live="polite"><div class="ph"><h3>Monthly Refuel</h3><span class="meta" id="rfMeta"></span></div><div style="padding:12px 16px 14px;font-size:13px" class="ink2" id="rfBody"></div></div>
|
||||
<div class="panel" style="padding:0">
|
||||
<div class="ph"><h3 id="goesTitle">Where it goes</h3><span class="meta">same transaction</span></div>
|
||||
<div style="padding:10px 16px 14px" id="goesRows"></div>
|
||||
@@ -78,9 +81,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/wallet.js?v=20261008a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/credits-screen.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/wallet.js?v=20261021a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/credits-screen.js?v=20261101t"></script>
|
||||
<script src="/assets/fuel.js?v=20261025ff"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/* LinkSpin goal pixel, script version (conversion pixel, 2026-10-23). Paste on your thank-you page:
|
||||
* <script async src="https://linkspin.app/cv.js?px=YOUR_PIXEL_ID&goal=subscriber"></script> (optional &value=19.95)
|
||||
* It sends the click id from this page's address, or the one the landing tag (t.js) kept on your site, to LinkSpin.
|
||||
* The image version (cv.gif) works without scripts; this one is surer because it can read what the landing tag kept.
|
||||
* It never throws and never blocks your page.
|
||||
*/
|
||||
(function () {
|
||||
try {
|
||||
var RX = /^[a-z0-9]{6,24}$/i, W = window;
|
||||
function stored() {
|
||||
var v = '';
|
||||
try { var j = JSON.parse(W.localStorage.getItem('ls_clk') || 'null'); if (j && RX.test(j.id || '') && Date.now() - (j.ts || 0) < 30 * 864e5) v = j.id; } catch (e) {}
|
||||
if (!v) { try { var m = /(?:^|;\s*)ls_clk=([a-z0-9]{6,24})/i.exec(document.cookie || ''); if (m) v = m[1]; } catch (e) {} }
|
||||
return v;
|
||||
}
|
||||
var q = new URLSearchParams(location.search);
|
||||
var inUrl = q.get('lsclk') || q.get('lsid') || q.get('clickid') || '';
|
||||
var c = '', m = '';
|
||||
if (RX.test(inUrl)) { c = inUrl; m = 'url'; } else { c = stored(); m = c ? 'stored' : ''; }
|
||||
var list = document.getElementsByTagName('script');
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var s = list[i];
|
||||
try {
|
||||
if (!/\/cv\.js(\?|$)/.test(s.src || '') || s.getAttribute('data-ls-done')) continue;
|
||||
s.setAttribute('data-ls-done', '1');
|
||||
var u = new URL(s.src, location.href), px = u.searchParams.get('px') || '';
|
||||
if (!/^px[a-f0-9]{10}$/.test(px)) continue;
|
||||
var goal = u.searchParams.get('goal') || '', value = u.searchParams.get('value');
|
||||
var out = u.origin + '/cv.gif?px=' + px + (goal ? '&goal=' + encodeURIComponent(goal) : '') + (value != null && value !== '' ? '&value=' + encodeURIComponent(value) : '') + (c ? '&c=' + encodeURIComponent(c) + '&m=' + m : '') + (u.searchParams.get('test') === '1' ? '&test=1' : '') + '&r=' + Math.random().toString(36).slice(2, 8);
|
||||
var im = new Image(1, 1); im.src = out;
|
||||
} catch (e) {}
|
||||
}
|
||||
} catch (e) { /* never break the member's page */ }
|
||||
})();
|
||||
@@ -1,14 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Risk and Earnings Disclaimer | LinkSpin</title>
|
||||
<meta name="description" content="LinkSpin risk and earnings disclaimer.">
|
||||
<link rel="canonical" href="{{SITE_URL}}/disclaimer">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
|
||||
+6
-5
@@ -1,14 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="dark">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>How earning works | LinkSpin</title>
|
||||
<meta name="description" content="How members earn ad credits on LinkSpin: the daily set, the claim streak, verified visits, videos, inbox ads, the login bonus, and what to do with the credits.">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta name="theme-color" content="#043b2f">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@500;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20260916a">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20261101t">
|
||||
<style>
|
||||
.eg{max-width:820px}
|
||||
.eg h2{font-size:23px;margin:40px 0 10px;padding-top:18px;border-top:1px solid var(--line)}
|
||||
@@ -17,7 +18,7 @@
|
||||
table{border-collapse:collapse;width:100%;max-width:560px;margin:10px 0 16px;font-variant-numeric:tabular-nums;font-size:15px}
|
||||
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line)} th{color:var(--muted);font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;font-weight:500}
|
||||
td:last-child,th:last-child{text-align:right}
|
||||
.rule{border-left:4px solid var(--mint);background:rgba(59,157,255,.07);padding:14px 18px;border-radius:0 12px 12px 0;margin:0 0 20px}
|
||||
.rule{border-left:4px solid var(--mint);background:var(--mint-faint);padding:14px 18px;border-radius:0 12px 12px 0;margin:0 0 20px}
|
||||
.rule b{font-family:var(--disp);display:block;margin-bottom:4px}
|
||||
</style>
|
||||
</head>
|
||||
@@ -60,7 +61,7 @@
|
||||
|
||||
<h2>6. Now spend it</h2>
|
||||
<p>Credits sitting in your balance do nothing. Campaigns › New campaign: pick a banner or a text ad, give it a name and a budget in credits, point it at your own invite link or wall, and launch. Banner and text ads also push out to the partner network, so a 100-credit campaign is a hundred cents of real delivery. The done screen has a one-tap button for this after every claim.</p>
|
||||
<p>Two things to know: a campaign reserves its whole budget the moment you start it, so your available balance drops right away and never surprises you later, and login ads are the one format that needs purchased credits.</p>
|
||||
<p>Two things to know: a campaign reserves its whole budget the moment you start it, so your available balance drops right away and never surprises you later, and login ads are the one format that needs purchased credits: a login-ad slot is 1,000 purchased credits for 30 days of unlimited sign-in impressions, 3 slots at a time, first come first served.</p>
|
||||
|
||||
<p class="muted small" style="margin-top:30px">No income is guaranteed. Results depend on your effort. Cryptocurrency involves risk of loss. LinkSpin sells advertising; it is not an investment.</p>
|
||||
<footer>
|
||||
@@ -68,6 +69,6 @@
|
||||
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-3
@@ -1,12 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Help · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px;max-width:980px}
|
||||
.hl .hd,.hl .rw{grid-template-columns:minmax(0,1fr) 150px 130px}.hl .rw{cursor:pointer}
|
||||
@@ -29,7 +30,7 @@
|
||||
<div id="page">
|
||||
<div class="body" id="helpBody"><div class="panel"><span class="muted">loading</span></div></div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/help-screen.js?v=20261016a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>LinkSpin: one link, every page you promote</title>
|
||||
@@ -18,9 +18,10 @@
|
||||
<meta name="twitter:image" content="{{SITE_URL}}/banners/linkspin-og-1200x630.png">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
+6
-5
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Join LinkSpin</title>
|
||||
@@ -7,12 +7,13 @@
|
||||
<meta name="robots" content="noindex, follow">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
<style>
|
||||
.spon{display:inline-flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--line);border-radius:999px;background:#FFF;align-self:flex-start;max-width:100%}
|
||||
.spon .av{width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent-dim));display:grid;place-items:center;color:#fff;font:700 11px var(--mono);overflow:hidden;flex:none}
|
||||
.spon{display:inline-flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--line);border-radius:999px;background:var(--panel);align-self:flex-start;max-width:100%}
|
||||
.spon .av{width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent-dim));display:grid;place-items:center;color:var(--accent-ink);font:700 11px var(--mono);overflow:hidden;flex:none}
|
||||
.spon .av img{width:100%;height:100%;object-fit:cover}
|
||||
.steps{display:flex;flex-direction:column;gap:12px;margin-top:6px}
|
||||
.step{display:flex;gap:12px;align-items:flex-start}
|
||||
@@ -105,7 +106,7 @@ body.squeeze .card{position:sticky;top:16px}
|
||||
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/join.js?v=20261009b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+12
-11
@@ -1,41 +1,42 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="dark">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Founding week checklist | LinkSpin</title>
|
||||
<meta name="description" content="The eight things a leader gets done before launch, and why the order matters. Member training.">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta name="theme-color" content="#043b2f">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@500;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20260916a">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20261101t">
|
||||
<style>
|
||||
.lw-rule{border-left:4px solid #f2c94c;background:rgba(242,201,76,.08);padding:16px 20px;border-radius:0 12px 12px 0;margin:0 0 24px}
|
||||
.lw-rule{border-left:4px solid var(--gold-2);background:var(--gold-soft);padding:16px 20px;border-radius:0 12px 12px 0;margin:0 0 24px}
|
||||
.lw-rule b{font-family:var(--disp);font-size:17px;display:block;margin-bottom:6px}
|
||||
.lw-top{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;margin:0 0 18px}
|
||||
.lw-count{font-family:var(--disp);font-weight:800;font-size:15px}
|
||||
.lw-count b{color:var(--mint);font-size:22px}
|
||||
.lw-bar{height:10px;border-radius:99px;background:rgba(255,255,255,.06);overflow:hidden;margin:8px 0 0;width:100%}
|
||||
.lw-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--mint),#9ff2dc);width:0;transition:width .4s}
|
||||
.lw-bar{height:10px;border-radius:99px;background:var(--ink-faint);overflow:hidden;margin:8px 0 0;width:100%}
|
||||
.lw-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--mint),var(--cyan));width:0;transition:width .4s}
|
||||
.lw-when{font-family:var(--mono);font-size:12px;color:var(--muted)}
|
||||
.lw-when b{color:var(--ink);font-family:var(--disp);font-size:18px;display:block}
|
||||
.chk{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
|
||||
.chk li{display:grid;grid-template-columns:34px 1fr auto;gap:14px;align-items:start;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:14px 16px}
|
||||
.chk li.done{border-color:rgba(59,157,255,.45)}
|
||||
.chk li.done{border-color:var(--mint-line)}
|
||||
.chk .box{width:30px;height:30px;border-radius:9px;border:2px solid var(--line-strong);display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--mint);font-size:18px}
|
||||
.chk li.done .box{background:rgba(59,157,255,.14);border-color:var(--mint)}
|
||||
.chk li.done .box{background:var(--mint-soft-2);border-color:var(--mint)}
|
||||
.chk h3{margin:0 0 3px;font-size:16px}
|
||||
.chk p{margin:0;color:var(--muted);font-size:14px}
|
||||
.chk .why{margin-top:6px;font-size:13px;color:var(--ink)}
|
||||
.chk .act{white-space:nowrap}
|
||||
.chk .act .btn{margin-top:0}
|
||||
.days{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
|
||||
.days>div{background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:10px;padding:12px 14px;font-size:14px}
|
||||
.days>div{background:var(--ground-soft);border:1px solid var(--line);border-radius:10px;padding:12px 14px;font-size:14px}
|
||||
.days .k{font-family:var(--disp);font-weight:800;color:var(--mint);margin-bottom:6px}
|
||||
.days ul{margin:0;padding-left:18px}
|
||||
blockquote{margin:0 0 10px;background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:10px;padding:12px 16px;color:var(--muted)}
|
||||
blockquote{margin:0 0 10px;background:var(--ground-soft);border:1px solid var(--line);border-radius:10px;padding:12px 16px;color:var(--muted)}
|
||||
blockquote span{display:block;font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--mint);margin-bottom:6px}
|
||||
.swipe{margin:0 0 12px;background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:10px;padding:12px 16px}
|
||||
.swipe{margin:0 0 12px;background:var(--ground-soft);border:1px solid var(--line);border-radius:10px;padding:12px 16px}
|
||||
.swipe .cap{font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--mint);margin-bottom:6px;display:flex;justify-content:space-between;gap:10px;align-items:center}
|
||||
.swipe .subj{font-weight:700;margin:0 0 8px}
|
||||
.swipe pre{white-space:pre-wrap;font:inherit;color:var(--muted);margin:0;line-height:1.5}
|
||||
@@ -104,7 +105,7 @@
|
||||
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/launch.js?v=20260915b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Live ledger | LinkSpin</title>
|
||||
@@ -16,9 +16,10 @@
|
||||
<meta name="twitter:image" content="{{SITE_URL}}/banners/linkspin-og-1200x630.png">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
@@ -64,7 +65,7 @@
|
||||
<span class="mono" style="font-size:11px">a Crypto Team Build Network property</span>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/ledger.js?v=20261007a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+129
-10
@@ -1,22 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Links · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>
|
||||
.ws{display:grid;grid-template-columns:320px minmax(0,1fr);min-height:calc(100vh - 94px)}
|
||||
.dbody .tiles{grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
|
||||
.list{border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0;background:rgba(255,255,255,.55)}
|
||||
.list{border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0;background:var(--panel-glass)}
|
||||
.list .hd{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line)}
|
||||
.list .hd h2{font-family:var(--display);font-size:20px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;margin:0}
|
||||
.list .flt{padding:8px 16px;border-bottom:1px solid var(--line)}
|
||||
.list .items{overflow:auto}
|
||||
.item{display:grid;grid-template-columns:minmax(0,1fr) 64px;gap:8px;padding:11px 16px;border-bottom:1px solid var(--line);border-left:3px solid transparent;cursor:pointer}
|
||||
.item:hover{background:rgba(31,111,235,.05)} .item.on{background:var(--panel);border-left-color:var(--sig)}
|
||||
.item:hover{background:var(--row-hover)} .item.on{background:var(--panel);border-left-color:var(--sig)}
|
||||
.item .nm{font-weight:700;display:flex;gap:8px;align-items:center;flex-wrap:wrap} .item .cd{font-family:var(--mono);font-size:11px;color:var(--muted)}
|
||||
.item .rt{display:grid;justify-items:end;gap:3px} .item .rt .n{font-family:var(--mono)}
|
||||
.detail{display:flex;flex-direction:column;min-width:0}
|
||||
@@ -25,11 +26,23 @@
|
||||
.dbody{padding:16px 24px;display:grid;gap:14px}
|
||||
.dest .hd,.dest .rw{grid-template-columns:minmax(0,2fr) 150px 80px 80px 110px 130px}
|
||||
.dest .rw.edit{grid-template-columns:1fr;background:var(--panel-2)}
|
||||
/* Compact rows when the TABLE (not the window) is narrow: the detail pane sits beside the link list and the rail, so a
|
||||
desktop window could leave the destination column near 0 px and wrap the URL one letter per line (Michael, 10-21). */
|
||||
.tbl.dest{container-type:inline-size}
|
||||
@container (max-width:860px){
|
||||
.dest .hd{display:none}
|
||||
.dest .rw:not(.edit){display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px}
|
||||
.dest .rw:not(.edit)>div:first-child{flex:1 1 100%;min-width:0}
|
||||
.dest .rw:not(.edit)>.r{text-align:left}
|
||||
.dest .rw:not(.edit)>.r:nth-child(3)::before{content:"Clicks ";color:var(--muted);font-size:11px}
|
||||
.dest .rw:not(.edit)>.r:nth-child(4)::before{content:"Unique ";color:var(--muted);font-size:11px}
|
||||
.dest .rw:not(.edit)>span:last-child{margin-left:auto}
|
||||
}
|
||||
.dest .dl{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
||||
.hdot{display:inline-block;width:9px;height:9px;border-radius:50%;background:var(--line-strong);flex:none;vertical-align:middle}
|
||||
.hdot.ok{background:var(--ok);box-shadow:0 0 0 2px rgba(14,138,92,.2)} .hdot.warn{background:#D98B0C;box-shadow:0 0 0 2px rgba(217,139,12,.2)} .hdot.bad{background:var(--bad);box-shadow:0 0 0 2px rgba(185,28,28,.2)}
|
||||
.hchip{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10px;font-weight:700;color:var(--ink-2);border:1px solid var(--line-strong);border-radius:999px;padding:2px 8px;white-space:nowrap;background:#fff;cursor:pointer;letter-spacing:.02em}
|
||||
.hchip.set{color:var(--sig-2);border-color:rgba(255,106,26,.5);background:var(--sig-soft)}
|
||||
.hdot.ok{background:var(--ok);box-shadow:0 0 0 2px color-mix(in srgb,var(--ok) 20%,transparent)} .hdot.warn{background:var(--note-line);box-shadow:0 0 0 2px color-mix(in srgb,var(--note-line) 20%,transparent)} .hdot.bad{background:var(--bad);box-shadow:0 0 0 2px color-mix(in srgb,var(--bad) 20%,transparent)}
|
||||
.hchip{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10px;font-weight:700;color:var(--ink-2);border:1px solid var(--line-strong);border-radius:999px;padding:2px 8px;white-space:nowrap;background:var(--panel);cursor:pointer;letter-spacing:.02em}
|
||||
.hchip.set{color:var(--sig-2);border-color:var(--sig-line);background:var(--sig-soft)}
|
||||
.he{display:grid;gap:10px}
|
||||
.he-presets{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
|
||||
.he-tz{display:flex;gap:8px;align-items:center;flex-wrap:wrap} .he-tz select{width:auto;min-width:180px} .he-tz input{width:200px}
|
||||
@@ -42,7 +55,7 @@
|
||||
.he-grid .c.on{background:var(--sig);border-color:var(--sig-2)}
|
||||
.he-sum{font-weight:700} .he-sum small{font-weight:500;color:var(--muted)}
|
||||
.he .acts{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
||||
.note{border:1px solid rgba(194,65,12,.4);background:var(--warn-soft);color:var(--warn);border-radius:8px;padding:8px 12px;font-size:12px}
|
||||
.note{border:1px solid var(--warn-line);background:var(--warn-soft);color:var(--warn);border-radius:8px;padding:8px 12px;font-size:12px}
|
||||
.wrow{display:flex;align-items:center;gap:8px} .wrow input{width:56px}
|
||||
.empty{padding:40px 24px;color:var(--muted);text-align:center;display:grid;gap:10px;justify-items:center}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:16px}
|
||||
@@ -52,10 +65,36 @@
|
||||
@media (max-width:760px){.ws{grid-template-columns:minmax(0,1fr)}.tabs{flex-wrap:wrap}.list{border-right:0;border-bottom:1px solid var(--line);max-height:44vh}.ws.focus .list{display:none}.ws:not(.focus) .detail{display:none}
|
||||
.dhead{padding:12px 16px}.dhead .code{flex:1 1 100%;word-break:break-all}.dbody{padding:12px 16px}
|
||||
.dest .rw{grid-template-columns:1fr}.dest .rw .r{text-align:left}#addRow{grid-template-columns:1fr}.tiles{grid-template-columns:repeat(2,minmax(0,1fr))}.kv{grid-template-columns:minmax(0,1fr) 50px 50px}}
|
||||
/* Banner Spin builder (2026-10-18) */
|
||||
.vsw{display:flex;gap:4px;padding:10px 16px 0;border-bottom:1px solid var(--line);background:var(--panel)}
|
||||
.vsw button{background:transparent;border:1px solid transparent;border-bottom:0;border-radius:8px 8px 0 0;color:var(--muted);font-family:var(--display);font-size:15px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:7px 14px;cursor:pointer;margin-bottom:-1px}
|
||||
.vsw button.on{background:var(--bg,#f6f8fb);border-color:var(--line);color:var(--accent-hi)}
|
||||
.vsw .nw{font-family:var(--mono);font-size:9px;letter-spacing:.06em;color:var(--sig-2);margin-left:4px}
|
||||
.bsr .hd,.bsr .rw{grid-template-columns:minmax(0,2.4fr) 140px 80px 80px 96px 130px}
|
||||
.bsr .rw.edit{grid-template-columns:1fr;background:var(--panel-2)}
|
||||
.bthumb{display:block;max-width:100%;max-height:96px;width:auto;height:auto;border:1px solid var(--line);border-radius:4px;background:repeating-conic-gradient(var(--panel-2) 0 25%,var(--panel) 0 50%) 50%/12px 12px}
|
||||
.bprev{display:grid;gap:6px;justify-items:start;overflow:auto;max-width:100%}
|
||||
.bprev img{display:block;max-width:100%;height:auto;border:1px dashed var(--line-strong);background:repeating-conic-gradient(var(--panel-2) 0 25%,var(--panel) 0 50%) 50%/12px 12px}
|
||||
.bframe{border:1px dashed var(--line-strong);display:grid;place-items:center;color:var(--muted);font-family:var(--mono);font-size:11px;max-width:100%;background:var(--panel-2)}
|
||||
.addg{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
|
||||
.addg .full{grid-column:1/-1}
|
||||
.tgt{display:grid;grid-template-columns:180px minmax(0,1fr);gap:8px;align-items:end}
|
||||
.okm{color:var(--ok);font-size:12px} .wm{color:var(--warn);font-size:12px} .bm{color:var(--bad);font-size:12px}
|
||||
.code-blk{display:grid;gap:6px} .code-blk pre{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font-family:var(--mono);font-size:12px;background:var(--panel-2);border:1px solid var(--line);border-radius:6px;padding:8px 10px}
|
||||
.code-blk .hd2{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
|
||||
.tierbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;font-size:12.5px}
|
||||
.modes{display:grid;gap:8px} .modes label{display:flex;gap:8px;align-items:flex-start;cursor:pointer} .modes input{margin-top:3px}
|
||||
.bsr .ml{display:none}
|
||||
.st3 .hd,.st3 .rw{grid-template-columns:minmax(0,2fr) 80px 70px 70px 64px 74px 56px}
|
||||
.st3 .ml{display:none} .bhl{font-size:11.5px} .bswin{background:var(--ok);color:var(--ok-ink);border-radius:3px;padding:1px 6px;font-size:10px;font-weight:700;letter-spacing:.06em;margin-left:6px;vertical-align:middle}
|
||||
.bscache{display:block;margin-top:3px;font-size:11px;color:var(--warn)} .bsbreak{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
|
||||
@media (max-width:900px){.bsr .ml,.st3 .ml{display:inline;color:var(--muted);font-size:11px}.bsr .rw .r,.st3 .rw .r{text-align:left}.bsr .hd,.st3 .hd{display:none}.bsr .rw{grid-template-columns:1fr 1fr}.st3 .rw{grid-template-columns:1fr 1fr 1fr}.st3 .rw>:first-child{grid-column:1/-1}.addg{grid-template-columns:1fr}.bsbreak{grid-template-columns:1fr}}
|
||||
@media (max-width:760px){.bsr .rw{grid-template-columns:1fr}.tgt{grid-template-columns:1fr}.vsw{padding:8px 10px 0}.vsw button{padding:6px 10px;font-size:14px}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div class="vsw" id="vsw" role="tablist" aria-label="Link type"><button type="button" class="on" data-v="links" role="tab">Spin links</button><button type="button" data-v="banners" role="tab">Banner Spins<span class="nw">NEW</span></button></div>
|
||||
<div class="ws" id="ws">
|
||||
<div class="list">
|
||||
<div class="hd"><h2 id="listCount">Links</h2><span class="muted mono" id="listSort">by clicks, 7 days</span></div>
|
||||
@@ -127,6 +166,85 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ws" id="bsWs" hidden>
|
||||
<div class="list">
|
||||
<div class="hd"><h2 id="bsCount">Banner Spins</h2><span class="muted mono" id="bsSort">by views, 30 d</span></div>
|
||||
<div class="flt" id="bsTier" style="font-size:12px"></div>
|
||||
<div class="items" id="bsItems"></div>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="empty" id="bsNoSel"><div class="h-disp" style="font-size:18px">Banner Spin</div><div class="muted" id="bsNoSelText">One image address and one click address that rotate up to 25 banners, each with its own target. Put it on your site, a forum signature or a safelist once; change the banners here any time.</div><button class="btn pri" type="button" id="bsNewBtn2">+ New Banner Spin</button></div>
|
||||
<div id="bsSel" hidden>
|
||||
<div class="dhead">
|
||||
<button class="btn sm" type="button" id="bsBack" hidden>← Banner Spins</button>
|
||||
<h2 id="bsName">Banner Spin</h2>
|
||||
<span class="tag plain" id="bsSize"></span>
|
||||
<span class="mono" id="bsLive"></span>
|
||||
<button class="hchip" type="button" id="bsHoursChip" title="Hours this Banner Spin is on">Always on</button>
|
||||
<span class="grow"></span>
|
||||
<button class="btn sm" type="button" id="bsRename">Rename</button>
|
||||
<button class="btn sm" type="button" id="bsPause">Pause</button>
|
||||
<button class="btn sm danger" type="button" id="bsDel">Delete</button>
|
||||
</div>
|
||||
<div class="dbody">
|
||||
<div class="note" id="bsOffNote" hidden></div>
|
||||
<div class="tiles" id="bsTiles"></div>
|
||||
<div class="tabs" id="bsTabs">
|
||||
<button type="button" class="on" data-tab="banners">Banners</button>
|
||||
<button type="button" data-tab="settings">Settings</button>
|
||||
<button type="button" data-tab="code">Get the code</button>
|
||||
<button type="button" data-tab="stats">Stats</button>
|
||||
</div>
|
||||
<div id="bs-banners">
|
||||
<div class="tbl bsr">
|
||||
<div class="hd"><span>Banner and target</span><span>Weight</span><span class="r">Views</span><span class="r">Clicks</span><span>Status</span><span></span></div>
|
||||
<div id="bsRows"></div>
|
||||
<div class="ft" id="bsFoot"></div>
|
||||
</div>
|
||||
<div class="panel" style="margin-top:12px" id="bsAdd">
|
||||
<h2>Add a banner</h2>
|
||||
<div class="addg">
|
||||
<label class="lbl">Upload an image (JPG, PNG or GIF, animated is fine, up to 150 KB)<input class="field" id="bsFile" type="file" accept="image/png,image/jpeg,image/gif"></label>
|
||||
<label class="lbl">Or paste an image address<input class="field mono" id="bsImgUrl" type="url" placeholder="https://"></label>
|
||||
<div class="full bprev" id="bsPrev"></div>
|
||||
<div class="full tgt"><label class="lbl" style="margin:0">A click goes to<select class="field" id="bsTgtKind"><option value="url">A page address</option></select></label><label class="lbl" style="margin:0" id="bsTgtUrlWrap">Page address<input class="field mono" id="bsTgtUrl" type="url" placeholder="https://"></label></div>
|
||||
<label class="lbl">Label (only you see it)<input class="field" id="bsLabel" type="text" maxlength="60" placeholder="Gold offer, blue version"></label>
|
||||
<label class="lbl">Weight, 1 to 100<input class="field mono" id="bsWeight" type="number" min="1" max="100" value="10"></label>
|
||||
</div>
|
||||
<div style="display:flex;gap:10px;align-items:center;flex-wrap:wrap"><button class="btn pri" type="button" id="bsAddBtn">Add banner</button><span class="muted" id="bsAddNote" style="font-size:12px"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bs-settings" hidden>
|
||||
<div class="two">
|
||||
<div class="panel"><h2>Rotation</h2><div class="modes" id="bsModes">
|
||||
<label><input type="radio" name="bsMode" value="weight"><span><b>Random by weight</b><br><span class="muted">Every page view picks again. A banner with weight 20 shows twice as often as one with 10.</span></span></label>
|
||||
<label><input type="radio" name="bsMode" value="visitor"><span><b>One per visitor</b><br><span class="muted">Each visitor sees the same banner all day; different visitors get different banners by weight.</span></span></label></div></div>
|
||||
<div class="panel"><h2>Traffic source</h2><label class="lbl" style="margin:0">Network this Banner Spin runs on<select class="field" id="bsSrc"><option value="">None</option></select></label><div class="muted" style="font-size:12px">Conversions from its clicks fire that source's postback. Add the network's click macros to the click address (Get the code shows it).</div></div>
|
||||
</div>
|
||||
<div class="panel" style="margin-top:12px"><h2>Fallback</h2><div class="muted">Used when the Banner Spin is paused, outside its hours, or every banner is paused. A click we cannot match to a banner goes to the fallback page too.</div>
|
||||
<label class="lbl">Fallback page<input class="field mono" id="bsFallback" type="url" placeholder="https://"></label>
|
||||
<div class="addg"><label class="lbl">Fallback banner image (optional), upload<input class="field" id="bsFbFile" type="file" accept="image/png,image/jpeg,image/gif"></label><label class="lbl">or paste an image address<input class="field mono" id="bsFbUrl" type="url" placeholder="https://"></label></div>
|
||||
<div class="bprev" id="bsFbPrev"></div>
|
||||
<div style="display:flex;gap:8px;flex-wrap:wrap"><button class="btn pri" type="button" id="bsFbSave">Save fallback</button><button class="btn" type="button" id="bsFbClear">Remove fallback image</button></div>
|
||||
</div>
|
||||
<div class="panel" style="margin-top:12px"><h2>Hours this Banner Spin is on</h2><div class="muted">Outside these hours every placement shows the fallback banner. Each banner can have its own hours too (the clock button on its row).</div><div id="bsHours"></div></div>
|
||||
</div>
|
||||
<div id="bs-code" hidden>
|
||||
<div class="panel" style="padding:10px 12px"><div style="display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:end"><label class="lbl" style="margin:0">Link domain<select class="field" id="bsHost"></select></label><span class="muted mono" id="bsHostNote" style="font-size:11px"></span></div></div>
|
||||
<div id="bsCodes" style="display:grid;gap:10px;margin-top:10px"></div>
|
||||
<div class="note" style="margin-top:10px" id="bsGmail"><b>Using it in email?</b> Gmail fetches an image once through its own image proxy and keeps that copy, so Gmail readers stop seeing the rotation. For email, make a Banner Spin with a single banner and swap that banner when you want a change. Other mail apps load the image fresh on each open.</div>
|
||||
<div class="note" style="margin-top:10px"><b>Paid ad networks</b> copy your image to their own servers when you upload a creative, so it will not rotate there. Use the script tag or the image address on sites, blogs, forums and safelists that load the image from us.</div>
|
||||
</div>
|
||||
<div id="bs-stats" hidden>
|
||||
<div class="panel"><h2>By banner</h2><div class="tbl st3"><div class="hd"><span>Banner</span><span class="r">Views</span><span class="r">Unique</span><span class="r">Clicks</span><span class="r">CTR</span><span class="r">Matched</span><span class="r">Conv</span></div><div id="bsStB"></div></div><div class="muted" style="font-size:11.5px;margin-top:6px" id="bsWinNote"></div></div>
|
||||
<div class="panel" style="margin-top:12px"><h2>By placement (the page the banner sits on)</h2><div class="tbl st3"><div class="hd"><span>Placement</span><span class="r">Views</span><span class="r">Loads</span><span class="r">Clicks</span><span class="r">CTR</span><span class="r">Matched</span><span></span></div><div id="bsStP"></div></div></div>
|
||||
<div class="panel" style="margin-top:12px"><h2>Clicks by country and device</h2><div class="bsbreak"><div class="kv" id="bsStC"></div><div class="kv" id="bsStD"></div></div><div class="muted" style="font-size:11.5px;margin-top:6px" id="bsStBots"></div></div>
|
||||
<div class="panel" style="margin-top:12px"><h2>Views by day, Central time, last 30</h2><div class="bars" id="bsDayBars"></div><div class="axis" id="bsDayAxis"></div><div class="muted" style="font-size:11.5px" id="bsStNote"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbody" id="pbWrap" style="border-top:1px solid var(--line)">
|
||||
<div class="panel pbpanel">
|
||||
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap"><h2>Postbacks</h2><span class="muted">Tell your tracker or traffic network when a click converts. Fired server to server with the click id that came in on the link.</span><span class="grow"></span><button class="btn sm" type="button" id="pbNew">+ Postback</button></div>
|
||||
@@ -135,7 +253,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/links.js?v=20261012a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/links.js?v=20261021t"></script>
|
||||
<script src="/assets/banner-spin.js?v=20261020bs3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+22
-14
@@ -1,14 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>More · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<style>@import url("/assets/site.css?v=ls20260916a") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261008a">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>@import url("/assets/site.css?v=ls20261101t") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -108,6 +109,7 @@
|
||||
<p><input id="obUsername" placeholder="Username (3-20 letters, numbers, _)" autocomplete="off" style="width:100%"></p>
|
||||
<p class="muted small" style="margin:12px 0 4px">Optional — a short bio for your public page (you can skip this).</p>
|
||||
<p><textarea id="obBio" rows="2" maxlength="600" placeholder="A short bio (optional)" style="width:100%"></textarea></p>
|
||||
<p class="muted small" style="margin:-6px 0 8px">No links in the bio, and nothing from the prohibited list in the <a href="/terms#prohibited" target="_blank" rel="noopener">Terms</a>.</p>
|
||||
<p id="obErr" class="small" style="color:var(--bad)" hidden></p>
|
||||
<p style="margin-top:14px;display:flex;gap:10px;justify-content:flex-end">
|
||||
<button class="btn sec small" id="obSkip" type="button" hidden>Skip for now</button>
|
||||
@@ -483,7 +485,7 @@
|
||||
<p><select id="cType" style="width:100%">
|
||||
<option value="banner">Banner (per impression)</option>
|
||||
<option value="text">Text ad (per impression)</option>
|
||||
<option value="login">Login ad (per day)</option>
|
||||
<option value="login">Login ad (30-day slot)</option>
|
||||
</select></p>
|
||||
<p class="small muted" id="cWhere" style="margin:-4px 0 10px"></p>
|
||||
<p><input id="cName" placeholder="Campaign name" style="width:100%"></p>
|
||||
@@ -589,7 +591,7 @@
|
||||
campaigns just like purchased ones.</p>
|
||||
<p><span class="badge" id="earnProgress">…</span>
|
||||
<span class="badge" id="earnBalance">…</span></p>
|
||||
<div class="card" style="background:rgba(4,8,7,.5)" id="earnStage">
|
||||
<div class="card" style="background:var(--ground-soft)" id="earnStage">
|
||||
<div id="earnAdBox" class="small muted" style="min-height:80px;display:grid;place-items:center">
|
||||
Press the button to open the first ad in a new tab.</div>
|
||||
<p style="margin-top:14px">
|
||||
@@ -608,7 +610,7 @@
|
||||
can't be skipped — the timer runs on our server. You never see your own videos.
|
||||
Prefer a feed? <a href="/shorts">Open Shorts</a> for a full-screen, swipe-to-next experience.</p>
|
||||
<p><span class="badge" id="vidProgress">…</span></p>
|
||||
<div class="card" style="background:rgba(4,8,7,.5)" id="vidStage">
|
||||
<div class="card" style="background:var(--ground-soft)" id="vidStage">
|
||||
<div id="vidBox" class="small muted" style="min-height:120px;display:grid;place-items:center">
|
||||
Press the button to load the first video.</div>
|
||||
<div id="vidWrap" hidden style="max-width:560px;margin:0 auto">
|
||||
@@ -630,7 +632,7 @@
|
||||
<p class="muted small">Visit a member's site in a new tab, stay the required few seconds,
|
||||
pass a quick check, and earn. Each site counts once for you — real, unique human visits.</p>
|
||||
<p><span class="badge" id="vsProgress">…</span></p>
|
||||
<div class="card" style="background:rgba(4,8,7,.5)">
|
||||
<div class="card" style="background:var(--ground-soft)">
|
||||
<div id="vsBox" class="small muted" style="min-height:70px;display:grid;place-items:center">Press the button to load a site to visit.</div>
|
||||
<div id="vsCheck" hidden style="margin-top:10px"><span class="prompt" id="vsPrompt"></span> <span id="vsOpts"></span></div>
|
||||
<p style="margin-top:12px">
|
||||
@@ -848,6 +850,7 @@
|
||||
<button class="btn small sec" id="pfAvatarBtn" type="button">Upload avatar</button>
|
||||
<span class="small muted" id="pfAvatarInfo"></span></p>
|
||||
<p><textarea id="pfBio" rows="3" maxlength="600" placeholder="A short bio for your profile page…" style="width:100%"></textarea></p>
|
||||
<p class="small muted" style="margin:-6px 0 10px">No links in the bio, and nothing from the prohibited list in the <a href="/terms#prohibited" target="_blank" rel="noopener">Terms</a>.</p>
|
||||
<p class="small muted" style="margin-bottom:4px">Social links (https URLs — shown on your public page):</p>
|
||||
<div class="grid c2" style="gap:8px">
|
||||
<input id="soc-facebook" placeholder="Facebook URL" style="width:100%">
|
||||
@@ -864,6 +867,11 @@
|
||||
<p style="margin-top:12px"><button class="btn" id="pfDetailsSave">Save profile</button>
|
||||
<a class="btn small sec" id="pfViewBio" target="_blank" rel="noopener" hidden>View my page</a></p>
|
||||
</div>
|
||||
<div class="card theme-card">
|
||||
<h3>Appearance</h3>
|
||||
<p class="muted small">Light or dark, or Auto to follow your device setting. Saved with your account, so it follows you to any browser you sign in on.</p>
|
||||
<span class="seg theme-seg" role="group" aria-label="Theme"><button type="button" data-theme="light" title="Light theme">Light</button><button type="button" data-theme="dark" title="Dark theme">Dark</button><button type="button" data-theme="auto" title="Follow the device">Auto</button></span>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Your line banner</h3>
|
||||
<p class="muted small">Set a destination link (and a banner image for your wall), and every new
|
||||
@@ -948,7 +956,7 @@
|
||||
<div class="card">
|
||||
<h3>Wallet connection</h3>
|
||||
<p class="small" style="border:1px solid var(--line-strong);border-radius:10px;padding:8px 12px;margin:0 0 10px"><b>Everything here is POL on the Polygon network.</b> Packages are paid in POL and every payout lands as POL in this wallet. No other coin or chain is used, so keep the wallet on Polygon and keep a little POL for gas.</p>
|
||||
<p class="muted small">Connected the wrong wallet, or stuck on a transaction prompt? Disconnect to clear the session, then reconnect or pick a different wallet.</p>
|
||||
<p class="muted small">Connected the wrong wallet, or stuck on a transaction prompt? Disconnect to clear the session, then reconnect or pick a different wallet. Your linked wallet stays on your account. To buy from a second wallet of your own, add it as a position on <a href="/credits">Credits</a>.</p>
|
||||
<p><button class="btn sec small" id="wcDisconnect" type="button">Disconnect wallet</button>
|
||||
<span class="small muted" id="wcDisconnectInfo"></span></p>
|
||||
</div>
|
||||
@@ -1007,12 +1015,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/tools.js?v=20261011a"></script>
|
||||
<script src="/assets/wallet.js?v=20261008a"></script>
|
||||
<script src="/assets/promo.js?v=20261009b"></script>
|
||||
<script src="/assets/my.js?v=20261016a"></script>
|
||||
<script src="/assets/wallet.js?v=20261021a"></script>
|
||||
<script src="/assets/promo.js?v=20261020bs3"></script>
|
||||
<script src="/assets/my.js?v=20261101t"></script>
|
||||
<script src="/assets/chat.js?v=20261016a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+7
-6
@@ -1,15 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Pages · LinkSpin</title>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261101t">
|
||||
<style>
|
||||
.look{display:grid;gap:10px;margin:6px 0 10px}.lk-row{display:flex;gap:10px;align-items:flex-start}.lk-k{flex:none;width:64px;font:700 11px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);padding-top:9px}
|
||||
.lk-opts{display:flex;gap:6px;flex-wrap:wrap}.lk-opts button{font:600 12px var(--body);padding:7px 10px;border-radius:7px;border:1px solid var(--line);background:transparent;color:var(--fg);cursor:pointer}.lk-opts button.on{border-color:var(--accent);background:rgba(59,157,255,.12)}
|
||||
.lk-opts{display:flex;gap:6px;flex-wrap:wrap}.lk-opts button{font:600 12px var(--body);padding:7px 10px;border-radius:7px;border:1px solid var(--line);background:transparent;color:var(--fg);cursor:pointer}.lk-opts button.on{border-color:var(--accent);background:var(--accent-soft)}
|
||||
.heroes{display:flex;gap:6px;flex-wrap:wrap}.heroes button{width:72px;height:48px;border-radius:7px;border:2px solid var(--line);padding:0;overflow:hidden;cursor:pointer;background:#000}.heroes button img{width:100%;height:100%;object-fit:cover;display:block;opacity:.8}.heroes button.on{border-color:var(--accent)}.heroes button.on img{opacity:1}
|
||||
.pal{display:flex;gap:8px;flex-wrap:wrap}.pal button{width:34px;height:26px;border-radius:7px;border:2px solid transparent;cursor:pointer;padding:0;overflow:hidden;display:grid;grid-template-columns:1fr 1fr 1fr}.pal button i{display:block}.pal button.on{border-color:var(--fg)}
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
.card{box-shadow:var(--sh)} .card.on{border-color:var(--sig);box-shadow:0 0 0 1px var(--sig),var(--sh)}
|
||||
.thumb{height:96px;background:var(--panel-2);padding:12px;display:grid;gap:6px;align-content:start} .thumb i{display:block;background:var(--line);height:6px;border-radius:2px} .thumb i.t{background:var(--accent-dim);height:10px;width:70%} .thumb i.b{background:linear-gradient(90deg,var(--accent-hi),var(--accent));height:14px;width:40%;margin-top:auto}
|
||||
.card .cap{padding:10px 12px;display:grid;gap:3px} .card .cap b{font-size:13px}
|
||||
.side{border-left:1px solid var(--line);padding:16px;display:grid;gap:12px;align-content:start;background:rgba(255,255,255,.6)}
|
||||
.side{border-left:1px solid var(--line);padding:16px;display:grid;gap:12px;align-content:start;background:var(--panel-glass)}
|
||||
.side h2{font-family:var(--display);font-size:18px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;margin:0}
|
||||
.types{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px} .types button{background:transparent;border:1px solid var(--line);border-radius:var(--r);color:var(--ink);padding:8px 6px;cursor:pointer;display:grid;gap:2px;text-align:left} .types button.on{border-color:var(--accent)} .types small{color:var(--muted);font-size:11px}
|
||||
.ed{display:grid;gap:10px} .ed textarea{min-height:90px;resize:vertical}
|
||||
@@ -72,7 +73,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/pages-screen.js?v=20261011a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261101t"></script>
|
||||
<script src="/assets/pages-screen.js?v=20261021t"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="dark">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>For site owners | LinkSpin</title>
|
||||
<meta name="description" content="Marty's partner kit for site owners who run a downline builder: the platform in three minutes, how the money moves, what your members get, and what you get for listing LinkSpin.">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta name="theme-color" content="#043b2f">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@500;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20260916a">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20261101t">
|
||||
<style>
|
||||
.pk{max-width:820px}
|
||||
.pk h2{font-size:24px;margin:44px 0 12px;padding-top:20px;border-top:1px solid var(--line)}
|
||||
@@ -26,11 +27,11 @@
|
||||
table{border-collapse:collapse;width:100%;margin:10px 0 18px;font-variant-numeric:tabular-nums;font-size:15px}
|
||||
th,td{text-align:left;padding:9px 10px;border-bottom:1px solid var(--line)} th{color:var(--muted);font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;font-weight:500}
|
||||
td:nth-child(2),td:nth-child(3),th:nth-child(2),th:nth-child(3){text-align:right}
|
||||
.get{border:1px solid #f2c94c;background:rgba(242,201,76,.08);border-radius:14px;padding:18px 22px;margin:16px 0}
|
||||
.get h3{color:#f2c94c;margin:0 0 8px}
|
||||
.cta{margin:26px 0 8px;padding:22px;border:1px solid var(--mint);border-radius:14px;background:rgba(59,157,255,.06)}
|
||||
.get{border:1px solid var(--gold-line);background:var(--gold-soft);border-radius:14px;padding:18px 22px;margin:16px 0}
|
||||
.get h3{color:var(--gold-2);margin:0 0 8px}
|
||||
.cta{margin:26px 0 8px;padding:22px;border:1px solid var(--mint);border-radius:14px;background:var(--mint-faint)}
|
||||
.cta .btn{margin-top:10px}
|
||||
code{background:rgba(4,8,7,.6);padding:2px 7px;border-radius:6px;font-size:13.5px;word-break:break-all}
|
||||
code{background:var(--ground-soft);padding:2px 7px;border-radius:6px;font-size:13.5px;word-break:break-all}
|
||||
@media (max-width:640px){.split{grid-template-columns:1fr 1fr}}
|
||||
</style>
|
||||
</head>
|
||||
@@ -130,7 +131,7 @@
|
||||
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford to lose.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/partners.js?v=20261010a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+9
-8
@@ -1,16 +1,17 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="dark">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Team-building plays | LinkSpin</title>
|
||||
<meta name="description" content="Three ways to build your LinkSpin line, plus the Qualified Start opening move. Member training.">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta name="theme-color" content="#043b2f">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@500;700;800&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20260916a">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=ls20261101t">
|
||||
<style>
|
||||
.pl-rule{border-left:4px solid #f2c94c;background:rgba(242,201,76,.08);padding:16px 20px;border-radius:0 12px 12px 0;margin:0 0 28px}
|
||||
.pl-rule{border-left:4px solid var(--gold-2);background:var(--gold-soft);padding:16px 20px;border-radius:0 12px 12px 0;margin:0 0 28px}
|
||||
.pl-rule b{font-family:var(--disp);font-size:17px;display:block;margin-bottom:6px}
|
||||
.pl-split{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:0 0 10px}
|
||||
.pl-split>div{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:14px 10px;text-align:center}
|
||||
@@ -24,17 +25,17 @@
|
||||
.pl-ladder .b{color:var(--mint);font-size:12.5px}
|
||||
.play header{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:6px}
|
||||
.play h2{font-size:24px;margin:0}
|
||||
.play .tag{font-family:var(--mono);font-size:11.5px;color:var(--mint);border:1px solid rgba(59,157,255,.4);border-radius:999px;padding:3px 10px}
|
||||
.play .tag{font-family:var(--mono);font-size:11.5px;color:var(--mint);border:1px solid var(--mint-line);border-radius:999px;padding:3px 10px}
|
||||
.play ol{margin:0 0 14px 20px;padding:0;line-height:1.6}
|
||||
.play ol li{margin:0 0 8px}
|
||||
.meta{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
|
||||
.meta>div{background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:10px;padding:12px 14px;font-size:14px}
|
||||
.meta>div{background:var(--ground-soft);border:1px solid var(--line);border-radius:10px;padding:12px 14px;font-size:14px}
|
||||
.meta .k{font-family:var(--mono);font-size:11px;color:var(--muted);letter-spacing:.08em;text-transform:uppercase;margin-bottom:4px}
|
||||
.rec{border-color:var(--mint)}
|
||||
.cal{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
|
||||
.cal>div{background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:10px;padding:12px 14px;font-size:14px}
|
||||
.cal>div{background:var(--ground-soft);border:1px solid var(--line);border-radius:10px;padding:12px 14px;font-size:14px}
|
||||
.cal .k{font-family:var(--disp);font-weight:800;color:var(--mint);margin-bottom:6px}
|
||||
blockquote{margin:0 0 10px;background:rgba(4,8,7,.45);border:1px solid var(--line);border-radius:10px;padding:12px 16px;color:var(--muted);font-style:italic}
|
||||
blockquote{margin:0 0 10px;background:var(--ground-soft);border:1px solid var(--line);border-radius:10px;padding:12px 16px;color:var(--muted);font-style:italic}
|
||||
blockquote span{display:block;font-style:normal;font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--mint);margin-bottom:4px}
|
||||
.fit-table th{text-align:left;color:var(--muted);font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;font-weight:500}
|
||||
.fit-table td,.fit-table th{padding:9px 10px;border-bottom:1px solid var(--line);vertical-align:top}
|
||||
@@ -192,7 +193,7 @@
|
||||
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/common.js?v=20261101t"></script>
|
||||
<script src="/assets/plays.js?v=20260910b"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+7
-3
@@ -1,14 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Privacy Policy | LinkSpin</title>
|
||||
<meta name="description" content="LinkSpin privacy policy.">
|
||||
<link rel="canonical" href="{{SITE_URL}}/privacy">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
@@ -27,6 +28,9 @@
|
||||
<p>A minimal set: the email you sign up with, a username and any profile details you choose to add (avatar, bio, social links), and, only if you link one, your public wallet address. The links you rotate, the pages you publish, the zones you register, campaign content you create and reports you submit are stored to run the service. We also read on-chain activity that is already public on the blockchain.</p>
|
||||
<h2 class="disp">Click and impression records</h2>
|
||||
<p>When someone opens one of your spin links or sees a zone on your site, we record the time, the destination chosen, the country, the device type, the referring site and any click id or tracking parameters in the link, plus a daily-salted hash of the visitor that is not reversible to a person. These records power your reports and are kept for the life of the link.</p>
|
||||
<h2 class="disp">Conversion tracking</h2>
|
||||
<p>When someone clicks an ad on LinkSpin or InstantAdPay, or a spin link whose owner tracks goals, we give that click a random click id and add it to the address they land on (as <code>lsclk</code>). We keep the click with its time, campaign, country, device type and where it was clicked, plus a one-way hash of the network address and browser that we use only to match a conversion within 24 hours. We do not store the IP address itself.</p>
|
||||
<p>Advertisers who use our landing tag (<code>t.js</code>) keep that click id on their own website for 30 days, in the browser's local storage and a cookie named <code>ls_clk</code> on their site. When the visitor later reaches the advertiser's thank-you page, the goal pixel (<code>cv.gif</code> or <code>cv.js</code>) tells us the goal was reached for that click id, so the advertiser can see how many of their clicks became, say, subscribers or sales, and what each cost. We also set a cookie named <code>ls.clk</code> on our own domain when an ad is clicked, so the pixel can still match where the advertiser's site has no tag. Nothing personal is read or stored by the tag or the pixel: no names, emails or form contents. A conversion only ever counts for the advertiser who owns the click.</p>
|
||||
<h2 class="disp">Leads on your pages</h2>
|
||||
<p>Email addresses entered on a page you publish belong to you and are shown only to you. We store them so you can download them or forward them to your own autoresponder. Visitors are told on the page who is collecting their email.</p>
|
||||
<h2 class="disp">What we do not collect</h2>
|
||||
@@ -34,7 +38,7 @@
|
||||
<h2 class="disp">How we use it</h2>
|
||||
<p>To run your account, serve and measure links, pages and ads, attribute referrals, send service and notification emails (payouts, messages, onboarding), and keep the Platform secure. You can set your email and chat notification preferences in your dashboard.</p>
|
||||
<h2 class="disp">Cookies</h2>
|
||||
<p>We use a session cookie to keep you signed in, a referral cookie to credit the sponsor whose link you arrived through, a click cookie that ties a sign-up back to the spin link that brought you, and a demo cookie that holds a spin link you made before signing in. That is it. No third-party ad-tracking cookies.</p>
|
||||
<p>We use a session cookie to keep you signed in, a referral cookie to credit the sponsor whose link you arrived through, a click cookie that ties a sign-up back to the spin link that brought you, a demo cookie that holds a spin link you made before signing in, a visitor cookie (<code>ls.vid</code>) that lets members show or hide their own ads to people who visited their pages, and the conversion click cookie (<code>ls.clk</code>) described above. The last two can be read when our audience or goal pixel loads on a member's own site. We do not use any other company's tracking cookies, and we do not sell or share these records.</p>
|
||||
<h2 class="disp">Sharing</h2>
|
||||
<p>Your username and public profile are visible to others by design, and on-chain transactions are public by nature. We share data with infrastructure providers (hosting, email delivery) only as needed to operate the service, with the partner ad network only as impression counts, and when required by law.</p>
|
||||
<h2 class="disp">Your choices</h2>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
@@ -12,15 +12,16 @@
|
||||
<meta property="og:image" content="{{SITE_URL}}/banners/linkspin-og-1200x630.png">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
<style>
|
||||
.strip .n{font-family:var(--display);font-size:22px;color:var(--chrome-ink);letter-spacing:.04em;line-height:1}
|
||||
.strip .st{display:flex;align-items:baseline;gap:8px}
|
||||
.sizes{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px}
|
||||
.sz{padding:14px;display:flex;flex-direction:column;gap:10px;min-height:130px}
|
||||
.sz .box{height:62px;display:flex;align-items:center;justify-content:center}
|
||||
.sz .box i{display:block;background:repeating-linear-gradient(135deg,var(--accent-soft) 0 4px,#fff 4px 8px);border:1.5px solid var(--accent-dim);border-radius:2px}
|
||||
.sz .box i{display:block;background:repeating-linear-gradient(135deg,var(--accent-soft) 0 4px,var(--panel) 4px 8px);border:1.5px solid var(--accent-dim);border-radius:2px}
|
||||
.sz .lab{display:flex;justify-content:space-between;align-items:center;gap:6px;flex-wrap:wrap}
|
||||
.sz .lab b{font:700 14px var(--mono)}
|
||||
.steps{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;counter-reset:step}
|
||||
@@ -34,8 +35,8 @@
|
||||
.rates td.n{font:700 15px var(--mono);white-space:nowrap}
|
||||
.yesno{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
|
||||
.yesno ul{margin:0;padding-left:18px;color:var(--ink-2);display:flex;flex-direction:column;gap:8px;font-size:15px}
|
||||
.tag.v{border-color:rgba(255,106,26,.45);color:var(--sig-2);background:var(--sig-soft)}
|
||||
.code{display:block;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;color:#8CC8FF;font:500 12px var(--mono);padding:12px 14px;line-height:1.6;overflow-wrap:anywhere}
|
||||
.tag.v{border-color:var(--sig-line);color:var(--sig-2);background:var(--sig-soft)}
|
||||
.code{display:block;background:var(--inset);border:1px solid var(--chrome-line);border-radius:6px;color:var(--chrome-hi);font:500 12px var(--mono);padding:12px 14px;line-height:1.6;overflow-wrap:anywhere}
|
||||
.faq details{border:1px solid var(--line);border-radius:8px;background:var(--panel);padding:0 18px}
|
||||
.faq summary{cursor:pointer;font-weight:700;padding:14px 0;list-style:none;display:flex;justify-content:space-between;gap:12px}
|
||||
.faq summary::-webkit-details-marker{display:none}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user