3367e1ad4e
* chore: upgrade Code to 1.73.0 This upgrades Code to 1.73.0 via the tag. * chore: refresh integration patch * chore: clean up base-path patch Only change here was they moved lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts so I had to update it. Code still looks the same though. * chore: refresh proposed-api patch * chore: update marketplace patch Simlar to a previous patch, the location of lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts changed so I had to update this patch. No changes to code itself. * chore: update hash in webview patch I believe there was only one to update but I may have missed one. * chore: refresh disable-builtin-ext-update.diff * chore: refresh update-check quilt couldn't apply it so I had to add one change in manually to lib/vscode/src/vs/server/node/serverEnvironmentService.ts * chore: refresh logout patch * chore: refresh proxy-uri patch * chore: refresh local-storage patch * chore: refresh sourcemaps patch * chore: refresh disable-downloads patch * chore: refresh telemetry patch * refactor: re-apply display-language patch This kinda got removed but I added it back in. * refactor: drop exec-argv patch This was accepted upstream! :tada * chore: refresh getting-started patch * fixup: add missing slash in marketplace * fixup: update notes proposed-api patch * fixup: support this.args.log as string Seems like upstream now uses a string[] for this. For now, support string. See2b50ab06b1
* Revert "fixup: support this.args.log as string" This reverts commit78c02a1f13
. * fixup!: add log to toCodeArgs This was changed upstream from `string` to `string[]` so now we convert to an array in `toCodeArgs`. See78c02a1f13
* fixup: update telemetry description
138 lines
5.0 KiB
Diff
138 lines
5.0 KiB
Diff
Add a notification that lets you know when an update is out
|
|
|
|
The easiest way to test this is probably to change the version in your
|
|
package.json and delete the last notification storage item.
|
|
|
|
1. change version in root `package.json`
|
|
2. Open DevTools > Application > Storage (top-level)
|
|
3. Click "Clear site data"
|
|
4. See update notification
|
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
|
|
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
|
@@ -1,10 +1,16 @@
|
|
import { Disposable } from 'vs/base/common/lifecycle';
|
|
import { localize } from 'vs/nls';
|
|
+import { ILogService } from 'vs/platform/log/common/log';
|
|
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
|
+import { IProductService } from 'vs/platform/product/common/productService';
|
|
+import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
|
|
|
export class CodeServerClient extends Disposable {
|
|
constructor (
|
|
+ @ILogService private logService: ILogService,
|
|
@INotificationService private notificationService: INotificationService,
|
|
+ @IProductService private productService: IProductService,
|
|
+ @IStorageService private storageService: IStorageService,
|
|
) {
|
|
super();
|
|
}
|
|
@@ -71,5 +77,59 @@ export class CodeServerClient extends Di
|
|
},
|
|
});
|
|
}
|
|
+
|
|
+ if (this.productService.updateEndpoint) {
|
|
+ this.checkUpdates(this.productService.updateEndpoint)
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private checkUpdates(updateEndpoint: string) {
|
|
+ const getUpdate = async (updateCheckEndpoint: string): Promise<void> => {
|
|
+ this.logService.debug('Checking for update...');
|
|
+
|
|
+ const response = await fetch(updateCheckEndpoint, {
|
|
+ headers: { Accept: 'application/json' },
|
|
+ });
|
|
+ if (!response.ok) {
|
|
+ throw new Error(response.statusText);
|
|
+ }
|
|
+ const json = await response.json();
|
|
+ if (json.error) {
|
|
+ throw new Error(json.error);
|
|
+ }
|
|
+ if (json.isLatest) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ const lastNoti = this.storageService.getNumber('csLastUpdateNotification', StorageScope.APPLICATION);
|
|
+ if (lastNoti) {
|
|
+ // Only remind them again after 1 week.
|
|
+ const timeout = 1000 * 60 * 60 * 24 * 7;
|
|
+ const threshold = lastNoti + timeout;
|
|
+ if (Date.now() < threshold) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ this.storageService.store('csLastUpdateNotification', Date.now(), StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
+
|
|
+ this.notificationService.notify({
|
|
+ severity: Severity.Info,
|
|
+ message: `[code-server v${json.latest}](https://github.com/cdr/code-server/releases/tag/v${json.latest}) has been released!`,
|
|
+ });
|
|
+ };
|
|
+
|
|
+ const updateLoop = (): void => {
|
|
+ getUpdate(updateEndpoint)
|
|
+ .catch(error => {
|
|
+ this.logService.debug(`failed to check for update: ${error}`);
|
|
+ })
|
|
+ .finally(() => {
|
|
+ // Check again every 6 hours.
|
|
+ setTimeout(updateLoop, 1000 * 60 * 60 * 6);
|
|
+ });
|
|
+ };
|
|
+
|
|
+ updateLoop();
|
|
}
|
|
}
|
|
Index: code-server/lib/vscode/src/vs/base/common/product.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
|
|
+++ code-server/lib/vscode/src/vs/base/common/product.ts
|
|
@@ -33,6 +33,7 @@ export type ExtensionVirtualWorkspaceSup
|
|
export interface IProductConfiguration {
|
|
readonly codeServerVersion?: string
|
|
readonly rootEndpoint?: string
|
|
+ readonly updateEndpoint?: string
|
|
|
|
readonly version: string;
|
|
readonly date?: string;
|
|
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
@@ -312,6 +312,7 @@ export class WebClientServer {
|
|
productConfiguration: <Partial<IProductConfiguration>>{
|
|
codeServerVersion: this._productService.codeServerVersion,
|
|
rootEndpoint: base,
|
|
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
|
|
embedderIdentifier: 'server-distro',
|
|
extensionsGallery: this._productService.extensionsGallery,
|
|
},
|
|
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
|
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
|
@@ -11,6 +11,8 @@ import { refineServiceDecorator } from '
|
|
import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
|
|
|
export const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = {
|
|
+ /* ----- code-server ----- */
|
|
+ 'disable-update-check': { type: 'boolean' },
|
|
|
|
/* ----- server setup ----- */
|
|
|
|
@@ -88,6 +90,8 @@ export const serverOptions: OptionDescri
|
|
};
|
|
|
|
export interface ServerParsedArgs {
|
|
+ /* ----- code-server ----- */
|
|
+ 'disable-update-check'?: boolean;
|
|
|
|
/* ----- server setup ----- */
|
|
|