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:
@@ -4,6 +4,7 @@
|
||||
// The server downloads the current month's CSV once, keeps it in DATA_DIR/geo/,
|
||||
// loads it into sorted range tables (IPv4 as uint32, IPv6 as BigInt) and answers
|
||||
// countryOf(ip) by binary search. Refreshes monthly.
|
||||
const { SITE_URL } = require('./host');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
@@ -62,7 +63,7 @@ function download(mk) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.mkdirSync(path.join(DATA_DIR, 'geo'), { recursive: true });
|
||||
const tmp = fileFor(mk) + '.part';
|
||||
const req = https.get('https://download.db-ip.com/free/dbip-country-lite-' + mk + '.csv.gz', { headers: { 'User-Agent': 'LinkSpin/1.0 (+https://linkspin-test.saasy.top)' }, timeout: 60000 }, res => {
|
||||
const req = https.get('https://download.db-ip.com/free/dbip-country-lite-' + mk + '.csv.gz', { headers: { 'User-Agent': 'LinkSpin/1.0 (+' + SITE_URL + ')' }, timeout: 60000 }, res => {
|
||||
if (res.statusCode !== 200) { res.resume(); return reject(new Error('HTTP ' + res.statusCode)); }
|
||||
const out = fs.createWriteStream(tmp);
|
||||
res.pipe(out); out.on('finish', () => { fs.renameSync(tmp, fileFor(mk)); resolve(fileFor(mk)); }); out.on('error', reject);
|
||||
|
||||
Reference in New Issue
Block a user