1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Fixed import error report

This commit is contained in:
Laurent Cozic 2023-11-11 17:38:16 +00:00
parent 5f7d438ac1
commit 6211606a22
6 changed files with 36 additions and 10 deletions

View File

@ -26,7 +26,7 @@ const { FoldersScreenUtils } = require('@joplin/lib/folders-screen-utils.js');
import Folder from '@joplin/lib/models/Folder'; import Folder from '@joplin/lib/models/Folder';
import Tag from '@joplin/lib/models/Tag'; import Tag from '@joplin/lib/models/Tag';
import { reg } from '@joplin/lib/registry'; import { reg } from '@joplin/lib/registry';
const packageInfo = require('./packageInfo.js'); const packageInfo: PackageInfo = require('./packageInfo.js');
import DecryptionWorker from '@joplin/lib/services/DecryptionWorker'; import DecryptionWorker from '@joplin/lib/services/DecryptionWorker';
import ClipperServer from '@joplin/lib/ClipperServer'; import ClipperServer from '@joplin/lib/ClipperServer';
const { webFrame } = require('electron'); const { webFrame } = require('electron');
@ -68,6 +68,7 @@ import path = require('path');
import { checkPreInstalledDefaultPlugins, installDefaultPlugins, setSettingsForDefaultPlugins } from '@joplin/lib/services/plugins/defaultPlugins/defaultPluginsUtils'; import { checkPreInstalledDefaultPlugins, installDefaultPlugins, setSettingsForDefaultPlugins } from '@joplin/lib/services/plugins/defaultPlugins/defaultPluginsUtils';
import userFetcher, { initializeUserFetcher } from '@joplin/lib/utils/userFetcher'; import userFetcher, { initializeUserFetcher } from '@joplin/lib/utils/userFetcher';
import { parseNotesParent } from '@joplin/lib/reducer'; import { parseNotesParent } from '@joplin/lib/reducer';
import { PackageInfo } from '@joplin/lib/versionInfo';
const pluginClasses = [ const pluginClasses = [
require('./plugins/GotoAnything').default, require('./plugins/GotoAnything').default,

View File

@ -5,8 +5,9 @@ import bridge from './services/bridge';
import KvStore from '@joplin/lib/services/KvStore'; import KvStore from '@joplin/lib/services/KvStore';
import * as ArrayUtils from '@joplin/lib/ArrayUtils'; import * as ArrayUtils from '@joplin/lib/ArrayUtils';
import { CheckForUpdateOptions, extractVersionInfo, GitHubRelease } from './utils/checkForUpdatesUtils'; import { CheckForUpdateOptions, extractVersionInfo, GitHubRelease } from './utils/checkForUpdatesUtils';
const packageInfo = require('./packageInfo.js'); import { PackageInfo } from '@joplin/lib/versionInfo';
import { compareVersions } from 'compare-versions'; import { compareVersions } from 'compare-versions';
const packageInfo: PackageInfo = require('./packageInfo.js');
const logger = Logger.create('checkForUpdates'); const logger = Logger.create('checkForUpdates');

View File

@ -1,9 +1,9 @@
import * as React from 'react'; import * as React from 'react';
import versionInfo from '@joplin/lib/versionInfo'; import versionInfo, { PackageInfo } from '@joplin/lib/versionInfo';
import PluginService, { Plugins } from '@joplin/lib/services/plugins/PluginService'; import PluginService, { Plugins } from '@joplin/lib/services/plugins/PluginService';
import Setting from '@joplin/lib/models/Setting'; import Setting from '@joplin/lib/models/Setting';
import restart from '../services/restart'; import restart from '../services/restart';
const packageInfo = require('../packageInfo.js'); const packageInfo: PackageInfo = require('../packageInfo.js');
const ipcRenderer = require('electron').ipcRenderer; const ipcRenderer = require('electron').ipcRenderer;
interface ErrorInfo { interface ErrorInfo {

View File

@ -8,7 +8,7 @@ import KeymapService from '@joplin/lib/services/KeymapService';
import { PluginStates, utils as pluginUtils } from '@joplin/lib/services/plugins/reducer'; import { PluginStates, utils as pluginUtils } from '@joplin/lib/services/plugins/reducer';
import shim from '@joplin/lib/shim'; import shim from '@joplin/lib/shim';
import Setting from '@joplin/lib/models/Setting'; import Setting from '@joplin/lib/models/Setting';
import versionInfo from '@joplin/lib/versionInfo'; import versionInfo, { PackageInfo } from '@joplin/lib/versionInfo';
import makeDiscourseDebugUrl from '@joplin/lib/makeDiscourseDebugUrl'; import makeDiscourseDebugUrl from '@joplin/lib/makeDiscourseDebugUrl';
import { ImportModule } from '@joplin/lib/services/interop/Module'; import { ImportModule } from '@joplin/lib/services/interop/Module';
import InteropServiceHelper from '../InteropServiceHelper'; import InteropServiceHelper from '../InteropServiceHelper';
@ -25,7 +25,7 @@ import { ProfileConfig } from '@joplin/lib/services/profileConfig/types';
import PluginService, { PluginSettings } from '@joplin/lib/services/plugins/PluginService'; import PluginService, { PluginSettings } from '@joplin/lib/services/plugins/PluginService';
import { getListRendererById, getListRendererIds } from '@joplin/lib/services/noteList/renderers'; import { getListRendererById, getListRendererIds } from '@joplin/lib/services/noteList/renderers';
import useAsyncEffect from '@joplin/lib/hooks/useAsyncEffect'; import useAsyncEffect from '@joplin/lib/hooks/useAsyncEffect';
const packageInfo = require('../packageInfo.js'); const packageInfo: PackageInfo = require('../packageInfo.js');
const { clipboard } = require('electron'); const { clipboard } = require('electron');
const Menu = bridge().Menu; const Menu = bridge().Menu;

View File

@ -1,21 +1,32 @@
import { PluginSettings } from './services/plugins/PluginService'; import { PluginSettings } from './services/plugins/PluginService';
import type PluginService from './services/plugins/PluginService'; import type PluginService from './services/plugins/PluginService';
import versionInfo from './versionInfo'; import versionInfo, { PackageInfo } from './versionInfo';
const renderErrorBlock = (errors: any[]): string => { const renderErrorBlock = (errors: any[]): string => {
if (!errors.length) return ''; if (!errors.length) return '';
return `\`\`\`\n${errors.map(e => typeof e === 'string' ? e.trim() : e.message.trim())}\n\`\`\``; return `\`\`\`\n${errors.map(e => typeof e === 'string' ? e.trim() : e.message.trim())}\n\`\`\``;
}; };
export default (title: string, body: string, errors: any[], packageInfo: any, pluginService: PluginService, pluginSettings: PluginSettings) => { const getOsName = (platform: typeof process.platform) => {
if (platform === 'win32') return 'Windows';
if (platform === 'darwin') return 'macOS';
if (platform === 'linux') return 'Linux';
if (platform === 'android') return 'Android';
return '';
};
export default (title: string, body: string, errors: any[], packageInfo: PackageInfo, pluginService: PluginService, pluginSettings: PluginSettings) => {
const v = versionInfo(packageInfo, pluginService.enabledPlugins(pluginSettings)); const v = versionInfo(packageInfo, pluginService.enabledPlugins(pluginSettings));
const errorBlock = renderErrorBlock(errors); const errorBlock = renderErrorBlock(errors);
const query: Record<string, string> = { const query: Record<string, string> = {
title, title,
body: `# About\n\n${v.body.trim()}\n\n# Body\n\n${body}${errorBlock ? `\n\n# Errors\n\n${errorBlock}` : ''}`,
category: 'support', category: 'support',
version: packageInfo.version,
os: getOsName(process.platform),
'desktop-about-content': v.body,
content: `#### Body\n\n${body}${errorBlock ? `\n\n#### Errors\n\n${errorBlock}` : ''}`,
}; };
const queryString = Object.keys(query).map(k => `${k}=${encodeURIComponent(query[k])}`).join('&'); const queryString = Object.keys(query).map(k => `${k}=${encodeURIComponent(query[k])}`).join('&');

View File

@ -3,6 +3,19 @@ import Setting from './models/Setting';
import { reg } from './registry'; import { reg } from './registry';
import { Plugins } from './services/plugins/PluginService'; import { Plugins } from './services/plugins/PluginService';
export interface PackageInfo {
name: string;
version: string;
description: string;
build: {
appId: string;
};
git: {
branch: string;
hash: string;
};
}
interface PluginList { interface PluginList {
completeList: string; completeList: string;
summary: string; summary: string;
@ -40,7 +53,7 @@ function getPluginLists(plugins: Plugins): PluginList {
}; };
} }
export default function versionInfo(packageInfo: any, plugins: Plugins) { export default function versionInfo(packageInfo: PackageInfo, plugins: Plugins) {
const p = packageInfo; const p = packageInfo;
let gitInfo = ''; let gitInfo = '';
if ('git' in p) { if ('git' in p) {