fix(dashboard): fallback for crypto.randomUUID on HTTP (non-secure context)

crypto.randomUUID() is only available over HTTPS. Add a timestamp+random
fallback so the dashboard works on plain HTTP during development/IP access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-29 02:01:21 +03:30
parent 83758fe68a
commit a21cb7dd8e
+3 -1
View File
@@ -4,7 +4,9 @@ export function getOrCreateTerminalId(): string {
if (typeof window === "undefined") return "server";
let id = localStorage.getItem(TERMINAL_KEY);
if (!id) {
id = crypto.randomUUID();
id = typeof crypto.randomUUID === "function"
? crypto.randomUUID()
: `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
localStorage.setItem(TERMINAL_KEY, id);
}
return id;