Skip to content

Commit 3e22109

Browse files
committed
cli: Add --disable-update-check flag
Closes #2361
1 parent 01a3e3b commit 3e22109

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

ci/dev/vscode.patch

+12-9
Original file line numberDiff line numberDiff line change
@@ -769,10 +769,10 @@ index 096b9e23493539c9937940a56e555d95bbae38d9..ef37e614004f550f7b64eacd362f6894
769769
remove(key: string, scope: StorageScope): void {
770770
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
771771
new file mode 100644
772-
index 0000000000000000000000000000000000000000..71df1d2b0a718c6a6fbb66a075be52d1be3ff00d
772+
index 0000000000000000000000000000000000000000..bae5b43e07e33b24ed5cc62d39c6b929c0bc4e5f
773773
--- /dev/null
774774
+++ b/src/vs/server/browser/client.ts
775-
@@ -0,0 +1,239 @@
775+
@@ -0,0 +1,241 @@
776776
+import { Emitter } from 'vs/base/common/event';
777777
+import { URI } from 'vs/base/common/uri';
778778
+import { localize } from 'vs/nls';
@@ -926,7 +926,7 @@ index 0000000000000000000000000000000000000000..71df1d2b0a718c6a6fbb66a075be52d1
926926
+
927927
+ const logService = (services.get(ILogService) as ILogService);
928928
+ const storageService = (services.get(IStorageService) as IStorageService);
929-
+ const updateCheckEndpoint = path.join(options.base, "/update/check")
929+
+ const updateCheckEndpoint = path.join(options.base, "/update/check");
930930
+ const getUpdate = async (): Promise<void> => {
931931
+ logService.debug("Checking for update...");
932932
+
@@ -946,8 +946,8 @@ index 0000000000000000000000000000000000000000..71df1d2b0a718c6a6fbb66a075be52d1
946946
+
947947
+ const lastNoti = storageService.getNumber("csLastUpdateNotification", StorageScope.GLOBAL);
948948
+ if (lastNoti) {
949-
+ // Only remind them again after two days.
950-
+ const timeout = 1000*60*24*2;
949+
+ // Only remind them again after 1 week.
950+
+ const timeout = 1000*60*24*7;
951951
+ const threshold = lastNoti + timeout;
952952
+ if (Date.now() < threshold) {
953953
+ return;
@@ -970,7 +970,9 @@ index 0000000000000000000000000000000000000000..71df1d2b0a718c6a6fbb66a075be52d1
970970
+ });
971971
+ };
972972
+
973-
+ updateLoop();
973+
+ if (!options.disableUpdateCheck) {
974+
+ updateLoop();
975+
+ }
974976
+
975977
+ // This will be used to set the background color while VS Code loads.
976978
+ const theme = storageService.get("colorThemeData", StorageScope.GLOBAL);
@@ -1404,17 +1406,18 @@ index 0000000000000000000000000000000000000000..56331ff1fc32bbd82e769aaecb551e42
14041406
+require('../../bootstrap-amd').load('vs/server/entry');
14051407
diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts
14061408
new file mode 100644
1407-
index 0000000000000000000000000000000000000000..fd0115a74eb2d7362a3bf2543cb354a29a58936a
1409+
index 0000000000000000000000000000000000000000..14f658f2702034a0500aebb5417576e5d6ffe406
14081410
--- /dev/null
14091411
+++ b/src/vs/server/ipc.d.ts
1410-
@@ -0,0 +1,132 @@
1412+
@@ -0,0 +1,133 @@
14111413
+/**
14121414
+ * External interfaces for integration into code-server over IPC. No vs imports
14131415
+ * should be made in this file.
14141416
+ */
14151417
+export interface Options {
1416-
+ disableTelemetry: boolean
14171418
+ base: string
1419+
+ disableTelemetry: boolean
1420+
+ disableUpdateCheck: boolean
14181421
+}
14191422
+
14201423
+export interface InitMessage {

src/node/cli.ts

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface Args extends VsArgs {
3333
"cert-host"?: string
3434
"cert-key"?: string
3535
"disable-telemetry"?: boolean
36+
"disable-update-check"?: boolean
3637
help?: boolean
3738
host?: string
3839
json?: boolean
@@ -114,6 +115,12 @@ const options: Options<Required<Args>> = {
114115
},
115116
"cert-key": { type: "string", path: true, description: "Path to certificate key when using non-generated cert." },
116117
"disable-telemetry": { type: "boolean", description: "Disable telemetry." },
118+
"disable-update-check": {
119+
type: "boolean",
120+
description:
121+
"Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and \n" +
122+
"then notifies you once every week that a new release is available.",
123+
},
117124
help: { type: "boolean", short: "h", description: "Show this output." },
118125
json: { type: "boolean" },
119126
open: { type: "boolean", description: "Open in browser on startup. Does not work remotely." },

src/node/routes/vscode.ts

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ router.get("/", async (req, res) => {
4242
commit !== "development" ? content.replace(/<!-- PROD_ONLY/g, "").replace(/END_PROD_ONLY -->/g, "") : content,
4343
{
4444
disableTelemetry: !!req.args["disable-telemetry"],
45+
disableUpdateCheck: !!req.args["disable-update-check"],
4546
},
4647
)
4748
.replace(`"{{REMOTE_USER_DATA_URI}}"`, `'${JSON.stringify(options.remoteUserDataUri)}'`)

0 commit comments

Comments
 (0)