Site host from one module: host.js exports SITE_HOST/SITE_URL and every module, email, Telegram post, QR, ad click URL and OG tag reads it (no more hard-coded test hostname); public pages carry {{SITE_URL}} filled at serve time; frame check carries the curtain pass for our own hosts so a test ad can point at a spin link; stale IAP sitemap removed

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-07 08:52:04 -05:00
parent 6da444c790
commit ad744d8c0f
29 changed files with 135 additions and 111 deletions
+4 -3
View File
@@ -12,6 +12,7 @@
//
// FEATURE-FLAGGED: inert unless NAS_DB_HOST/USER/PASSWORD/NAME are all set.
// Nothing here runs (no connection, no writes) when the flag is off.
const { SITE_HOST, SITE_URL } = require('./host');
const crypto = require('crypto');
let pool = null;
@@ -76,9 +77,9 @@ async function pushCampaign(c, opts = {}) {
Name, Email, PaymentDetails, EDate, sp, width, height, BannerURL, pid, ref_by, catid)
VALUES (?,?,?,?,?,?,0,1,?,?,?,?,?,?,'',?,?,?,?,0,?)`,
// clicks route through our redirect so they count and carry the network site as the referrer
[token, c.title || null, c.type === 'text' ? (c.body || null) : null, 'https://linkspin-test.saasy.top/api/ads/click/' + c.id,
[token, c.title || null, c.type === 'text' ? (c.body || null) : null, SITE_URL + '/api/ads/click/' + c.id,
assigned, assigned, now, kind.adtype,
opts.name || 'LinkSpin member', opts.email || 'ads@linkspin-test.saasy.top',
opts.name || 'LinkSpin member', opts.email || 'ads@' + SITE_HOST,
'LinkSpin campaign #' + c.id, edate,
c.width || '', c.height || '', c.type === 'banner' ? c.imageUrl : null, kind.pid, CATID_CRYPTO]);
return { nasAdId: ad.insertId, manageToken: token, assigned };
@@ -111,7 +112,7 @@ async function deactivate(nasAdId) {
// point an existing NAS ad at our click redirect (migration for rows pushed before 2026-09-10)
async function setClickUrl(nasAdId, campaignId) {
if (!enabled()) return { skipped: 'flag-off' };
await q('UPDATE sponsorads SET WebsiteURL=? WHERE ID=?', ['https://linkspin-test.saasy.top/api/ads/click/' + Number(campaignId), Number(nasAdId)]);
await q('UPDATE sponsorads SET WebsiteURL=? WHERE ID=?', [SITE_URL + '/api/ads/click/' + Number(campaignId), Number(nasAdId)]);
return { ok: true };
}
async function topUp(nasAdId, addImpressions, days) {