fix(url): support caddy localhost URLs in dev mode#1190
Conversation
π¦ Changeset detectedLatest commit: 1a59622 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Related Documentation 1 document(s) may need updating based on files changed in this PR: Read Frog - Open Source Immersive Translate Build and Development Environment SetupView Suggested Changes@@ -37,6 +37,7 @@
- **Environment Variable:**
- Set `WXT_USE_LOCAL_PACKAGES=true` in a `.env.local` file to enable local package resolution.
- An example file `.env.local.example` is provided. Copy it to `.env.local` and adjust as needed.
+ - When `WXT_USE_LOCAL_PACKAGES=true` is set in development mode, the extension uses `WEBSITE_CADDY_DEV_URL` instead of `WEBSITE_PROD_URL` for the website URL. The development environment uses [Caddy](https://caddyserver.com/) to serve the website with HTTPS support on localhost.
- **TypeScript Configuration:**
- The root `tsconfig.json` now extends `tsconfig.local.json` if present.
@@ -46,6 +47,9 @@
- **Vite/WXT Configuration:**
- The `wxt.config.ts` file conditionally aliases `@read-frog/*` packages to local paths when `WXT_USE_LOCAL_PACKAGES` is set.
- React and ReactDOM are always resolved as singletons from the root `node_modules` to avoid duplication.
+
+- **Localhost URL Support:**
+ - The extension supports both HTTP and HTTPS localhost URLs in development mode. The official site URL patterns include both `http://localhost/*` and `https://localhost/*`.
- **.gitignore:**
- `.gitignore` is updated to ignore `tsconfig.local.json` but allow example files to be tracked.Note: You must be authenticated to accept/decline updates. |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a596225f3
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export const WEBSITE_URL = (import.meta.env.DEV && import.meta.env.WXT_USE_LOCAL_PACKAGES === "true") | ||
| ? WEBSITE_DEV_URL | ||
| ? WEBSITE_CADDY_DEV_URL |
There was a problem hiding this comment.
Preserve non-Caddy dev URL for
dev:local
WEBSITE_URL now switches every import.meta.env.DEV && WXT_USE_LOCAL_PACKAGES=true build to https://localhost:4433, but the standard dev:local script in package.json:13 only sets that env var and does not start or require Caddy. In the existing local-packages workflow where the site still runs on the plain dev server (http://localhost:8888), this change makes the extension send auth and RPC traffic to the wrong origin (src/utils/auth/auth-client.ts:37-45, src/utils/orpc/client.ts:9-12), so login, API calls, and docs/blog links stop working even though OFFICIAL_SITE_URL_PATTERNS still recognizes the HTTP localhost page. This needs a fallback or separate toggle for the Caddy-backed setup instead of replacing the old dev URL unconditionally.
Useful? React with πΒ / π.
Type of Changes
Description
Related Issue
Closes #
How Has This Been Tested?
Screenshots
Checklist
Additional Information
Summary by cubic
Enable dev support for Caddy-served HTTPS localhost. This lets the extension match and open the local site when using the Caddy reverse proxy.
OFFICIAL_SITE_URL_PATTERNS.WEBSITE_CADDY_DEV_URLforWEBSITE_URLin dev whenWXT_USE_LOCAL_PACKAGES === "true".Written for commit 1a59622. Summary will update on new commits.