fix: store instance settings in extension storage instead of localStorage - #6
Open
Laecherlich wants to merge 1 commit into
Open
Conversation
…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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
With a self-hosted instance configured, the injected issue-page buttons (Jira/Linear/Plane) fail with a 401 and log the user out.
endpointandclientIdare kept inuseStorage(vueuse), which is backed bylocalStorage. Content scripts sharelocalStoragewith 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 viabrowser.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
instance_endpoint/instance_client_idinbrowser.storage.local, exactly like the tokens already are.settingsLoadedpromise; the content script awaits it before any integration makes API calls.storage.onChangedlistener.Adds no new
vue-tscerrors (same error count as main).