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

Fixes #371

Summary

crypto.randomUUID() is only available in secure contexts (HTTPS or localhost). When the app is accessed over plain HTTP on a non-localhost address (e.g. a LAN IP), calls to it throw a TypeError.

Changes

  • Add a randomUUID() helper in apps/web/src/lib/utils.ts that delegates to crypto.randomUUID() when available, and falls back to crypto.getRandomValues() otherwise
  • Replace all direct crypto.randomUUID() calls in ChatView.tsx with the new helper

Note

Polyfill crypto.randomUUID for non-secure HTTP contexts in web app

Introduces a randomUUID() wrapper in lib/utils.ts that calls crypto.randomUUID when available and falls back to Effect.runSync(Random.nextUUIDv4) when it is not (e.g. non-HTTPS contexts where crypto.randomUUID is undefined).

  • All ID generation in lib/utils.ts (newCommandId, newProjectId, newThreadId, newMessageId) now uses the wrapper.
  • All UUID usage in ChatView.tsx (terminal IDs, worktree branch names, image attachment IDs) is updated to use the wrapper.
Macroscope summarized 3028ffc.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: b62c8965-424c-4f0b-927b-a0301bc0e663

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. juliusmarminge merged this767de27

    4. juliusmarminge closed this

Sign in to join this conversation.