"Use one of my spin links" on the text-ad form (Marty 2026-11-15): a member picks one of their own LinkSpin spin links as the ad link, so one free ad rotates clicks across every page they promote. Listed live from LinkSpin (GET /api/my/spins -> lstrack.spins, /api/partner/vab/links op 'spins'). A LinkSpin /r/<code> link on any LinkSpin host is accepted ONLY when LinkSpin confirms it is the signed-in member's own (lstrack.checkSpin): someone else's, a paused one, one with no active pages, or any while LinkSpin is not answering is refused; the network's fixed nw* links and /r/ links on other sites stay ordinary links; other shortener rules unchanged. A spin-link ad (ad.spin) never gets the "Track with LinkSpin" wrapper: /go/<ad> sends straight to the spin link, the checkbox is greyed with a note. LinkSpin hosts learned from every spins answer (warmed hourly by the sweep). Chatbot: CANNED spin-link + FACTS. my.js?v=7. Smoke 217 pass (14b2: foreign refused, own accepted), chatbot 206 pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -361,10 +361,17 @@ const server = http.createServer(async (req, res) => {
|
||||
let ls = null; // LinkSpin tracking of the ad (lstrack.js): state, the tracked link, its clicks as LinkSpin counts them
|
||||
if (a) { const stt = lstrack.state(a); ls = { on: lstrack.on(), track: a.track !== false, state: stt, link: stt === 'tracked' ? a.ls.link : null, clicks: null };
|
||||
if (stt === 'tracked' && m.username) { const cs = await lstrack.clicks(m.username).catch(() => null); if (cs && cs[String(a.id)]) { const c0 = cs[String(a.id)]; ls.clicks = { hits: c0.hits || 0, hits30: c0.hits30 || 0, unique30: c0.unique30 || 0 }; } } }
|
||||
return json(res, 200, { address: me, username: m.username, netVerified: netVerified(m), ad: a ? { id: a.id, headline: a.headline, line1: a.line1, line2: a.line2, link: a.link, status: a.status, views: a.views || 0, clicks: a.clicks || 0, vclicks: a.vclicks || 0, createdAt: a.createdAt, track: a.track !== false } : null, linkspin: ls,
|
||||
return json(res, 200, { address: me, username: m.username, netVerified: netVerified(m), ad: a ? { id: a.id, headline: a.headline, line1: a.line1, line2: a.line2, link: a.link, status: a.status, views: a.views || 0, clicks: a.clicks || 0, vclicks: a.vclicks || 0, createdAt: a.createdAt, track: a.track !== false, spin: !!a.spin } : null, linkspin: ls,
|
||||
boosts: wire.purchases().filter(b => b.buyer === me).sort((x, y) => (y.at || 0) - (x.at || 0)).map(wire.boostView), earned: myEarned(me), line: line.slice(0, 8), lineOk: lo.ok,
|
||||
page, joinUrl: joinUrl(''), boost: C.boost });
|
||||
}
|
||||
// "Use one of my spin links" (Marty 2026-11-15): the member's own LinkSpin spin links, read from LinkSpin (lstrack.spins)
|
||||
if (p === '/api/my/spins' && req.method === 'GET') {
|
||||
if (limited(req, 'spins', 120, 3600000)) return json(res, 429, { error: 'Too many requests this hour.' });
|
||||
const m = store.member(me); if (!netVerified(m)) return json(res, 403, { error: 'Sign in through InstantAdPay or LinkSpin to use your spin links.' });
|
||||
const r = await lstrack.spins(m.username); if (r.error) return json(res, 502, { error: r.error });
|
||||
return json(res, 200, { account: r.account !== false, spins: r.spins || [] });
|
||||
}
|
||||
// the member's one text ad: create, or edit (a Boost follows the ad, so editing keeps it)
|
||||
if (p === '/api/my/ad' && req.method === 'POST') {
|
||||
if (limited(req, 'ad', 30, 3600000)) return json(res, 429, { error: 'Too many changes this hour.' });
|
||||
@@ -376,14 +383,18 @@ const server = http.createServer(async (req, res) => {
|
||||
if (line1.length < 3 || line1.length > C.ad.line) return json(res, 400, { error: 'Write the first line in 3 to ' + C.ad.line + ' characters.' });
|
||||
if (line2.length > C.ad.line) return json(res, 400, { error: 'Keep the second line to ' + C.ad.line + ' characters.' });
|
||||
const lk = safety.checkLink(b.link, 'Your link'); if (lk.error) return json(res, 400, lk);
|
||||
// a LinkSpin spin link (/r/<code> on a LinkSpin host) is accepted ONLY when LinkSpin confirms it is this member's own
|
||||
// (lstrack.checkSpin, Marty 2026-11-15). It is already tracked on LinkSpin, so it never gets the tracked-link wrapper.
|
||||
const sp = await lstrack.checkSpin(lk.url, m.username); if (sp.error) return json(res, 400, { error: sp.error });
|
||||
const spin = sp.spin ? sp.code : null;
|
||||
const cur = store.adOf(me);
|
||||
if (C.linkProbe && (!cur || cur.link !== lk.url)) { const pr = await safety.probeLink(lk.url, { frames: false }); if (pr.error) return json(res, 400, pr); }
|
||||
// "Track with LinkSpin" (default on): the ad's public link goes through the member's own LinkSpin tracked link (lstrack.js).
|
||||
// LinkSpin is asked right away (at most 4 s); if it does not answer, the ad goes live with its own link and the sweep retries.
|
||||
const track = b.track === undefined ? (cur ? cur.track !== false : true) : b.track !== false && b.track !== 'off' && b.track !== 0;
|
||||
const lsNow = async x => { if (!lstrack.on() || x.track === false) return lstrack.state(x); await Promise.race([lstrack.ensureAd(x).catch(() => {}), new Promise(r => setTimeout(r, 4000).unref())]); return lstrack.state(x); };
|
||||
if (cur) { Object.assign(cur, { headline, line1, line2, link: lk.url, track, status: cur.status === 'paused' ? 'paused' : 'live' }); if (cur.link !== (cur.ls && cur.ls.url)) delete cur.lsTry; store.saveAd(cur); return json(res, 200, { ok: true, ad: { id: cur.id }, created: false, linkspin: await lsNow(cur) }); }
|
||||
const a = store.addAd({ owner: me, headline, line1, line2, link: lk.url, track, status: 'live', views: 0, clicks: 0, vclicks: 0 }); store.bump('adsPosted');
|
||||
if (cur) { Object.assign(cur, { headline, line1, line2, link: lk.url, track, spin, status: cur.status === 'paused' ? 'paused' : 'live' }); if (cur.link !== (cur.ls && cur.ls.url)) delete cur.lsTry; store.saveAd(cur); return json(res, 200, { ok: true, ad: { id: cur.id }, created: false, linkspin: await lsNow(cur) }); }
|
||||
const a = store.addAd({ owner: me, headline, line1, line2, link: lk.url, track, spin, status: 'live', views: 0, clicks: 0, vclicks: 0 }); store.bump('adsPosted');
|
||||
wire.attachPending(me, a.id);
|
||||
return json(res, 200, { ok: true, ad: { id: a.id }, created: true, linkspin: await lsNow(a) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user