Skip to content

feat: support configurable self-hosted API URLs - #25

Closed
dyk1454683243-sudo wants to merge 1 commit into
DevOlabode:mainfrom
dyk1454683243-sudo:cursor/configurable-api-url-e7a3
Closed

dyk1454683243-sudo wants to merge 1 commit into
DevOlabode:mainfrom
dyk1454683243-sudo:cursor/configurable-api-url-e7a3

Conversation

@dyk1454683243-sudo

@dyk1454683243-sudo dyk1454683243-sudo commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Lets the extension talk to a self-hosted Curate API without editing manifest.json or rebuilding.

The options page now has three environments:

  • Production — locked to the hosted API (https://curate-h0ga.onrender.com)
  • Development — loopback only (localhost, 127.0.0.1, [::1])
  • Self-hosted — a caller-supplied URL, validated then granted at runtime

Default host_permissions stay limited to the hosted origin and http://localhost:3000. Extra hosts use optional_host_permissions and chrome.permissions.request() on Save / Test connection, so Chrome prompts for that origin only.

connect-src is scoped to https: plus loopback HTTP. That matches validation: http:// is rejected except on loopback, so LAN HTTP is not silently broken by CSP.

A custom URL previously stored under Production is promoted to Self-hosted instead of being overwritten.

Related Issue

Fixes #14

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Tests

Testing

  • Automated tests (npm test)
  • Manual testing (options page: production lock, self-hosted HTTPS save/sanitize, http:// non-loopback rejected)
  • Extension build completed successfully (npm run build:extension)
  • CI build check passed

tests/unit/apiUrl.test.js covers sanitization (scheme, wildcards, credentials, loopback HTTP), storage resolution / migration, and the manifest permission/CSP constraints.

Design notes (from #14)

  • Self-hosting is opt-in via optional_host_permissions, not a wider default host_permissions.
  • The options page requires a full URL, rejects *, credentials, query, and fragment, and keeps a path prefix.
  • CSP is more permissive in a scoped way (https: + localhost variants). A background relay would not help: MV3 service workers use the same extension_pages CSP.
  • Production no longer fights a custom URL: Production is the hosted default, Self-hosted is the custom path.

Checklist

  • I followed the contribution guidelines
  • I tested my changes
  • I updated documentation if necessary
  • This PR focuses on one change

Add a Self-hosted environment in extension options so a custom Curate
host can be used without editing the manifest or rebuilding. URLs are
validated and sanitized, and extra host access is requested at save
time through optional_host_permissions.

Fixes DevOlabode#14

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

@cursoragent is attempting to deploy a commit to the solabode499-5056's projects Team on Vercel.

A member of the Team first needs to authorize it.

@dyk1454683243-sudo

Copy link
Copy Markdown
Contributor Author

Withdrawing this PR while I clean up a high-volume open-PR backlog. Sorry for the noise — happy to come back later with a focused change if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support configurable self-hosted API URLs

2 participants