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
fix: satisfy async-effect, data-category and strict-read guards for the cover lettering controls (#10345)
Adam Eivyccddd120ec00
diff --git a/client/src/components/musicVideo/CoverLetteringPanel.jsx b/client/src/components/musicVideo/CoverLetteringPanel.jsxindex f6d959dadb..98a98dd1f3 100644--- a/client/src/components/musicVideo/CoverLetteringPanel.jsx+++ b/client/src/components/musicVideo/CoverLetteringPanel.jsx@@ -28,20 +28,25 @@ const humanize = (value) => {const control = 'w-full bg-port-bg border border-port-border rounded px-1.5 py-1 text-xs min-h-[44px] sm:min-h-0';const button = 'flex items-center gap-1 bg-port-accent/20 text-port-accent disabled:opacity-50 rounded px-2 py-1.5 min-h-[44px] sm:min-h-0';-// A face is registered with the page once per upload, so the preview sets the title in the file the server will.-const loadedFaces = new Set();+// A face is registered with the page once per upload (a re-upload changes `addedAt`), so the preview sets the title in the file the server will.+const faceLoads = new Map();+function loadFace(font) {+ const key = `${font.id}:${font.addedAt}`;+ if (!faceLoads.has(key)) {+ faceLoads.set(key, new FontFace(font.family, `url(${musicVideoCoverFontUrl(font.id)})`).load()+ .then((face) => { document.fonts.add(face); })+ .catch(() => { faceLoads.delete(key); }));+ }+ return faceLoads.get(key);+}+// Re-renders once the uploaded faces are usable, so the preview's text widths are measured in them rather than in a fallback.function usePreviewFonts(fonts) {const [tick, setTick] = useState(0);useEffect(() => {- if (typeof FontFace === 'undefined' || typeof document === 'undefined' || !document.fonts) return;- for (const font of fonts || []) {- const key = `${font.id}:${font.addedAt}`;- if (loadedFaces.has(key)) continue;- loadedFaces.add(key);- new FontFace(font.family, `url(${musicVideoCoverFontUrl(font.id)})`).load()- .then((face) => { document.fonts.add(face); setTick((t) => t + 1); })- .catch(() => loadedFaces.delete(key));- }+ if (!fonts?.length || typeof FontFace === 'undefined' || typeof document === 'undefined' || !document.fonts) return undefined;+ let active = true;+ Promise.all(fonts.map(loadFace)).then(() => { if (active) setTick((t) => t + 1); });+ return () => { active = false; };}, [fonts]);return tick;}diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex 7537c3c321..8614cd1a23 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -263,7 +263,7 @@ grep -i "what you want to do" client/src/hooks/README.md| `useMusicVideoRevisions` | Selective section revision (#8987): open a revision from a reviewed draft excerpt (its flagged sections' takes are rejected, the rest kept), resume it from the server checkpoint — generating ONLY the sections the server reports as `needsGeneration` through the board's scene lanes, or adopting the draft re-render via `attachRender` once every revised section has a take — and cancel it. A server refusal toasts as a failure; a throw in the hook's own follow-up AFTER the server succeeded reloads the saved record instead (#9940), so an opened repair whose resume failed stays recoverable from the "Needs attention" banner. Returns `{ busy, revise(excerptId, sceneIds?), repair(basis), repairPerformance(sceneId, input), resume(revisionId), cancel(revisionId) }`. | The Music Video excerpt panel. || `useMusicVideoAutoReview` | Opt-in automatic review/retries (#8988): start a run over a draft window with explicit review (`maxAttempts`) and paid-generation (`maxGenerations`) limits plus a vision reviewer; applies the project pushed on `music-video:auto-review` and reports outcomes; the server generates a run's revised sections itself (#10014), so the board never submits them and a run completes with no tab open. Returns `{ busy, action, start(startSec, endSec, limits, reviewer), resume(runId, limits?), stop(runId), cancel(runId) }`. | The Music Video excerpt panel. || `useMusicVideoExcerpts` | Draft excerpt render + timecoded review notes (#8986): a `useSseJobSlot` render job over a chosen `[startSec, endSec)` window (any terminal frame reloads the project, since the persisted excerpt shape lives server-side) plus add/edit/delete review-note calls that apply the fresh whole project from each response. Returns `{ rendering, progress, deletingId, noteBusyId, startExcerpt(startSec, endSec), cancelExcerpt(excerptId), attachRender(jobId, projectId), deleteExcerpt(excerptId), addNote(excerptId, {atSec, note, verdict?}), editNote(excerptId, noteId, patch), deleteNote(excerptId, noteId) }`. | The Music Video excerpt panel. |-| `useMusicVideoCoverLettering` | Music Video cover Lettering controls (#10345): the install's uploaded typefaces and saved per-artist styles, loaded once. Loads on first `enabled` (the section is open). Returns `{ fonts, styles, uploading, uploadFont(file), removeFont(id), saveStyle({ name, design }), removeStyle(name) }` (`fonts`/`styles` null until loaded); each mutation applies the server's answer at once. | `CoverArtPanel` (Publish stage). |+| `useMusicVideoCoverLettering` | Music Video cover Lettering controls (#10345): the install's uploaded typefaces and saved per-artist styles, loaded once. Loads whenever `enabled` (the section is open). Returns `{ fonts, styles, uploading, uploadFont(file), removeFont(id), saveStyle({ name, design }), removeStyle(name) }` (`fonts`/`styles` null until loaded); each mutation applies the server's answer at once. | `CoverArtPanel` (Publish stage). || `useMusicVideoPublishKit` | Music Video publishing kit (#9281): a `useSseJobSlot` build job (encodes, thumbnails, captions, chapters) whose terminal frame reloads the project, plus the one-call copy draft, per-field copy edits and thumbnail choice, each applying the returned project. Returns `{ building, progress, build(), cancelBuild(), drafting, saving, draftCopy(body), saveCopy(patch), selectThumbnail(filename) }`. | The Music Video Publish stage. || `useMusicVideoPublishing` | Music Video posting (#9282): per-platform drafts filled in the PortOS Browser. `prepare` returns the filled draft's summary and screenshot (a sign-in-required refusal is kept as the platform's error with its login URL), `submit` posts that reviewed draft and applies the returned project, `discard` closes it. Platforms are opt-in (#9287): it loads the saved `platforms` (enabled + optional account each) and per-platform `history` (posts, reception tally, recent notes across projects); `setPlatform` toggles one optimistically and `recordPost` saves a hand-made post's link or a post's reception and notes. Returns `{ drafts, busy, errors, prepare(target, options), submit(target), discard(target), platforms, history, enabledTargets, setPlatform(target, change), recordPost(target, body) }`. | The Music Video Publish stage's posting panel. || `useMusicVideoModelSettings` | A project's saved render pins — video backend (local/Grok/fal.ai)/model/generation-mode/audio-reactive LoRA + the image-side frame pin — with the Video Gen catalog they read from. Optimistic-local + silent PATCH, rollback + toast on failure; `saving` gates the dependent generate buttons. Returns `{ models, modelsLoading, defaultModel, falEnabled, saving, settings, effectiveModelId, activeModel, audioReactiveModels, audioReactiveLoras, detectedAudioReactiveLora, audioReactiveReady, audioReactiveSelected, videoBlockedReason, change, changeFramePin }`. `videoBlockedReason` is the single "why can't I generate" string (an unavailable audio-reactive setup, or a fal.ai pin with no configured API key) shared by the disabled buttons, their tooltips, and the blocked-call toast. | The Music Video renderer selects and anything building a scene-clip job payload from them. |diff --git a/client/src/hooks/useMusicVideoCoverLettering.js b/client/src/hooks/useMusicVideoCoverLettering.jsindex 08ca35d9db..a948e92a66 100644--- a/client/src/hooks/useMusicVideoCoverLettering.js+++ b/client/src/hooks/useMusicVideoCoverLettering.js@@ -1,4 +1,4 @@-import { useCallback, useEffect, useRef, useState } from 'react';+import { useCallback, useEffect, useState } from 'react';import toast from '../components/ui/Toast';import {deleteMusicVideoArtistStyle,@@ -12,8 +12,8 @@ import {/*** What the cover Lettering controls draw on besides the song itself (#10345):* the typefaces the director uploaded and the saved style per artist. Both are- * install-wide server records, loaded once, the first time `enabled` (the- * Lettering section is open); each mutation applies the server's answer at+ * install-wide server records, loaded whenever `enabled` (the Lettering+ * section is open); each mutation applies the server's answer at* once. `fonts` / `styles` are null until loaded. Failures toast through the* shared request layer and leave the lists as they were.*/@@ -21,14 +21,14 @@ export default function useMusicVideoCoverLettering({ enabled = true } = {}) {const [fonts, setFonts] = useState(null);const [styles, setStyles] = useState(null);const [uploading, setUploading] = useState(false);- const requested = useRef(false);- // One load per mount, the first time the section is open; closing it again never drops the answer.+ // Loaded each time the section opens (the lists are small), so a font or style saved on another device shows up.useEffect(() => {- if (!enabled || requested.current) return;- requested.current = true;- getMusicVideoCoverFonts({ silent: true }).then((res) => setFonts(res?.fonts || [])).catch(() => setFonts((prev) => prev || []));- getMusicVideoArtistStyles({ silent: true }).then((res) => setStyles(res?.styles || [])).catch(() => setStyles((prev) => prev || []));+ if (!enabled) return undefined;+ let active = true;+ getMusicVideoCoverFonts({ silent: true }).then((res) => { if (active) setFonts(res?.fonts || []); }).catch(() => { if (active) setFonts((prev) => prev || []); });+ getMusicVideoArtistStyles({ silent: true }).then((res) => { if (active) setStyles(res?.styles || []); }).catch(() => { if (active) setStyles((prev) => prev || []); });+ return () => { active = false; };}, [enabled]);const uploadFont = useCallback(async (file) => {diff --git a/server/services/dataManager.js b/server/services/dataManager.jsindex 1dd221cbe4..a63b601b54 100644--- a/server/services/dataManager.js+++ b/server/services/dataManager.js@@ -78,6 +78,7 @@ export const CATEGORIES = {'browser-profile': { label: 'Browser Profile', description: 'Chrome/Chromium browser data', archivable: false, deletable: true, purgeScope: 'category' },cache: { label: 'Remote API and Reading Cache', description: 'Cached remote API metadata and the author-hosted Accelerando reading source — refetched on demand, safe to purge', archivable: false, deletable: true, purgeScope: 'category' },'calendar': { label: 'Calendar', description: 'Calendar sync data', archivable: true, deletable: false },+ 'cover-fonts': { label: 'Cover Fonts', description: 'Typefaces uploaded for music video cover lettering; covers made with one fall back to a built-in typeface if it is removed', archivable: true, deletable: false },'private': { label: 'Private Keys', description: 'Machine-local integration credentials — managed in Settings > Credentials', archivable: false, deletable: false },'certs': { label: 'TLS Certificates', description: 'HTTPS certificate and private key — purging drops the install back to HTTP', archivable: false, deletable: false },'launch-videos': { label: 'Launch Videos', description: 'App launch-video compositions, plans, captions and rendered deliverables', archivable: true, deletable: false },diff --git a/server/services/musicVideo/coverFonts.js b/server/services/musicVideo/coverFonts.jsindex a77dcfe088..7074f95328 100644--- a/server/services/musicVideo/coverFonts.js+++ b/server/services/musicVideo/coverFonts.js@@ -62,7 +62,8 @@ const isFont = (v) => v && typeof v === 'object' && typeof v.id === 'string' &&/** The uploaded typefaces, oldest first: `{ id, family, ext, width, addedAt }`. */export async function listCoverFonts() {- const stored = await readJSONFile(indexFile(), { fonts: [] }, { allowArray: false });+ // Strict: a present-but-unreadable index is an error, never an empty list the next upload would write over.+ const stored = await readJSONFile(indexFile(), { fonts: [] }, { allowArray: false, strict: true });return (Array.isArray(stored?.fonts) ? stored.fonts : []).filter(isFont);}