Fix config storage for self-hosted instances#5
Open
bvorh wants to merge 1 commit into
Open
Conversation
Move endpoint URL and client ID from local storage to browser storage, so it persists across different contexts.
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.
I'm running a self-hosted instance of solidtime, and was running into the following issue with the browser extension:
I used an LLM to identify the issue and propose a fix. However, I do understand the changes it proposed, tested them and cleaned up the code before opening an MR.
Issue Description
The problem was that the auth and refresh tokens are stored in the global browser storage, but the instance configuration (
endpointandclientId) were not. The instance config was stored in local/vue storage instead, which is not shared between the background and the content context. Thus, when the first API call from the Linear page was made, the endpoint config fell back to default settings, causing the API call to fail. I could also observe this in the Chrome console (401 error from app.solidtime.io instead of my own configured domain).Fix
The fix involves storing the instance config in the global browser storage, ensuring local changes are reflected (using
watch) and introducing a new exportedreadyPromise which other components can await before using any of the values stored in the common storage.Testing
I tested the changes both with
npm run devand by installing the unpacked extension in my Chromium browser. I can now successfully log in to my self-hosted instance, and the API calls go through.Looking forward to your feedback on this, I'm happy to incorporate any changes you would like me to add.