From 4e5d87e01f66d8a47de0d5390986b66f075f9df7 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 24 Apr 2025 10:37:21 +0100 Subject: [PATCH 1/4] Add usage telemetry question to admin init command --- lib/commands/init/index.js | 24 +++++++++++++++++++ .../init/resources/settings.js.mustache | 18 ++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/lib/commands/init/index.js b/lib/commands/init/index.js index ca3a7e0..d6c1362 100644 --- a/lib/commands/init/index.js +++ b/lib/commands/init/index.js @@ -94,6 +94,27 @@ async function promptSettingsFile(opts) { return responses; } +async function promptTelemetry() { + heading("Share Anonymouse Usage Information"); + + const responses = await prompt([ + { + type: 'select', + name: 'telemetryEnabled', + // initial: "Yes", + message: `Node-RED would like to send anonymous usage data back to the Node-RED team. +This information helps us to understand how it is used. +For full information on what information is collected and how it is used, +please see https://nodered.org/docs/telemetry`, + choices: ['Yes, send my usage data', 'No, do not send my usage data'], + result(value) { + return /Yes/.test(value) + } + } + ]) + return responses +} + async function promptUser() { const responses = await prompt([ { @@ -279,6 +300,9 @@ async function command(argv, result) { const fileSettings = await promptSettingsFile({userDir}); + const telemetryResponses = await promptTelemetry() + config.telemetryEnabled = telemetryResponses.telemetryEnabled ? 'true' : 'false' + const securityResponses = await promptSecurity(); if (securityResponses.adminAuth) { let adminAuth = { diff --git a/lib/commands/init/resources/settings.js.mustache b/lib/commands/init/resources/settings.js.mustache index 8b66161..e103531 100644 --- a/lib/commands/init/resources/settings.js.mustache +++ b/lib/commands/init/resources/settings.js.mustache @@ -276,6 +276,7 @@ module.exports = { * Runtime Settings * - lang * - runtimeState + * - telemetry * - diagnostics * - logging * - contextStorage @@ -313,6 +314,23 @@ module.exports = { enabled: false, /** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */ ui: false, + }, + telemetry: { + /** + * By default, telemetry is disabled until the user provides consent the first + * time they open the editor. + * + * The following property can be uncommented and set to true/false to enable/disable + * telemetry without seeking further consent in the editor. + * The user can override this setting via the user settings dialog within the editor + */ + {{^telemetryEnabled}}//enabled: true,{{/telemetryEnabled}} + {{#telemetryEnabled}}enabled: {{telemetryEnabled}},{{/telemetryEnabled}} + /** + * If telemetry is enabled, the editor will notify the user if a new version of Node-RED + * is available. Set the following property to false to disable this notification. + */ + // updateNotification: true }, /** Configure the logging output */ logging: { From a0ae8f6895d372c605bae4dad6e436d867cbf7bc Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 24 Apr 2025 11:42:22 +0100 Subject: [PATCH 2/4] Update consent message --- lib/commands/init/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/commands/init/index.js b/lib/commands/init/index.js index d6c1362..56b8303 100644 --- a/lib/commands/init/index.js +++ b/lib/commands/init/index.js @@ -104,8 +104,10 @@ async function promptTelemetry() { // initial: "Yes", message: `Node-RED would like to send anonymous usage data back to the Node-RED team. This information helps us to understand how it is used. +It does not include any details of your flows or users. For full information on what information is collected and how it is used, -please see https://nodered.org/docs/telemetry`, +please see https://nodered.org/docs/telemetry +`, choices: ['Yes, send my usage data', 'No, do not send my usage data'], result(value) { return /Yes/.test(value) From 7f2bdf1d14fa83b7664347e1f29fc6bc902f17c0 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 25 Apr 2025 15:53:22 +0100 Subject: [PATCH 3/4] Update for 4.1.0 release --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0473547..d7b24b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 4.1.0 + + - Add telemetry consent to init command @knolleary + ### 4.0.2 - Update dependencies @knolleary diff --git a/package.json b/package.json index 508aeeb..a5a1729 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-admin", - "version": "4.0.2", + "version": "4.1.0", "description": "The Node-RED admin command line interface", "homepage": "https://nodered.org", "bugs": { From 677bc2adbd1240ce4c547bbcee0abe29551f0b15 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 10 Jun 2025 09:32:13 +0100 Subject: [PATCH 4/4] Update lib/commands/init/index.js --- lib/commands/init/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/commands/init/index.js b/lib/commands/init/index.js index 56b8303..6f7701e 100644 --- a/lib/commands/init/index.js +++ b/lib/commands/init/index.js @@ -102,8 +102,9 @@ async function promptTelemetry() { type: 'select', name: 'telemetryEnabled', // initial: "Yes", - message: `Node-RED would like to send anonymous usage data back to the Node-RED team. -This information helps us to understand how it is used. + message: `Node-RED can notify you when there is a new version available. +This ensures you keep up to date with the latest features and fixes. +This requires sending anonymised data back to the Node-RED team. It does not include any details of your flows or users. For full information on what information is collected and how it is used, please see https://nodered.org/docs/telemetry