Archived
1
0

Set telemetry setting based on disable-telemetry flag

By design the disable-telemetry flag does not affect extension
telemetry, only the setting does, so disabling the setting when the flag
is set should cause extensions to also stop sending telemetry.

Fixes #1116.
This commit is contained in:
Asher 2020-03-13 12:36:57 -05:00
parent 26647c54c9
commit 2342443368
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 8 additions and 3 deletions

View File

@ -486,10 +486,10 @@ index eab8591492..26668701f7 100644
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`); options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
new file mode 100644 new file mode 100644
index 0000000000..95e70869f2 index 0000000000..3f53907de0
--- /dev/null --- /dev/null
+++ b/src/vs/server/browser/client.ts +++ b/src/vs/server/browser/client.ts
@@ -0,0 +1,224 @@ @@ -0,0 +1,227 @@
+import { Emitter } from 'vs/base/common/event'; +import { Emitter } from 'vs/base/common/event';
+import { URI } from 'vs/base/common/uri'; +import { URI } from 'vs/base/common/uri';
+import { localize } from 'vs/nls'; +import { localize } from 'vs/nls';
@ -518,6 +518,9 @@ index 0000000000..95e70869f2
+ +
+const TELEMETRY_SECTION_ID = 'telemetry'; +const TELEMETRY_SECTION_ID = 'telemetry';
+ +
+const el = document.getElementById("vscode-disable-telemetry");
+const disableTelemetry = el && el.getAttribute("data-value") === "true" || false;
+
+Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({ +Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
+ 'id': TELEMETRY_SECTION_ID, + 'id': TELEMETRY_SECTION_ID,
+ 'order': 110, + 'order': 110,
@ -527,7 +530,7 @@ index 0000000000..95e70869f2
+ 'telemetry.enableTelemetry': { + 'telemetry.enableTelemetry': {
+ 'type': 'boolean', + 'type': 'boolean',
+ 'description': localize('telemetry.enableTelemetry', 'Enable usage data and errors to be sent to a Microsoft online service.'), + 'description': localize('telemetry.enableTelemetry', 'Enable usage data and errors to be sent to a Microsoft online service.'),
+ 'default': true, + 'default': !disableTelemetry,
+ 'tags': ['usesOnlineServices'] + 'tags': ['usesOnlineServices']
+ } + }
+ } + }

View File

@ -23,6 +23,7 @@
<meta id="vscode-remote-commit" data-settings="{{COMMIT}}" /> <meta id="vscode-remote-commit" data-settings="{{COMMIT}}" />
<meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}" /> <meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}" />
<meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}" /> <meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}" />
<meta id="vscode-disable-telemetry" data-value="{{DISABLE_TELEMETRY}}" />
<!-- Workbench Icon/Manifest/CSS --> <!-- Workbench Icon/Manifest/CSS -->
<link rel="icon" href="{{BASE}}/static/{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" /> <link rel="icon" href="{{BASE}}/static/{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />

View File

@ -205,6 +205,7 @@ export class VscodeHttpProvider extends HttpProvider {
.replace(`"{{PRODUCT_CONFIGURATION}}"`, `'${JSON.stringify(options.productConfiguration)}'`) .replace(`"{{PRODUCT_CONFIGURATION}}"`, `'${JSON.stringify(options.productConfiguration)}'`)
.replace(`"{{WORKBENCH_WEB_CONFIGURATION}}"`, `'${JSON.stringify(options.workbenchWebConfiguration)}'`) .replace(`"{{WORKBENCH_WEB_CONFIGURATION}}"`, `'${JSON.stringify(options.workbenchWebConfiguration)}'`)
.replace(`"{{NLS_CONFIGURATION}}"`, `'${JSON.stringify(options.nlsConfiguration)}'`) .replace(`"{{NLS_CONFIGURATION}}"`, `'${JSON.stringify(options.nlsConfiguration)}'`)
.replace("{{DISABLE_TELEMETRY}}", this.args["disable-telemetry"] ? "true" : "false")
return this.replaceTemplates(route, response) return this.replaceTemplates(route, response)
} }