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
This commit is contained in:
Matthias Einwag
2020-09-22 23:12:51 -07:00
parent bcdedbb3d5
commit b93ced6f63
3 changed files with 72 additions and 4 deletions

View File

@@ -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);
}
}