From 7d28ec7b5f632f076553bb15cfd8767651d6e3bc Mon Sep 17 00:00:00 2001 From: martbost Date: Tue, 3 Nov 2026 07:36:55 -0600 Subject: [PATCH] Short banner image URLs (Michael Camire via Marty, 2026-11-03): the Spaces CDN links in the Games and BixPay kits ran about 105 characters and exchange / safelist image fields cut them off, so the banners never showed. /b// on instantadpay.com and the share hosts (https://ctbgo.com/b/turkeydrop/728x90.png) serves the same game-banners CDN file in place (no redirect, HEAD works, 300-file six-hour cache); promo.js builds every game and BixPay banner URL on the share domain; chatbot banner-image answer; promo.js?v=20261103b, KNOWLEDGE_DATE 2026-11-03 Co-Authored-By: Claude Fable 5.1 --- chatbot.js | 4 ++-- public/assets/promo.js | 17 ++++++++++------- public/my.html | 2 +- server.js | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/chatbot.js b/chatbot.js index 25acbfc..ba155ca 100644 --- a/chatbot.js +++ b/chatbot.js @@ -33,7 +33,7 @@ function key() { function enabled() { return !!key(); } // ---- canned answers: instant, free, always in voice ---- -const KNOWLEDGE_DATE = '2026-11-02'; // bump whenever the canned answers / prompt are brought up to date +const KNOWLEDGE_DATE = '2026-11-03'; // bump whenever the canned answers / prompt are brought up to date const SUPPORT_RE = /(contact|reach|email|e-mail|message|talk to|speak (to|with)|get hold of) (the )?(support|admin|administrator|owner|marty|staff|team at instantadpay|someone|a (human|person|real person))|support (email|address|ticket|team|desk)|help ?desk|(open|send|file|submit|raise) (a )?(support )?ticket|\b(human|real person|live (agent|person|chat|support))\b|customer (service|support)|support@|how (do|can) i get (help|support)/i; const CANNED = [ { id: 'support', title: 'Contact support or open a ticket', q: ['How do I contact support?', 'How do I talk to a real person?', 'How do I open a support ticket?'], tags: ['support', 'help', 'ticket', 'contact', 'help desk'], @@ -190,7 +190,7 @@ const CANNED = [ a: 'You get your share link the moment you sign in, free members included. Open Members > Promo tools: the "Your links" block at the top lists your invite link plus five angle versions (Instant, Ad spend, Free, Ledger, Two), each with a note on who it is for and Copy and Share buttons. They are the same link with a code on the end, so every join and purchase credits you; only the first page the person sees changes. One tip: switch on payouts (one free wallet step in Members) before your people start buying, because the contract locks each buyer to their sponsor at their first purchase.' }, { id: 'banner-image', title: 'Banner image link and sizes', q: ['Why was my banner image refused?', 'What banner sizes are there?', 'How do I upload a banner?'], tags: ['banner', 'image', 'sizes', 'campaign'], re: /(banner (image|url|link|size|creative|file)|image (url|link|field)|broken (banner|image)|upload (a |my |the )?(banner|image|creative)|(png|jpg|jpeg) link|which sizes?)/i, - a: 'The image field on a banner campaign needs a direct link to the picture itself, one that ends in .png, .jpg, .gif, .webp or .svg, or an upload. A web page link (your join page, an image-hosting page) is refused, because it would show a broken banner. Easiest source: Promo tools > Banners, pick the size you want and tap Copy image URL. Sizes are the standard ad sizes (728x90, 300x250, 160x600, 320x50 and more); the campaign form asks for the size too. Banner and text ads also run out on the wider network.' }, + a: 'The image field on a banner campaign needs a direct link to the picture itself, one that ends in .png, .jpg, .gif, .webp or .svg, or an upload. A web page link (your join page, an image-hosting page) is refused, because it would show a broken banner. Easiest source: Promo tools > Banners, pick the size you want and tap Copy image URL. Game and BixPay banner links in Promo tools are short (for example https://ctbgo.com/b/turkeydrop/728x90.png) so they fit the image fields on exchanges and safelists that cut long links. Sizes are the standard ad sizes (728x90, 300x250, 160x600, 320x50 and more); the campaign form asks for the size too. Banner and text ads also run out on the wider network.' }, { id: 'themes', title: 'Light and dark themes', q: ['Is there a light mode?', 'How do I switch themes?'], tags: ['theme', 'dark mode', 'light mode', 'appearance', 'accessibility'], re: /(dark ?mode|light ?mode|dark theme|light theme|night mode|themes?|appearance|too bright|too dark|high contrast)/i, a: 'InstantAdPay has light and dark themes (added 2026-11-02). In the member area use the Light, Dark or Auto control in the header, or the Appearance card on your Profile. Dark is the original look, Light is a bright green-grey workspace with the same layout, and Auto follows your device setting and switches with it. Your choice is saved on your account, so it follows you to any device once you sign in, and it applies to the public pages and your wall too. Nothing changes until you pick one. Both themes pass the accessibility contrast standard for text.' }, diff --git a/public/assets/promo.js b/public/assets/promo.js index dd3c885..ed27093 100644 --- a/public/assets/promo.js +++ b/public/assets/promo.js @@ -286,7 +286,10 @@ window.IAPPromo = (function () { const gms = $('promo-games'); if (gms && token && gms.dataset.filled !== token) { gms.dataset.filled = token; - const enc = encodeURIComponent, CDN = 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/'; + const enc = encodeURIComponent; + // short image host (2026-11-03, Michael Camire via Marty): /b// on the share domain serves the game-banners CDN files in + // place; the ~105-character CDN URLs were cut off by exchange and safelist image fields. 728x90.png expands to -728x90.png. + const CDN = 'https://' + ((typeof SHARE_DOMAIN === 'string' && SHARE_DOMAIN) || location.host) + '/b/'; const preLaunch = (y, m, d) => Date.now() < Date.UTC(y, m - 1, d, 5); // before midnight Central on that day const GAMES = [ // the public games page (2026-10-10, Marty: "make sure that's in the promo tools for everyone"): every game on one page, with the member's referral on the Join button @@ -312,18 +315,18 @@ window.IAPPromo = (function () { { name: 'Friendly post', text: 'If you ever played Trade Wars on a BBS, this is that feeling again, on your phone. Warp & Wares: 30 days, 1,200 sectors, three goods, a team of five, and prizes in Polygon at published positions. Free to play: {L}' }, { name: 'Telegram or WhatsApp line', text: 'New season game in the network: Warp & Wares. 200 turns a day, trade and hold territory, weekly Polygon prizes. Free: {L}' }] }, // Turkey Drop (2026-10-28, the Thanksgiving season game): shows only while it is in the public games list (gamesLive, through Nov 30) and from Nov 2 - { slug: 'turkeydrop', name: 'Turkey Drop', link: 'https://turkeydropgame.com/?ref=', img: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/turkeydrop/og-turkeydrop.jpg', sub: 'Thanksgiving game that pays Polygon, through Nov 30', + { slug: 'turkeydrop', name: 'Turkey Drop', link: 'https://turkeydropgame.com/?ref=', img: CDN + 'turkeydrop/og-turkeydrop.jpg', sub: 'Thanksgiving game that pays Polygon, through Nov 30', posts: [ { name: 'Short post', text: 'Turkey Drop is a free Thanksgiving game. The radio station helicopter is dropping turkeys over the mall, and you swing the net to catch them before they splat. Score milestones pay Polygon the first time you reach them, and the top 3 each week win a Polygon prize. Here through Nov 30: {L}' }, { name: 'Telegram or WhatsApp line', text: 'Thanksgiving game in the network: Turkey Drop. Catch the turkeys before they splat, score milestones pay Polygon. Free, through Nov 30: {L}' }] }, // POL Miner (2026-10-28): shows once 'polminer' is in gamesLive (the public games list), like PolyBreak - { slug: 'polminer', name: 'POL Miner', link: 'https://polminer.com/?ref=', img: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/polminer/og-polminer.jpg', sub: 'mining game that pays Polygon', + { slug: 'polminer', name: 'POL Miner', link: 'https://polminer.com/?ref=', img: CDN + 'polminer/og-polminer.jpg', sub: 'mining game that pays Polygon', posts: [ { name: 'Short post', text: 'POL Miner is a free mining game. Dig down through the layers, haul ore up to sell, upgrade your pick, lamp and cart, and beat a drill boss every 30 m. The rare pink Polygon crystals pay Polygon to the wallet on your InstantAdPay account. {L}' }, { name: 'Friendly post', text: 'This one is easy to lose an hour in. POL Miner is free, it plays fine on a phone, and you sign in with your InstantAdPay account. Each pink Polygon crystal you dig out pays Polygon, and so does each drill boss the first time you beat it. Give it a dig: {L}' }, { name: 'Crystal angle', text: 'Somewhere under the gravel there is a pink glow. In POL Miner the rare Polygon crystals pay Polygon when you dig them out. Free to play: {L}' }, { name: 'Telegram or WhatsApp line', text: 'New game in the network: POL Miner. Free mining game, the pink Polygon crystals pay Polygon: {L}' }] }, - { slug: 'polybreak', name: 'PolyBreak', link: 'https://polybreak.app/?ref=', img: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/polybreak/og-polybreak.jpg', sub: 'brick breaker that pays Polygon', + { slug: 'polybreak', name: 'PolyBreak', link: 'https://polybreak.app/?ref=', img: CDN + 'polybreak/og-polybreak.jpg', sub: 'brick breaker that pays Polygon', posts: [ { name: 'Short post', text: 'PolyBreak is a free brick breaker in the old Amiga arcade style. Smash a wall of glass jewel bricks, grab the capsules, and catch the purple Polygon gem when it drops. Your first clear of each round pays Polygon to the wallet on your InstantAdPay account. {L}' }, { name: 'Friendly post', text: 'I grew up on brick breakers, so this one got me. PolyBreak is free, it plays great on a phone, and it signs in with your InstantAdPay account. First round clears pay Polygon, and so does every purple gem you catch. Out of paddles? Visit a member\'s page and you get one more. Give it a try: {L}' }, @@ -350,7 +353,7 @@ window.IAPPromo = (function () { posts: [ { name: 'Short post', text: 'Drip Runner is a quick free runner game. Hop the network, dodge the drones, clear chapters and refuel for POL rewards. Play in your browser: {L}' }, { name: 'Friendly post', text: 'Got two minutes? Drip Runner is a fast little runner game I keep coming back to. See how far you get: {L}' }] }, - { slug: 'clutterhunt', name: 'ClutterHunt', link: 'https://clutterhunt.com/?ref=', img: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/clutterhunt/og-harvest-farmhouse.jpg', sub: 'hidden-object game, Harvest Farmhouse rooms through Nov 30', + { slug: 'clutterhunt', name: 'ClutterHunt', link: 'https://clutterhunt.com/?ref=', img: CDN + 'clutterhunt/og-harvest-farmhouse.jpg', sub: 'hidden-object game, Harvest Farmhouse rooms through Nov 30', posts: [ { name: 'Short post', text: 'ClutterHunt is a free hidden-object game, and the Harvest Farmhouse just opened: six new rooms through Nov 30, a clock running, and everything moves each time you play. First clears pay POL. Can you three-star Expert? {L}' }, { name: 'Friendly post', text: 'If you like spot-the-object puzzles, try ClutterHunt. New farmhouse rooms this month, free in your browser, with POL rewards for clearing rooms: {L}' }, @@ -393,7 +396,7 @@ window.IAPPromo = (function () { for (const p of posts) pp.appendChild(block(p.text, '' + esc(p.name) + '', [linkBtn('https://x.com/intent/tweet?text=' + enc(p.text), 'X'), linkBtn('https://t.me/share/url?url=' + enc(link) + '&text=' + enc(p.text.replace(link, '').trim()), 'Telegram'), linkBtn('https://wa.me/?text=' + enc(p.text), 'WhatsApp')])); } const grid = $('gbGrid'); grid.innerHTML = ''; - for (const [s, n] of SIZES) { const w = s.split('x')[0], h = s.split('x')[1], src = CDN + g.slug + '/' + g.slug + '-' + s + '.png'; + for (const [s, n] of SIZES) { const w = s.split('x')[0], h = s.split('x')[1], src = CDN + g.slug + '/' + s + '.png'; const code = '' + g.name + ''; const d = document.createElement('div'); d.className = 'promo-block'; d.innerHTML = '
' + s + ' ' + esc(n) + '
' + esc(g.name) + ' ' + s + '
' + esc(code) + '
'; const row = document.createElement('div'); row.className = 'pb-actions'; row.appendChild(copyBtn(code, 'Copy embed code')); row.appendChild(copyBtn(src, 'Copy image URL')); row.appendChild(linkBtn(src, 'Open image')); d.appendChild(row); grid.appendChild(d); } @@ -455,7 +458,7 @@ window.IAPPromo = (function () { { name: 'Partner angle', net: 'LinkedIn', text: 'BixPay pays partners on every card and on card spending, ten levels deep. If you\'re building a team anyway, this fits right in: {L}' } ]; const BIX_SWIPE = { subject: 'A Visa card for the crypto you already earn', body: 'Hey,\n\nQuick one, because this solved something for me.\n\nI earn crypto in a few places, and for a long time the awkward part was spending it. Exchange, bank, waiting, fees. BixPay took that out of the loop: it is a self-custody wallet with a Visa card in one app. You send USDT or USDC to it on Polygon, load the card, and pay wherever Visa is accepted, Apple Pay and Google Pay included.\n\nThe parts I liked:\n- The keys stay with you. It is your wallet, not an account someone else holds.\n- No load fee. 3% per purchase, and BIX\'s terms cover the rest.\n- A virtual card is $9.99 and you can be using it the same day.\n- If you build a team, BixPay pays partners on every card and on card spending, ten levels deep.\n\nUS note: it is open in 31 states so far. If yours is not on the list yet, you can still get the wallet and build.\n\nHere is my link: {L}\n\nBixPay is a separate company. BIX issues the wallet and the card through its banking partners and sets its own fees, limits, eligibility and terms. Crypto assets can lose value.\n\nTalk soon,' }; - const BIX_CDN = 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/bixpay/'; + const BIX_CDN = 'https://' + ((typeof SHARE_DOMAIN === 'string' && SHARE_DOMAIN) || location.host) + '/b/bixpay/'; // short image host, same files as the game-banners CDN (2026-11-03) const BIX_SIZES = [['728x90', 'Leaderboard'], ['300x250', 'Medium rectangle'], ['468x60', 'Banner'], ['600x300', 'Traffic exchange / splash page']]; function fillBix(me) { const b = (me && me.bix) || {}; const sec = $('promo-bixpay'); if (!sec) return; diff --git a/public/my.html b/public/my.html index 613e136..3272a55 100644 --- a/public/my.html +++ b/public/my.html @@ -1261,7 +1261,7 @@ - + diff --git a/server.js b/server.js index acc52b6..5c5f4ca 100644 --- a/server.js +++ b/server.js @@ -2200,11 +2200,46 @@ async function gameAnswer(g, slug, acct) { // the game token (only once a userna } const SHARE_HOSTS = String(process.env.SHARE_HOSTS || 'ctbgo.com,mylinehq.com').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); + +// Short banner image URLs (2026-11-03; Michael Camire via Marty: the Spaces CDN URLs run about 105 characters and get cut off +// by exchange and safelist image fields, so the banners never show). /b// serves the same file from +// game-banners// on the Spaces CDN, bytes in place (no redirect: some sites only HEAD the URL), on the share hosts as +// well as here: https://ctbgo.com/b/turkeydrop/728x90.png. A bare . expands to -.. Small +// in-memory cache, 300 files, six hours, misses remembered ten minutes. +const BANNER_CDN = 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/'; +const BANNER_TYPES = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', webp: 'image/webp', gif: 'image/gif' }; +const bannerCache = new Map(); // cdn url -> { buf, type, at, miss } +async function serveBanner(req, res, p) { + const m = /^\/b\/([a-z0-9-]{2,30})\/([a-z0-9-]{1,60})\.(png|jpe?g|webp|gif)$/i.exec(p); + if (!m) return false; + const slug = m[1].toLowerCase(), ext = m[3].toLowerCase(); + let name = m[2].toLowerCase(); if (/^\d{2,4}x\d{2,4}$/.test(name)) name = slug + '-' + name; + const url = BANNER_CDN + slug + '/' + name + '.' + ext; + let hit = bannerCache.get(url); + if (!hit || Date.now() - hit.at > (hit.miss ? 600e3 : 6 * 3600e3)) { + try { + const r = await fetch(url, { signal: AbortSignal.timeout(10000) }); + if (r.ok) { + const buf = Buffer.from(await r.arrayBuffer()); + hit = { buf, type: r.headers.get('content-type') || BANNER_TYPES[ext], at: Date.now() }; + } else hit = { miss: r.status, at: Date.now() }; + if (bannerCache.size >= 300) bannerCache.delete(bannerCache.keys().next().value); + bannerCache.set(url, hit); + } catch (e) { if (!hit) { res.writeHead(502, baseHeaders({ 'Content-Type': 'text/plain', 'Cache-Control': 'no-store' })); res.end('banner source unreachable'); return true; } } + } + if (hit.miss) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain', 'Cache-Control': 'no-store' })); res.end('no such banner'); return true; } + res.writeHead(200, baseHeaders({ 'Content-Type': hit.type, 'Content-Length': hit.buf.length, 'Cache-Control': 'public, max-age=86400', 'Access-Control-Allow-Origin': '*', 'X-Robots-Tag': 'noindex' })); + if (req.method === 'HEAD') res.end(); else res.end(hit.buf); + return true; +} + const server = http.createServer(async (req, res) => { { const t0 = Date.now(); res.on('finish', () => { const ms = Date.now() - t0; if (ms > 3000) console.warn('slow request', req.method, String(req.url || '').split('?')[0].slice(0, 80), ms + 'ms', res.statusCode); }); } // visibility for member-felt delays (2026-10-12) try { const u = new URL(req.url, 'http://x'); const p = u.pathname; + // short banner images, served on every host (share hosts included) before the share-host redirect + if ((req.method === 'GET' || req.method === 'HEAD') && p.startsWith('/b/') && await serveBanner(req, res, p)) return; // share-link domains (ctbgo.com, mylinehq.com): / goes to that member's join page, anything else to the same path // here. 302 (not 301) so links never get pinned in caches; the query (?v= angle, ?promo=) rides along. { const sh = String(req.headers.host || '').toLowerCase().replace(/:\d+$/, '').replace(/^www\./, '');