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:
@@ -4,7 +4,9 @@ export function getOrCreateTerminalId(): string {
|
|||||||
if (typeof window === "undefined") return "server";
|
if (typeof window === "undefined") return "server";
|
||||||
let id = localStorage.getItem(TERMINAL_KEY);
|
let id = localStorage.getItem(TERMINAL_KEY);
|
||||||
if (!id) {
|
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);
|
localStorage.setItem(TERMINAL_KEY, id);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
Reference in New Issue
Block a user