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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (round 4): revert on duplicate, escape-key bubble, strict kebab, DELETE validation
Adam Eivye8a3f76c4eed
diff --git a/client/src/components/dashboard/LayoutEditor.jsx b/client/src/components/dashboard/LayoutEditor.jsxindex 269f53c8cd..99a2a65297 100644--- a/client/src/components/dashboard/LayoutEditor.jsx+++ b/client/src/components/dashboard/LayoutEditor.jsx@@ -195,7 +195,10 @@ export default function LayoutEditor({ layouts, activeLayoutId, onClose, onSave,value={dupName}autoFocusonChange={(e) => setDupName(e.target.value)}- onKeyDown={(e) => { if (e.key === 'Enter') commitDuplicate(); if (e.key === 'Escape') setMode('idle'); }}+ onKeyDown={(e) => {+ if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); commitDuplicate(); }+ else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); setMode('idle'); }+ }}placeholder="Name for new layout"className="flex-1 bg-port-bg border border-port-border rounded-lg px-3 py-2 text-sm text-white focus:border-port-accent outline-hidden"/>diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsxindex f989962387..772120efa6 100644--- a/client/src/pages/Dashboard.jsx+++ b/client/src/pages/Dashboard.jsx@@ -106,10 +106,13 @@ export default function Dashboard() {};const duplicateLayout = async ({ id, name, widgets }) => {+ const previousId = activeLayoutId;const result = await api.saveDashboardLayout(id, name, widgets);setLayouts(result.layouts);setActiveLayoutId(id);- await api.setActiveDashboardLayout(id);+ // Mirror selectLayout's revert-on-failure so the picker doesn't+ // diverge from server state if the active-write fails.+ await api.setActiveDashboardLayout(id).catch(() => setActiveLayoutId(previousId));};const deleteLayoutById = async (id) => {diff --git a/server/routes/dashboardLayouts.js b/server/routes/dashboardLayouts.jsindex 5bbbb3c4a3..619713eaf6 100644--- a/server/routes/dashboardLayouts.js+++ b/server/routes/dashboardLayouts.js@@ -13,7 +13,9 @@ import * as svc from '../services/dashboardLayouts.js';const router = Router();-const idSchema = z.string().min(1).max(60).regex(/^[a-z0-9-]+$/, 'id must be lowercase kebab');+// Strict kebab: alphanumeric segments joined by single dashes, no leading+// or trailing dashes, no runs of dashes. Matches `default`, `morning-review`.+const idSchema = z.string().min(1).max(60).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'id must be lowercase kebab');const layoutSchema = z.object({id: idSchema,@@ -58,7 +60,8 @@ router.put('/:id', asyncHandler(async (req, res) => {}));router.delete('/:id', asyncHandler(async (req, res) => {- const state = await svc.deleteLayout(String(req.params.id)).catch((err) => { throw mapServiceError(err); });+ const { id } = validateRequest(z.object({ id: idSchema }), req.params ?? {});+ const state = await svc.deleteLayout(id).catch((err) => { throw mapServiceError(err); });res.json(state);}));