fix: Linux was unable to start properly in some cases.

This commit is contained in:
Quentin DECAUNES 2019-08-06 13:52:49 +02:00
parent 160782d924
commit 417ae7e927
2 changed files with 46 additions and 29 deletions

View File

@ -1,36 +1,8 @@
ready(function(){ ready(function(){
const uuidv4 = require('uuid/v4');
const settings = require('electron-settings'); const settings = require('electron-settings');
const fixPath = require('fix-path'); const fixPath = require('fix-path');
document.isStarting = true; document.isStarting = true;
Sentry.init({ addSentry();
dsn: 'https://f80fd3ea297141a8bdc04ce812762f39@sentry.io/1513427',
release: require('./package.json').version,
beforeSend: (event) => {
event.exception.values = event.exception.values.map((value) => {
if (value.stacktrace) {
value.stacktrace.frames = value.stacktrace.frames.map((frame) => {
frame.filename = frame.filename.replace(/^.*ryzen(|-)controller\//g, "");
return frame;
});
}
return value;
});
if (event.request.url) {
event.request.url = event.request.url.replace(/^.*ryzen(|-)controller\//g, "");
}
return event;
}
});
Sentry.configureScope((scope) => {
if (!settings.get('userid')) {
settings.set('userid', uuidv4());
}
const userid = settings.get('userid');
scope.setUser({
id: userid
});
});
fixPath(); fixPath();
displayOptions(); displayOptions();
preFillSettings(); preFillSettings();

View File

@ -1,3 +1,48 @@
/**
* Will enable Sentry.
*/
function addSentry() {
const uuidv4 = require('uuid/v4');
const settings = require('electron-settings');
var waitSentry = setInterval(() => {
if (!Sentry) {
console.log('waitSentry');
return;
}
clearInterval(waitSentry);
console.log('sentryOk');
Sentry.init({
dsn: 'https://f80fd3ea297141a8bdc04ce812762f39@sentry.io/1513427',
release: require('./package.json').version,
beforeSend: (event) => {
event.exception.values = event.exception.values.map((value) => {
if (value.stacktrace) {
value.stacktrace.frames = value.stacktrace.frames.map((frame) => {
frame.filename = frame.filename.replace(/^.*ryzen(|-)controller\//g, "");
return frame;
});
}
return value;
});
if (event.request.url) {
event.request.url = event.request.url.replace(/^.*ryzen(|-)controller\//g, "");
}
return event;
}
});
Sentry.configureScope((scope) => {
if (!settings.get('userid')) {
settings.set('userid', uuidv4());
}
const userid = settings.get('userid');
scope.setUser({
id: userid
});
});
}, 100);
}
/** /**
* Will load options_data.json and display them into index.html. * Will load options_data.json and display them into index.html.
*/ */