Skip to content

Support configurable self-hosted API URLs #14

Description

@DevOlabode

Current behavior

src/shared/config.js and extension/options/options.html already have a developer-facing "Environment" + "API base URL" setting, but it's more limited than it looks:

  • DEFAULT_API_URLS only knows about development (http://localhost:3000) and production (the hosted Render URL) - see src/shared/config.js:1-4.
  • getApiBaseUrl() (src/shared/config.js:21-46) actively resets a non-localhost, non-legacy URL back to the hosted default whenever environment is production (config.js:38-42). In practice, a contributor typing a self-hosted URL into "Production" mode gets silently overridden.
  • manifest.json hardcodes host_permissions (extension/manifest.json:34-37) and the CSP connect-src (extension/manifest.json:39) to just the hosted URL and localhost:3000. Even if the config layer allowed a custom URL, the browser would block the request - Manifest V3 host permissions and CSP connect-src are fixed at install/build time and can't be changed by a runtime setting.

This is a discussion issue before implementation

Manifest V3's optional_host_permissions lets an extension request additional host access at runtime via chrome.permissions.request(), prompting the user - that's the realistic path here, not editing host_permissions directly per install.

Please define, before implementing:

  • Whether self-hosting is opt-in via optional_host_permissions (user grants access to their own host explicitly) rather than broadening the default host_permissions
  • How the options page collects and validates a custom host (scheme required, no wildcards beyond what's needed)
  • What happens to the CSP connect-src - it may need to become more permissive in a scoped way, or the request needs to go through a background-script relay
  • How this interacts with the existing environment field, since today "production" actively fights a custom URL

Relevant files

  • src/shared/config.js
  • extension/options/options.html, extension/options/options.js
  • extension/manifest.json (permissions, host_permissions, content_security_policy)
  • docs/architecture.md ("no content scripts... Permissions are storage plus host access")

Non-goals

  • Do not widen host_permissions to <all_urls> or a broad wildcard - that changes the extension's review/trust profile for every user, including the default hosted setup.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestextensionBrowser extension (popup, options, background)help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions