diff --git a/beszel/site/src/lib/utils.ts b/beszel/site/src/lib/utils.ts index d80aa45..a143bda 100644 --- a/beszel/site/src/lib/utils.ts +++ b/beszel/site/src/lib/utils.ts @@ -442,7 +442,13 @@ export const alertInfo: Record = { export const getHostDisplayValue = (system: SystemRecord): string => system.host.slice(system.host.lastIndexOf("/") + 1) /** Generate a random token for the agent */ -export const generateToken = () => crypto?.randomUUID() ?? (performance.now() * Math.random()).toString(16) +export const generateToken = () => { + try { + return crypto?.randomUUID() + } catch (e) { + return Array.from({ length: 2 }, () => (performance.now() * Math.random()).toString(16).replace(".", "-")).join("-") + } +} /** Get the hub URL from the global BESZEL object */ export const getHubURL = () => BESZEL?.HUB_URL || window.location.origin