diff options
author | Matthias Einwag <[email protected]> | 2020-09-23 07:12:51 +0100 |
---|---|---|
committer | Matthias Einwag <[email protected]> | 2020-09-23 07:12:51 +0100 |
commit | b93ced6f633fab2733b40aef2541582b00e053fb (patch) | |
tree | d4f100e94e0f8cbece5fddc76385f42cdd181e45 /editors/code/src/persistent_state.ts | |
parent | bcdedbb3d5a45ea974cc5f8e9068e9604c43a757 (diff) |
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 5705eed81..afb652589 100644 --- a/editors/code/src/persistent_state.ts +++ b/editors/code/src/persistent_state.ts | |||
@@ -38,4 +38,15 @@ export class PersistentState { | |||
38 | async updateServerVersion(value: string | undefined) { | 38 | async updateServerVersion(value: string | undefined) { |
39 | await this.globalState.update("serverVersion", value); | 39 | await this.globalState.update("serverVersion", value); |
40 | } | 40 | } |
41 | |||
42 | /** | ||
43 | * Github authorization token. | ||
44 | * This is used for API requests against the Github API. | ||
45 | */ | ||
46 | get githubToken(): string | undefined { | ||
47 | return this.globalState.get("githubToken"); | ||
48 | } | ||
49 | async updateGithubToken(value: string | undefined) { | ||
50 | await this.globalState.update("githubToken", value); | ||
51 | } | ||
41 | } | 52 | } |