|
|
|
@ -252,7 +252,7 @@ index da4fa3e9d0..50f3e1144f 100644
|
|
|
|
|
|
|
|
|
|
function processLib() {
|
|
|
|
|
diff --git a/package.json b/package.json
|
|
|
|
|
index 86e3d5140d..2e52256e49 100644
|
|
|
|
|
index 86e3d5140d..962050280c 100644
|
|
|
|
|
--- a/package.json
|
|
|
|
|
+++ b/package.json
|
|
|
|
|
@@ -42,6 +42,9 @@
|
|
|
|
@ -265,6 +265,15 @@ index 86e3d5140d..2e52256e49 100644
|
|
|
|
|
"applicationinsights": "1.0.8",
|
|
|
|
|
"chokidar": "3.2.3",
|
|
|
|
|
"graceful-fs": "4.2.3",
|
|
|
|
|
@@ -185,5 +188,8 @@
|
|
|
|
|
"windows-foreground-love": "0.2.0",
|
|
|
|
|
"windows-mutex": "0.3.0",
|
|
|
|
|
"windows-process-tree": "0.2.4"
|
|
|
|
|
+ },
|
|
|
|
|
+ "resolutions": {
|
|
|
|
|
+ "minimist": "^1.2.5"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/product.json b/product.json
|
|
|
|
|
index 5378b017c8..afdadda974 100644
|
|
|
|
|
--- a/product.json
|
|
|
|
@ -713,10 +722,10 @@ index eab8591492..26668701f7 100644
|
|
|
|
|
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
|
|
|
|
|
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..649cf32f0a
|
|
|
|
|
index 0000000000..8fb2a87303
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/src/vs/server/browser/client.ts
|
|
|
|
|
@@ -0,0 +1,264 @@
|
|
|
|
|
@@ -0,0 +1,208 @@
|
|
|
|
|
+import { Emitter } from 'vs/base/common/event';
|
|
|
|
|
+import { URI } from 'vs/base/common/uri';
|
|
|
|
|
+import { localize } from 'vs/nls';
|
|
|
|
@ -724,7 +733,6 @@ index 0000000000..649cf32f0a
|
|
|
|
|
+import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
|
|
|
|
+import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
|
|
|
|
+import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
|
|
|
|
+import { ILogService } from 'vs/platform/log/common/log';
|
|
|
|
|
+import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
|
|
|
|
+import { Registry } from 'vs/platform/registry/common/platform';
|
|
|
|
|
+import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection';
|
|
|
|
@ -886,61 +894,6 @@ index 0000000000..649cf32f0a
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const applyUpdate = async (): Promise<void> => {
|
|
|
|
|
+ (services.get(ILogService) as ILogService).debug("Applying update...");
|
|
|
|
|
+
|
|
|
|
|
+ const response = await fetch(normalize(`${options.base}/update/apply`), {
|
|
|
|
|
+ headers: { "content-type": "application/json" },
|
|
|
|
|
+ });
|
|
|
|
|
+ const json = await response.json();
|
|
|
|
|
+ if (response.status !== 200 || json.error) {
|
|
|
|
|
+ throw new Error(json.error || response.statusText);
|
|
|
|
|
+ }
|
|
|
|
|
+ (services.get(INotificationService) as INotificationService).info(`Updated to ${json.version}`);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const getUpdate = async (): Promise<void> => {
|
|
|
|
|
+ (services.get(ILogService) as ILogService).debug("Checking for update...");
|
|
|
|
|
+
|
|
|
|
|
+ const response = await fetch(normalize(`${options.base}/update`), {
|
|
|
|
|
+ headers: { "content-type": "application/json" },
|
|
|
|
|
+ });
|
|
|
|
|
+ const json = await response.json();
|
|
|
|
|
+ if (response.status !== 200 || json.error) {
|
|
|
|
|
+ throw new Error(json.error || response.statusText);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (json.isLatest) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ (services.get(INotificationService) as INotificationService).notify({
|
|
|
|
|
+ severity: Severity.Info,
|
|
|
|
|
+ message: `code-server has an update: ${json.version}`,
|
|
|
|
|
+ actions: {
|
|
|
|
|
+ primary: [{
|
|
|
|
|
+ id: 'update',
|
|
|
|
|
+ label: 'Apply Update',
|
|
|
|
|
+ tooltip: '',
|
|
|
|
|
+ class: undefined,
|
|
|
|
|
+ enabled: true,
|
|
|
|
|
+ checked: true,
|
|
|
|
|
+ dispose: () => undefined,
|
|
|
|
|
+ run: applyUpdate,
|
|
|
|
|
+ }],
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const updateLoop = (): void => {
|
|
|
|
|
+ getUpdate().catch((error) => {
|
|
|
|
|
+ (services.get(ILogService) as ILogService).warn(error);
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ setTimeout(updateLoop, 300000);
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ updateLoop();
|
|
|
|
|
+
|
|
|
|
|
+ // This will be used to set the background color while VS Code loads.
|
|
|
|
|
+ const theme = (services.get(IStorageService) as IStorageService).get("colorThemeData", StorageScope.GLOBAL);
|
|
|
|
|
+ if (theme) {
|
|
|
|
@ -3465,7 +3418,7 @@ index 153ac595d0..a6eb49c5dd 100644
|
|
|
|
|
import 'vs/workbench/services/credentials/browser/credentialsService';
|
|
|
|
|
import 'vs/workbench/services/url/browser/urlService';
|
|
|
|
|
diff --git a/yarn.lock b/yarn.lock
|
|
|
|
|
index 6bc96e8377..585401f144 100644
|
|
|
|
|
index 6bc96e8377..a2baf909d6 100644
|
|
|
|
|
--- a/yarn.lock
|
|
|
|
|
+++ b/yarn.lock
|
|
|
|
|
@@ -140,6 +140,23 @@
|
|
|
|
@ -3506,7 +3459,35 @@ index 6bc96e8377..585401f144 100644
|
|
|
|
|
just-debounce@^1.0.0:
|
|
|
|
|
version "1.0.0"
|
|
|
|
|
resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea"
|
|
|
|
|
@@ -6798,6 +6822,11 @@ p-try@^2.0.0:
|
|
|
|
|
@@ -6009,26 +6033,11 @@ minimatch@0.3:
|
|
|
|
|
dependencies:
|
|
|
|
|
brace-expansion "^1.1.7"
|
|
|
|
|
|
|
|
|
|
-minimist@0.0.8:
|
|
|
|
|
- version "0.0.8"
|
|
|
|
|
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
|
|
|
|
- integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
|
|
|
|
|
-
|
|
|
|
|
-minimist@^1.2.0:
|
|
|
|
|
- version "1.2.0"
|
|
|
|
|
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
|
|
|
|
- integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=
|
|
|
|
|
-
|
|
|
|
|
-minimist@^1.2.5:
|
|
|
|
|
+minimist@0.0.8, minimist@^1.2.0, minimist@^1.2.5, minimist@~0.0.1:
|
|
|
|
|
version "1.2.5"
|
|
|
|
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
|
|
|
|
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
|
|
|
|
|
|
|
|
|
-minimist@~0.0.1:
|
|
|
|
|
- version "0.0.10"
|
|
|
|
|
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
|
|
|
|
|
- integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=
|
|
|
|
|
-
|
|
|
|
|
minipass@^2.2.1, minipass@^2.3.3:
|
|
|
|
|
version "2.3.3"
|
|
|
|
|
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.3.tgz#a7dcc8b7b833f5d368759cce544dccb55f50f233"
|
|
|
|
|
@@ -6798,6 +6807,11 @@ p-try@^2.0.0:
|
|
|
|
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1"
|
|
|
|
|
integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==
|
|
|
|
|
|
|
|
|
|