Inject bug report endpoint URL from config.json

This commit is contained in:
Kegan Dougal 2017-01-19 16:49:25 +00:00
parent bf887e82fe
commit 3996d23b19
3 changed files with 12 additions and 2 deletions

View file

@ -4,6 +4,7 @@
"brand": "Riot",
"integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar.vector.im/api",
"bug_report_endpoint_url": "https://vector.im/bugs",
"enableLabs": true,
"roomDirectory": {
"servers": [

View file

@ -241,6 +241,7 @@ async function loadApp() {
let configError;
try {
configJson = await getConfig();
rageshake.setBugReportEndpoint(configJson.bug_report_endpoint_url);
} catch (e) {
configError = e;
}

View file

@ -251,7 +251,7 @@ class IndexedDBLogStore {
}, (err) => {
console.error(err);
})
}console.log("async consumeeeee");
}
return logs;
}
@ -296,6 +296,7 @@ function selectQuery(store, keyRange, resultMapper) {
let store = null;
let logger = null;
let initPromise = null;
let bugReportEndpoint = null;
module.exports = {
/**
@ -339,6 +340,10 @@ module.exports = {
await store.consume(false);
},
setBugReportEndpoint: function(url) {
bugReportEndpoint = url;
},
/**
* Send a bug report.
* @param {string} userText Any additional user input.
@ -348,6 +353,9 @@ module.exports = {
if (!logger) {
throw new Error("No console logger, did you forget to call init()?");
}
if (!bugReportEndpoint) {
throw new Error("No bug report endpoint has been set.");
}
// 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 = [];
@ -364,7 +372,7 @@ module.exports = {
await new Promise((resolve, reject) => {
request({
method: "POST",
url: "http://localhost:1337",
url: bugReportEndpoint,
body: {
logs: logs,
text: userText || "User did not supply any additional text.",