Skip to content

Commit cc18175

Browse files
committed
cli: Add --disable-update-check flag
Closes #2361
1 parent 27f0f19 commit cc18175

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

ci/dev/vscode.patch

+10-7
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ new file mode 100644
813813
index 0000000000000000000000000000000000000000..ead6a3cd5e98fdde074f19ee5043f152ed407146
814814
--- /dev/null
815815
+++ b/src/vs/server/browser/client.ts
816-
@@ -0,0 +1,239 @@
816+
@@ -0,0 +1,241 @@
817817
+import { Emitter } from 'vs/base/common/event';
818818
+import { URI } from 'vs/base/common/uri';
819819
+import { localize } from 'vs/nls';
@@ -967,7 +967,7 @@ index 0000000000000000000000000000000000000000..ead6a3cd5e98fdde074f19ee5043f152
967967
+
968968
+ const logService = (services.get(ILogService) as ILogService);
969969
+ const storageService = (services.get(IStorageService) as IStorageService);
970-
+ const updateCheckEndpoint = path.join(options.base, "/update/check")
970+
+ const updateCheckEndpoint = path.join(options.base, "/update/check");
971971
+ const getUpdate = async (): Promise<void> => {
972972
+ logService.debug('Checking for update...');
973973
+
@@ -987,8 +987,8 @@ index 0000000000000000000000000000000000000000..ead6a3cd5e98fdde074f19ee5043f152
987987
+
988988
+ const lastNoti = storageService.getNumber('csLastUpdateNotification', StorageScope.GLOBAL);
989989
+ if (lastNoti) {
990-
+ // Only remind them again after two days.
991-
+ const timeout = 1000*60*24*2;
990+
+ // Only remind them again after 1 week.
991+
+ const timeout = 1000*60*24*7;
992992
+ const threshold = lastNoti + timeout;
993993
+ if (Date.now() < threshold) {
994994
+ return;
@@ -1011,7 +1011,9 @@ index 0000000000000000000000000000000000000000..ead6a3cd5e98fdde074f19ee5043f152
10111011
+ });
10121012
+ };
10131013
+
1014-
+ updateLoop();
1014+
+ if (!options.disableUpdateCheck) {
1015+
+ updateLoop();
1016+
+ }
10151017
+
10161018
+ // This will be used to set the background color while VS Code loads.
10171019
+ const theme = storageService.get('colorThemeData', StorageScope.GLOBAL);
@@ -1448,14 +1450,15 @@ new file mode 100644
14481450
index 0000000000000000000000000000000000000000..0a4a91e5e36bda7f888feedda348aaff5fe32d27
14491451
--- /dev/null
14501452
+++ b/src/vs/server/ipc.d.ts
1451-
@@ -0,0 +1,132 @@
1453+
@@ -0,0 +1,133 @@
14521454
+/**
14531455
+ * External interfaces for integration into code-server over IPC. No vs imports
14541456
+ * should be made in this file.
14551457
+ */
14561458
+export interface Options {
1457-
+ disableTelemetry: boolean
14581459
+ base: string
1460+
+ disableTelemetry: boolean
1461+
+ disableUpdateCheck: boolean
14591462
+}
14601463
+
14611464
+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)