ViralAdBlitz "Use one of my spin links" (Marty 2026-11-15): /api/partner/vab/links op 'spins' (same net.v1 signature) lists the account's own spin links { code, name, url (public /r/ link on the clean link host), destinations (active), paused }, never partner-made links (tracked text ads, program links), nothing else about the account; hosts = every host a /r/ link answers on (also sent with account false) so ViralAdBlitz can tell a LinkSpin spin link from any other link. Read only. qa/partner-vabspins.test.mjs (12 pass) in qa netsrc; netsrc, sso, member green
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3170,7 +3170,8 @@ const server = http.createServer(async (req, res) => {
|
||||
const email = String(b.email || '').trim().toLowerCase();
|
||||
let a = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email) ? await accounts.byEmail(email).catch(() => null) : null;
|
||||
if ((!a || !a.email) && b.username && /^[A-Za-z0-9_.-]{2,40}$/.test(String(b.username))) a = await accounts.byUsername(String(b.username)).catch(() => null);
|
||||
if (!a || !a.email) return json(res, 200, { account: false });
|
||||
const hostsAll = () => Array.from(new Set([SITE_HOST].concat(String(siteConfig().linkDomains || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean))));
|
||||
if (!a || !a.email) return json(res, 200, b.op === 'spins' ? { account: false, hosts: hostsAll() } : { account: false });
|
||||
const hs = domains.hosts(); if (!hs.length) return json(res, 503, { error: 'No clean link domain right now.' });
|
||||
const host = hs[0].host; const PID = /^[a-z0-9_-]{1,40}$/i;
|
||||
const linkOf = (code, pid) => 'https://' + host + '/r/' + code + '?s1=' + encodeURIComponent(pid) + '&placement=' + encodeURIComponent(pid);
|
||||
@@ -3179,6 +3180,17 @@ const server = http.createServer(async (req, res) => {
|
||||
for (const [k, v] of Object.entries(st)) { const pid = k.slice(pfx.length); out[pid] = { code: v.code, link: linkOf(v.code, pid), hits: v.hits, hits30: v.hits30, unique30: v.unique30 }; }
|
||||
return json(res, 200, { account: true, username: a.username || null, host, stats: out }, { 'Cache-Control': 'no-store' });
|
||||
}
|
||||
// { username|email, op: 'spins' } -> { account, username, host, hosts, spins: [{ code, name, url, destinations, paused }] } (Marty 2026-11-15):
|
||||
// the member's own spin links, for ViralAdBlitz's "Use one of my spin links" on the text-ad form. Links a partner made
|
||||
// (partner set: tracked text ads, program links) are left out. hosts = every host a /r/ link of this LinkSpin answers on,
|
||||
// so the partner can tell a LinkSpin spin link from any other link (also sent with account false: they are public). Read only;
|
||||
// nothing else about the account.
|
||||
if (b.op === 'spins') {
|
||||
const owner = String(a.email).trim().toLowerCase();
|
||||
const mine = rotator.rawRotations().filter(r => r.owner === owner && !r.partner);
|
||||
const spins = mine.slice(0, 100).map(r => ({ code: r.code, name: String(r.name || '').slice(0, 80), url: 'https://' + host + '/r/' + r.code, destinations: (r.destinations || []).filter(d => d.active !== false).length, paused: !!r.paused }));
|
||||
return json(res, 200, { account: true, username: a.username || null, host, hosts: hostsAll(), spins }, { 'Cache-Control': 'no-store' });
|
||||
}
|
||||
if (b.op !== 'ensure' || !Array.isArray(b.links) || !b.links.length || b.links.length > 60) return json(res, 400, { error: 'op' });
|
||||
const src = sources.networkSource(a.email, PL.template);
|
||||
const links = {}, errors = {};
|
||||
|
||||
Reference in New Issue
Block a user