From bca3666ee2dd0df5b36f4b18070d4fa3e58095c7 Mon Sep 17 00:00:00 2001 From: martbost Date: Sun, 22 Nov 2026 12:29:54 -0600 Subject: [PATCH] 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 --- catalog/traffic-sources.json | 18 ++++++ chatbot.js | 6 +- netlinks.js | 1 + public/assets/video-spin.js | 103 +++++++++++++++++++++++++++++++++++ public/links.html | 20 ++++++- qa/netsrc.test.mjs | 6 +- rotator.js | 4 +- server.js | 84 ++++++++++++++++++++++++++-- sources.js | 2 +- 9 files changed, 232 insertions(+), 12 deletions(-) create mode 100644 public/assets/video-spin.js diff --git a/catalog/traffic-sources.json b/catalog/traffic-sources.json index 0369ac0..d199758 100644 --- a/catalog/traffic-sources.json +++ b/catalog/traffic-sources.json @@ -159,6 +159,24 @@ "verified": true, "source": "network" }, + { + "key": "socialtube", + "name": "Social Tube", + "site": "socialtube.club", + "costModel": "", + "params": [ + { + "key": "clickid", + "token": "{clickid}", + "label": "Click id", + "role": "externalId" + } + ], + "postbackUrl": "", + "notes": "Crypto Team Build Network video gallery (members' short videos made with Video App Income). Clicks that arrive from Social Tube carry ?src=socialtube and are counted under this source automatically. Sign-ups and credit purchases on Video App Income that follow one of your clicks show in Reports > Conversions.", + "verified": true, + "source": "network" + }, { "key": "viraladsource", "name": "ViralAdSource", diff --git a/chatbot.js b/chatbot.js index 37b2b28..0273891 100644 --- a/chatbot.js +++ b/chatbot.js @@ -26,7 +26,7 @@ let DATA_DIR = null; let chain = null; const MODEL = process.env.OPENROUTER_MODEL || 'deepseek/deepseek-v4-flash:nitro'; const CONTRACT = '0x26Bdc556b94399bEdd69ae3ACA5aA6c54D946e8b'; -const KNOWLEDGE_DATE = '2026-11-18'; // the day the CANNED answers and FACTS below were last checked against the site +const KNOWLEDGE_DATE = '2026-11-22'; // the day the CANNED answers and FACTS below were last checked against the site function init(opts) { if (opts && typeof opts.refuelOn === 'function') REFUEL_ON = opts.refuelOn; DATA_DIR = opts.dataDir; chain = opts.chain; const ready = kb.init({ dataDir: DATA_DIR, seeds: seeds() }); @@ -69,6 +69,9 @@ const CANNED = [ { id: 'level4-override', title: 'The Level 4 override (3%)', q: ['What is the Level 4 override?', 'Do I earn from my fourth level?', 'How does the 3% override work?'], tags: ['override', 'level 4', 'fourth level', 'commission', 'payouts'], re: /(level ?(4|four)|4th level|fourth level|override|3 ?%|three percent)/i, a: 'The Level 4 override is 3 percent of every package bought four levels below you, paid by the company on top of the three levels the contract pays. It goes to the buyer’s 4th sponsor up if that member has 5 or more qualifying buyers (referrals who bought a package of $25 or more, the same bar as level 3). If they are not qualified yet, it moves up the line to the next member who is, up to 25 steps, and each purchase pays one override to one person. It is paid weekly in POL from a company wallet, every Monday after 9 AM Central for the Monday to Sunday week before, through the contract’s award function, so every payment has a Polygon link, and it shows on your Wallet screen as "Level 4 override". Weekly totals under 0.01 POL carry over to the next week. Purchases from the start date on count, earlier ones do not. It comes out of the platform’s 20 percent share, so the 50/20/10 split does not change. InstantAdPay pays its own override separately. What you earn depends on real purchases in your line; nothing is guaranteed.' }, + { id: 'video-spin', title: 'Video Spins (Social Tube videos)', q: ['What is a Video Spin?', 'How do Video Spins work?', 'Where do my Social Tube videos go here?'], tags: ['video spin', 'video spins', 'social tube'], + re: /(video ?spins?|rotat\w* (my |several |some )?videos?|spin (my |several )?videos?|social ?tube.{0,40}(track|link|spin|rotat)|(track|spin|rotat)\w*.{0,40}social ?tube)/i, + a: 'A Video Spin is one short link that opens a different video page each time. Open Links, choose Video Spins, name one, then tick videos you made on Video App Income or paste the Social Tube address of any member\'s video. Share the one link and the videos take turns; you can pause or remove any of them, and a video its owner hides is taken out automatically. Each video shows its clicks here plus how many people opened it, played it and tapped its button on Social Tube. Whoever\'s video is playing gets the views, and anyone who goes on to make their own video is credited to you. Video Spins come with your tier: Starter holds 2 with 5 videos each, Builder 5 with 15, Leader 10 with 25. Starter opens with any package of your own. The videos themselves are made on Video App Income (the first one is free) and shown on Social Tube, socialtube.club.' }, { id: 'banner-spin', title: 'Banner Spin: one image link that rotates your banners', q: ['What is Banner Spin?', 'How do I rotate several banners in one ad slot?', 'Who gets Banner Spin?'], tags: ['banner spin', 'banners', 'rotator', 'traffic exchange'], re: /banner ?spins?\b|rotat\w* (my |several |multiple |many |a few |\d+ )?banners|banners? rotat|(one|single) (image|banner) (url|address|link)/i, a: '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, so one banner slot on a traffic exchange, safelist, forum or your own site carries a whole campaign. It is a free add-on that opens with your own package of $25 or more: Starter holds 2 Banner Spins of 5 banners, Builder (level 2 open, 2 qualifying buyers) 5 of 15, Leader (level 3 open, 5 qualifying buyers) 10 of 25. Build it under Links, Banner Spins (' + SITE_URL + '/links#b) and copy one of four embeds: the image + click pair for exchanges and safelists, the HTML snippet for your site, the script tag (it writes the banner and its own link, so every click matches exactly) or the forum code. A click goes to the banner that visitor saw; one we cannot match goes to your fallback. It will not rotate inside paid ad networks (they copy the image when you upload a creative) or in Gmail (its image proxy keeps one copy), so use a single-banner Banner Spin for email. The Stats tab and Reports show views, clicks, CTR, match rate and conversions per banner and per placement, a WINNER badge once two banners have 1,000 views each, and a CACHED flag on sites that copy banners. Every live banner is checked every 30 minutes and paused after three failed checks, never the last live one.' }, @@ -222,6 +225,7 @@ FACTS: ${refuelFact()}${synFact()}- PRODUCT, all free with an email account: SPIN LINKS (the rotator: one short link, /r/, rotates between destinations by weight; pause any destination; a fallback for when all are off; one-hop redirect; every click recorded with day, country, source, device and a daily-salted visitor hash; bots filtered on the server; click ids and sub ids such as clickid, subid, s1 to s4 pass through to the destination; split tests by tagging the same link with different sub ids; a demo spin on the home page needs no account; DAYPARTING is live: a 7x24 hours grid per spin and per destination, time zone by name or the local time of the visitor, presets, and 'my best hours' from the clicks of the member after 200 clicks; automatic HEALTH CHECKS are live: every destination is checked every 30 minutes, a dead or parked one is paused after three failing checks and resumed when it passes twice, the owner is told once, and Check now runs it on demand). PAGES (page builder: scan any offer URL, get a bridge, review or squeeze page; designs, palettes, layouts and niche presets with hero images; leads to the member's own list with a CSV download, or the member pastes an autoresponder form on a squeeze page and LinkSpin restyles it; there is no lead webhook; published on the pages domain lookfirst.page; sales, advertorial and press-release layouts are coming). ZONES (an ad slot on the member's own site: one async script tag, nine sizes 728x90, 468x60, 300x250, 336x280, 250x250, 125x125, 160x600, 120x600, 320x50; waterfall = LinkSpin member campaign, then a network ad for 728x90 and 468x60, then the LinkSpin house banner; pays ad credits per VIEWABLE impression, half the banner on screen for one second, bots never, 50 credited views per visitor per zone per day; rates 1 credit per 5 viewable member-ad views and 1 per 10 network-ad views, 1 per 8 on a Verified zone; warm-up: a zone earns after its first 100 on-site views with at least 40 percent viewable and goes on hold below that; origin lock: paid ads serve only on the declared site and its subdomains, elsewhere the house banner shows and nothing is earned; up to 50 zones per account; PUBLISHER PROGRAM at /publishers for site owners, tiers Standard (default) and Verified (admin-reviewed site, better network rate)). AUDIENCES (first-party retargeting: "My visitors" collects everyone who viewed the member's pages and zones for 30 days; a pixel tag /p.js for other sites; campaigns can "show only to" or "never show to" an audience; nothing personal stored). PROMO TOOLS at /tools#promo (social posts, text-a-friend, email swipes, banners, objection bank, hook videos; five hook angles with videos: links, pages, zones, audiences, stack; angle links are the invite link plus ?v=). REPORTS (every link in one view, plus Pages, Zones, and since 2026-10-12 Traffic sources and Placements). BLOG at /blog with RSS at /blog/feed.xml. TRAFFIC SOURCES at /sources (2026-10-12): a source is a record of a network the member buys traffic on, created from a catalog of networks (PropellerAds, Zeropark, Adsterra, ExoClick, HilltopAds, TrafficStars, PopAds and more, with each network's macro tokens and conversion postback URL; account-specific slots such as a goal id are filled in at creation) or defined by hand; a spin link is pointed at one source (Share kit on the Links screen, or the Sources screen), and then the Share kit's first row is the exact campaign URL for that network with its macros already in place; when a click that came through that source converts (join, lead, wallet, purchase, or a partner-reported conversion; the member picks which) LinkSpin fires that network's own postback with the network's click id and the payout, server to server, and only the network that sent the click is told; Reports show clicks, uniques and conversions by source and by placement (the value the network's zone, placement, site, campaign, creative, banner or keyword macro carried); up to 30 sources per account, 20 params each; a source with no postback still builds the campaign URL and shows in Reports; the account-level Postbacks list on the Links screen (for the member's own tracker) still works alongside. TRAFFIC GUIDE at /traffic-guide (2026-10-28, public, linked from the Sources screen header and each source's detail): pick an offer type (free sign-up or email capture; crypto or team-build opportunity; advertising tools and ad credits; games and play-to-earn; software, apps and AI tools; courses and info products; giveaways and freebies) to see each ad format rated best / good / weak / avoid with a reason, a tip, and the catalog networks that sell the good formats (strict-policy networks Google, Microsoft, Facebook, Taboola, Revcontent, MGID left out for the crypto offer; adult-only TrafficJunky only for games and giveaways); cards for the 8 formats (popunder, push, in-page push, native, search, social, banners, domain redirect: what it is, how you pay, what converts, what struggles, landing page); a table of all 30 catalog networks with the formats each sells, adult-heavy and strict-policy flags and best-for; ground rules (test small, track every click under Sources, one change at a time, block zones that waste money, no income promises, mainstream vs adult inventory). The New source picker shows the same format tags and can be searched by format (push, native...). Never promise results; the guide says Reports are the final word. Knowledge checked on ${KNOWLEDGE_DATE}. - CONVERSION PIXEL (LIVE 2026-10-23, Control Room > Conversions at ${SITE_URL}/conversions; InstantAdPay members see the same goals under Campaigns > Conversion tracking, held on their LinkSpin account): a member names GOALS (subscriber, sale, any word, optional default value, up to 20); each goal has a PUBLIC pixel id (px + 10 characters) that can only count clicks the member owns. EVERY CLICK GETS AN ID: LinkSpin ad clicks (banner, text, zones) and InstantAdPay ad clicks add lsclk= to the target address (other params kept); a spin link reached through an ad passes its own id on and inherits the ad as its source; spin links of a member with a goal add lsclk to the destination too, and so do Banner Spin clicks that go straight to a page (since 2026-10-26; a banner pointed at a spin link gets the spin link's id). SETUP, 3 steps: 1) the LANDING TAG on the landing page, one line , keeps the id on the member's own site 30 days (localStorage + a first-party cookie), fills hidden form fields named lsclk, lsid or clickid and adds the id to links that stay on the same site; 2) the GOAL PIXEL on the thank-you page, an image cv.gif?px=PIXEL_ID&goal=NAME (optional &value=19.95) or the script version cv.js that reads what the tag kept; 3) Send a test conversion (recorded apart, never counted). MATCHING ORDER: the click id in the address, then the id the tag kept, then LinkSpin's own cookie, then a 24-hour match on network + browser (a hash, no IP stored); the method is shown per goal so members see how solid each count is. RULES: each goal counts once per 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 the pixel owner's own clicks, rate limited per pixel and per visitor. OWN CLICKS (2026-10-26): the goal owner's own click on ANY click type (ads, spin links, Banner Spins) is kept as a test and never counted: a click made while signed in as the owner, or a click or conversion from a browser (network + browser soft key) the owner has signed in from on LinkSpin or InstantAdPay; the Conversions screen says 'N from your own clicks, kept as tests and left out'. To test, use Send a test conversion and the &test=1 page check, never a sign-up of your own. REPORTS per goal: conversions and cost per goal (the campaign's credits spent / its conversions, in that site's ad credits) by ad campaign (LinkSpin and InstantAdPay), spin link, Banner Spin (banners straight to a page), destination page and traffic source, plus CSV export. ONE PLACE TO LOOK (2026-11-07): Reports > Conversions on LinkSpin and the Conversion tracking card on InstantAdPay list goals together with join, wallet and purchase events, with values, each event once; per-link Conv. counts include goals; the CSV holds goal conversions only. NETWORK EVENTS (2026-11-07, reporting only, it never changes sponsors, payouts or anything on chain): the landing tag adds the kept click id to links to instantadpay.com, linkspin.app and the share domains instantadpay.link, ctbgo.com and mylinehq.com, also inside a member's own redirect link when the address is in one of its parameters (spin and Banner Spin links are left alone; a button that navigates by script instead of a link is not covered); a spin link or Banner Spin pointed straight at those sites adds lsclk with no goal needed. InstantAdPay keeps the click 30 days in a first-party cookie, stores it on the account at sign-up and reports sign-up, wallet link and each package purchase (value = the USD price on the chain event, linked positions included) to LinkSpin, which counts join and wallet once per click and every purchase on its own. Same 30-day rule: an event more than 30 days after the click does not count. The first account on a click owns it. The click owner's own account and own clicks are kept as tests. Postbacks fire for join, wallet and purchase as they do for LinkSpin's own. Nothing is counted back in time: an account without a click stored at sign-up has none. POSTBACKS: a postback or traffic source set to the event 'goal' fires for every goal with {event} = the goal name. AUTORESPONDERS: when Aweber, GetResponse or another provider hosts the thank-you page, set its thank-you (success) redirect to the member's own page that carries the pixel; otherwise the pixel still counts through the cookie or the 24-hour match, less surely. The tag and pixel never break the page if LinkSpin cannot be reached and work inside traffic-exchange frames. SETUP GUIDE (public, 2026-10-24): ${SITE_URL}/conversion-tracking (InstantAdPay's copy: https://instantadpay.com/conversion-tracking): why track, the flow, the 4 steps (goal, landing tag, goal pixel, test), copy-paste examples (plain HTML, WordPress footer plugin + Custom HTML block, page builders, Aweber/GetResponse custom thank-you page), the page check (add &test=1 to the pixel address, open the thank-you page, the last test time updates, then remove it), what to do without code on the thank-you page (image pixel = cookie or 24-hour match; LinkSpin.goal(pixelId, name) from the page's own code for a pop-up form; postbacks), how to read the report and a troubleshooting checklist (same domain for landing and thank-you page, goal pixel only on the thank-you page, the script version is surest, a Banner Spin banner pointed straight at a page now carries its own click id and counts under By Banner Spin; the member's own clicks on ads, spin links and Banner Spins are all kept as tests). Send members there for any setup question. - TOOL LIMITS BY TIER (2026-10-21): spin links and pages each: Free (no package) 3, Starter (any package of your own) 10, Builder (level 2 open, 2 qualifying buyers) 50, Leader (level 3 open, 5 qualifying buyers) unlimited (fair use). Each spin link rotates up to 25 destinations at every tier; clicks are unlimited. Nothing already made is ever removed when a cap applies; new ones wait for the upgrade. Banner Spin has its own ladder (Starter 2 x 5, Builder 5 x 15, Leader 10 x 25). Other limits, same for everyone: 50 zones, 20 audiences, 20 postbacks, 5 linked positions. +- VIDEO SPIN (LIVE 2026-11-22): Links > Video Spins. One short spin link (/r/) that rotates through video pages on Social Tube (socialtube.club, the network's video gallery of videos members make on Video App Income). The member picks their own videos from a list or pastes any member's Social Tube video address; every video is checked with Video App Income before it is added, and other addresses cannot be put in a Video Spin. Pause, resume and remove per video; pause or delete the whole spin; a hidden or removed video is taken out by the health check. Per video: clicks (LinkSpin) plus opened / played / tapped the button (counted on Social Tube). The video owner gets the views; a visitor who goes on to join Video App Income is credited to the spin's owner. Limits by tier: Starter 2 Video Spins x 5 videos, Builder 5 x 15, Leader 10 x 25; Free has none. Video Spins are counted apart from ordinary spin links. Social Tube is also its own traffic source now (clicks from it carry ?src=socialtube; network link code nwst). - BANNER SPIN (LIVE 2026-10-18, reports and health checks 2026-10-20): one image address (/i/.gif on a link domain) and one click address (/c/) that rotate up to 25 banners, each with its own target (any https page or one of the member's spin links), weights 1 to 100, random by weight on every view or one banner per visitor per day, the dayparting grid per Banner Spin and per banner, pause, a fallback page and an optional fallback banner image, and a traffic source so its conversions fire that network's postback. Built on the Links screen (${SITE_URL}/links#b). WHO GETS IT: a free add-on for members with their own package of $25 or more; tiers: 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; dropping below a tier keeps everything serving, it only stops new ones. One size per Banner Spin (468x60, 728x90, 300x250, 125x125, 160x600, 120x600, 336x280, 250x250, 320x50); JPG, PNG or GIF (animated is fine), 150 KB at most, uploads count toward the 10 files a day. EMBEDS: the image + click pair (traffic exchanges, safelists, downline builders), an HTML snippet (own sites, blogs, HTML email), a script tag (writes the banner and its own link, so every click matches exactly) and forum BBCode; every link domain answers every code. MATCHING: with the pair, the server remembers which banner a visitor saw on which page for 15 minutes and sends the click there; an unmatched click goes to the fallback. LIMITS: paid ad networks (Froggy, PropellerAds and the like) copy the image at upload, so it freezes on one banner there; Gmail and some mail apps fetch images through a caching proxy, so email readers mostly see one banner and clicks fall back: use a single-banner Banner Spin for email. REPORTS: per banner and per placement views, unique viewers (daily sample), clicks, CTR, match rate and conversions, by Central day, country and device, bots and server loads shown separately and never counted; a WINNER badge once two or more live banners have 1,000 views each and one leads on click rate (LinkSpin never changes weights by itself); a CACHED flag on a placement that copies banners to its own server; totals also on the Reports screen. HEALTH: every 30 minutes each live banner's image must load as an image of the right size and its target must pass the spin-link checks (dead, parked, slow); three failures in a row pause that banner, two clean passes resume it, the last live banner is never auto-paused, and the status shows on each banner row. - PACKAGES (priced in dollars, settled in POL at the live rate, 1 credit = 1 cent of ad delivery): $10 door = 1,000 credits, for trying the ads, does NOT count toward qualification; $25 Starter = 2,500; $50 Builder = 5,000; $100 Growth = 10,000; $250 Leader = 25,000; $500 Network = 50,000. Any package of $25 or more makes the buyer a qualifying buyer for their sponsor. - THE SPLIT, same transaction on Polygon, fixed in the contract: 50 percent direct sponsor, 20 percent level 2, 10 percent level 3, 10 percent + 10 percent to the two admin wallets. Level 1 pays from a referral's first qualifying purchase once the sponsor's payouts are on. Level 2 opens after two of the member's people buy a qualifying ($25 or larger) package, level 3 after five. An unfilled tier passes up the line to the next qualified member, then to the platform. Nothing is held, there are no withdrawals, no pending balances. Contract ${CONTRACT} on Polygon, verified on Polygonscan; plain-language review at ${SITE_URL}/contract; live ledger at ${SITE_URL}/ledger with a verify link on every row. diff --git a/netlinks.js b/netlinks.js index 454eeef..4474e11 100644 --- a/netlinks.js +++ b/netlinks.js @@ -15,6 +15,7 @@ const SITES = [ { id: 'viraladsource', code: 'nwvas', name: 'ViralAdSource', url: 'https://viraladsource.com/{s2}?ref={s1}' }, { id: 'yourprogrambuilder', code: 'nwypb', name: 'YourProgramBuilder', url: 'https://yourprogrambuilder.com/{s2}?ref={s1}' }, { id: 'videoappincome', code: 'nwvai', name: 'Video App Income', url: 'https://videoappincome.com/{s2}?ref={s1}' }, // 2026-11-21: s2 = join for the invite page, empty = the sales page + { id: 'socialtube', code: 'nwst', name: 'Social Tube', url: 'https://socialtube.club/{s2}?ref={s1}' }, // 2026-11-22: the network's video gallery; ?ref= keeps the member's credit on every page there { id: 'fivex', code: 'nw5x', name: '5xYourTeam', url: 'https://5xyourteam.com/{s2}?ref={s1}' }, { id: 'downlinehydra', code: 'nwdh', name: 'DownlineHydra', url: 'https://downlinehydra.com/{s2}?ref={s1}' }, { id: 'stackpol', code: 'nwsp', name: 'Stack POL', url: 'https://stackpol.com/{s2}?ref={s1}' }, diff --git a/public/assets/video-spin.js b/public/assets/video-spin.js new file mode 100644 index 0000000..fb94d31 --- /dev/null +++ b/public/assets/video-spin.js @@ -0,0 +1,103 @@ +// Video Spin (2026-11-22): the third view on the Links screen. One short link that rotates through video pages on Social Tube. +// It is a spin link underneath (rotator.js, kind 'video'): pause, weights and removal go through the spin-link routes; creating one, +// adding videos and the play counts go through /api/my/videospins (server.js), which checks every video with Video App Income. +(function () { + 'use strict'; + if (!window.CR || !document.getElementById('vsWs')) return; + const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt, api = CR.api, toast = CR.toast; + let D = null, SPINS = [], SEL = null, HOST = '', PLAYS = {}, BUSY = false; + let WANT = Number((/^#v([0-9]+)$/.exec(location.hash) || [])[1]) || 0; // the Video Spin named in the address when the page opened + const mark = () => { if (!$('vsWs').hidden) history.replaceState(null, '', '#v' + (SEL || '')); }; + const base = () => 'https://' + (HOST || location.host), linkOf = s => base() + '/r/' + s.code; + const clicks7 = s => s.hits7 || 0; + const state = s => s.paused ? { cls: 'warn', t: 'PAUSED' } : !s.destinations.some(d => d.active) ? { cls: 'bad', t: 'NO LIVE VIDEO' } : { cls: 'ok', t: 'LIVE' }; + + // ── view switch: this script only owns the Video Spins view; banner-spin.js keeps switching the other two ── + function show(on) { + $('vsWs').hidden = !on; const vb = $('vsNewBtn'); if (vb) vb.hidden = !on; + if (on) { $('ws').hidden = true; $('bsWs').hidden = true; const nb = $('newBtn'), bn = $('bsNewBtn'); if (nb) nb.hidden = true; if (bn) bn.hidden = true; } + } + $('vsw').querySelectorAll('button').forEach(b => b.addEventListener('click', () => { + const on = b.dataset.v === 'videos'; show(on); + if (on) load(true); + })); + (function addBtn(n) { const nb = $('newBtn'); if (!nb) { if (n < 50) setTimeout(() => addBtn(n + 1), 200); return; } + const b = document.createElement('button'); b.className = 'btn pri'; b.id = 'vsNewBtn'; b.type = 'button'; b.hidden = $('vsWs').hidden; b.textContent = '+ New Video Spin'; nb.parentNode.appendChild(b); + b.addEventListener('click', () => { SEL = null; render(); const i = $('vsNewName'); if (i) i.focus(); }); })(0); + + async function load(keep) { + try { D = await CR.get('/api/my/videospins'); } catch (e) { toast(e.message, true); return; } + SPINS = (D.spins || []).slice().sort((a, b) => clicks7(b) - clicks7(a) || b.created - a.created); + const hs = D.hosts || []; if (!HOST || !hs.includes(HOST)) HOST = hs[0] || location.host; + if (!keep || !SPINS.some(s => s.id === SEL)) SEL = null; + if (WANT) { if (SPINS.some(s => s.id === WANT)) SEL = WANT; WANT = 0; } + mark(); setTimeout(mark, 1500); // the spin-link list reloads in the background and may set its own address; keep ours while this view is open + render(); if (SEL) loadPlays(); + } + async function loadPlays() { const id = SEL; try { const r = await CR.get('/api/my/videospins/' + id + '/plays'); if (id === SEL) { PLAYS = r.plays || {}; renderDetail(); } } catch (e) {} } + + function render() { renderList(); renderDetail(); } + function renderList() { + const L = D.limits || { spins: 0, videos: 0 }, t = D.tier || { label: '' }; + $('vsCount').textContent = SPINS.length + ' Video Spin' + (SPINS.length === 1 ? '' : 's'); + $('vsTier').innerHTML = L.spins ? esc(t.label) + ' tier: ' + L.spins + ' Video Spins, ' + L.videos + ' videos in each.' + : 'Video Spins start at the Starter tier (any package of your own): 2 Video Spins with 5 videos in each.'; + $('vsItems').innerHTML = SPINS.length ? SPINS.map(s => { const h = state(s); return '
' + + '
' + esc(s.name) + (h.cls !== 'ok' ? ' ' + h.t + '' : '') + ' ' + s.destinations.length + ' video' + (s.destinations.length === 1 ? '' : 's') + '
' + esc((HOST || location.host) + '/r/' + s.code) + '
' + + '
' + fmt(clicks7(s)) + '7 d
'; }).join('') + : '
No Video Spins yet.
'; + $('vsItems').querySelectorAll('.item').forEach(el => { const go = () => { SEL = Number(el.dataset.id); PLAYS = {}; history.replaceState(null, '', '#v' + SEL); render(); loadPlays(); }; + el.addEventListener('click', go); el.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); go(); } }); }); + } + + function renderDetail() { + const box = $('vsDetail'), s = SPINS.find(x => x.id === SEL), L = D.limits || { spins: 0, videos: 0 }; + if (!s) { + const can = D.on && L.spins > 0 && SPINS.length < L.spins; + box.innerHTML = '
Video Spin
' + + '

One short link that plays a different video page each time it is opened. Pick videos you made on Video App Income, or add any member\'s video by its Social Tube link. Share the one link; the videos take turns. People who go on to make their own video are credited to you.

' + + (D.vaiError ? '

' + esc(D.vaiError) + '

' : '') + + (!D.on ? '

Video Spins are not switched on yet.

' + : can ? '
' + : '

' + (L.spins ? 'You have all ' + L.spins + ' Video Spins your tier holds. Remove one to make another.' : 'Video Spins start at the Starter tier (any package of your own).') + '

') + + '
'; + const c = $('vsCreate'); if (c) { const go = async () => { const name = $('vsNewName').value.trim(); if (!name) { toast('Give it a name first.', true); return; } if (BUSY) return; BUSY = true; + try { const r = await api('/api/my/videospins', { name }); SEL = r.rotation.id; history.replaceState(null, '', '#v' + SEL); toast('Video Spin created. Now add videos.'); await load(true); } catch (e) { toast(e.message, true); } BUSY = false; }; + c.addEventListener('click', go); $('vsNewName').addEventListener('keydown', e => { if (e.key === 'Enter') go(); }); } + return; + } + const inSpin = new Set(s.destinations.map(d => d.vid)), mine = (D.videos || []).filter(v => !inSpin.has(v.id)), room = Math.max(0, L.videos - s.destinations.length); + const rows = s.destinations.map(d => { const p = PLAYS[d.vid] || null, gone = p && p.live === false; + const tag = gone ? 'REMOVED BY OWNER' : !d.active ? '' + (d.autoPaused ? 'PAUSED: NOT LOADING' : 'PAUSED') + '' : ''; + return '
' + esc(d.label || 'Video') + ' ' + tag + '
' + (d.vowner ? 'By ' + esc(d.vowner) + '. ' : '') + fmt(d.hits || 0) + ' click' + ((d.hits || 0) === 1 ? '' : 's') + + (p ? ', ' + fmt(p.views) + ' opened, ' + fmt(p.plays) + ' played, ' + fmt(p.taps) + ' tapped the button' : '') + '
' + + '
'; }).join(''); + box.innerHTML = '

' + esc(s.name) + '

' + state(s).t + '
' + + '
' + + '

' + fmt(s.hits || 0) + ' clicks in all, ' + fmt(s.hits7 || 0) + ' in the last 7 days' + (s.conversions ? ', ' + s.conversions + ' conversion' + (s.conversions === 1 ? '' : 's') : '') + '. Each open goes to one of the videos below.

' + + '

Videos in this spin ' + s.destinations.length + ' of ' + L.videos + '

' + + (rows || '

No videos yet. Add some below; the link starts working with the first one.

') + + '

Add your videos

' + + (D.vaiError ? '

' + esc(D.vaiError) + '

' : !D.member ? '

No Video App Income account was found for your email address. Make your first video at videoappincome.com (it is free), then come back.

' + : !room ? '

This Video Spin is full for your tier.

' + : mine.length ? '
' + mine.map(v => '').join('') + '
Room for ' + room + ' more.
' + : '

' + ((D.videos || []).length ? 'All of your videos are already in this spin.' : 'You have no videos on Social Tube yet. Make one on Video App Income and it appears here.') + '

') + + '

Add any member\'s video

Open the video on socialtube.club and paste its address. Its owner gets the views; people who go on to join are credited to you.

' + + (room ? '
' : '

This Video Spin is full for your tier.

') + + '
'; + $('vsCopy').addEventListener('click', () => { const u = linkOf(s); (navigator.clipboard && navigator.clipboard.writeText ? navigator.clipboard.writeText(u) : Promise.reject()).then(() => toast('Link copied'), () => { $('vsLink').select(); toast('Select and copy the link', true); }); }); + $('vsPause').addEventListener('click', () => act(() => api('/api/my/rotations/' + s.id, { paused: !s.paused }), s.paused ? 'Resumed' : 'Paused')); + $('vsDel').addEventListener('click', e => { const b = e.currentTarget; if (b.dataset.arm !== '1') { b.dataset.arm = '1'; b.textContent = 'Tap again to delete'; setTimeout(() => { b.dataset.arm = ''; b.textContent = 'Delete'; }, 4000); return; } + act(async () => { await api('/api/my/rotations/' + s.id, { remove: true }); SEL = null; history.replaceState(null, '', '#v'); }, 'Video Spin deleted'); }); + box.querySelectorAll('[data-act]').forEach(b => b.addEventListener('click', () => { const a = b.dataset.act, p = '/api/my/rotations/' + s.id + '/dest/' + b.dataset.d; + act(() => api(p, a === 'remove' ? { remove: true } : { active: a === 'resume' }), a === 'remove' ? 'Video removed from this spin' : a === 'resume' ? 'Video resumed' : 'Video paused'); })); + const am = $('vsAddMine'); if (am) am.addEventListener('click', () => { const ids = [...box.querySelectorAll('.vsc input:checked')].map(x => x.value); if (!ids.length) { toast('Tick at least one video.', true); return; } + act(() => api('/api/my/videospins/' + s.id + '/add', { ids }), ids.length === 1 ? 'Video added' : ids.length + ' videos added'); }); + const al = $('vsAddLink'); if (al) { const go = () => { const link = $('vsLinkIn').value.trim(); if (!link) { toast('Paste a Social Tube video link first.', true); return; } act(() => api('/api/my/videospins/' + s.id + '/add', { link }), 'Video added'); }; + al.addEventListener('click', go); $('vsLinkIn').addEventListener('keydown', e => { if (e.key === 'Enter') go(); }); } + } + async function act(fn, done) { if (BUSY) return; BUSY = true; try { await fn(); if (done) toast(done); await load(true); } catch (e) { toast(e.message, true); } BUSY = false; } + + window.VideoSpin = { reload: () => load(true) }; + if (/^#v/.test(location.hash)) setTimeout(() => { const b = $('vsw').querySelector('button[data-v="videos"]'); if (b) b.click(); }, 400); +})(); diff --git a/public/links.html b/public/links.html index 7f5215e..4130c70 100644 --- a/public/links.html +++ b/public/links.html @@ -107,11 +107,20 @@ .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}} +/* Video Spin (2026-11-22) */ +.vsp{padding:18px 20px 28px;max-width:860px}.vshead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}.vshead h2{margin:0;font-size:20px} +.vsrow{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.vsrow .field{flex:1;min-width:200px} +.vsh{font-size:14px;letter-spacing:.06em;text-transform:uppercase;margin:24px 0 8px;display:flex;gap:10px;align-items:baseline}.vsh .muted{font-size:12px;text-transform:none;letter-spacing:0;font-weight:400} +.vsv{display:grid;grid-template-columns:44px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}.vsv img{width:44px;height:78px;object-fit:cover;border-radius:6px;background:#000} +.vsi b{font-size:14px}.vsi .muted{font-size:12.5px;margin-top:3px}.vsa{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end} +.vsgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:10px}.vsc{position:relative;display:block;cursor:pointer;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--panel)} +.vsc img{display:block;width:100%;aspect-ratio:9/16;object-fit:cover;background:#000}.vsc span{display:block;font-size:12px;line-height:1.3;padding:6px 7px;max-height:44px;overflow:hidden}.vsc input{position:absolute;left:6px;top:6px;width:18px;height:18px} +@media (max-width:760px){.vsp{padding:14px 14px 24px}.vsv{grid-template-columns:44px minmax(0,1fr)}.vsa{grid-column:1/-1;justify-content:flex-start}}
-
+

Links

by clicks, 7 days
@@ -183,6 +192,14 @@
+