Video Spin: one short link that rotates through video pages on Social Tube; Social Tube as a network link + traffic source

Links > Video Spins (third view). A Video Spin is a spin link (rotator kind 'video'): its videos are picked from the member's own Video App
Income videos or added by any member's Social Tube address, each checked with Video App Income over signed calls (NETCONV_SECRET_VAI,
prefix vspin.v1.). Pasted addresses are refused on a Video Spin. Per video: clicks here plus opened / played / tapped from Video App Income.
Limits mirror Banner Spin (Starter 2x5, Builder 5x15, Leader 10x25), counted apart from spin links. Network link nwst + source socialtube;
socialtube.club gets the click id. Chatbot answer video-spin, KNOWLEDGE_DATE 2026-11-22 (Marty 2026-11-22).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-22 12:29:54 -06:00
parent a6c36aeca1
commit bca3666ee2
9 changed files with 232 additions and 12 deletions
+3 -1
View File
@@ -100,7 +100,7 @@ function pub(r) {
for (const h of hits) { const d = perDest[h.d] = perDest[h.d] || { hits: 0, hits7: 0, uniques: new Set() }; d.hits++; if (h.ts >= since7) d.hits7++; d.uniques.add(h.v); }
const conv = convOf(r.id); const convBy = {}; for (const c of conv) convBy[c.ev] = (convBy[c.ev] || 0) + 1;
const since30 = Date.now() - 30 * DAY;
return { id: r.id, code: r.code, name: r.name, owner: r.owner, created: r.created, fallback: r.fallback || '', paused: !!r.paused, conversions: conv.length, convBy,
return { id: r.id, code: r.code, name: r.name, kind: r.kind || '', owner: r.owner, created: r.created, fallback: r.fallback || '', paused: !!r.paused, conversions: conv.length, convBy,
hours: r.hours || null, tz: r.tz || 'visitor', offHours30: hits.filter(h => h.oh && h.ts >= since30 && !h.bot).length, fallbackHealth: r.fallbackHealth || null, sourceId: r.sourceId || '',
destinations: r.destinations.map(d => Object.assign({ hours: null, health: null, autoPaused: 0 }, d, { hits: (perDest[d.id] || { hits: 0 }).hits, hits7: (perDest[d.id] || { hits7: 0 }).hits7, uniques: (perDest[d.id] || { uniques: new Set() }).uniques.size })),
hits: hits.length, hits7: hits.filter(h => h.ts >= since7).length, uniques: new Set(hits.map(h => h.v)).size, bots: hits.filter(h => h.bot).length };
@@ -131,6 +131,7 @@ async function create(owner, body) {
if (!isOwner(owner) && J.db.rotations.filter(r => r.owner === norm(owner)).length >= 100) return { error: 'That is a lot of rotations. Archive some first.' };
let code = newCode(); while (J.db.rotations.some(r => r.code === code)) code = newCode();
const r = { id: (J.db.rotations.reduce((m, x) => Math.max(m, x.id), 0) + 1), owner: norm(owner), name, code, fallback: cleanUrl(body.fallback) || '', destinations: [], created: Date.now(), paused: false, nextDest: 1 };
if (body.kind === 'video') { r.kind = 'video'; if (/^[A-Za-z0-9_.-]{1,40}$/.test(String(body.vref || ''))) r.vref = String(body.vref); } // Video Spin (2026-11-22): set by server.js only, never from a member's request body
J.db.rotations.push(r); J.save(); return { ok: true, rotation: pub(r) };
}
async function update(owner, id, body) {
@@ -194,6 +195,7 @@ async function addDest(owner, id, body, opts) {
if (r.destinations.length >= cap) return { error: 'Up to ' + DEST_MAX + ' destinations per rotation.' };
const w = Math.max(1, Math.min(100, Math.round(Number(body.weight) || 1)));
const d = { id: r.nextDest++, url, label: String(body.label || '').trim().slice(0, 60), weight: w, active: true, added: Date.now() };
if (opts && opts.video) { d.vid = String(opts.video.id); d.poster = String(opts.video.poster || ''); d.vowner = String(opts.video.owner || '').slice(0, 40); } // a Video Spin destination
r.destinations.push(d);
if (opts && opts.defer) return { ok: true, id: d.id }; // bulk import: the caller saves once at the end (rotator.json holds every click, ~18 MB; one write per destination would stall the app)
J.save(); return { ok: true, rotation: pub(r) };