@@ -769,10 +769,10 @@ index 096b9e23493539c9937940a56e555d95bbae38d9..ef37e614004f550f7b64eacd362f6894
769769 remove(key: string, scope: StorageScope): void {
770770diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
771771new file mode 100644
772- index 0000000000000000000000000000000000000000..3c0703b7174ad792a4b42841e96ee93765d71601
772+ index 0000000000000000000000000000000000000000..385b9da491d38a9f5d10fab6e4666c84a892f49d
773773--- /dev/null
774774+++ b/src/vs/server/browser/client.ts
775- @@ -0,0 +1,189 @@
775+ @@ -0,0 +1,240 @@
776776+ import { Emitter } from 'vs/base/common/event';
777777+ import { URI } from 'vs/base/common/uri';
778778+ import { localize } from 'vs/nls';
@@ -791,6 +791,8 @@ index 0000000000000000000000000000000000000000..3c0703b7174ad792a4b42841e96ee937
791791+ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
792792+ import { Options } from 'vs/server/ipc.d';
793793+ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
794+ + import { ILogService } from 'vs/platform/log/common/log';
795+ + import * as path from 'vs/base/common/path';
794796+
795797+ class TelemetryService extends TelemetryChannelClient {
796798+ public constructor(
@@ -922,8 +924,57 @@ index 0000000000000000000000000000000000000000..3c0703b7174ad792a4b42841e96ee937
922924+ });
923925+ }
924926+
927+ + const logService = (services.get(ILogService) as ILogService);
928+ + const storageService = (services.get(IStorageService) as IStorageService);
929+ + // We set this here first in case the path changes.
930+ + const updateCheckEndpoint = path.join(window.location.pathname, "/update/check")
931+ + const getUpdate = async (): Promise<void> => {
932+ + logService.debug("Checking for update...");
933+ +
934+ + const response = await fetch(updateCheckEndpoint, {
935+ + headers: { "Accept": "application/json" },
936+ + });
937+ + if (!response.ok) {
938+ + throw new Error(response.statusText);
939+ + }
940+ + const json = await response.json();
941+ + if (json.error) {
942+ + throw new Error(json.error);
943+ + }
944+ + if (json.isLatest) {
945+ + return;
946+ + }
947+ +
948+ + const lastNoti = storageService.getNumber("csLastUpdateNotification", StorageScope.GLOBAL);
949+ + if (lastNoti) {
950+ + // Only remind them again after two days.
951+ + const timeout = 1000*60*24*2;
952+ + const threshold = lastNoti + timeout;
953+ + if (Date.now() < threshold) {
954+ + return;
955+ + }
956+ + }
957+ +
958+ + storageService.store("csLastUpdateNotification", Date.now(), StorageScope.GLOBAL);
959+ + (services.get(INotificationService) as INotificationService).notify({
960+ + severity: Severity.Info,
961+ + message: `[code-server v${json.latest}](https://github.com/cdr/code-server/releases/tag/v${json.latest}) has been released!`,
962+ + });
963+ + };
964+ +
965+ + const updateLoop = (): void => {
966+ + getUpdate().catch((error) => {
967+ + logService.debug(`failed to check for update: ${error}`);
968+ + }).finally(() => {
969+ + // Check again every 6 hours.
970+ + setTimeout(updateLoop, 1000*60*6);
971+ + });
972+ + };
973+ +
974+ + updateLoop();
975+ +
925976+ // This will be used to set the background color while VS Code loads.
926- + const theme = (services.get(IStorageService) as IStorageService) .get("colorThemeData", StorageScope.GLOBAL);
977+ + const theme = storageService .get("colorThemeData", StorageScope.GLOBAL);
927978+ if (theme) {
928979+ localStorage.setItem("colorThemeData", theme);
929980+ }
@@ -3858,15 +3909,15 @@ index 738ce140c1af76ee0017c59cc883578e966f5348..80833b7023ed5795bb3de303b54ec08d
38583909
38593910 .monaco-workbench .part.editor > .content .welcomePage .splash ul {
38603911diff --git a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
3861- index 4a61a79fe447e2aa238af568791bff1e0cec4d29..791b63342f476f1baba9d31b040d3ef589e3f70a 100644
3912+ index 4a61a79fe447e2aa238af568791bff1e0cec4d29..69cc2e4331a3b04d05d79632920f5c5bbfa924e8 100644
38623913--- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
38633914+++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
38643915@@ -328,7 +328,7 @@ class WelcomePage extends Disposable {
38653916
38663917 const prodName = container.querySelector('.welcomePage .title .caption') as HTMLElement;
38673918 if (prodName) {
38683919- prodName.textContent = this.productService.nameLong;
3869- + prodName.textContent = `code-server v${this.productService.codeServerVersion}`
3920+ + prodName.textContent = `code-server v${this.productService.codeServerVersion}`;
38703921 }
38713922
38723923 recentlyOpened.then(({ workspaces }) => {
0 commit comments