Skip to content

Commit 72f3b4e

Browse files
authored
fix(scarf): guard crypto.randomUUID for non-secure contexts (#1360)
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
1 parent 8d46e5d commit 72f3b4e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/components/Scarf.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function Scarf({ id, path }: { id: string; path: string }) {
2828
lastVisit.current = visit
2929
setPixel({
3030
visit,
31-
src: `https://static.scarf.sh/a.png?x-pxid=${encodeURIComponent(id)}&key=${crypto.randomUUID()}`,
31+
src: `https://static.scarf.sh/a.png?x-pxid=${encodeURIComponent(id)}&key=${crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2)}`,
3232
})
3333
}, [id, visit])
3434

0 commit comments

Comments
 (0)