Login ad on a clock, hop back to the asking site, 5xYourTeam in the wallets map, signed-out login slot refused (Marty 2026-11-15)
Login ad: every Control Room page asks (cr-shell.js loginAd, the per-tab sessionStorage guard is gone); the server answers with an ad only when the member's last finished view on LinkSpin is older than loginAdEveryHours (site setting, default 3). loginadclock.js (the same file as InstantAdPay), MySQL table login_ad_views through DOCSTORE_URL. POST /api/ads/login/seen at the end of the countdown restarts the clock only if the serve was dwell-2 s earlier. Member erase forgets the row. Admin site setting label.
Signed out: /api/ads/slot?type=login draws nothing and counts no view (bots, probes, previews cannot run up an advertiser's numbers).
Hop: a member who signed in here because another network site asked ("Sign in with LinkSpin", nsso.back) goes back there after the login ad (/sso/resume), from every Control Room screen, not only the retired /my.
networksso.js: the network-wide copy (loop guard 120 s, fivex, unknown r refused); fivex added to the wallets map (FIVEX_URL, default https://5xyourteam.com).
Tests: qa/networksso-partner.e2e.mjs (same file as InstantAdPay, in run.sh): partner via LinkSpin, LinkSpin clock, signed-out slot; networksso e2e retries a keep-alive ECONNRESET. qa sso: ALL PASSED; qa member: ALL PASSED (2 known warnings; networksso e2e flaked on ECONNRESET once, passes with the retry).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,7 @@ const leaderboard = require('./leaderboard');
|
||||
const toolkit = require('./toolkit');
|
||||
const registry = require('./registry'); // network registry: who is who across properties (LinkSpin, 2026-09-15)
|
||||
const iapsync = require('./iapsync'); // reverse registry sync: LinkSpin-first members reach InstantAdPay (2026-10-15)
|
||||
const loginClock = require('./loginadclock'); // login ads on a clock, not only at sign-in (Marty 2026-11-15): see loginadclock.js
|
||||
const erase = require('./erase'); // member erase (2026-11-15, LS-1021): POST /api/admin/erase + the hub's member.erased event
|
||||
const hubsync = require('./hubsync'); // network hub link, inert unless HUB_ENABLED=1 (2026-11-12)
|
||||
const SF = require('./sponsorfollow'); // deliberate sponsor changes follow to InstantAdPay until chain-bound + one network tank (2026-10-22)
|
||||
@@ -648,7 +649,8 @@ async function boot() {
|
||||
wallets: { bannerline: () => String(process.env.BL_URL || 'https://downlinebanners.com').replace(/\/+$/, ''), // Downline Banners by wallet (2026-11-13)
|
||||
vbb: () => String(process.env.VBB_URL || 'https://viralbannerblitz.com').replace(/\/+$/, ''), // Viral Banner Blitz by wallet (2026-11-14)
|
||||
viraladblitz: () => String(process.env.VAB_URL || 'https://viraladblitz.com').replace(/\/+$/, ''), // ViralAdBlitz by wallet (2026-11-15; VAB_URL = staging host until the domain switch)
|
||||
downlinehydra: () => String(process.env.DH_URL || 'https://downlinehydra.com').replace(/\/+$/, '') }, // DownlineHydra (2026-11-15; DH_URL = https://dh.saasy.top until the domain switch)
|
||||
downlinehydra: () => String(process.env.DH_URL || 'https://downlinehydra.com').replace(/\/+$/, ''), // DownlineHydra (2026-11-15; DH_URL = https://dh.saasy.top until the domain switch)
|
||||
fivex: () => String(process.env.FIVEX_URL || 'https://5xyourteam.com').replace(/\/+$/, '') }, // 5xYourTeam by wallet (2026-11-15: it asked with r=fivex and was answered as if InstantAdPay asked)
|
||||
wallet: async s => { const a = await accounts.byEmail(s.email); const addr = String(s.address || (a && a.address) || '').toLowerCase(); return addr ? { address: addr, name: '' } : null; },
|
||||
member: async req => { // a wallet sign-in carries the address, not the email: find the account that owns the wallet (2026-11-13)
|
||||
const s = await auth.fromRequest(req); if (!s) return null;
|
||||
@@ -669,6 +671,7 @@ async function boot() {
|
||||
signinPath: to => (to === '/' ? '/ads' : to) }); // every Control Room screen shows the sign-in itself
|
||||
accounts.init({ dataDir: DATA_DIR });
|
||||
ads.init({ dataDir: DATA_DIR, chain });
|
||||
loginClock.init({ url: process.env.DATABASE_URL || process.env.DOCSTORE_URL, hours: () => siteConfig().loginAdEveryHours });
|
||||
mailer.init({ dataDir: DATA_DIR });
|
||||
messages.init({ dataDir: DATA_DIR });
|
||||
messages.reclassifyCarryNotices(ADMIN_EMAIL || 'house@linkspin.co').then(n => { if (n) console.log('messages: ' + n + ' carry notices made quiet (notice kind)'); }).catch(() => {});
|
||||
@@ -770,7 +773,7 @@ async function boot() {
|
||||
'convtrack.json': { state: convtrack._state, save: convtrack._save }, 'earned.json': ads._earned, 'hubsync.json': { state: hubsync._state, save: hubsync._save },
|
||||
'iapsync.json': { state: iapsync._state, save: iapsync._save }, 'mail-intro.json': mailer._intro, 'postbacks.json': postbacks._json, 'registry.json': registry._json,
|
||||
'rotator.json': rotator._json, 'sponsorfollow.json': { state: followStore._state, save: followStore._save } },
|
||||
reload: {}, forget: [email => iapsync._forget(email), email => hubsync._forgetHeld(email)] });
|
||||
reload: {}, forget: [email => loginClock.forget(String(email || '').toLowerCase()), email => iapsync._forget(email), email => hubsync._forgetHeld(email)] });
|
||||
// link-domain pool: channels live in site.json (linkDomainChannels), check state in domains.json; a burn alerts the admin once
|
||||
domains.init({ dataDir: DATA_DIR, siteConfig, saveSite: patch => fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(siteConfig(), patch), null, 2)),
|
||||
notify: async text => { const sc = siteConfig(); if (sc.telegramBotToken && sc.telegramAdminChatId) await telegramSend(sc.telegramAdminChatId, text); else if (ADMIN_EMAIL && mailer.hasKey()) await mailer.send(ADMIN_EMAIL, 'LinkSpin: link domain burned', text.replace(/<[^>]+>/g, '')); } });
|
||||
@@ -877,6 +880,7 @@ function siteConfig() {
|
||||
memberWeeklyEmail: '0', // 1 = the weekly 'Your week on LinkSpin' email goes to every active member, not only sponsors with a line
|
||||
noPayoutIds: '', // LinkSpin member ids differ from InstantAdPay's (IAP #25 = Jim's compromised wallet; LinkSpin #25 is a real member, cleared 2026-10-15). Positions kept for linkage only (compromised wallets): no buys signed from them, no new joins routed under them or their upline chain (Marty, 2026-09-14)
|
||||
leaderboardWeeklyPrize: '', leaderboardMonthlyPrize: '', leaderboardWeeklyCredits: '1000,500,250', leaderboardMonthlyCredits: '5000,2500,1000', leaderboardAnnounceGeneral: '1', // referral contest prizes (text shown on /leaderboard; credits granted to the winner automatically at rollover)
|
||||
loginAdEveryHours: 3, // login ad: shown again on the next member page once the last finished view is this many hours old (Marty 2026-11-15)
|
||||
tankAdoptCap: 10, // holding tank: people one adopter may hold at one time (not yet switched on payouts), Marty 2026-11-11
|
||||
legacyCreditsAdvertiser: 500, legacyCreditsEarner: 150, // welcome-back credits for listed Faucet Wave / Tier One Ads emails arriving via /from/<brand>
|
||||
geoTier1: '', // comma-separated ISO country codes; empty = built-in default (US, CA, GB, AU, NZ, IE, DE, FR, NL, SE, NO, DK, FI, CH, AT, BE)
|
||||
@@ -3971,12 +3975,19 @@ const server = http.createServer(async (req, res) => {
|
||||
// -- ad engine (spec §8b v1: banners, text, login ads)
|
||||
if (p === '/api/ads/slot' && req.method === 'GET') {
|
||||
const t = String(u.searchParams.get('type') || 'banner');
|
||||
// login ads run on the member's clock (loginadclock.js): a signed-in member gets one when the last finished view is older than loginAdEveryHours
|
||||
let lk = ''; if (t === 'login') { const s = await auth.fromRequest(req).catch(() => null); lk = loginClock.keyOf(s); if (!lk) return json(res, 200, { ad: null, signedOut: true }); if (!(await loginClock.due(lk))) return json(res, 200, { ad: null, notDue: true }); } // signed out never draws or counts a login ad (2026-11-15)
|
||||
const ad = await ads.serve(t, Object.assign({ width: Number(u.searchParams.get('w')) || 0, height: Number(u.searchParams.get('h')) || 0 }, viewerGeo(req), audiences.matcher(req)));
|
||||
// login ads: the member clicks "Open Ad" (a real, counted click into a
|
||||
// new tab) while the countdown runs on our interstitial page
|
||||
if (ad && t === 'login') ad.dwell = ads.rates().loginDwellSeconds || 10;
|
||||
if (ad && t === 'login') { ad.dwell = ads.rates().loginDwellSeconds || 10; if (lk) await loginClock.served(lk); }
|
||||
return json(res, 200, { ad });
|
||||
}
|
||||
if (p === '/api/ads/login/seen' && req.method === 'POST') { // the login-ad countdown ended: restart this member's clock
|
||||
const s = await auth.fromRequest(req).catch(() => null); const k = loginClock.keyOf(s);
|
||||
if (!k) return json(res, 401, { error: 'Sign in first.' });
|
||||
return json(res, 200, await loginClock.seen(k, ads.rates().loginDwellSeconds || 10));
|
||||
}
|
||||
m = /^\/api\/ads\/click\/(\d+)$/.exec(p);
|
||||
if (m && req.method === 'GET') {
|
||||
const target = await ads.click(m[1]);
|
||||
|
||||
Reference in New Issue
Block a user