Skip to content

fix: store instance settings in extension storage instead of localStorage - #6

Open
Laecherlich wants to merge 1 commit into
solidtime-io:mainfrom
lipsia:fix/instance-settings-extension-storage
Open

fix: store instance settings in extension storage instead of localStorage#6
Laecherlich wants to merge 1 commit into
solidtime-io:mainfrom
lipsia:fix/instance-settings-extension-storage

Conversation

@Laecherlich

Copy link
Copy Markdown

Problem

With a self-hosted instance configured, the injected issue-page buttons (Jira/Linear/Plane) fail with a 401 and log the user out.

endpoint and clientId are kept in useStorage (vueuse), which is backed by localStorage. Content scripts share localStorage with the host page (e.g. *.atlassian.net), where these keys never exist — so all API calls from injected buttons silently fall back to the default cloud endpoint. The instance's Bearer token (correctly shared via browser.storage) is then sent to app.solidtime.io, which returns 401; the interceptor's token refresh also targets the wrong host, fails, and clears the session.

Fix

  • Store instance_endpoint / instance_client_id in browser.storage.local, exactly like the tokens already are.
  • Expose a settingsLoaded promise; the content script awaits it before any integration makes API calls.
  • Sync changes across contexts via the existing storage.onChanged listener.
  • Migrate values a previous version persisted in the popup's localStorage (extension pages only — a content script's localStorage belongs to the host page and must not be migrated from).

Adds no new vue-tsc errors (same error count as main).

…rage

Content scripts share localStorage with the host page (e.g. atlassian.net),
where the instance_endpoint/instance_client_id keys never exist. API calls
made from injected buttons therefore always went to the default cloud
endpoint with a self-hosted instance's token, failed with 401, and the
failed refresh logged the user out.

Store the settings in browser.storage.local (like the tokens), expose a
settingsLoaded promise the content script awaits before making API calls,
sync changes across contexts via storage.onChanged, and migrate values a
previous version persisted in the popup's localStorage.
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.

1 participant