1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +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,