2018-04-11 12:32:33 +02:00
|
|
|
const { init } = require('@sentry/electron');
|
2018-04-06 13:15:23 +02:00
|
|
|
const fs = require('fs');
|
2019-01-04 10:58:35 +01:00
|
|
|
|
2019-01-04 12:57:58 +01:00
|
|
|
const { ipcMain } = require('electron')
|
2018-04-03 14:35:41 +02:00
|
|
|
|
2018-04-06 13:15:23 +02:00
|
|
|
let crashReportsEnabled = true;
|
2018-04-03 14:35:41 +02:00
|
|
|
const DSN =
|
|
|
|
'https://cb7b474b2e874afb8e400c47d1452ecc:7876224cbff543d992cb0ac4021962f8@sentry.io/1040940';
|
|
|
|
|
2018-04-03 15:58:21 +02:00
|
|
|
const isDev = () => {
|
|
|
|
return fs.existsSync('.git');
|
|
|
|
};
|
|
|
|
|
2018-04-06 13:15:23 +02:00
|
|
|
const shouldSendCallback = () => {
|
|
|
|
return !isDev() && crashReportsEnabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-01-04 12:57:58 +01:00
|
|
|
ipcMain.on('settings.changed', function (event, settings) {
|
2018-04-06 13:15:23 +02:00
|
|
|
crashReportsEnabled = settings.crash_reports;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-04-11 12:32:33 +02:00
|
|
|
init({
|
2018-04-06 13:15:23 +02:00
|
|
|
dsn: DSN,
|
|
|
|
shouldSendCallback: shouldSendCallback
|
|
|
|
});
|