You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Desktop: Add version info to error screen
This commit is contained in:
@ -174,6 +174,7 @@ ReactNativeClient/lib/services/synchronizer/utils/types.js
|
|||||||
ReactNativeClient/lib/services/UndoRedoService.js
|
ReactNativeClient/lib/services/UndoRedoService.js
|
||||||
ReactNativeClient/lib/ShareExtension.js
|
ReactNativeClient/lib/ShareExtension.js
|
||||||
ReactNativeClient/lib/shareHandler.js
|
ReactNativeClient/lib/shareHandler.js
|
||||||
|
ReactNativeClient/lib/versionInfo.js
|
||||||
ReactNativeClient/PluginAssetsLoader.js
|
ReactNativeClient/PluginAssetsLoader.js
|
||||||
ReactNativeClient/setUpQuickActions.js
|
ReactNativeClient/setUpQuickActions.js
|
||||||
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
|
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -165,6 +165,7 @@ ReactNativeClient/lib/services/synchronizer/utils/types.js
|
|||||||
ReactNativeClient/lib/services/UndoRedoService.js
|
ReactNativeClient/lib/services/UndoRedoService.js
|
||||||
ReactNativeClient/lib/ShareExtension.js
|
ReactNativeClient/lib/ShareExtension.js
|
||||||
ReactNativeClient/lib/shareHandler.js
|
ReactNativeClient/lib/shareHandler.js
|
||||||
|
ReactNativeClient/lib/versionInfo.js
|
||||||
ReactNativeClient/PluginAssetsLoader.js
|
ReactNativeClient/PluginAssetsLoader.js
|
||||||
ReactNativeClient/setUpQuickActions.js
|
ReactNativeClient/setUpQuickActions.js
|
||||||
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
|
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
|
||||||
|
@ -34,6 +34,7 @@ const KeymapService = require('lib/services/KeymapService.js').default;
|
|||||||
const TemplateUtils = require('lib/TemplateUtils');
|
const TemplateUtils = require('lib/TemplateUtils');
|
||||||
const CssUtils = require('lib/CssUtils');
|
const CssUtils = require('lib/CssUtils');
|
||||||
const resourceEditWatcherReducer = require('lib/services/ResourceEditWatcher/reducer').default;
|
const resourceEditWatcherReducer = require('lib/services/ResourceEditWatcher/reducer').default;
|
||||||
|
const versionInfo = require('lib/versionInfo').default;
|
||||||
|
|
||||||
const commands = [
|
const commands = [
|
||||||
require('./gui/Header/commands/focusSearch'),
|
require('./gui/Header/commands/focusSearch'),
|
||||||
@ -598,37 +599,17 @@ class Application extends BaseApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _showAbout() {
|
function _showAbout() {
|
||||||
const p = packageInfo;
|
const v = versionInfo(packageInfo);
|
||||||
let gitInfo = '';
|
|
||||||
if ('git' in p) {
|
|
||||||
gitInfo = _('Revision: %s (%s)', p.git.hash, p.git.branch);
|
|
||||||
}
|
|
||||||
const copyrightText = 'Copyright © 2016-YYYY Laurent Cozic';
|
|
||||||
const message = [
|
|
||||||
p.description,
|
|
||||||
'',
|
|
||||||
copyrightText.replace('YYYY', new Date().getFullYear()),
|
|
||||||
_('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), process.platform),
|
|
||||||
'',
|
|
||||||
_('Client ID: %s', Setting.value('clientId')),
|
|
||||||
_('Sync Version: %s', Setting.value('syncVersion')),
|
|
||||||
_('Profile Version: %s', reg.db().version()),
|
|
||||||
_('Keychain Supported: %s', Setting.value('keychain.supported') >= 1 ? _('Yes') : _('No')),
|
|
||||||
];
|
|
||||||
if (gitInfo) {
|
|
||||||
message.push(`\n${gitInfo}`);
|
|
||||||
console.info(gitInfo);
|
|
||||||
}
|
|
||||||
const text = message.join('\n');
|
|
||||||
|
|
||||||
const copyToClipboard = bridge().showMessageBox(text, {
|
const copyToClipboard = bridge().showMessageBox(v.message, {
|
||||||
icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`,
|
icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`,
|
||||||
buttons: [_('Copy'), _('OK')],
|
buttons: [_('Copy'), _('OK')],
|
||||||
cancelId: 1,
|
cancelId: 1,
|
||||||
defaultId: 1,
|
defaultId: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (copyToClipboard === 0) {
|
if (copyToClipboard === 0) {
|
||||||
clipboard.writeText(message.splice(3).join('\n'));
|
clipboard.writeText(v.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1096,7 +1077,7 @@ class Application extends BaseApplication {
|
|||||||
return { action: 'upgradeSyncTarget' };
|
return { action: 'upgradeSyncTarget' };
|
||||||
}
|
}
|
||||||
|
|
||||||
const dir = Setting.value('profileDir');
|
const dir = Setting.value('profileDir');
|
||||||
|
|
||||||
// Loads app-wide styles. (Markdown preview-specific styles loaded in app.js)
|
// Loads app-wide styles. (Markdown preview-specific styles loaded in app.js)
|
||||||
const filename = Setting.custom_css_files.JOPLIN_APP;
|
const filename = Setting.custom_css_files.JOPLIN_APP;
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import versionInfo from 'lib/versionInfo';
|
||||||
|
const packageInfo = require('../packageInfo.js');
|
||||||
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
|
|
||||||
export default class ErrorBoundary extends React.Component {
|
export default class ErrorBoundary extends React.Component {
|
||||||
|
|
||||||
@ -8,22 +11,52 @@ export default class ErrorBoundary extends React.Component {
|
|||||||
this.setState({ error: error, errorInfo: errorInfo });
|
this.setState({ error: error, errorInfo: errorInfo });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const onAppClose = () => {
|
||||||
|
ipcRenderer.send('asynchronous-message', 'appCloseReply', {
|
||||||
|
canClose: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ipcRenderer.on('appClose', onAppClose);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.error) {
|
if (this.state.error) {
|
||||||
try {
|
try {
|
||||||
const output = [];
|
const output = [];
|
||||||
output.push(<h2>Message</h2>);
|
|
||||||
output.push(<p>{this.state.error.message}</p>);
|
output.push(
|
||||||
|
<section key="message">
|
||||||
|
<h2>Message</h2>
|
||||||
|
<p>{this.state.error.message}</p>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
|
||||||
|
output.push(
|
||||||
|
<section key="versionInfo">
|
||||||
|
<h2>Version info</h2>
|
||||||
|
<pre>{versionInfo(packageInfo).message}</pre>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
|
||||||
if (this.state.error.stack) {
|
if (this.state.error.stack) {
|
||||||
output.push(<h2>Stack trace</h2>);
|
output.push(
|
||||||
output.push(<pre>{this.state.error.stack}</pre>);
|
<section key="stacktrace">
|
||||||
|
<h2>Stack trace</h2>
|
||||||
|
<pre>{this.state.error.stack}</pre>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.errorInfo) {
|
if (this.state.errorInfo) {
|
||||||
if (this.state.errorInfo.componentStack) {
|
if (this.state.errorInfo.componentStack) {
|
||||||
output.push(<h2>Component stack</h2>);
|
output.push(
|
||||||
output.push(<pre>{this.state.errorInfo.componentStack}</pre>);
|
<section key="componentStack">
|
||||||
|
<h2>Component stack</h2>
|
||||||
|
<pre>{this.state.errorInfo.componentStack}</pre>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
ReactNativeClient/lib/versionInfo.ts
Normal file
32
ReactNativeClient/lib/versionInfo.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const Setting = require('lib/models/Setting.js');
|
||||||
|
const { _ } = require('lib/locale.js');
|
||||||
|
const { reg } = require('lib/registry.js');
|
||||||
|
|
||||||
|
export default function versionInfo(packageInfo:any) {
|
||||||
|
const p = packageInfo;
|
||||||
|
let gitInfo = '';
|
||||||
|
if ('git' in p) {
|
||||||
|
gitInfo = _('Revision: %s (%s)', p.git.hash, p.git.branch);
|
||||||
|
}
|
||||||
|
const copyrightText = 'Copyright © 2016-YYYY Laurent Cozic';
|
||||||
|
const now = new Date();
|
||||||
|
const message = [
|
||||||
|
p.description,
|
||||||
|
'',
|
||||||
|
copyrightText.replace('YYYY', `${now.getFullYear()}`),
|
||||||
|
_('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), process.platform),
|
||||||
|
'',
|
||||||
|
_('Client ID: %s', Setting.value('clientId')),
|
||||||
|
_('Sync Version: %s', Setting.value('syncVersion')),
|
||||||
|
_('Profile Version: %s', reg.db().version()),
|
||||||
|
_('Keychain Supported: %s', Setting.value('keychain.supported') >= 1 ? _('Yes') : _('No')),
|
||||||
|
];
|
||||||
|
if (gitInfo) {
|
||||||
|
message.push(`\n${gitInfo}`);
|
||||||
|
console.info(gitInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
message: message.join('\n'),
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user