From c2178b4c6ebc711ddad0575fc034c03ea5db291f Mon Sep 17 00:00:00 2001 From: martbost Date: Mon, 12 Oct 2026 11:18:08 -0500 Subject: [PATCH] Traffic-source catalog lives in catalog/ (DATA_DIR=/app/data is the runtime volume in production and would hide a shipped file) Co-Authored-By: Claude Fable 5.1 --- .gitignore | 3 +-- {data => catalog}/traffic-sources.json | 0 server.js | 2 +- sources.js | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) rename {data => catalog}/traffic-sources.json (100%) diff --git a/.gitignore b/.gitignore index a99847f..bc48be7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ node_modules/ -data/* +data/ *.log qa/out/ -!data/traffic-sources.json diff --git a/data/traffic-sources.json b/catalog/traffic-sources.json similarity index 100% rename from data/traffic-sources.json rename to catalog/traffic-sources.json diff --git a/server.js b/server.js index 005e09e..cc8e406 100644 --- a/server.js +++ b/server.js @@ -423,7 +423,7 @@ async function boot() { setInterval(() => health.tick().catch(e => console.error('health', e.message)), 30 * 60 * 1000); setInterval(() => { try { rotator.sweepDemos(); } catch (e) {} }, 60 * 60 * 1000); // unclaimed home-page demo spins expire after 24 h postbacks.init({ dataDir: DATA_DIR, ownHosts, rotator, sources }); - sources.init({ dataDir: DATA_DIR, postbacks, rotator, catalogFile: path.join(ROOT, 'data', 'traffic-sources.json'), linkHost: () => { const hs = String(siteConfig().linkDomains || '').split(',').map(x => x.trim()).filter(Boolean); return hs[0] || SITE_HOST; } }); + sources.init({ dataDir: DATA_DIR, postbacks, rotator, catalogFile: path.join(ROOT, 'catalog', 'traffic-sources.json'), linkHost: () => { const hs = String(siteConfig().linkDomains || '').split(',').map(x => x.trim()).filter(Boolean); return hs[0] || SITE_HOST; } }); zones.init({ dataDir: DATA_DIR, ads, siteHost: SITE_HOST }); pages.init({ dataDir: DATA_DIR, ownHosts, imageBase: () => (IS_PROD ? 'https' : 'http') + '://' + SITE_HOST, openrouterKey: () => { if (process.env.OPENROUTER_API_KEY) return process.env.OPENROUTER_API_KEY.trim(); try { return fs.readFileSync(path.join(DATA_DIR, 'openrouter.key'), 'utf8').trim(); } catch (e) { return ''; } } }); audiences.init({ dataDir: DATA_DIR }); diff --git a/sources.js b/sources.js index 4973ac0..eb6e884 100644 --- a/sources.js +++ b/sources.js @@ -2,7 +2,7 @@ // A source remembers the network's macro tokens (so the campaign URL to paste into the network is built for // the member), the network's own conversion postback (fired only for clicks that came through that source), // and shows up in Reports as a dimension (clicks and conversions by source, and by zone / placement / site when -// the macro carried it). Sources are created from a template catalog (data/traffic-sources.json, shipped in the +// the macro carried it). Sources are created from a template catalog (catalog/traffic-sources.json, shipped in the // repo, read at boot) or defined by hand. JSON store on the volume, same pattern as postbacks.js. 'use strict'; const fs = require('fs');