diff options
| author | Matthias Einwag <matthias.einwag@live.com> | 2020-09-22 23:12:51 -0700 |
|---|---|---|
| committer | Matthias Einwag <matthias.einwag@live.com> | 2020-09-22 23:12:51 -0700 |
| commit | b93ced6f633fab2733b40aef2541582b00e053fb (patch) | |
| tree | d4f100e94e0f8cbece5fddc76385f42cdd181e45 /editors/code/src/persistent_state.ts | |
| parent | bcdedbb3d5a45ea974cc5f8e9068e9604c43a757 (diff) | |
| download | rust-b93ced6f633fab2733b40aef2541582b00e053fb.tar.gz rust-b93ced6f633fab2733b40aef2541582b00e053fb.zip | |
Allow to use a Github Auth token for fetching releases
This change allows to use a authorization token provided by Github in order to fetch metadata for a RA release. Using an authorization token prevents to get rate-limited in environments where lots of RA users use a shared client IP (e.g. behind a company NAT). The auth token is stored in `ExtensionContext.globalState`. As far as I could observe through testing with a local WSL2 environment that state is synced between an extension installed locally and a remote version. The change provides no explicit command to query for an auth token. However in case a download fails it will provide a retry option as well as an option to enter the auth token. This should be more discoverable for most users. Closes #3688
Diffstat (limited to 'editors/code/src/persistent_state.ts')
| -rw-r--r-- | editors/code/src/persistent_state.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/editors/code/src/persistent_state.ts b/editors/code/src/persistent_state.ts index 5705eed812d..afb65258991 100644 --- a/editors/code/src/persistent_state.ts +++ b/editors/code/src/persistent_state.ts @@ -38,4 +38,15 @@ export class PersistentState { async updateServerVersion(value: string | undefined) { await this.globalState.update("serverVersion", value); } + + /** + * Github authorization token. + * This is used for API requests against the Github API. + */ + get githubToken(): string | undefined { + return this.globalState.get("githubToken"); + } + async updateGithubToken(value: string | undefined) { + await this.globalState.update("githubToken", value); + } } |
