From beba4d2ae36c4499e99a27258fb58b9a8e6e12b7 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 19 Jan 2017 17:40:21 +0000 Subject: [PATCH] Add version and user agent to bug report --- src/vector/rageshake.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vector/rageshake.js b/src/vector/rageshake.js index 3fb9efdc..e3cc6661 100644 --- a/src/vector/rageshake.js +++ b/src/vector/rageshake.js @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg'; import request from "browser-request"; // This module contains all the code needed to log the console, persist it to disk and submit bug reports. Rationale is as follows: @@ -356,6 +357,18 @@ module.exports = { if (!bugReportEndpoint) { throw new Error("No bug report endpoint has been set."); } + + let version = "UNKNOWN"; + try { + version = await PlatformPeg.get().getAppVersion(); + } + catch (err) {} // PlatformPeg already logs this. + + let userAgent = "UNKNOWN"; + if (window.navigator && window.navigator.userAgent) { + userAgent = window.navigator.userAgent; + } + // If in incognito mode, store is null, but we still want bug report sending to work going off // the in-memory console logs. let logs = []; @@ -376,6 +389,8 @@ module.exports = { body: { logs: logs, text: userText || "User did not supply any additional text.", + version: version, + user_agent: userAgent, }, json: true, }, (err, res) => {