Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): polyfill crypto.randomUUID for non-secure HTTP contexts #666

Mergedchirino(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/666/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 19 additions and 10 deletions.

x
0 of 2 viewed, 2 left
6 additions and 6 deletionsapps/web/src/components/ChatView.tsxModified
View file
@@ -175,7 +175,7 @@
VisualStudioCode,
Zed,
} from "./Icons";
-import { cn, isMacPlatform, isWindowsPlatform } from "~/lib/utils";
+import { cn, isMacPlatform, isWindowsPlatform, randomUUID } from "~/lib/utils";
import { Badge } from "./ui/badge";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
import { Command, CommandItem, CommandList } from "./ui/command";
@@ -434,7 +434,7 @@
​
function buildTemporaryWorktreeBranchName(): string {
// Keep the 8-hex suffix shape for backend temporary-branch detection.
- const token = crypto.randomUUID().slice(0, 8).toLowerCase();
+ const token = randomUUID().slice(0, 8).toLowerCase();
return `${WORKTREE_BRANCH_PREFIX}/${token}`;
​
@@ -1376,13 +1376,13 @@
}, [activeThreadId, setTerminalOpen, terminalState.terminalOpen]);
const splitTerminal = useCallback(() => {
if (!activeThreadId || hasReachedTerminalLimit) return;
- const terminalId = `terminal-${crypto.randomUUID()}`;
+ const terminalId = `terminal-${randomUUID()}`;
storeSplitTerminal(activeThreadId, terminalId);
setTerminalFocusRequestId((value) => value + 1);
}, [activeThreadId, storeSplitTerminal, hasReachedTerminalLimit]);
const createNewTerminal = useCallback(() => {