mirror of
https://github.com/coder/code-server.git
synced 2026-05-06 20:41:59 +02:00
chore(vscode): update to 1.56.0
This commit is contained in:
@@ -51,7 +51,7 @@ export const enum UpdateType {
|
||||
|
||||
export type Uninitialized = { type: StateType.Uninitialized };
|
||||
export type Idle = { type: StateType.Idle, updateType: UpdateType, error?: string };
|
||||
export type CheckingForUpdates = { type: StateType.CheckingForUpdates, context: any };
|
||||
export type CheckingForUpdates = { type: StateType.CheckingForUpdates, explicit: boolean };
|
||||
export type AvailableForDownload = { type: StateType.AvailableForDownload, update: IUpdate };
|
||||
export type Downloading = { type: StateType.Downloading, update: IUpdate };
|
||||
export type Downloaded = { type: StateType.Downloaded, update: IUpdate };
|
||||
@@ -63,7 +63,7 @@ export type State = Uninitialized | Idle | CheckingForUpdates | AvailableForDown
|
||||
export const State = {
|
||||
Uninitialized: { type: StateType.Uninitialized } as Uninitialized,
|
||||
Idle: (updateType: UpdateType, error?: string) => ({ type: StateType.Idle, updateType, error }) as Idle,
|
||||
CheckingForUpdates: (context: any) => ({ type: StateType.CheckingForUpdates, context } as CheckingForUpdates),
|
||||
CheckingForUpdates: (explicit: boolean) => ({ type: StateType.CheckingForUpdates, explicit } as CheckingForUpdates),
|
||||
AvailableForDownload: (update: IUpdate) => ({ type: StateType.AvailableForDownload, update } as AvailableForDownload),
|
||||
Downloading: (update: IUpdate) => ({ type: StateType.Downloading, update } as Downloading),
|
||||
Downloaded: (update: IUpdate) => ({ type: StateType.Downloaded, update } as Downloaded),
|
||||
@@ -86,7 +86,7 @@ export interface IUpdateService {
|
||||
readonly onStateChange: Event<State>;
|
||||
readonly state: State;
|
||||
|
||||
checkForUpdates(context: any): Promise<void>;
|
||||
checkForUpdates(explicit: boolean): Promise<void>;
|
||||
downloadUpdate(): Promise<void>;
|
||||
applyUpdate(): Promise<void>;
|
||||
quitAndInstall(): Promise<void>;
|
||||
|
||||
@@ -52,8 +52,8 @@ export class UpdateChannelClient implements IUpdateService {
|
||||
this.channel.call<State>('_getInitialState').then(state => this.state = state);
|
||||
}
|
||||
|
||||
checkForUpdates(context: any): Promise<void> {
|
||||
return this.channel.call('checkForUpdates', context);
|
||||
checkForUpdates(explicit: boolean): Promise<void> {
|
||||
return this.channel.call('checkForUpdates', explicit);
|
||||
}
|
||||
|
||||
downloadUpdate(): Promise<void> {
|
||||
|
||||
@@ -97,7 +97,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
||||
this.logService.info('update#ctor - startup checks only; automatic updates are disabled by user preference');
|
||||
|
||||
// Check for updates only once after 30 seconds
|
||||
setTimeout(() => this.checkForUpdates(null), 30 * 1000);
|
||||
setTimeout(() => this.checkForUpdates(false), 30 * 1000);
|
||||
} else {
|
||||
// Start checking for updates after 30 seconds
|
||||
this.scheduleCheckForUpdates(30 * 1000).then(undefined, err => this.logService.error(err));
|
||||
@@ -110,21 +110,21 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
||||
|
||||
private scheduleCheckForUpdates(delay = 60 * 60 * 1000): Promise<void> {
|
||||
return timeout(delay)
|
||||
.then(() => this.checkForUpdates(null))
|
||||
.then(() => this.checkForUpdates(false))
|
||||
.then(() => {
|
||||
// Check again after 1 hour
|
||||
return this.scheduleCheckForUpdates(60 * 60 * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
async checkForUpdates(context: any): Promise<void> {
|
||||
async checkForUpdates(explicit: boolean): Promise<void> {
|
||||
this.logService.trace('update#checkForUpdates, state = ', this.state.type);
|
||||
|
||||
if (this.state.type !== StateType.Idle) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.doCheckForUpdates(context);
|
||||
this.doCheckForUpdates(explicit);
|
||||
}
|
||||
|
||||
async downloadUpdate(): Promise<void> {
|
||||
|
||||
@@ -19,8 +19,6 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
||||
export class DarwinUpdateService extends AbstractUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly disposables = new DisposableStore();
|
||||
|
||||
@memoize private get onRawError(): Event<string> { return Event.fromNodeEventEmitter(electron.autoUpdater, 'error', (_, message) => message); }
|
||||
@@ -40,7 +38,7 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService, productService);
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
override initialize(): void {
|
||||
super.initialize();
|
||||
this.onRawError(this.onError, this, this.disposables);
|
||||
this.onRawUpdateAvailable(this.onUpdateAvailable, this, this.disposables);
|
||||
@@ -52,7 +50,7 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
this.logService.error('UpdateService error:', err);
|
||||
|
||||
// only show message when explicitly checking for updates
|
||||
const shouldShowMessage = this.state.type === StateType.CheckingForUpdates ? !!this.state.context : true;
|
||||
const shouldShowMessage = this.state.type === StateType.CheckingForUpdates ? this.state.explicit : true;
|
||||
const message: string | undefined = shouldShowMessage ? err : undefined;
|
||||
this.setState(State.Idle(UpdateType.Archive, message));
|
||||
}
|
||||
@@ -105,12 +103,12 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
if (this.state.type !== StateType.CheckingForUpdates) {
|
||||
return;
|
||||
}
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!this.state.context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: this.state.explicit });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Archive));
|
||||
}
|
||||
|
||||
protected doQuitAndInstall(): void {
|
||||
protected override doQuitAndInstall(): void {
|
||||
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
|
||||
electron.autoUpdater.quitAndInstall();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeH
|
||||
|
||||
export class LinuxUpdateService extends AbstractUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor(
|
||||
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@@ -62,7 +60,7 @@ export class LinuxUpdateService extends AbstractUpdateService {
|
||||
});
|
||||
}
|
||||
|
||||
protected async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
protected override async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
// Use the download URL if available as we don't currently detect the package type that was
|
||||
// installed and the website download page is more useful than the tarball generally.
|
||||
if (this.productService.downloadUrl && this.productService.downloadUrl.length > 0) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { spawn } from 'child_process';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
|
||||
abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
abstract class AbstractUpdateService implements IUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
@@ -52,21 +52,21 @@ abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
|
||||
private scheduleCheckForUpdates(delay = 60 * 60 * 1000): Promise<void> {
|
||||
return timeout(delay)
|
||||
.then(() => this.checkForUpdates(null))
|
||||
.then(() => this.checkForUpdates(false))
|
||||
.then(() => {
|
||||
// Check again after 1 hour
|
||||
return this.scheduleCheckForUpdates(60 * 60 * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
async checkForUpdates(context: any): Promise<void> {
|
||||
async checkForUpdates(explicit: boolean): Promise<void> {
|
||||
this.logService.trace('update#checkForUpdates, state = ', this.state.type);
|
||||
|
||||
if (this.state.type !== StateType.Idle) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.doCheckForUpdates(context);
|
||||
this.doCheckForUpdates(explicit);
|
||||
}
|
||||
|
||||
async downloadUpdate(): Promise<void> {
|
||||
@@ -132,9 +132,7 @@ abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
protected abstract doCheckForUpdates(context: any): void;
|
||||
}
|
||||
|
||||
export class SnapUpdateService extends AbstractUpdateService2 {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
export class SnapUpdateService extends AbstractUpdateService {
|
||||
|
||||
constructor(
|
||||
private snap: string,
|
||||
@@ -150,7 +148,7 @@ export class SnapUpdateService extends AbstractUpdateService2 {
|
||||
const onChange = Event.fromNodeEventEmitter(watcher, 'change', (_, fileName: string) => fileName);
|
||||
const onCurrentChange = Event.filter(onChange, n => n === 'current');
|
||||
const onDebouncedCurrentChange = Event.debounce(onCurrentChange, (_, e) => e, 2000);
|
||||
const listener = onDebouncedCurrentChange(this.checkForUpdates, this);
|
||||
const listener = onDebouncedCurrentChange(() => this.checkForUpdates(false));
|
||||
|
||||
lifecycleMainService.onWillShutdown(() => {
|
||||
listener.dispose();
|
||||
@@ -158,24 +156,24 @@ export class SnapUpdateService extends AbstractUpdateService2 {
|
||||
});
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
protected doCheckForUpdates(): void {
|
||||
this.setState(State.CheckingForUpdates(false));
|
||||
this.isUpdateAvailable().then(result => {
|
||||
if (result) {
|
||||
this.setState(State.Ready({ version: 'something', productVersion: 'something' }));
|
||||
} else {
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: false });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Snap));
|
||||
}
|
||||
}, err => {
|
||||
this.logService.error(err);
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: false });
|
||||
this.setState(State.Idle(UpdateType.Snap, err.message || err));
|
||||
});
|
||||
}
|
||||
|
||||
protected doQuitAndInstall(): void {
|
||||
protected override doQuitAndInstall(): void {
|
||||
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
|
||||
|
||||
// Allow 3 seconds for VS Code to close
|
||||
|
||||
@@ -49,8 +49,6 @@ function getUpdateType(): UpdateType {
|
||||
|
||||
export class Win32UpdateService extends AbstractUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private availableUpdate: IAvailableUpdate | undefined;
|
||||
|
||||
@memoize
|
||||
@@ -73,7 +71,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService, productService);
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
override initialize(): void {
|
||||
super.initialize();
|
||||
|
||||
if (getUpdateType() === UpdateType.Setup) {
|
||||
@@ -177,7 +175,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
});
|
||||
}
|
||||
|
||||
protected async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
protected override async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
if (state.update.url) {
|
||||
this.nativeHostMainService.openExternal(undefined, state.update.url);
|
||||
}
|
||||
@@ -206,7 +204,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
protected async doApplyUpdate(): Promise<void> {
|
||||
protected override async doApplyUpdate(): Promise<void> {
|
||||
if (this.state.type !== StateType.Downloaded && this.state.type !== StateType.Downloading) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -242,7 +240,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
.then(() => this.setState(State.Ready(update)));
|
||||
}
|
||||
|
||||
protected doQuitAndInstall(): void {
|
||||
protected override doQuitAndInstall(): void {
|
||||
if (this.state.type !== StateType.Ready || !this.availableUpdate) {
|
||||
return;
|
||||
}
|
||||
@@ -259,7 +257,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
protected getUpdateType(): UpdateType {
|
||||
protected override getUpdateType(): UpdateType {
|
||||
return getUpdateType();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user