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
This commit is contained in:
you
2026-03-23 05:13:17 +00:00
parent 4a5cd9fef4
commit 26d28d88d1
2 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -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
+9 -3
View File
@@ -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;