mirror of https://github.com/microsoft/vscode.git
update: distinguish between explicit and implicit update requests (#247334)
* add a random query param to feed url
* Revert "add a random query param to feed url"
This reverts commit fed0c769ba
.
* update service: distinguish between explicit and implicit update requests
This commit is contained in:
parent
db97d5e1cb
commit
5bc61fd23e
|
@ -231,5 +231,5 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
|||
}
|
||||
|
||||
protected abstract buildUpdateFeedUrl(quality: string): string | undefined;
|
||||
protected abstract doCheckForUpdates(context: any): void;
|
||||
protected abstract doCheckForUpdates(explicit: boolean): void;
|
||||
}
|
||||
|
|
|
@ -91,8 +91,15 @@ export class DarwinUpdateService extends AbstractUpdateService implements IRelau
|
|||
return url;
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
protected doCheckForUpdates(explicit: boolean): void {
|
||||
if (!this.url) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(State.CheckingForUpdates(explicit));
|
||||
|
||||
const url = explicit ? this.url : `${this.url}?bg=true`;
|
||||
electron.autoUpdater.setFeedURL({ url });
|
||||
electron.autoUpdater.checkForUpdates();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,15 @@ export class LinuxUpdateService extends AbstractUpdateService {
|
|||
return createUpdateURL(`linux-${process.arch}`, quality, this.productService);
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
protected doCheckForUpdates(explicit: boolean): void {
|
||||
if (!this.url) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
this.requestService.request({ url: this.url }, CancellationToken.None)
|
||||
const url = explicit ? this.url : `${this.url}?bg=true`;
|
||||
this.setState(State.CheckingForUpdates(explicit));
|
||||
|
||||
this.requestService.request({ url }, CancellationToken.None)
|
||||
.then<IUpdate | null>(asJson)
|
||||
.then(update => {
|
||||
if (!update || !update.url || !update.version || !update.productVersion) {
|
||||
|
@ -50,7 +52,7 @@ export class LinuxUpdateService extends AbstractUpdateService {
|
|||
.then(undefined, err => {
|
||||
this.logService.error(err);
|
||||
// only show message when explicitly checking for updates
|
||||
const message: string | undefined = !!context ? (err.message || err) : undefined;
|
||||
const message: string | undefined = explicit ? (err.message || err) : undefined;
|
||||
this.setState(State.Idle(UpdateType.Archive, message));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -111,14 +111,15 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
|
|||
return createUpdateURL(platform, quality, this.productService);
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
protected doCheckForUpdates(explicit: boolean): void {
|
||||
if (!this.url) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
const url = explicit ? this.url : `${this.url}?bg=true`;
|
||||
this.setState(State.CheckingForUpdates(explicit));
|
||||
|
||||
this.requestService.request({ url: this.url }, CancellationToken.None)
|
||||
this.requestService.request({ url }, CancellationToken.None)
|
||||
.then<IUpdate | null>(asJson)
|
||||
.then(update => {
|
||||
const updateType = getUpdateType();
|
||||
|
@ -170,7 +171,7 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
|
|||
this.logService.error(err);
|
||||
|
||||
// only show message when explicitly checking for updates
|
||||
const message: string | undefined = !!context ? (err.message || err) : undefined;
|
||||
const message: string | undefined = explicit ? (err.message || err) : undefined;
|
||||
this.setState(State.Idle(getUpdateType(), message));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue