@@ -769,10 +769,10 @@ index 096b9e23493539c9937940a56e555d95bbae38d9..ef37e614004f550f7b64eacd362f6894
769
769
remove(key: string, scope: StorageScope): void {
770
770
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
771
771
new file mode 100644
772
- index 0000000000000000000000000000000000000000..3c0703b7174ad792a4b42841e96ee93765d71601
772
+ index 0000000000000000000000000000000000000000..385b9da491d38a9f5d10fab6e4666c84a892f49d
773
773
--- /dev/null
774
774
+++ b/src/vs/server/browser/client.ts
775
- @@ -0,0 +1,189 @@
775
+ @@ -0,0 +1,240 @@
776
776
+ import { Emitter } from 'vs/base/common/event';
777
777
+ import { URI } from 'vs/base/common/uri';
778
778
+ import { localize } from 'vs/nls';
@@ -791,6 +791,8 @@ index 0000000000000000000000000000000000000000..3c0703b7174ad792a4b42841e96ee937
791
791
+ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
792
792
+ import { Options } from 'vs/server/ipc.d';
793
793
+ 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';
794
796
+
795
797
+ class TelemetryService extends TelemetryChannelClient {
796
798
+ public constructor(
@@ -922,8 +924,57 @@ index 0000000000000000000000000000000000000000..3c0703b7174ad792a4b42841e96ee937
922
924
+ });
923
925
+ }
924
926
+
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
+ +
925
976
+ // 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);
927
978
+ if (theme) {
928
979
+ localStorage.setItem("colorThemeData", theme);
929
980
+ }
@@ -3858,15 +3909,15 @@ index 738ce140c1af76ee0017c59cc883578e966f5348..80833b7023ed5795bb3de303b54ec08d
3858
3909
3859
3910
.monaco-workbench .part.editor > .content .welcomePage .splash ul {
3860
3911
diff --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
3862
3913
--- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
3863
3914
+++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts
3864
3915
@@ -328,7 +328,7 @@ class WelcomePage extends Disposable {
3865
3916
3866
3917
const prodName = container.querySelector('.welcomePage .title .caption') as HTMLElement;
3867
3918
if (prodName) {
3868
3919
- prodName.textContent = this.productService.nameLong;
3869
- + prodName.textContent = `code-server v${this.productService.codeServerVersion}`
3920
+ + prodName.textContent = `code-server v${this.productService.codeServerVersion}`;
3870
3921
}
3871
3922
3872
3923
recentlyOpened.then(({ workspaces }) => {
0 commit comments