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

address review: use ServerError for SD URL validation, omit id from update schema, use PATHS.images

Adam Eivy2331c6d9444c
diff --git a/server/index.js b/server/index.js
index e4db1aa1ad..2b619b9042 100644
--- a/server/index.js
+++ b/server/index.js
@@ -337,8 +337,8 @@ startUpdateScheduler();
// Restore any active loops from previous session
restoreLoops().catch(err => console.error(`❌ Loop restore failed: ${err.message}`));
-// Serve generated images from data/images/
-app.use('/data/images', express.static(join(PATHS.data, 'images')));
+// Serve generated images from configured images directory
+app.use('/data/images', express.static(PATHS.images));
// Serve built client UI (production mode — no Vite dev server needed)
const CLIENT_DIST = join(__dirname, '..', 'client', 'dist');
diff --git a/server/routes/tools.js b/server/routes/tools.js
index 4545ac4b7c..99deb257fd 100644
--- a/server/routes/tools.js
+++ b/server/routes/tools.js
@@ -24,7 +24,7 @@ const registerToolSchema = z.object({
promptHints: z.string().max(1000).optional()
});
-const updateToolSchema = registerToolSchema.partial();
+const updateToolSchema = registerToolSchema.omit({ id: true }).partial();
// GET /api/tools - List all tools
router.get('/', asyncHandler(async (req, res) => {
diff --git a/server/services/imageGen.js b/server/services/imageGen.js
index 931eecb693..05dd0af409 100644
--- a/server/services/imageGen.js
+++ b/server/services/imageGen.js
@@ -10,6 +10,7 @@ import { writeFile } from 'fs/promises';
import { join } from 'path';
import { randomUUID } from 'crypto';
import { ensureDir, PATHS } from '../lib/fileUtils.js';
+import { ServerError } from '../lib/errorHandler.js';
import { fetchWithTimeout } from '../lib/fetchWithTimeout.js';
import { getSettings } from './settings.js';
import { imageGenEvents } from './imageGenEvents.js';
@@ -98,11 +99,11 @@ function startProgressPolling(baseUrl, generationId) {
}
function validateSdUrl(rawUrl) {
- if (!rawUrl) throw new Error('No SD API URL configured — set it in Settings > Image Gen');
+ if (!rawUrl) throw new ServerError('No SD API URL configured — set it in Settings > Image Gen', { status: 400, code: 'IMAGE_GEN_NOT_CONFIGURED' });
let url;
- try { url = new URL(rawUrl); } catch { throw new Error('Invalid SD API URL — must be a valid http/https URL'); }
+ try { url = new URL(rawUrl); } catch { throw new ServerError('Invalid SD API URL — must be a valid http/https URL', { status: 400, code: 'INVALID_SD_URL' }); }
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
- throw new Error('Invalid SD API URL — only http and https are allowed');
+ throw new ServerError('Invalid SD API URL — only http and https are allowed', { status: 400, code: 'INVALID_SD_URL' });
}
return url.origin;
}