From 26d28d88d1a51fe165e9604540dd9dcf4e7d91ea Mon Sep 17 00:00:00 2001 From: you Date: Mon, 23 Mar 2026 05:13:17 +0000 Subject: [PATCH] fix: theme.json goes next to config.json, log location on startup - Search order: app dir first (next to config.json), then data/ dir - Startup log: '[theme] Loaded from ...' or 'No theme.json found. Place it next to config.json' - README updated: 'put it next to config.json' instead of confusing data/ path --- README.md | 2 +- server.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fbe5f5c..6f62ae33 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ docker run -d \ # Now edit ./data/config.json directly on the host ``` -**Theme customization:** Drop a `theme.json` in the same data directory (`/app/data/theme.json`) to override default colors, branding, and node/packet type colors for all users. Use the built-in customizer (Tools → Customize) to design your theme and download the file. +**Theme customization:** Put `theme.json` next to `config.json` — wherever your config lives, that's where the theme goes. Use the built-in customizer (Tools → Customize) to design your theme, download the file, and drop it in. Changes are picked up on page refresh — no restart needed. The server logs where it's looking on startup. ### Manual Install diff --git a/server.js b/server.js index b0f81be4..acd3ca36 100644 --- a/server.js +++ b/server.js @@ -394,10 +394,10 @@ function getObserverIdsForRegions(regionParam) { return ids; } -// Theme: hot-load from theme.json (checks data dir first, then app dir) +// Theme: hot-load from theme.json (same dir as config.json, or data/ dir) const THEME_PATHS = [ - path.join(__dirname, 'data', 'theme.json'), - path.join(__dirname, 'theme.json') + path.join(__dirname, 'theme.json'), + path.join(__dirname, 'data', 'theme.json') ]; function loadThemeFile() { for (const p of THEME_PATHS) { @@ -3039,6 +3039,12 @@ const listenPort = process.env.PORT || config.port; server.listen(listenPort, () => { const protocol = isHttps ? 'https' : 'http'; console.log(`MeshCore Analyzer running on ${protocol}://localhost:${listenPort}`); + // Log theme file location + let themeFound = false; + for (const p of THEME_PATHS) { + try { fs.accessSync(p); console.log(`[theme] Loaded from ${p}`); themeFound = true; break; } catch {} + } + if (!themeFound) console.log(`[theme] No theme.json found. Place it next to config.json or in data/ to customize.`); // Pre-warm expensive caches via self-requests (yields event loop between each) setTimeout(() => { const port = listenPort;