Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: persist theme preference server-side across browsers/machines

Adam Eivyaf94fac9a99d
diff --git a/.changelog/v0.25.x.md b/.changelog/v0.25.x.md
index d537b0110f..bec1419214 100644
--- a/.changelog/v0.25.x.md
+++ b/.changelog/v0.25.x.md
@@ -18,10 +18,15 @@ Peer apps display and remote agent streaming on the Instances page — see what'
- **Brain retry button UX** — retry button shows spinner and "Classifying..." state, prevents double-clicks during AI classification
+### Server-persisted theme preference
+- Theme selection now saves to `data/settings.json` on the server, so it persists across browsers and machines
+- Falls back to localStorage if the server is unreachable
+
## Fixes
- **Reduce peer announcement log noise** — `announceSelf` now only fires when a peer transitions to online (from offline/unknown), not on every 30-second poll cycle
- **Brain classification uses configured provider** — background classification now passes the brain's resolved provider/model instead of raw overrides, ensuring it uses the brain-configured provider
+- **Remove git refresh button** — the DevTools Git page no longer has a manual refresh icon; just reload the page
## Removed
diff --git a/client/src/hooks/useTheme.js b/client/src/hooks/useTheme.js
index fb032b683a..1a1e144119 100644
--- a/client/src/hooks/useTheme.js
+++ b/client/src/hooks/useTheme.js
@@ -1,4 +1,4 @@
-import { useState, useCallback } from 'react';
+import { useState, useCallback, useEffect } from 'react';
const STORAGE_KEY = 'portos-theme';
@@ -108,11 +108,32 @@ export default function useTheme() {
return id;
});
+ // On mount, fetch server-side theme and apply if different from localStorage
+ useEffect(() => {
+ fetch('/api/settings')
+ .then(r => r.ok ? r.json() : null)
+ .then(settings => {
+ const serverTheme = settings?.theme;
+ if (serverTheme && THEMES[serverTheme] && serverTheme !== themeId) {
+ localStorage.setItem(STORAGE_KEY, serverTheme);
+ applyTheme(serverTheme);
+ setThemeId(serverTheme);
+ }
+ })
+ .catch(() => {}); // Server unreachable — use localStorage fallback
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
+
const setTheme = useCallback((id) => {
if (!THEMES[id]) return;
localStorage.setItem(STORAGE_KEY, id);
applyTheme(id);
setThemeId(id);
+ // Persist to server (fire-and-forget)
+ fetch('/api/settings', {
+ method: 'PUT',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ theme: id }),
+ }).catch(() => {});
}, []);
return { themeId, theme: THEMES[themeId], themes: THEMES, setTheme };
diff --git a/data.sample/settings.json b/data.sample/settings.json
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/data.sample/settings.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index e4bc9231d4..5809b227d4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "portos",
- "version": "0.25.1",
+ "version": "0.25.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "portos",
- "version": "0.25.1",
+ "version": "0.25.2",
"license": "MIT",
"workspaces": [
"packages/*",
diff --git a/package.json b/package.json
index 57e2cef612..5da43ea1ca 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "portos",
- "version": "0.25.1",
+ "version": "0.25.2",
"private": true,
"description": "Local dev machine App OS portal",
"author": "Adam Eivy (@antic|@atomantic)",
diff --git a/server/index.js b/server/index.js
index cab932980a..e764b6e41a 100644
--- a/server/index.js
+++ b/server/index.js
@@ -41,6 +41,7 @@ import moltworldWsRoutes from './routes/moltworldWs.js';
import jiraRoutes from './routes/jira.js';
import autobiographyRoutes from './routes/autobiography.js';
import instancesRoutes from './routes/instances.js';
+import settingsRoutes from './routes/settings.js';
import { ensureSelf, startPolling } from './services/instances.js';
import { initSocket } from './services/socket.js';
import { initScriptRunner } from './services/scriptRunner.js';
@@ -211,6 +212,7 @@ app.use('/api/lmstudio', lmstudioRoutes);
app.use('/api/browser', browserRoutes);
app.use('/api/jira', jiraRoutes);
app.use('/api/instances', instancesRoutes);
+app.use('/api/settings', settingsRoutes);
// Initialize script runner
initScriptRunner().catch(err => console.error(`❌ Script runner init failed: ${err.message}`));
diff --git a/server/routes/settings.js b/server/routes/settings.js
new file mode 100644
index 0000000000..b402c64b4e
--- /dev/null
+++ b/server/routes/settings.js
@@ -0,0 +1,19 @@
+import { Router } from 'express';
+import { getSettings, updateSettings } from '../services/settings.js';
+import { asyncHandler } from '../lib/errorHandler.js';
+
+const router = Router();
+
+// GET /api/settings
+router.get('/', asyncHandler(async (req, res) => {
+ const settings = await getSettings();
+ res.json(settings);
+}));
+
+// PUT /api/settings
+router.put('/', asyncHandler(async (req, res) => {
+ const merged = await updateSettings(req.body);
+ res.json(merged);
+}));
+
+export default router;
diff --git a/server/services/settings.js b/server/services/settings.js
new file mode 100644
index 0000000000..6a1bfe3807
--- /dev/null
+++ b/server/services/settings.js
@@ -0,0 +1,24 @@
+import { readFile, writeFile } from 'fs/promises';
+import { join, dirname } from 'path';
+import { fileURLToPath } from 'url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const SETTINGS_FILE = join(__dirname, '..', '..', 'data', 'settings.json');
+
+const load = async () => {
+ const raw = await readFile(SETTINGS_FILE, 'utf-8').catch(() => '{}');
+ return JSON.parse(raw);
+};
+
+const save = async (settings) => {
+ await writeFile(SETTINGS_FILE, JSON.stringify(settings, null, 2) + '\n');
+};
+
+export const getSettings = load;
+
+export const updateSettings = async (patch) => {
+ const current = await load();
+ const merged = { ...current, ...patch };
+ await save(merged);
+ return merged;
+};