fix(studio): crypto.randomUUID crash on non-secure origins (http LAN IP)

Build now (and every studio/image editor id generation) called crypto.randomUUID,
which is undefined outside a secure context — so over http://<LAN-IP> (used because
localhost is VPN-hijacked) the click threw 'crypto.randomUUID is not a function' and
the spinner hung forever, never reaching the editor.

Add lib/uuid.ts (crypto.randomUUID → crypto.getRandomValues → Math.random fallback)
and use it in studio-store, image-editor-store, project-defaults, dev-mock-project.

Verified headless (Chrome over http://172.28.144.1): Build now → 201 → navigates to
/studio/video/<id> → editor renders Scene 1 with editable title/subtitle fields.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-05 10:36:57 +03:30
parent 8ab86a5cc6
commit 5b2617d621
5 changed files with 45 additions and 4 deletions
+2 -1
View File
@@ -39,9 +39,10 @@ import {
captureSceneThumbnailFromStage,
scheduleSceneThumbnailCapture,
} from "@/lib/studio-scene-thumbnail";
import { uuid } from "@/lib/uuid";
function createId(): string {
return crypto.randomUUID();
return uuid();
}
function defaultPropsForType(type: LayerType): LayerProps {