-
Notifications
You must be signed in to change notification settings - Fork 10
feat: robust handling for internal uri #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
justlevine
merged 31 commits into
rtCamp:develop
from
SH4LIN:feature/robust-handling-of-internal-url
Mar 25, 2025
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9f44ad2
Feature: Add a robust URL checker for internal WordPress URLs and an …
SH4LIN e87e16e
Merge branch 'develop' into feature/robust-handling-of-internal-url
SH4LIN a53888e
refactor: update docs and other occurrences of NEXT_PUBLIC_WORDPRESS_URL
SH4LIN 0f74440
chore: format code
SH4LIN 8179d99
refactor: update failing test case
SH4LIN 92d65d4
refactor: remove toInternalUri from Button component as Link componen…
SH4LIN 56e07f7
refactor: rename env variables (replace *WORDPRESS* with *WP*)
SH4LIN 76bf6a8
feature: add test cases for url-checker and internal-uri, update test…
SH4LIN db7616c
chore: doc format
SH4LIN c314912
refactor: sort env variables .env.example, rename to-internal-uri.ts …
SH4LIN 3bac82b
refactor: replace useCorsProxy and corsProxyPrefix with hasCorsProxy,…
SH4LIN 4556d78
chore: add changeset
SH4LIN 7f8df73
Merge branch 'develop' into feature/robust-handling-of-internal-url
justlevine 35390b8
Merge branch 'develop' into feature/robust-handling-of-internal-url
justlevine c98f845
refactor: variable update
SH4LIN dc0db5f
refactor: update test cases
SH4LIN ad1d360
Merge branch 'rtCamp:develop' into feature/robust-handling-of-interna…
SH4LIN 4fec62c
fix: CHANGELOG.md format
SH4LIN 12cd3ed
refactor: remove hasCorsProxy variable, address PR feedback related t…
SH4LIN 9edd2db
refactor: address feedback related to comments
SH4LIN d321999
refactor: by default isWPSiteUrl will have false for ignoreProtocol
SH4LIN 954c273
Merge branch 'develop' into feature/robust-handling-of-internal-url
justlevine 4b28a3a
chore: update changeset
justlevine 7b53fa7
chore: format
justlevine 563d37e
refactor: handled http and https cases for the site and homeurl
SH4LIN 8caa57e
Merge remote-tracking branch 'upstream/develop' into pr/SH4LIN/111
justlevine e5cc7e4
dev!: Reorganize core `utils` into type-based subdirectories.
justlevine 515ad04
ci: update .env when testing examples
justlevine 7dc9e5b
chore: format
justlevine eb1343e
chore: sort env vars semantically
justlevine f26db3d
Merge branch 'develop' into feature/robust-handling-of-internal-url
justlevine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"@snapwp/blocks": minor | ||
"@snapwp/query": minor | ||
"@snapwp/types": minor | ||
"@snapwp/core": minor | ||
"@snapwp/next": minor | ||
"snapwp": minor | ||
--- | ||
|
||
feat!: Add and improve robust WordPress and internal URI handling. | ||
|
||
**Breaking Changes:** | ||
|
||
The [Environment Variables and Config API](../docs/config-api.md) have been updated, with many of the variables renamed or removed. Please review the updated documentation for the latest changes. | ||
|
||
| Old value | Replace with | | ||
|----------|----------| | ||
| NEXT_PUBLIC_URL | NEXT_PUBLIC_FRONTEND_URL | | ||
| NEXT_PUBLIC_WORDPRESS_URL | NEXT_PUBLIC_WP_HOME_URL | | ||
| NEXT_PUBLIC_WORDPRESS_UPLOADS_PATH | NEXT_PUBLIC_WP_UPLOADS_DIRECTORY | | ||
| NEXT_PUBLIC_WORDPRESS_REST_URL_PREFIX | NEXT_PUBLIC_REST_URL_PREFIX | | ||
| getConfig().nextUrl | getConfig().frontendUrl | | ||
| getConfig().homeUrl | getConfig().wpHomeUrl | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@snapwp/core": minor | ||
--- | ||
|
||
dev!: Reorganize core `utils` into type-based subdirectories. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
# Enable if connecting to a self-signed cert | ||
# Enable if connecting to a self-signed cert. | ||
# NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
|
||
# The headless frontend domain URL. Uncomment this line and ensure the value matches the URL used by your frontend app. | ||
# NEXT_PUBLIC_URL=http://localhost:3000 | ||
# The URL of the Next.js "headless" frontend. | ||
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000 | ||
|
||
# The WordPress "frontend" domain URL | ||
NEXT_PUBLIC_WORDPRESS_URL=https://headless-demo.local | ||
# The traditional WordPress frontend domain URL. E.g. https://my-headless-site.local | ||
NEXT_PUBLIC_WP_HOME_URL= | ||
|
||
# The WordPress GraphQL endpoint | ||
# The backend "WordPress Address" URL where your WordPress core files reside. | ||
# Only needed if different than `NEXT_PUBLIC_WP_HOME_URL`. E.g. https://my-headless-site.local/wp/ | ||
# NEXT_PUBLIC_WP_SITE_URL= | ||
|
||
# The WordPress GraphQL endpoint. | ||
NEXT_PUBLIC_GRAPHQL_ENDPOINT=graphql | ||
|
||
# The WordPress Uploads directory path | ||
# NEXT_PUBLIC_WORDPRESS_UPLOADS_PATH=/wp-content/uploads | ||
# The WordPress REST API URL prefix. | ||
# NEXT_PUBLIC_REST_URL_PREFIX=/wp-json | ||
|
||
# The relative path to the WordPress uploads directory. | ||
# NEXT_PUBLIC_WP_UPLOADS_DIRECTORY=/wp-content/uploads | ||
|
||
# The WordPress REST URL Prefix | ||
# NEXT_PUBLIC_WORDPRESS_REST_URL_PREFIX=/wp-json | ||
# The CORS proxy prefix to use when bypassing CORS restrictions from WordPress server. If unset, no proxy will be used. | ||
# NEXT_PUBLIC_CORS_PROXY_PREFIX=/proxy | ||
|
||
# Token used for authenticating GraphQL introspection queries | ||
# Token used for authenticating GraphQL introspection queries. | ||
INTROSPECTION_TOKEN= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
justlevine marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
# Enable if connecting to a self-signed cert | ||
# NODE_TLS_REJECT_UNAUTHORIZED="0" | ||
# Enable if connecting to a self-signed cert. | ||
# NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
|
||
# The headless frontend domain URL | ||
NEXT_PUBLIC_URL="http://localhost:3000" | ||
# The URL of the Next.js "headless" frontend. | ||
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000 | ||
|
||
# The WordPress "frontend" domain URL | ||
NEXT_PUBLIC_WORDPRESS_URL="http://localhost" | ||
# The traditional WordPress frontend domain URL. E.g. https://my-headless-site.local | ||
NEXT_PUBLIC_WP_HOME_URL= | ||
|
||
# The WordPress GraphQL endpoint | ||
NEXT_PUBLIC_GRAPHQL_ENDPOINT="graphql" | ||
# The backend "WordPress Address" URL where your WordPress core files reside. | ||
# Only needed if different than `NEXT_PUBLIC_WP_HOME_URL`. E.g. https://my-headless-site.local/wp/ | ||
# NEXT_PUBLIC_WP_SITE_URL= | ||
|
||
# The WordPress Uploads directory path | ||
# NEXT_PUBLIC_WORDPRESS_UPLOADS_PATH=/wp-content/uploads | ||
# The WordPress GraphQL endpoint. | ||
NEXT_PUBLIC_GRAPHQL_ENDPOINT=graphql | ||
|
||
# The WordPress REST URL Prefix | ||
# NEXT_PUBLIC_WORDPRESS_REST_URL_PREFIX=/wp-json | ||
# The WordPress REST API URL prefix. | ||
# NEXT_PUBLIC_REST_URL_PREFIX=/wp-json | ||
|
||
# Token used for authenticating GraphQL introspection queries | ||
# The relative path to the WordPress uploads directory. | ||
# NEXT_PUBLIC_WP_UPLOADS_DIRECTORY=/wp-content/uploads | ||
|
||
# The CORS proxy prefix to use when bypassing CORS restrictions from WordPress server. If unset, no proxy will be used. | ||
# NEXT_PUBLIC_CORS_PROXY_PREFIX=/proxy | ||
|
||
# Token used for authenticating GraphQL introspection queries. | ||
INTROSPECTION_TOKEN= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.