From 1a1990b9ad4ed670525e0ffb6f337104c0558bff Mon Sep 17 00:00:00 2001 From: Quentin Decaunes Date: Sat, 3 Aug 2019 21:22:28 +0200 Subject: [PATCH] fix: Avoid Sentry noise by creating a random user id. --- js/app.js | 18 ++++++++++++++---- package-lock.json | 23 +++++++---------------- package.json | 3 ++- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/js/app.js b/js/app.js index f8503d8..083be6b 100644 --- a/js/app.js +++ b/js/app.js @@ -1,4 +1,8 @@ ready(function(){ + const uuidv4 = require('uuid/v4'); + const settings = require('electron-settings'); + const fixPath = require('fix-path'); + document.isStarting = true; Sentry.init({ dsn: 'https://f80fd3ea297141a8bdc04ce812762f39@sentry.io/1513427', release: require('./package.json').version, @@ -14,9 +18,15 @@ ready(function(){ return event; } }); - const settings = require('electron-settings'); - const fixPath = require('fix-path'); - document.isStarting = true; + Sentry.configureScope((scope) => { + if (!settings.get('userid')) { + settings.set('userid', uuidv4()); + } + const userid = settings.get('userid'); + scope.setUser({ + id: userid + }); + }); fixPath(); displayOptions(); preFillSettings(); @@ -33,7 +43,7 @@ ready(function(){ preset_updateList(); checkForNewRelease(); document.isStarting = false; - + appendLog(`################## UserId: ${settings.get('userid')}`); settings.set('settings', Object.assign( diff --git a/package-lock.json b/package-lock.json index 15a5f04..503682d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,8 +57,7 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "optional": true + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, "ansi-styles": { "version": "3.2.1", @@ -656,8 +655,7 @@ "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "optional": true + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, "env-paths": { "version": "1.0.0", @@ -1132,14 +1130,12 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "optional": true + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-promise": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz", - "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU=", - "optional": true + "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU=" }, "is-stream": { "version": "1.1.0", @@ -1262,14 +1258,12 @@ "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "optional": true + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "optional": true + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, "lodash.get": { "version": "4.4.2", @@ -2033,7 +2027,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "optional": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -2050,7 +2043,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "optional": true, "requires": { "ansi-regex": "^4.1.0" } @@ -2246,8 +2238,7 @@ "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" }, "validate-npm-package-license": { "version": "3.0.4", diff --git a/package.json b/package.json index 237c57a..507c475 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "compare-versions": "^3.4.0", "electron-settings": "^3.2.0", "fix-path": "^2.1.0", - "uikit": "^3.1.5" + "uikit": "^3.1.5", + "uuid": "^3.3.2" } }