1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Desktop: Add support for automatically uploading crash reports

This commit is contained in:
Laurent Cozic 2024-01-18 21:45:25 +00:00
parent a9691f6b1c
commit de0ae7653f
9 changed files with 3310 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -23,3 +23,4 @@ integration-tests/test-profile/
build/defaultPlugins/
build/7zip/7za
build/7zip/7za.exe
sentry.properties

View File

@ -129,6 +129,10 @@ class Application extends BaseApplication {
this.setupOcrService();
}
if (action.type === 'SETTING_UPDATE_ONE' && action.key === 'autoUploadCrashDumps') {
bridge().autoUploadCrashDumps = action.value;
}
if (action.type === 'SETTING_UPDATE_ONE' && action.key === 'style.editor.fontFamily' || action.type === 'SETTING_UPDATE_ALL') {
this.updateEditorFont();
}
@ -406,6 +410,8 @@ class Application extends BaseApplication {
argv = await super.start(argv);
bridge().autoUploadCrashDumps = Setting.value('autoUploadCrashDumps');
// this.crashDetectionHandler();
await this.applySettingsSideEffects();

View File

@ -3,6 +3,7 @@ import shim from '@joplin/lib/shim';
import { _, setLocale } from '@joplin/lib/locale';
import { BrowserWindow, nativeTheme, nativeImage } from 'electron';
const { dirname, toSystemSlashes } = require('@joplin/lib/path-utils');
import * as Sentry from '@sentry/electron/main';
interface LastSelectedPath {
file: string;
@ -20,6 +21,7 @@ export class Bridge {
private electronWrapper_: ElectronAppWrapper;
private lastSelectedPaths_: LastSelectedPath;
private autoUploadCrashDumps_ = false;
public constructor(electronWrapper: ElectronAppWrapper) {
this.electronWrapper_ = electronWrapper;
@ -27,6 +29,11 @@ export class Bridge {
file: null,
directory: null,
};
Sentry.init({
dsn: 'https://cceec550871b1e8a10fee4c7a28d5cf2@o4506576757522432.ingest.sentry.io/4506594281783296',
beforeSend: event => this.autoUploadCrashDumps_ ? event : null,
});
}
public electronApp() {
@ -37,6 +44,14 @@ export class Bridge {
return !this.electronApp().electronApp().isPackaged;
}
public get autoUploadCrashDumps() {
return this.autoUploadCrashDumps_;
}
public set autoUploadCrashDumps(v: boolean) {
this.autoUploadCrashDumps_ = v;
}
// The build directory contains additional external files that are going to
// be packaged by Electron Builder. This is for files that need to be
// accessed outside of the Electron app (for example the application icon).

View File

@ -31,6 +31,8 @@ const React = require('react');
const nodeSqlite = require('sqlite3');
const initLib = require('@joplin/lib/initLib').default;
const pdfJs = require('pdfjs-dist');
require('@sentry/electron/renderer');
const main = async () => {
if (bridge().env() === 'dev') {

View File

@ -9,6 +9,11 @@ const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
const envFromArgs = require('@joplin/lib/envFromArgs');
const packageInfo = require('./packageInfo.js');
const { isCallbackUrl } = require('@joplin/lib/callbackUrlUtils');
const Sentry = require('@sentry/electron/main');
Sentry.init({
dsn: 'https://cceec550871b1e8a10fee4c7a28d5cf2@o4506576757522432.ingest.sentry.io/4506594281783296',
});
// Electron takes the application name from package.json `name` and
// displays this in the tray icon toolip and message box titles, however in

View File

@ -152,6 +152,7 @@
"@joplin/lib": "~2.14",
"@joplin/renderer": "~2.14",
"@joplin/utils": "~2.14",
"@sentry/electron": "4.17.0",
"@types/mustache": "4.2.5",
"async-mutex": "0.4.0",
"codemirror": "5.65.9",

View File

@ -1383,6 +1383,17 @@ class Setting extends BaseModel {
autoUpdateEnabled: { value: true, type: SettingItemType.Bool, storage: SettingStorage.File, isGlobal: true, section: 'application', public: platform !== 'linux', appTypes: [AppType.Desktop], label: () => _('Automatically check for updates') },
'autoUpdate.includePreReleases': { value: false, type: SettingItemType.Bool, section: 'application', storage: SettingStorage.File, isGlobal: true, public: true, appTypes: [AppType.Desktop], label: () => _('Get pre-releases when checking for updates'), description: () => _('See the pre-release page for more details: %s', 'https://joplinapp.org/help/about/prereleases') },
'autoUploadCrashDumps': {
value: '',
type: SettingItemType.Bool,
public: true,
advanced: true,
appTypes: [AppType.Desktop],
label: () => 'Automatically upload crash reports',
description: () => 'If you experience a crash, please enable this option to automatically send a crash report.',
},
'clipperServer.autoStart': { value: false, type: SettingItemType.Bool, storage: SettingStorage.File, isGlobal: true, public: false },
'sync.interval': {
value: 300,

110
yarn.lock
View File

@ -6538,6 +6538,7 @@ __metadata:
"@joplin/tools": ~2.14
"@joplin/utils": ~2.14
"@playwright/test": 1.40.1
"@sentry/electron": 4.17.0
"@testing-library/react-hooks": 8.0.1
"@types/jest": 29.5.8
"@types/mustache": 4.2.5
@ -9610,6 +9611,108 @@ __metadata:
languageName: node
linkType: hard
"@sentry-internal/feedback@npm:7.92.0":
version: 7.92.0
resolution: "@sentry-internal/feedback@npm:7.92.0"
dependencies:
"@sentry/core": 7.92.0
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
checksum: 7e10d4224a12443c38907370e93081101624594f09eea9b4813d253cd733f8ff3ef165975cc135ec57d934f5780022ad23fb291aa0fa0e52465f9a82bf880cc4
languageName: node
linkType: hard
"@sentry-internal/tracing@npm:7.92.0":
version: 7.92.0
resolution: "@sentry-internal/tracing@npm:7.92.0"
dependencies:
"@sentry/core": 7.92.0
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
checksum: 2daa6916d6a57bbab33c993a1c6a306525772c4fc16c08a5287327c0fef4c2f7120cca3d353f669d4dceb0e95dc4bb72a2b53fde63979a7793a0527dfe7fecd4
languageName: node
linkType: hard
"@sentry/browser@npm:7.92.0":
version: 7.92.0
resolution: "@sentry/browser@npm:7.92.0"
dependencies:
"@sentry-internal/feedback": 7.92.0
"@sentry-internal/tracing": 7.92.0
"@sentry/core": 7.92.0
"@sentry/replay": 7.92.0
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
checksum: 360791752e68cd837816c86e818bb4a4f638a68fdf47a9df85588f5a0a659979fb9d5539a5f66f7c136914361f29b60f946785013d6575ef10e8aded996eff04
languageName: node
linkType: hard
"@sentry/core@npm:7.92.0":
version: 7.92.0
resolution: "@sentry/core@npm:7.92.0"
dependencies:
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
checksum: 9db7454c64f672981d95f0cc061297cccd02c208c212c54ef7e1a1d7612e8e87a8bb1bbc51eadda919c01dac9c6f4ae5ad97e4ec7874528e2e4b5cb9d553a21f
languageName: node
linkType: hard
"@sentry/electron@npm:4.17.0":
version: 4.17.0
resolution: "@sentry/electron@npm:4.17.0"
dependencies:
"@sentry/browser": 7.92.0
"@sentry/core": 7.92.0
"@sentry/node": 7.92.0
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
deepmerge: 4.3.0
tslib: ^2.5.0
checksum: 2e5a84981a058e2afbb897fbd12222881cc718741c81b86f83b88187771cdf6d5c613c44b88306ce1736a47b6c06a82236fbc0de47f5f9af9ed289751dd2f60e
languageName: node
linkType: hard
"@sentry/node@npm:7.92.0":
version: 7.92.0
resolution: "@sentry/node@npm:7.92.0"
dependencies:
"@sentry-internal/tracing": 7.92.0
"@sentry/core": 7.92.0
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
https-proxy-agent: ^5.0.0
checksum: 77efdd0c3c0f868879e5f906975ecec226f5379f9e5426b99e1b5133c006760dc9a3a36a0bd757d8e0c392440fd443567380117b3fa7fbf466ca91293d051f56
languageName: node
linkType: hard
"@sentry/replay@npm:7.92.0":
version: 7.92.0
resolution: "@sentry/replay@npm:7.92.0"
dependencies:
"@sentry-internal/tracing": 7.92.0
"@sentry/core": 7.92.0
"@sentry/types": 7.92.0
"@sentry/utils": 7.92.0
checksum: a56c62dbf6623b091e4ad5b2982862a2512ab8ef8efef0ac78f9447b9aff312be6cb87b0cf148193030354d5a99bf181f0bb3707b4ecc4f2fd03ceda35a23f66
languageName: node
linkType: hard
"@sentry/types@npm:7.92.0":
version: 7.92.0
resolution: "@sentry/types@npm:7.92.0"
checksum: 0dac88acf76aeb905f68b180717ec03451922fea6ddb7a0d1af1d55e658e8e9d0b1d696f1d6eecbbb99f372c8cc622165bd24d5059a1ffb14fe7172cdbb57306
languageName: node
linkType: hard
"@sentry/utils@npm:7.92.0":
version: 7.92.0
resolution: "@sentry/utils@npm:7.92.0"
dependencies:
"@sentry/types": 7.92.0
checksum: 358dd7f31558f0367e38e69f0b24e9b25d02e6ae15b8c5841b8ed4b55eaf6ba311449f283aec9887a6275cc191d3f6083209e8de31e50ab0a4f06e3015c1ccd3
languageName: node
linkType: hard
"@sideway/address@npm:^4.1.3":
version: 4.1.3
resolution: "@sideway/address@npm:4.1.3"
@ -18107,6 +18210,13 @@ __metadata:
languageName: node
linkType: hard
"deepmerge@npm:4.3.0":
version: 4.3.0
resolution: "deepmerge@npm:4.3.0"
checksum: c7980eb5c5be040b371f1df0d566473875cfabed9f672ccc177b81ba8eee5686ce2478de2f1d0076391621cbe729e5eacda397179a59ef0f68901849647db126
languageName: node
linkType: hard
"deepmerge@npm:^2.0.0":
version: 2.2.1
resolution: "deepmerge@npm:2.2.1"