[ts-migrate][src] Init tsconfig.json file

Co-authored-by: ts-migrate <>
This commit is contained in:
tiddlygit-test 2020-12-20 23:18:43 +08:00
parent 1cc36bb57d
commit 7a4a58c1d3
68 changed files with 234 additions and 481 deletions

View file

@ -1,31 +1,21 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'isDev'.
import isDev from 'electron-is-dev';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
import os from 'os';
const isMac = process.platform === 'darwin';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
const REACT_PATH = isDev ? 'http://localhost:3000' : `file://${path.resolve(__dirname, '..', '..', 'build', 'index.html')}`;
// .app/Contents/Resources/wiki/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'TIDDLYWIKI... Remove this comment to see the full error message
const TIDDLYWIKI_TEMPLATE_FOLDER_PATH = isDev ? path.resolve(__dirname, '..', '..', 'template', 'wiki') : path.resolve(process.resourcesPath, '..', 'wiki');
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'TIDDLERS_P... Remove this comment to see the full error message
const TIDDLERS_PATH = 'tiddlers';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'ICON_PATH'... Remove this comment to see the full error message
const ICON_PATH = isDev ? path.resolve(__dirname, '..', 'icon.png') : `file://${path.resolve(__dirname, '..', 'icon.png')}`;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'CHROME_ERR... Remove this comment to see the full error message
const CHROME_ERROR_PATH = 'chrome-error://chromewebdata/';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'DESKTOP_PA... Remove this comment to see the full error message
const DESKTOP_PATH = path.join(os.homedir(), 'Desktop');
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'LOG_FOLDER... Remove this comment to see the full error message
const LOG_FOLDER = isDev
? path.resolve(__dirname, '..', '..', 'logs')
: isMac
? path.resolve(process.resourcesPath, '..', 'logs')
: path.resolve(os.homedir(), '.tg-note', 'logs');
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'LOCALIZATI... Remove this comment to see the full error message
const LOCALIZATION_FOLDER = isDev ? path.resolve(__dirname, '..', '..', 'localization') : path.resolve(process.resourcesPath, '..', 'localization');
export { REACT_PATH, TIDDLYWIKI_TEMPLATE_FOLDER_PATH, TIDDLERS_PATH, ICON_PATH, CHROME_ERROR_PATH, DESKTOP_PATH, LOG_FOLDER, LOCALIZATION_FOLDER, isDev };

View file

@ -9,6 +9,7 @@ import { autoUpdater } from 'electron-updater';
import loadListeners from './listeners';
import * as mainWindow from './windows/main';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import openUrlWithWindow from './windows/open-url-with';
import createMenu from './libs/create-menu';
@ -21,10 +22,8 @@ import { getPreference, getPreferences } from './libs/preferences';
import { getWorkspaces, setWorkspace } from './libs/workspaces';
import { logger } from './libs/log';
import { commitAndSync } from './libs/git';
// @ts-expect-error ts-migrate(2306) FIXME: File '/Users/linonetwo/Desktop/repo/TiddlyGit-Desk... Remove this comment to see the full error message
import { clearMainBindings } from './libs/i18next-electron-fs-backend';
// @ts-expect-error ts-migrate(2306) FIXME: File '/Users/linonetwo/Desktop/repo/TiddlyGit-Desk... Remove this comment to see the full error message
import MAILTO_URLS from './constants/mailto-urls';
import './libs/updater';

View file

@ -3,11 +3,8 @@
/* global Image */
// Ported from
// https://github.com/electron-userland/electron-spellchecker/blob/master/src/context-menu-builder.js
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'clipboard'... Remove this comment to see the full error message
import { clipboard, nativeImage, shell, remote } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18nex... Remove this comment to see the full error message
import index18next from './i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'Menu'.
const { Menu, MenuItem } = remote;
/**
* Truncates a string to a max length of 25. Will split on a word boundary and
@ -415,4 +412,4 @@ export default class ContextMenuBuilder {
});
img.src = url;
}
};
}

View file

@ -1,28 +1,24 @@
// @ts-expect-error ts-migrate(6200) FIXME: Definitions of the following identifiers conflict ... Remove this comment to see the full error message
import { Menu, clipboard, ipcMain, shell } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getLanguag... Remove this comment to see the full error message
import { getLanguageMenu } from './i18next-electron-fs-backend';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import aboutWindow from '../windows/about';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import addWorkspaceWindow from '../windows/add-workspace';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import editWorkspaceWindow from '../windows/edit-workspace';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import goToUrlWindow from '../windows/go-to-url';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from '../windows/main';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import notificationsWindow from '../windows/notifications';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import preferencesWindow from '../windows/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18nex... Remove this comment to see the full error message
import index18next from './i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'formatByte... Remove this comment to see the full error message
import formatBytes from './format-bytes';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getViewBou... Remove this comment to see the full error message
import getViewBounds from './get-view-bounds';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
import { getWorkspaces, getActiveWorkspace, getNextWorkspace, getPreviousWorkspace } from './workspaces';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setActiveW... Remove this comment to see the full error message
import { setActiveWorkspaceView } from './workspaces-views';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getView'.
import { getView, getActiveBrowserView } from './views';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'createMenu... Remove this comment to see the full error message
function createMenu() {
const updaterEnabled = process.env.SNAP == undefined && !process.mas && !process.windowsStore;
const workspaces = getWorkspaces();
@ -46,11 +42,16 @@ function createMenu() {
accelerator: 'CmdOrCtrl+F',
click: () => {
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
if (win !== null && win.getBrowserView() !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
win.webContents.focus();
win.send('open-find-in-page');
(win as any).send('open-find-in-page');
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const contentSize = win.getContentSize();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const view = win.getBrowserView();
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
view.setBounds(getViewBounds(contentSize, true));
}
},
@ -61,7 +62,7 @@ function createMenu() {
accelerator: 'CmdOrCtrl+G',
click: () => {
const win = mainWindow.get();
win.send('request-back-find-in-page', true);
(win as any).send('request-back-find-in-page', true);
},
enabled: hasWorkspaces,
},
@ -70,7 +71,7 @@ function createMenu() {
accelerator: 'Shift+CmdOrCtrl+G',
click: () => {
const win = mainWindow.get();
win.send('request-back-find-in-page', false);
(win as any).send('request-back-find-in-page', false);
},
enabled: hasWorkspaces,
},
@ -120,6 +121,7 @@ function createMenu() {
return;
}
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
win.setMenuBarVisibility(!win.isMenuBarVisible());
ipcMain.emit('request-realign-active-workspace');
},
@ -138,7 +140,9 @@ function createMenu() {
return;
}
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
if (win !== null && win.getBrowserView() !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const contents = win.getBrowserView().webContents;
contents.zoomFactor = 1;
}
@ -157,7 +161,9 @@ function createMenu() {
return;
}
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
if (win !== null && win.getBrowserView() !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const contents = win.getBrowserView().webContents;
contents.zoomFactor += 0.1;
}
@ -176,7 +182,9 @@ function createMenu() {
return;
}
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
if (win !== null && win.getBrowserView() !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const contents = win.getBrowserView().webContents;
contents.zoomFactor -= 0.1;
}
@ -195,7 +203,9 @@ function createMenu() {
return;
}
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
if (win !== null && win.getBrowserView() !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
win.getBrowserView().webContents.reload();
}
},
@ -270,7 +280,9 @@ function createMenu() {
return;
}
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
if (win !== null && win.getBrowserView() !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const url = win.getBrowserView().webContents.getURL();
clipboard.writeText(url);
}
@ -307,6 +319,7 @@ function createMenu() {
click: () => {
const win = mainWindow.get();
if (win !== null) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
win.maximize();
}
},
@ -370,12 +383,14 @@ function createMenu() {
{
label: index18next.t('ContextMenu.Preferences'),
click: () => preferencesWindow.show(),
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ label: any; click: () => any; accelerator:... Remove this comment to see the full error message
accelerator: 'CmdOrCtrl+,',
},
{ type: 'separator' },
{
label: index18next.t('ContextMenu.Notifications'),
click: () => notificationsWindow.show(),
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ label: any; click: () => any; accelerator:... Remove this comment to see the full error message
accelerator: 'CmdOrCtrl+Shift+N',
},
{ type: 'separator' },
@ -384,6 +399,7 @@ function createMenu() {
click: () => ipcMain.emit('request-clear-browsing-data'),
},
{ type: 'separator' },
// @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'undefined... Remove this comment to see the full error message
{ role: 'services', submenu: [] },
{ type: 'separator' },
{ role: 'hide' },
@ -406,6 +422,7 @@ function createMenu() {
{ type: 'separator' },
{
label: index18next.t('ContextMenu.Preferences'),
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ label: any; accelerator: string; click: ()... Remove this comment to see the full error message
accelerator: 'CmdOrCtrl+,',
click: () => preferencesWindow.show(),
},
@ -413,15 +430,18 @@ function createMenu() {
{
label: index18next.t('ContextMenu.Notifications'),
click: () => notificationsWindow.show(),
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ label: any; click: () => any; accelerator:... Remove this comment to see the full error message
accelerator: 'CmdOrCtrl+Shift+N',
},
{ type: 'separator' },
{
label: index18next.t('Preference.ClearBrowsingData'),
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ label: any; accelerator: string; click: ()... Remove this comment to see the full error message
accelerator: 'CmdOrCtrl+Shift+Delete',
click: () => ipcMain.emit('request-clear-browsing-data'),
},
{ type: 'separator' },
// @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'undefined... Remove this comment to see the full error message
{ role: 'quit', label: 'Exit' },
],
});
@ -433,6 +453,7 @@ function createMenu() {
template[4].submenu.push({
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
label: workspace.name || `Workspace ${index + 1}`,
// @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'undefined... Remove this comment to see the full error message
type: 'checkbox',
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
checked: workspace.active,
@ -443,7 +464,7 @@ function createMenu() {
},
accelerator: `CmdOrCtrl+${index + 1}`,
});
template[2].submenu[template[2].submenu.length - 1].submenu.push({
(template[2].submenu[template[2].submenu.length - 1] as any).submenu.push({
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
label: workspace.name || `Workspace ${index + 1}`,
click: () => {
@ -454,12 +475,15 @@ function createMenu() {
});
});
template[4].submenu.push(
// @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'undefined... Remove this comment to see the full error message
{ type: 'separator' },
{
label: 'Select Next Workspace',
click: () => {
const currentActiveWorkspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const nextWorkspace = getNextWorkspace(currentActiveWorkspace.id);
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
setActiveWorkspaceView(nextWorkspace.id);
createMenu();
},
@ -470,7 +494,9 @@ function createMenu() {
label: 'Select Previous Workspace',
click: () => {
const currentActiveWorkspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const previousWorkspace = getPreviousWorkspace(currentActiveWorkspace.id);
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
setActiveWorkspaceView(previousWorkspace.id);
createMenu();
},
@ -482,6 +508,7 @@ function createMenu() {
label: 'Edit Current Workspace',
click: () => {
const activeWorkspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
editWorkspaceWindow.show(activeWorkspace.id);
},
enabled: hasWorkspaces,
@ -490,6 +517,7 @@ function createMenu() {
label: 'Remove Current Workspace',
click: () => {
const activeWorkspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
ipcMain.emit('request-remove-workspace', null, activeWorkspace.id);
},
enabled: hasWorkspaces,
@ -502,7 +530,7 @@ function createMenu() {
},
},
);
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '({ label: string; submenu: any; ... Remove this comment to see the full error message
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '({ label: string; submenu: ({ la... Remove this comment to see the full error message
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}

View file

@ -1,14 +1,12 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fetch'.
import fetch from 'node-fetch';
import ProxyAgent from 'proxy-agent';
// somehow, ELECTRON_RUN_AS_NODE is set to '1' instead of 'true' as specified
// so use generic process.env.ELECTRON_RUN_AS_NODE condition instead of
// something like process.env.ELECTRON_RUN_AS_NODE === 'true'
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
const { getPreference }: any = process.env.ELECTRON_RUN_AS_NODE ? {} : require('./preferences');
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'customized... Remove this comment to see the full error message
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
const customizedFetch = (url: any, _options: any, ...arguments_) => {
let proxyPacScript = process.env.PROXY_PAC_SCRIPT;
let proxyRules = process.env.PROXY_RULES;
@ -21,6 +19,7 @@ const customizedFetch = (url: any, _options: any, ...arguments_) => {
const options = { ..._options };
if (proxyType === 'rules') {
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
const agent = new ProxyAgent(proxyRules);
options.agent = agent;
} else if (proxyType === 'pacScript') {

View file

@ -1,5 +1,4 @@
// https://stackoverflow.com/a/18650828
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'formatByte... Remove this comment to see the full error message
function formatBytes(bytes: any, decimals = 2) {
if (bytes === 0) return '0 Bytes';

View file

@ -1,9 +1,8 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from '../windows/main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getViewBou... Remove this comment to see the full error message
const getViewBounds = (contentSize: any, findInPage = false, height: any, width: any) => {
const showSidebar = global.sidebar;
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const isFullScreen = mainWindow.get() && mainWindow.get().isFullScreen();
const showTitleBar = process.platform === 'darwin' && global.titleBar && !isFullScreen;
const showNavigationBar = (process.platform === 'linux' && global.attachToMenubar && !global.sidebar) || global.navigationBar;

View file

@ -1,8 +1,5 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'compact'.
import { compact } from 'lodash';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'GitProcess... Remove this comment to see the full error message
import { GitProcess } from 'dugite';
// const { logger } = require('../log');
// const i18n = require('../i18n');
@ -11,20 +8,16 @@ import { GitProcess } from 'dugite';
* Get modified files and modify type in a folder
* @param {string} wikiFolderPath location to scan git modify state
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getModifie... Remove this comment to see the full error message
async function getModifiedFileList(wikiFolderPath: any) {
const { stdout } = await GitProcess.exec(['status', '--porcelain'], wikiFolderPath);
const stdoutLines = stdout.split('\n');
return (
compact(stdoutLines)
return compact(stdoutLines)
.map((line: any) => line.match(/^\s?(\?\?|[ACMR]|[ACMR][DM])\s?(\S+)$/))
// @ts-expect-error ts-migrate(7031) FIXME: Binding element '_' implicitly has an 'any' type.
.map(([_, type, fileRelativePath]) => ({
type,
fileRelativePath,
filePath: path.join(wikiFolderPath, fileRelativePath),
}))
);
}));
}
export { getModifiedFileList };

View file

@ -1,25 +1,15 @@
/* eslint-disable sonarjs/no-duplicate-string */
/* eslint-disable unicorn/consistent-function-scoping */
/* eslint-disable no-await-in-loop */
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'compact'.
import { compact, truncate, trim } from 'lodash';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'GitProcess... Remove this comment to see the full error message
import { GitProcess } from 'dugite';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'isDev'.
import isDev from 'electron-is-dev';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'ipcMain'.
import { ipcMain } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
import { logger } from '../log';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18n'.
import index18n from '../i18n';
const disableSyncOnDevelopment = true;
const getGitUrlWithCredential = (rawUrl: any, username: any, accessToken: any) =>
trim(`${rawUrl}.git`.replace(/\n/g, '').replace('https://github.com/', `https://${username}:${accessToken}@github.com/`));
const getGitUrlWithOutCredential = (urlWithCredential: any) => trim(urlWithCredential.replace(/.+@/, 'https://'));
@ -46,7 +36,6 @@ async function credentialOff(wikiFolderPath: any) {
const gitUrlWithOutCredential = getGitUrlWithOutCredential(githubRepoUrl);
await GitProcess.exec(['remote', 'set-url', 'origin', gitUrlWithOutCredential], wikiFolderPath);
}
/**
* Get "master" or "main" from git repo
* @param {string} wikiFolderPath
@ -61,7 +50,6 @@ async function getDefaultBranchName(wikiFolderPath: any) {
}
return branchName;
}
/**
* Git add and commit all file
* @param {string} wikiFolderPath
@ -71,9 +59,8 @@ async function getDefaultBranchName(wikiFolderPath: any) {
*/
async function commitFiles(wikiFolderPath: any, username: any, email: any, message = 'Initialize with TiddlyGit-Desktop') {
await GitProcess.exec(['add', '.'], wikiFolderPath);
return GitProcess.exec(['commit', '-m', message, `--author="${username} <${email}>"`], wikiFolderPath);
return await GitProcess.exec(['commit', '-m', message, `--author="${username} <${email}>"`], wikiFolderPath);
}
/**
*
* @param {string} wikiFolderPath
@ -82,11 +69,9 @@ async function commitFiles(wikiFolderPath: any, username: any, email: any, messa
* @param {boolean} isMainWiki
* @param {{ info: Function, notice: Function }} logger Logger instance from winston
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'initWikiGi... Remove this comment to see the full error message
async function initWikiGit(wikiFolderPath: any, githubRepoUrl: any, userInfo: any, isMainWiki: any) {
const logProgress = (message: any) => logger.notice(message, { handler: 'createWikiProgress', function: 'initWikiGit' });
const logInfo = (message: any) => logger.info(message, { function: 'initWikiGit' });
logProgress(index18n.t('Log.StartGitInitialization'));
const { login: username, email, accessToken } = userInfo;
logInfo(
@ -114,7 +99,6 @@ async function initWikiGit(wikiFolderPath: any, githubRepoUrl: any, userInfo: an
logProgress(index18n.t('Log.GitRepositoryConfigurationFinished'));
}
}
/**
* See if there is any file not being committed
* @param {string} wikiFolderPath repo path to test
@ -122,9 +106,9 @@ async function initWikiGit(wikiFolderPath: any, githubRepoUrl: any, userInfo: an
async function haveLocalChanges(wikiFolderPath: any) {
const { stdout } = await GitProcess.exec(['status', '--porcelain'], wikiFolderPath);
const matchResult = stdout.match(/^(\?\?|[ACMR] |[ ACMR][DM])*/gm);
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
return matchResult.some((match: any) => !!match);
}
/**
* determine sync state of repository, i.e. how the remote relates to our HEAD
* 'ahead' means our local state is ahead of remote, 'behind' means local state is behind of the remote
@ -135,28 +119,37 @@ async function getSyncState(wikiFolderPath: any, logInfo: any) {
const { stdout } = await GitProcess.exec(['rev-list', '--count', '--left-right', `origin/${defaultBranchName}...HEAD`], wikiFolderPath);
logInfo('Checking sync state with upstream');
logInfo('stdout:', stdout, '(stdout end)');
if (stdout === '') return 'noUpstream';
if (stdout.match(/0\t0/)) return 'equal';
if (stdout.match(/0\t\d+/)) return 'ahead';
if (stdout.match(/\d+\t0/)) return 'behind';
if (stdout === '') {
return 'noUpstream';
}
if (stdout.match(/0\t0/)) {
return 'equal';
}
if (stdout.match(/0\t\d+/)) {
return 'ahead';
}
if (stdout.match(/\d+\t0/)) {
return 'behind';
}
return 'diverged';
}
async function assumeSync(wikiFolderPath: any, logInfo: any, logProgress: any) {
if ((await getSyncState(wikiFolderPath, logInfo)) === 'equal') return;
if ((await getSyncState(wikiFolderPath, logInfo)) === 'equal') {
return;
}
const SYNC_ERROR_MESSAGE = index18n.t('Log.SynchronizationFailed');
logProgress(SYNC_ERROR_MESSAGE);
throw new Error(SYNC_ERROR_MESSAGE);
}
/**
* echo the git dir
* @param {string} wikiFolderPath repo path
*/
async function getGitDirectory(wikiFolderPath: any, logInfo: any, logProgress: any) {
const { stdout, stderr } = await GitProcess.exec(['rev-parse', '--is-inside-work-tree', wikiFolderPath], wikiFolderPath);
if (stderr) logInfo(stderr);
if (stderr) {
logInfo(stderr);
}
if (stdout.startsWith('true')) {
const { stdout: stdout2 } = await GitProcess.exec(['rev-parse', '--git-dir', wikiFolderPath], wikiFolderPath);
const [gitPath2, gitPath1] = compact(stdout2.split('\n'));
@ -168,7 +161,6 @@ async function getGitDirectory(wikiFolderPath: any, logInfo: any, logProgress: a
logProgress(CONFIG_FAILED_MESSAGE);
throw new Error(`${wikiFolderPath} ${CONFIG_FAILED_MESSAGE}`);
}
/**
* get various repo state in string format
* @param {string} wikiFolderPath repo path to check
@ -176,27 +168,28 @@ async function getGitDirectory(wikiFolderPath: any, logInfo: any, logProgress: a
*/
async function getGitRepositoryState(wikiFolderPath: any, logInfo: any, logProgress: any) {
const gitDirectory = await getGitDirectory(wikiFolderPath, logInfo, logProgress);
if (!gitDirectory) return 'NOGIT';
if (!gitDirectory) {
return 'NOGIT';
}
let result = '';
if ((await fs.lstat(path.join(gitDirectory, 'rebase-merge', 'interactive')).catch(() => {}))?.isFile()) {
if (((await fs.lstat(path.join(gitDirectory, 'rebase-merge', 'interactive')).catch(() => {})) as any)?.isFile()) {
result += 'REBASE-i';
} else if ((await fs.lstat(path.join(gitDirectory, 'rebase-merge')).catch(() => {}))?.isDirectory()) {
} else if (((await fs.lstat(path.join(gitDirectory, 'rebase-merge')).catch(() => {})) as any)?.isDirectory()) {
result += 'REBASE-m';
} else {
if ((await fs.lstat(path.join(gitDirectory, 'rebase-apply')).catch(() => {}))?.isDirectory()) {
if (((await fs.lstat(path.join(gitDirectory, 'rebase-apply')).catch(() => {})) as any)?.isDirectory()) {
result += 'AM/REBASE';
}
if ((await fs.lstat(path.join(gitDirectory, 'MERGE_HEAD')).catch(() => {}))?.isFile()) {
if (((await fs.lstat(path.join(gitDirectory, 'MERGE_HEAD')).catch(() => {})) as any)?.isFile()) {
result += 'MERGING';
}
if ((await fs.lstat(path.join(gitDirectory, 'CHERRY_PICK_HEAD')).catch(() => {}))?.isFile()) {
if (((await fs.lstat(path.join(gitDirectory, 'CHERRY_PICK_HEAD')).catch(() => {})) as any)?.isFile()) {
result += 'CHERRY-PICKING';
}
if ((await fs.lstat(path.join(gitDirectory, 'BISECT_LOG')).catch(() => {}))?.isFile()) {
if (((await fs.lstat(path.join(gitDirectory, 'BISECT_LOG')).catch(() => {})) as any)?.isFile()) {
result += 'BISECTING';
}
}
if ((await GitProcess.exec(['rev-parse', '--is-inside-git-dir', wikiFolderPath], wikiFolderPath)).stdout.startsWith('true')) {
result += (await GitProcess.exec(['rev-parse', '--is-bare-repository', wikiFolderPath], wikiFolderPath)).stdout.startsWith('true') ? '|BARE' : '|GIT_DIR';
} else if ((await GitProcess.exec(['rev-parse', '--is-inside-work-tree', wikiFolderPath], wikiFolderPath)).stdout.startsWith('true')) {
@ -206,10 +199,8 @@ async function getGitRepositoryState(wikiFolderPath: any, logInfo: any, logProgr
result += '|DIRTY';
}
}
return result;
}
/**
* try to continue rebase, simply adding and committing all things, leave them to user to resolve in the TiddlyWiki later.
* @param {*} wikiFolderPath
@ -254,10 +245,8 @@ async function continueRebase(wikiFolderPath: any, username: any, email: any, lo
}
hasNotCommittedConflict = rebaseContinueStdError.startsWith('CONFLICT') || rebaseContinueStdOut.startsWith('CONFLICT');
}
logProgress(index18n.t('Log.CantSyncInSpecialGitStateAutoFixSucceed'));
}
/**
*
* @param {string} githubRepoName similar to "linonetwo/wiki", string after "https://github.com/"
@ -284,25 +273,23 @@ async function updateGitInfoTiddler(githubRepoName: any) {
}
return logger.error('no browserView in updateGitInfoTiddler');
}
/**
*
* @param {string} wikiFolderPath
* @param {string} githubRepoUrl
* @param {{ login: string, email: string, accessToken: string }} userInfo
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'commitAndS... Remove this comment to see the full error message
async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo: any) {
/** functions to send data to main thread */
const logProgress = (message: any) => logger.notice(message, { handler: 'wikiSyncProgress', function: 'commitAndSync', wikiFolderPath, githubRepoUrl });
const logInfo = (message: any) => logger.info(message, { function: 'commitAndSync', wikiFolderPath, githubRepoUrl });
if (disableSyncOnDevelopment && isDev) return;
if (disableSyncOnDevelopment && isDev) {
return;
}
const { login: username, email } = userInfo;
const commitMessage = 'Wiki updated with TiddlyGit-Desktop';
const defaultBranchName = await getDefaultBranchName(wikiFolderPath);
const branchMapping = `${defaultBranchName}:${defaultBranchName}`;
// update git info tiddler for plugins to use, for example, linonetwo/github-external-image
let wikiRepoName = new URL(githubRepoUrl).pathname;
if (wikiRepoName.startsWith('/')) {
@ -311,7 +298,6 @@ async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo:
if (wikiRepoName) {
await updateGitInfoTiddler(wikiRepoName);
}
// preflight check
const repoStartingState = await getGitRepositoryState(wikiFolderPath, logInfo, logProgress);
if (!repoStartingState || repoStartingState === '|DIRTY') {
@ -326,7 +312,6 @@ async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo:
// we may be in middle of a rebase, try fix that
await continueRebase(wikiFolderPath, username, email, logInfo, logProgress);
}
if (await haveLocalChanges(wikiFolderPath)) {
const SYNC_MESSAGE = index18n.t('Log.HaveThingsToCommit');
logProgress(SYNC_MESSAGE);
@ -342,7 +327,6 @@ async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo:
await credentialOn(wikiFolderPath, githubRepoUrl, userInfo);
logProgress(index18n.t('Log.FetchingData'));
await GitProcess.exec(['fetch', 'origin', defaultBranchName], wikiFolderPath);
//
switch (await getSyncState(wikiFolderPath, logInfo)) {
case 'noUpstream': {
@ -358,7 +342,9 @@ async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo:
case 'ahead': {
logProgress(index18n.t('Log.LocalAheadStartUpload'));
const { exitCode, stderr } = await GitProcess.exec(['push', 'origin', branchMapping], wikiFolderPath);
if (exitCode === 0) break;
if (exitCode === 0) {
break;
}
logProgress(index18n.t('Log.GitPushFailed'));
logInfo(`exitCode: ${exitCode}, stderr of git push:`);
logInfo(stderr);
@ -367,7 +353,9 @@ async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo:
case 'behind': {
logProgress(index18n.t('Log.LocalStateBehindSync'));
const { exitCode, stderr } = await GitProcess.exec(['merge', '--ff', '--ff-only', `origin/${defaultBranchName}`], wikiFolderPath);
if (exitCode === 0) break;
if (exitCode === 0) {
break;
}
logProgress(index18n.t('Log.GitMergeFailed'));
logInfo(`exitCode: ${exitCode}, stderr of git merge:`);
logInfo(stderr);
@ -389,14 +377,11 @@ async function commitAndSync(wikiFolderPath: any, githubRepoUrl: any, userInfo:
logProgress(index18n.t('Log.SyncFailedSystemError'));
}
}
await credentialOff(wikiFolderPath);
logProgress(index18n.t('Log.PerformLastCheckBeforeSynchronizationFinish'));
await assumeSync(wikiFolderPath, logInfo, logProgress);
logProgress(index18n.t('Log.SynchronizationFinish'));
}
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getRemoteU... Remove this comment to see the full error message
async function getRemoteUrl(wikiFolderPath: any) {
const { stdout: remoteStdout } = await GitProcess.exec(['remote'], wikiFolderPath);
const remotes = compact(remoteStdout.split('\n'));
@ -407,8 +392,6 @@ async function getRemoteUrl(wikiFolderPath: any) {
}
return '';
}
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'clone'.
async function clone(githubRepoUrl: any, repoFolderPath: any, userInfo: any) {
const logProgress = (message: any) => logger.notice(message, { handler: 'createWikiProgress', function: 'clone' });
const logInfo = (message: any) => logger.info(message, { function: 'clone' });
@ -440,10 +423,4 @@ async function clone(githubRepoUrl: any, repoFolderPath: any, userInfo: any) {
logProgress(index18n.t('Log.GitRepositoryConfigurationFinished'));
}
}
export {
initWikiGit,
commitAndSync,
getRemoteUrl,
clone,
};
export { initWikiGit, commitAndSync, getRemoteUrl, clone };

View file

@ -2,15 +2,10 @@
* Provide API from electron to tiddlywiki
* This file should be required by BrowserView's preload script to work
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getModifie... Remove this comment to see the full error message
import { getModifiedFileList } from './inspect';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'commitAndS... Remove this comment to see the full error message
import { commitAndSync } from './sync';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
import { getWorkspacesAsList } from '../workspaces';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { getPreference } from '../preferences';
contextBridge.exposeInMainWorld('git', {

View file

@ -2,7 +2,6 @@ import path from 'path';
import i18next from 'i18next';
import Backend from 'i18next-fs-backend';
// @ts-expect-error ts-migrate(2306) FIXME: File '/Users/linonetwo/Desktop/repo/TiddlyGit-Desk... Remove this comment to see the full error message
import { LOCALIZATION_FOLDER, isDev as isDevelopment } from '../constants/paths';
i18next.use(Backend).init({

View file

@ -1,12 +1,7 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'LOCALIZATI... Remove this comment to see the full error message
import { LOCALIZATION_FOLDER } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18n'.
import index18n from './i18n';
// Electron-specific; must match mainIpc
@ -18,7 +13,6 @@ const changeLanguageRequest = 'ChangeLanguage-Request';
// This is the code that will go into the preload.js file
// in order to set up the contextBridge api
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'preloadBin... Remove this comment to see the full error message
const preloadBindings = function (ipcRenderer: any) {
return {
send: (channel: any, data: any) => {
@ -45,7 +39,6 @@ const preloadBindings = function (ipcRenderer: any) {
// This is the code that will go into the main.js file
// in order to set up the ipc main bindings
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainBindin... Remove this comment to see the full error message
const mainBindings = function (ipcMain: any, browserWindow: any) {
ipcMain.on(readFileRequest, (IpcMainEvent: any, arguments_: any) => {
const localeFilePath = path.join(LOCALIZATION_FOLDER, arguments_.filename);
@ -61,6 +54,7 @@ const mainBindings = function (ipcMain: any, browserWindow: any) {
ipcMain.on(writeFileRequest, (IpcMainEvent: any, arguments_: any) => {
const localeFilePath = path.join(LOCALIZATION_FOLDER, arguments_.filename);
const localeFileFolderPath = path.dirname(localeFilePath);
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
fs.ensureDir(localeFileFolderPath, (directoryCreationError: any) => {
if (directoryCreationError) {
console.error(directoryCreationError);
@ -87,7 +81,6 @@ const whitelistMap = JSON.parse(fs.readFileSync(path.join(LOCALIZATION_FOLDER, '
const whiteListedLanguages = Object.keys(whitelistMap);
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getLanguag... Remove this comment to see the full error message
function getLanguageMenu() {
const subMenu = [];
for (const language of whiteListedLanguages) {

View file

@ -1,11 +1,7 @@
import winston from 'winston';
require('winston-daily-rotate-file');
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'LOG_FOLDER... Remove this comment to see the full error message
import { LOG_FOLDER } from '../../constants/paths';
import RendererTransport from './renderer-transport';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
require('winston-daily-rotate-file');
const logger = winston.createLogger({
levels: {
emerg: 0,
@ -19,7 +15,7 @@ const logger = winston.createLogger({
debug: 8,
},
transports: [
new winston.transports.DailyRotateFile({
new (winston.transports as any).DailyRotateFile({
filename: 'TiddlyGit-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: false,
@ -30,7 +26,7 @@ const logger = winston.createLogger({
new RendererTransport(),
],
exceptionHandlers: [
new winston.transports.DailyRotateFile({
new (winston.transports as any).DailyRotateFile({
filename: 'TiddlyGit-Exception-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: false,

View file

@ -29,4 +29,4 @@ export default class RendererTransport extends Transport {
callback();
}
};
}

View file

@ -1,12 +1,8 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'LOG_FOLDER... Remove this comment to see the full error message
import { LOG_FOLDER } from '../../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'wikiOutput... Remove this comment to see the full error message
function wikiOutputToFile(wikiName: any, stream: any) {
const logFilePath = path.join(LOG_FOLDER, `${wikiName}.log`);
stream.pipe(fs.createWriteStream(logFilePath));
@ -16,7 +12,6 @@ function wikiOutputToFile(wikiName: any, stream: any) {
* Recreate log file
* @param {string} wikiName
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'refreshOut... Remove this comment to see the full error message
function refreshOutputFile(wikiName: any) {
const logFilePath = path.join(LOG_FOLDER, `${wikiName}.log`);
if (fs.existsSync(logFilePath)) {

View file

@ -1,8 +1,5 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { getPreference } from './preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setViewsAu... Remove this comment to see the full error message
import { setViewsAudioPref, setViewsNotificationsPref } from './views';
let pauseNotificationsInfo: any = null;
@ -114,7 +111,6 @@ const calcPauseNotificationsInfo = () => {
let timeouts: any = [];
let updating = false;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'updatePaus... Remove this comment to see the full error message
const updatePauseNotificationsInfo = () => {
// avoid multiple timeouts running at the same time
if (updating) return;
@ -134,8 +130,7 @@ const updatePauseNotificationsInfo = () => {
const schedule = getCurrentScheduledDateTime();
// clear old timeouts
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'timeout' implicitly has an 'any' type.
timeouts.forEach((timeout) => {
timeouts.forEach((timeout: any) => {
clearTimeout(timeout);
});
@ -168,7 +163,6 @@ const updatePauseNotificationsInfo = () => {
updating = false;
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPauseNo... Remove this comment to see the full error message
const getPauseNotificationsInfo = () => pauseNotificationsInfo;
export { updatePauseNotificationsInfo, getPauseNotificationsInfo };

View file

@ -2,9 +2,9 @@
import path from 'path';
import semver from 'semver';
import settings from 'electron-settings';
let { app, nativeTheme, ipcMain, remote } = require('electron');
import sendToAllWindows from './send-to-all-windows';
const { app, nativeTheme, ipcMain, remote } = require('electron');
// scope
const v = '2018.2';

View file

@ -1,6 +1,5 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
const sendToAllWindows = (...arguments_) => {
const wins = BrowserWindow.getAllWindows();
wins.forEach((win) => {

View file

@ -1,13 +1,10 @@
// System Preferences are not stored in storage but stored in macOS Preferences.
// It can be retrieved and changed using Electron APIs
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'app'.
import { app, remote } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getSystemP... Remove this comment to see the full error message
const getSystemPreference = (name: any) => {
switch (name) {
case 'openAtLogin': {
@ -24,12 +21,10 @@ const getSystemPreference = (name: any) => {
}
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getSystemP... Remove this comment to see the full error message
const getSystemPreferences = () => ({
openAtLogin: getSystemPreference('openAtLogin'),
});
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setSystemP... Remove this comment to see the full error message
const setSystemPreference = (name: any, value: any) => {
switch (name) {
case 'openAtLogin': {

View file

@ -1,12 +1,7 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'app'.
import { app, dialog } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'autoUpdate... Remove this comment to see the full error message
import { autoUpdater } from 'electron-updater';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'createMenu... Remove this comment to see the full error message
import createMenu from './create-menu';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from '../windows/main';
(global as any).updateSilent = true;
global.updaterObj = {};
@ -19,6 +14,7 @@ autoUpdater.on('checking-for-update', () => {
});
autoUpdater.on('update-available', (info: any) => {
if (!(global as any).updateSilent) {
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
dialog.showMessageBox(mainWindow.get(), {
title: 'An Update is Available',
message: 'There is an available update. It is being downloaded. We will let you know when it is ready.',
@ -38,6 +34,7 @@ autoUpdater.on('update-available', (info: any) => {
autoUpdater.on('update-not-available', (info: any) => {
if (!(global as any).updateSilent) {
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), {
title: 'No Updates',
message: 'There are currently no updates available.',
@ -57,6 +54,7 @@ autoUpdater.on('update-not-available', (info: any) => {
autoUpdater.on('error', (error: any) => {
if (!(global as any).updateSilent) {
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), {
title: 'Failed to Check for Updates',
message: 'Failed to check for updates. Please check your Internet connection.',
@ -104,7 +102,7 @@ autoUpdater.on('update-downloaded', (info: any) => {
cancelId: 1,
};
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ type: string; buttons: string[... Remove this comment to see the full error message
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), dialogOptions)
.then(({ response }) => {
if (response === 0) {
@ -115,7 +113,7 @@ autoUpdater.on('update-downloaded', (info: any) => {
app.removeAllListeners('window-all-closed');
const win = mainWindow.get();
if (win != undefined) {
win.forceClose = true;
(win as any).forceClose = true;
win.close();
}
autoUpdater.quitAndInstall(false);

View file

@ -1,25 +1,15 @@
/* eslint-disable no-param-reassign */
// @ts-expect-error ts-migrate(6200) FIXME: Definitions of the following identifiers conflict ... Remove this comment to see the full error message
import { BrowserView, BrowserWindow, app, session, shell, dialog, ipcMain } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fsExtra'.
import fsExtra from 'fs-extra';
import { ElectronBlocker } from '@cliqz/adblocker-electron';
import index18n from './i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'wikiStartu... Remove this comment to see the full error message
import wikiStartup from './wiki/wiki-startup';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { getPreferences, getPreference } from './preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
import { getWorkspace, setWorkspace, getActiveWorkspace } from './workspaces';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
import { setWorkspaceMeta, getWorkspaceMetas, getWorkspaceMeta } from './workspace-metas';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getViewBou... Remove this comment to see the full error message
import getViewBounds from './get-view-bounds';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'customized... Remove this comment to see the full error message
import customizedFetch from './customized-fetch';
const views = {};
let shouldMuteAudio: any;
@ -83,7 +73,6 @@ const isInternalUrl = (url: any, currentInternalUrls: any) => {
});
return Boolean(matchedInternalUrl);
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'addView'.
export const addView = async (browserWindow: any, workspace: any) => {
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (views[workspace.id]) {
@ -135,6 +124,7 @@ export const addView = async (browserWindow: any, workspace: any) => {
}
// blocker
if (blockAds) {
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '(url: any, _options: any, ...arg... Remove this comment to see the full error message
ElectronBlocker.fromPrebuiltAdsAndTracking(customizedFetch, {
path: path.join(app.getPath('userData'), 'adblocker.bin'),
read: fsExtra.readFile,
@ -237,6 +227,7 @@ export const addView = async (browserWindow: any, workspace: any) => {
if (browserWindow && !browserWindow.isDestroyed()) {
// fix https://github.com/atomery/singlebox/issues/228
const contentSize = browserWindow.getContentSize();
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 1.
view.setBounds(getViewBounds(contentSize));
}
}
@ -568,6 +559,7 @@ export const addView = async (browserWindow: any, workspace: any) => {
if (workspace.active) {
browserWindow.setBrowserView(view);
const contentSize = browserWindow.getContentSize();
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 1.
view.setBounds(getViewBounds(contentSize));
view.setAutoResize({
width: true,
@ -581,7 +573,9 @@ export const addView = async (browserWindow: any, workspace: any) => {
await wikiStartup(workspace);
view.webContents.loadURL(initialUrl);
};
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
export const getView = (id: any) => views[id];
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
export const onEachView = (functionToRun: any) => Object.keys(views).forEach((key) => functionToRun(views[key]));
export const setActiveView = (browserWindow: any, id: any) => {
// stop find in page when switching workspaces
@ -601,6 +595,7 @@ export const setActiveView = (browserWindow: any, id: any) => {
if (getWorkspaceMeta(id).didFailLoad) {
view.setBounds(getViewBounds(contentSize, false, 0, 0)); // hide browserView to show error message
} else {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 1.
view.setBounds(getViewBounds(contentSize));
}
view.setAutoResize({
@ -672,6 +667,7 @@ export const reloadViewsDarkReader = () => {
export const reloadViewsWebContentsIfDidFailLoad = () => {
const metas = getWorkspaceMetas();
Object.keys(metas).forEach((id) => {
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (!metas[id].didFailLoad) {
return;
}
@ -694,6 +690,7 @@ export const reloadViewsWebContents = () => {
};
export const getActiveBrowserView = () => {
const workspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
return getView(workspace.id);
};
export const realignActiveView = (browserWindow: any, activeId: any) => {
@ -703,6 +700,7 @@ export const realignActiveView = (browserWindow: any, activeId: any) => {
if (getWorkspaceMeta(activeId).didFailLoad) {
view.setBounds(getViewBounds(contentSize, false, 0, 0)); // hide browserView to show error message
} else {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 1.
view.setBounds(getViewBounds(contentSize));
}
}

View file

@ -1,12 +1,8 @@
/* eslint-disable sonarjs/no-duplicate-string */
// @ts-expect-error ts-migrate(6200) FIXME: Definitions of the following identifiers conflict ... Remove this comment to see the full error message
import fs from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'TIDDLYWIKI... Remove this comment to see the full error message
import { TIDDLYWIKI_TEMPLATE_FOLDER_PATH, TIDDLERS_PATH } from '../../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'clone'.
import { clone } from '../git';
import { logger } from '../log';
import { updateSubWikiPluginContent } from './update-plugin-content';
@ -32,6 +28,7 @@ async function linkWiki(mainWikiPath: any, folderName: any, subWikiPath: any) {
try {
await fs.remove(mainWikiTiddlersFolderPath);
} catch {}
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
await fs.createSymlink(subWikiPath, mainWikiTiddlersFolderPath, 'junction');
logProgress(index18n.t('AddWorkspace.CreateLinkFromSubWikiToMainWikiSucceed'));
} catch (error) {
@ -86,6 +83,7 @@ async function createSubWiki(newFolderPath: any, folderName: any, mainWikiPath:
await linkWiki(mainWikiPath, folderName, newWikiPath);
if (tagName && typeof tagName === 'string') {
logProgress(index18n.t('AddWorkspace.AddFileSystemPath'));
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 2.
updateSubWikiPluginContent(mainWikiPath, { tagName, subWikiFolderName: folderName });
}
@ -147,6 +145,7 @@ async function cloneSubWiki(parentFolderLocation: any, wikiFolderName: any, main
await linkWiki(mainWikiPath, wikiFolderName, path.join(parentFolderLocation, wikiFolderName));
if (tagName && typeof tagName === 'string') {
logProgress(index18n.t('AddWorkspace.AddFileSystemPath'));
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 2.
updateSubWikiPluginContent(mainWikiPath, { tagName, subWikiFolderName: wikiFolderName });
}
}

View file

@ -1,21 +1,16 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'dialog'.
import { dialog } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'startWiki'... Remove this comment to see the full error message
import { startWiki } from './wiki-worker-mamager';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from '../../windows/main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18n'.
import index18n from '../i18n';
export default function startNodeJSWiki(homePath: any, port: any, userName: any, workspaceID: any) {
if (!homePath || typeof homePath !== 'string' || !path.isAbsolute(homePath)) {
const errorMessage = index18n.t('Dialog.NeedCorrectTiddlywikiFolderPath');
console.error(errorMessage);
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
dialog.showMessageBox(mainWindow.get(), {
title: index18n.t('Dialog.PathPassInCantUse'),
message: errorMessage + homePath,
@ -29,6 +24,7 @@ export default function startNodeJSWiki(homePath: any, port: any, userName: any,
const errorMessage = index18n.t('Dialog.CantFindWorkspaceFolderRemoveWorkspace');
console.error(errorMessage);
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), {
title: index18n.t('Dialog.WorkspaceFolderRemoved'),
message: errorMessage + homePath,
@ -52,4 +48,4 @@ export default function startNodeJSWiki(homePath: any, port: any, userName: any,
}
return startWiki(homePath, port, userName);
};
}

View file

@ -1,10 +1,6 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'compact'.
import { take, drop, compact } from 'lodash';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
import { logger } from '../log';
const getMatchPart = (tagToMatch: any) => `[!is[system]kin::to[${tagToMatch}]`;
@ -23,7 +19,6 @@ function getFileSystemPathsTiddlerPath(mainWikiPath: any) {
* @param {Object} newConfig { "tagName": Tag to indicate that a tiddler belongs to a sub-wiki, "subWikiFolderName": folder name inside the subwiki/ folder }
* @param {Object} oldConfig if you need to replace a line, you need to pass-in what old line looks like, so here we can find and replace it
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'updateSubW... Remove this comment to see the full error message
function updateSubWikiPluginContent(mainWikiPath: any, newConfig: any, oldConfig: any) {
const FileSystemPathsTiddlerPath = getFileSystemPathsTiddlerPath(mainWikiPath);
@ -70,7 +65,6 @@ function updateSubWikiPluginContent(mainWikiPath: any, newConfig: any, oldConfig
fs.writeFileSync(FileSystemPathsTiddlerPath, newFileSystemPathsFile);
}
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getSubWiki... Remove this comment to see the full error message
async function getSubWikiPluginContent(mainWikiPath: any) {
if (!mainWikiPath) return [];
const FileSystemPathsTiddlerPath = getFileSystemPathsTiddlerPath(mainWikiPath);

View file

@ -1,16 +1,10 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
import chokidar from 'chokidar';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'trim'.
import { trim, compact, debounce } from 'lodash';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { getPreference } from '../preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
import { logger } from '../log';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'commitAndS... Remove this comment to see the full error message
import { commitAndSync } from '../git';
const syncDebounceInterval = getPreference('syncDebounceInterval');
@ -23,7 +17,6 @@ const topLevelFoldersToIgnored = ['node_modules', '.git'];
// { [name: string]: Watcher }
const wikiWatchers = {};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'watchWiki'... Remove this comment to see the full error message
export function watchWiki(wikiRepoPath: any, githubRepoUrl: any, userInfo: any, wikiFolderPath = wikiRepoPath) {
if (!fs.existsSync(wikiRepoPath)) {
return logger.error('Folder not exist in watchFolder()', { wikiRepoPath, wikiFolderPath, githubRepoUrl });
@ -74,7 +67,6 @@ export function watchWiki(wikiRepoPath: any, githubRepoUrl: any, userInfo: any,
});
}
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'stopWatchW... Remove this comment to see the full error message
export async function stopWatchWiki(wikiRepoPath: any) {
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const watcher = wikiWatchers[wikiRepoPath];

View file

@ -2,9 +2,8 @@
* Call tiddlywiki api from electron
* This file should be required by BrowserView's preload script to work
*/
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'ipcRendere... Remove this comment to see the full error message
import { ipcRenderer, webFrame } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'Promise'.
// @ts-expect-error ts-migrate(2529) FIXME: Duplicate identifier 'Promise'. Compiler reserves ... Remove this comment to see the full error message
import Promise from 'bluebird';
// add tiddler
ipcRenderer.on('wiki-add-tiddler', async (event, title, text, meta) => {

View file

@ -1,22 +1,13 @@
/* eslint-disable global-require */
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fs'.
import fs from 'fs';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
import { logger } from '../log';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'commitAndS... Remove this comment to see the full error message
import { commitAndSync } from '../git';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'watchWiki'... Remove this comment to see the full error message
import { watchWiki, stopWatchWiki } from './watch-wiki';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'startNodeJ... Remove this comment to see the full error message
import startNodeJSWiki from './start-nodejs-wiki';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'stopWiki'.
import { stopWiki, startWiki } from './wiki-worker-mamager';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'TIDDLERS_P... Remove this comment to see the full error message
import { TIDDLERS_PATH } from '../../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { getPreference } from '../preferences';
// prevent private wiki try to restart wiki on start-up, where there will be several subsequent wikiStartup() call
@ -61,4 +52,4 @@ export default async function wikiStartup(workspace: any) {
await watchWiki(mainWikiPath, githubRepoUrl, userInfo);
}
}
};
}

View file

@ -1,16 +1,11 @@
/* eslint-disable global-require */
/* eslint-disable no-console */
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'Worker'.
import { Worker } from 'worker_threads';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'isDev'.
import isDev from 'electron-is-dev';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'Promise'.
// @ts-expect-error ts-migrate(2529) FIXME: Duplicate identifier 'Promise'. Compiler reserves ... Remove this comment to see the full error message
import Promise from 'bluebird';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
import { logger } from '../log';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'wikiOutput... Remove this comment to see the full error message
import { wikiOutputToFile, refreshOutputFile } from '../log/wiki-output';
// worker should send payload in form of `{ message: string, handler: string }` where `handler` is the name of function to call
const logMessage = (loggerMeta: any) => (message: any) => {
@ -45,7 +40,6 @@ export function startWiki(homePath: any, tiddlyWikiPort: any, userName: any) {
}
setWorkspaceMeta(workspaceID, { isLoading: true });
const workerData = { homePath, userName, tiddlyWikiPort };
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ workerData: { homePath: any; u... Remove this comment to see the full error message
const worker = new Worker(WIKI_WORKER_PATH, { workerData });
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
wikiWorkers[homePath] = worker;
@ -63,7 +57,6 @@ export function startWiki(homePath: any, tiddlyWikiPort: any, userName: any) {
delete wikiWorkers[homePath];
}
logger.warning(`NodeJSWiki ${homePath} Worker stopped with exit code ${code}.`, loggerMeta);
// @ts-expect-error ts-migrate(2794) FIXME: Expected 1 arguments, but got 0. Did you forget to... Remove this comment to see the full error message
resolve();
});
(worker as any).on('message', (message: any) => {
@ -79,7 +72,6 @@ export function startWiki(homePath: any, tiddlyWikiPort: any, userName: any) {
if (get()) {
get().close();
}
// @ts-expect-error ts-migrate(2794) FIXME: Expected 1 arguments, but got 0. Did you forget to... Remove this comment to see the full error message
resolve();
}, 100);
}
@ -90,8 +82,7 @@ export function startWiki(homePath: any, tiddlyWikiPort: any, userName: any) {
wikiOutputToFile(logFileName, (worker as any).stdout);
wikiOutputToFile(logFileName, (worker as any).stderr);
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'stopWiki'.
}
export async function stopWiki(homePath: any) {
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const worker = wikiWorkers[homePath];
@ -131,4 +122,4 @@ export async function stopAllWiki() {
// try to prevent https://github.com/electron/electron/issues/23315, but seems not working at all
await (Promise as any).delay(100);
logger.info('All wiki-worker is stopped', { function: 'stopAllWiki' });
};
}

View file

@ -1,9 +1,7 @@
const { workerData, parentPort, isMainThread } = require('worker_threads');
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
const path = require('path');
const $tw = require('@tiddlygit/tiddlywiki').TiddlyWiki();
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'startNodeJ... Remove this comment to see the full error message
function startNodeJSWiki() {
const { homePath, tiddlyWikiPort = 5112, userName } = workerData;
try {

View file

@ -1,4 +1,3 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// to keep workspace variables (meta) that
@ -6,13 +5,11 @@ import sendToAllWindows from './send-to-all-windows';
// badge count, error, etc
const workspaceMetas = {};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const getWorkspaceMeta = (id: any) => workspaceMetas[id] || {};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
const getWorkspaceMetas = () => workspaceMetas;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
const setWorkspaceMeta = (id: any, options: any) => {
// init
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message

View file

@ -1,38 +1,22 @@
// @ts-expect-error ts-migrate(6200) FIXME: Definitions of the following identifiers conflict ... Remove this comment to see the full error message
import { app, session } from 'electron';
import {
countWorkspaces,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'createWork... Remove this comment to see the full error message
createWorkspace,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getActiveW... Remove this comment to see the full error message
getActiveWorkspace,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPreviou... Remove this comment to see the full error message
getPreviousWorkspace,
getWorkspace,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
getWorkspaces,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'removeWork... Remove this comment to see the full error message
removeWorkspace,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setActiveW... Remove this comment to see the full error message
setActiveWorkspace,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
setWorkspace,
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
setWorkspaces,
setWorkspacePicture,,,
setWorkspacePicture,
} from './workspaces';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'addView'.
import { addView, hibernateView, removeView, setActiveView, setViewsAudioPref, setViewsNotificationsPref, realignActiveView } from './views';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from '../windows/main';
const createWorkspaceView = (
@ -87,7 +71,6 @@ const hibernateWorkspaceView = (id: any) => {
}
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setActiveW... Remove this comment to see the full error message
const setActiveWorkspaceView = (id: any) => {
const oldActiveWorkspace = getActiveWorkspace();
@ -95,7 +78,9 @@ const setActiveWorkspaceView = (id: any) => {
setActiveView(mainWindow.get(), id);
// hibernate old view
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
if (oldActiveWorkspace.hibernateWhenUnused && oldActiveWorkspace.id !== id) {
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
hibernateWorkspaceView(oldActiveWorkspace.id);
}
};
@ -110,6 +95,7 @@ const removeWorkspaceView = (id: any) => {
sendToAllWindows('update-title', '');
}
} else if (countWorkspaces() > 1 && getWorkspace(id).active) {
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
setActiveWorkspaceView(getPreviousWorkspace(id).id);
}
@ -134,6 +120,7 @@ const loadURL = (url: any, id: any) => {
setActiveView(mainWindow.get(), id);
}
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const v = mainWindow.get().getBrowserView();
if (v) {
v.webContents.focus();
@ -145,6 +132,7 @@ const realignActiveWorkspaceView = () => {
const activeWorkspace = getActiveWorkspace();
const win = mainWindow.get();
if (activeWorkspace && win) {
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
realignActiveView(win, activeWorkspace.id);
}
};

View file

@ -1,10 +1,6 @@
// @ts-expect-error ts-migrate(6200) FIXME: Definitions of the following identifiers conflict ... Remove this comment to see the full error message
import { app } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'fsExtra'.
import fsExtra from 'fs-extra';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'settings'.
import settings from 'electron-settings';
import { v1 as uuidv1 } from 'uuid';
import Jimp from 'jimp';
@ -12,22 +8,18 @@ import isUrl from 'is-url';
import download from 'download';
import tmp from 'tmp';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'sendToAllW... Remove this comment to see the full error message
import sendToAllWindows from './send-to-all-windows';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'wikiStartu... Remove this comment to see the full error message
import wikiStartup from './wiki/wiki-startup';
import { stopWatchWiki } from './wiki/watch-wiki';
import { stopWiki } from './wiki/wiki-worker-mamager';
import { updateSubWikiPluginContent } from './wiki/update-plugin-content';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'v'.
const v = '14';
let workspaces: any;
const countWorkspaces = () => Object.keys(workspaces).length;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
const getWorkspaces = () => {
if (workspaces) return workspaces;
@ -39,7 +31,6 @@ const getWorkspaces = () => {
return workspaces;
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
const getWorkspacesAsList = () => {
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const workspaceLst = Object.values(getWorkspaces()).sort((a, b) => a.order - b.order);
@ -51,7 +42,6 @@ const getWorkspace = (id: any) => workspaces[id];
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const getWorkspaceByName = (name: any) => getWorkspacesAsList().find((workspace) => workspace.name === name);
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPreviou... Remove this comment to see the full error message
const getPreviousWorkspace = (id: any) => {
const workspaceLst = getWorkspacesAsList();
@ -70,7 +60,6 @@ const getPreviousWorkspace = (id: any) => {
return workspaceLst[currentWorkspaceI - 1];
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getNextWor... Remove this comment to see the full error message
const getNextWorkspace = (id: any) => {
const workspaceLst = getWorkspacesAsList();
@ -89,23 +78,27 @@ const getNextWorkspace = (id: any) => {
return workspaceLst[currentWorkspaceI + 1];
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getActiveW... Remove this comment to see the full error message
const getActiveWorkspace = () => {
if (!workspaces) return null;
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
return Object.values(workspaces).find((workspace) => workspace.active);
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setActiveW... Remove this comment to see the full error message
const setActiveWorkspace = (id: any) => {
// deactive the current one
let currentActiveWorkspace = getActiveWorkspace();
if (currentActiveWorkspace) {
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
if (currentActiveWorkspace.id === id) return;
// @ts-expect-error ts-migrate(2698) FIXME: Spread types may only be created from object types... Remove this comment to see the full error message
currentActiveWorkspace = { ...currentActiveWorkspace };
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
currentActiveWorkspace.active = false;
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
workspaces[currentActiveWorkspace.id] = currentActiveWorkspace;
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
sendToAllWindows('set-workspace', currentActiveWorkspace.id, currentActiveWorkspace);
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
settings.setSync(`workspaces.${v}.${currentActiveWorkspace.id}`, currentActiveWorkspace);
}
@ -118,7 +111,6 @@ const setActiveWorkspace = (id: any) => {
settings.setSync(`workspaces.${v}.${id}`, newActiveWorkspace);
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
const setWorkspace = (id: any, options: any) => {
const workspace = { ...workspaces[id], ...options };
// set fileSystemPaths on sub-wiki setting update
@ -136,7 +128,6 @@ const setWorkspace = (id: any, options: any) => {
settings.setSync(`workspaces.${v}.${id}`, workspace);
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'setWorkspa... Remove this comment to see the full error message
const setWorkspaces = (newWorkspaces: any) => {
workspaces = newWorkspaces;
sendToAllWindows('set-workspaces', newWorkspaces);
@ -199,7 +190,6 @@ const removeWorkspacePicture = (id: any) => {
return Promise.resolve();
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'removeWork... Remove this comment to see the full error message
const removeWorkspace = (id: any) => {
const { name } = workspaces[id];
stopWiki(name);
@ -209,7 +199,6 @@ const removeWorkspace = (id: any) => {
settings.unsetSync(`workspaces.${v}.${id}`);
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'createWork... Remove this comment to see the full error message
const createWorkspace = (name: any, isSubWiki: any, mainWikiToLink: any, port: any, homeUrl: any, gitUrl: any, transparentBackground: any, tagName: any) => {
const newId = uuidv1();

View file

@ -1,11 +1,8 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'ipcMain'.
import { ipcMain } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from '../windows/main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainBindin... Remove this comment to see the full error message
import { mainBindings } from '../libs/i18next-electron-fs-backend';
export default function bindI18nListener() {
mainBindings(ipcMain, mainWindow.get());
};
}

View file

@ -1,27 +1,16 @@
/* eslint-disable sonarjs/no-duplicate-string */
/* eslint-disable no-param-reassign */
// @ts-expect-error ts-migrate(6200) FIXME: Definitions of the following identifiers conflict ... Remove this comment to see the full error message
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserVie... Remove this comment to see the full error message
import { BrowserView, Notification, app, dialog, ipcMain, nativeTheme, shell } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'autoUpdate... Remove this comment to see the full error message
import { autoUpdater } from 'electron-updater';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'initWikiGi... Remove this comment to see the full error message
import { initWikiGit, getRemoteUrl } from '../libs/git';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'stopWatchW... Remove this comment to see the full error message
import { stopWatchWiki } from '../libs/wiki/watch-wiki';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'updateSubW... Remove this comment to see the full error message
import { updateSubWikiPluginContent, getSubWikiPluginContent } from '../libs/wiki/update-plugin-content';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'stopWiki'.
import { stopWiki, startWiki } from '../libs/wiki/wiki-worker-mamager';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'logger'.
import { logger } from '../libs/log';
import { createWiki, createSubWiki, removeWiki, ensureWikiExist, cloneWiki, cloneSubWiki } from '../libs/wiki/create-wiki';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'ICON_PATH'... Remove this comment to see the full error message
import { ICON_PATH, REACT_PATH, DESKTOP_PATH, LOG_FOLDER, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { ICON_PATH, REACT_PATH, DESKTOP_PATH, LOG_FOLDER, isDev as isDevelopment } from '../constants/paths';
import { getPreference, getPreferences, resetPreferences, setPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getSystemP... Remove this comment to see the full error message
import { getSystemPreference, getSystemPreferences, setSystemPreference } from '../libs/system-preferences';
import {
countWorkspaces,
@ -32,7 +21,6 @@ import {
setWorkspacePicture,
removeWorkspacePicture,
} from '../libs/workspaces';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getWorkspa... Remove this comment to see the full error message
import { getWorkspaceMeta, getWorkspaceMetas } from '../libs/workspace-metas';
import {
clearBrowsingData,
@ -46,23 +34,31 @@ import {
wakeUpWorkspaceView,
realignActiveWorkspaceView,
} from '../libs/workspaces-views';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18n'.
import index18n from '../libs/i18n';
import { reloadViewsDarkReader, reloadViewsWebContentsIfDidFailLoad, getActiveBrowserView } from '../libs/views';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'updatePaus... Remove this comment to see the full error message
import { updatePauseNotificationsInfo, getPauseNotificationsInfo } from '../libs/notifications';
import getViewBounds from '../libs/get-view-bounds';
import createMenu from '../libs/create-menu';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import aboutWindow from '../windows/about';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import addWorkspaceWindow from '../windows/add-workspace';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import codeInjectionWindow from '../windows/code-injection';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import customUserAgentWindow from '../windows/custom-user-agent';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import displayMediaWindow from '../windows/display-media';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import editWorkspaceWindow from '../windows/edit-workspace';
import * as mainWindow from '../windows/main';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import notificationsWindow from '../windows/notifications';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import preferencesWindow from '../windows/preferences';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import proxyWindow from '../windows/proxy';
// @ts-expect-error ts-migrate(1192) FIXME: Module '"/Users/linonetwo/Desktop/repo/TiddlyGit-D... Remove this comment to see the full error message
import spellcheckLanguagesWindow from '../windows/spellcheck-languages';
import bindI18nListener from './i18n';
const loadListeners = () => {
@ -119,7 +115,7 @@ const loadListeners = () => {
REACT_PATH,
DESKTOP_PATH,
LOG_FOLDER,
isDev,
isDev: isDevelopment,
}[name];
});
ipcMain.on('get-basename', (event, pathString) => {
@ -134,6 +130,7 @@ const loadListeners = () => {
return '';
} catch (error) {
console.info(error);
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2-3 arguments, but got 1.
removeWiki(wikiFolderPath);
return String(error);
}
@ -159,6 +156,7 @@ const loadListeners = () => {
});
// Find In Page
ipcMain.on('request-find-in-page', (_, text, forward) => {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const contents = mainWindow.get().getBrowserView().webContents;
contents.findInPage(text, {
forward,
@ -166,13 +164,17 @@ const loadListeners = () => {
});
ipcMain.on('request-stop-find-in-page', (_, close) => {
const win = mainWindow.get();
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const view = win.getBrowserView();
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
const contents = view.webContents;
contents.stopFindInPage('clearSelection');
win.send('update-find-in-page-matches', 0, 0);
(win as any).send('update-find-in-page-matches', 0, 0);
// adjust bounds to hide the gap for find in page
if (close) {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const contentSize = win.getContentSize();
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
view.setBounds(getViewBounds(contentSize));
}
});
@ -289,7 +291,7 @@ const loadListeners = () => {
event.returnValue = getWorkspaces();
});
ipcMain.handle('get-workspaces-remote', async (event, wikiFolderPath) => {
return getRemoteUrl(wikiFolderPath);
return await getRemoteUrl(wikiFolderPath);
});
ipcMain.handle('request-create-workspace', (event, name, isSubWiki, mainWikiToLink, port, homeUrl, gitUrl, picture, transparentBackground, tagName) => {
createWorkspaceView(name, isSubWiki, mainWikiToLink, port, homeUrl, gitUrl, picture, transparentBackground, tagName);
@ -322,6 +324,7 @@ const loadListeners = () => {
createMenu();
// load url in the current workspace
const activeWorkspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
loadURL(url, activeWorkspace.id);
}
});
@ -334,6 +337,7 @@ const loadListeners = () => {
ipcMain.on('request-remove-workspace', (_, id) => {
// eslint-disable-next-line promise/catch-or-return
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), {
type: 'question',
buttons: [index18n.t('WorkspaceSelector.RemoveWorkspace'), index18n.t('WorkspaceSelector.RemoveWorkspaceAndDelete'), index18n.t('Cancel')],
@ -355,6 +359,7 @@ const loadListeners = () => {
const mainWorkspace = getWorkspaceByName(mainWikiPath);
const userName = getPreference('userName') || '';
await stopWiki(mainWikiPath);
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
await startWiki(mainWikiPath, mainWorkspace.port, userName);
// remove folderName from fileSystemPaths
if (workspace.isSubWiki) {
@ -405,43 +410,49 @@ const loadListeners = () => {
ipcMain.on('request-go-home', () => {
const win = mainWindow.get();
if (win !== undefined && win.getBrowserView() !== undefined) {
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
const contents = win.getBrowserView().webContents;
const activeWorkspace = getActiveWorkspace();
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
contents.loadURL(activeWorkspace.homeUrl);
win.send('update-can-go-back', contents.canGoBack());
win.send('update-can-go-forward', contents.canGoForward());
(win as any).send('update-can-go-back', contents.canGoBack());
(win as any).send('update-can-go-forward', contents.canGoForward());
}
});
ipcMain.on('request-go-back', () => {
const win = mainWindow.get();
if (win !== undefined && win.getBrowserView() !== undefined) {
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
const contents = win.getBrowserView().webContents;
if (contents.canGoBack()) {
contents.goBack();
win.send('update-can-go-back', contents.canGoBack());
win.send('update-can-go-forward', contents.canGoForward());
(win as any).send('update-can-go-back', contents.canGoBack());
(win as any).send('update-can-go-forward', contents.canGoForward());
}
}
});
ipcMain.on('request-go-forward', () => {
const win = mainWindow.get();
if (win !== undefined && win.getBrowserView() !== undefined) {
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
const contents = win.getBrowserView().webContents;
if (contents.canGoForward()) {
contents.goForward();
win.send('update-can-go-back', contents.canGoBack());
win.send('update-can-go-forward', contents.canGoForward());
(win as any).send('update-can-go-back', contents.canGoBack());
(win as any).send('update-can-go-forward', contents.canGoForward());
}
}
});
ipcMain.on('request-reload', () => {
const win = mainWindow.get();
if (win !== undefined) {
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
win.getBrowserView().webContents.reload();
}
});
ipcMain.on('request-show-message-box', (_, message, type) => {
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), {
type: type || 'error',
message,
@ -471,6 +482,7 @@ const loadListeners = () => {
// disable updater if user is using AppImageLauncher
if (process.platform === 'linux' && process.env.DESKTOPINTEGRATION === 'AppImageLauncher') {
dialog
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
.showMessageBox(mainWindow.get(), {
type: 'error',
message: 'Updater is incompatible with AppImageLauncher. Please uninstall AppImageLauncher or download new updates manually from our website.',
@ -494,7 +506,8 @@ const loadListeners = () => {
setImmediate(() => {
app.removeAllListeners('window-all-closed');
if (mainWindow.get() !== undefined) {
mainWindow.get().forceClose = true;
(mainWindow.get() as any).forceClose = true;
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
mainWindow.get().close();
}
autoUpdater.quitAndInstall(false);

View file

@ -1,6 +1,4 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
import './common/simple-context-menu';

View file

@ -1,4 +1,3 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
import './common/i18n';

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'auth' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'code-injection' });

View file

@ -1,9 +1,7 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'remote'.
import { remote } from 'electron';
// on production build, if we try to redirect to http://localhost:3000 , we will reach chrome-error://chromewebdata/ , but we can easily get back
// this happens when we are redirected by OAuth login
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'CHROME_ERR... Remove this comment to see the full error message
import { CHROME_ERROR_PATH, REACT_PATH } from '../../constants/paths';
const CHECK_LOADED_INTERVAL = 500;

View file

@ -1,6 +1,4 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge, ipcRenderer } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'preloadBin... Remove this comment to see the full error message
import { preloadBindings } from '../../libs/i18next-electron-fs-backend';
contextBridge.exposeInMainWorld('i18n', {

View file

@ -1,4 +1,3 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge, remote, ipcRenderer, webFrame, desktopCapturer } from 'electron';
contextBridge.exposeInMainWorld('remote', {

View file

@ -1,4 +1,3 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'remote'.
import { remote } from 'electron';
import contextMenu from 'electron-context-menu';

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'custom-user-agent' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'display-media' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'edit-workspace' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'go-to-url' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'main' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'menubar' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'notifications' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'open-url-with' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
import './common/authing-postmessage';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'preferences' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'proxy' });

View file

@ -2,7 +2,6 @@ import './common/simple-context-menu';
import './common/require-nodejs';
import './common/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'contextBri... Remove this comment to see the full error message
import { contextBridge } from 'electron';
contextBridge.exposeInMainWorld('meta', { mode: 'spellcheck-languages' });

View file

@ -1,13 +1,10 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'ipcRendere... Remove this comment to see the full error message
import { ipcRenderer, remote, webFrame } from 'electron';
import { enable as enableDarkMode, disable as disableDarkMode } from 'darkreader';
import ContextMenuBuilder from '../libs/context-menu-builder';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'index18nex... Remove this comment to see the full error message
import index18next from '../libs/i18n';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'MenuItem'.
const { MenuItem, shell } = remote;
import '../libs/wiki/wiki-operation';
import '../libs/git/wiki-git-api';
const { MenuItem, shell } = remote;
// @ts-expect-error ts-migrate(2322) FIXME: Type '{}' is not assignable to type 'Global & type... Remove this comment to see the full error message
window.global = {};
let handled = false;
@ -70,6 +67,7 @@ const handleLoaded = (event: any) => {
console.log(error); // eslint-disable-line no-console
}
}
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1-2 arguments, but got 0.
(window as any).contextMenuBuilder = new ContextMenuBuilder();
remote.getCurrentWebContents().on('context-menu', (e, info) => {
// eslint-disable-next-line promise/catch-or-return

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,10 +24,11 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'about.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -47,10 +40,8 @@ const create = () => {
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = () => {
if (win == undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
create();
} else {
win.show();

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,7 +24,7 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
// @ts-expect-error ts-migrate(1117) FIXME: An object literal cannot have multiple properties ... Remove this comment to see the full error message
enableRemoteModule: true,
@ -49,10 +41,8 @@ const create = () => {
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = () => {
if (win === undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
create();
} else {
win.show();

View file

@ -1,23 +1,17 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow, ipcMain } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
const wins = {};
const emitted = {};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const get = (id: any) => wins[id];
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = (id: any) => {
const attachToMenubar = getPreference('attachToMenubar');
@ -36,10 +30,11 @@ const create = (id: any) => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'auth.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
@ -78,7 +73,6 @@ const create = (id: any) => {
ipcMain.on('request-validate-auth-identity', identityValidationListener);
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = (id: any) => {
// @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (wins[id] == undefined) {

View file

@ -1,19 +1,11 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
let activeType: any = null;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = (type: any) => {
const attachToMenubar = getPreference('attachToMenubar');
activeType = type;
@ -29,10 +21,11 @@ const create = (type: any) => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'code-injection.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -41,7 +34,6 @@ const create = (type: any) => {
win = null;
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = (id: any) => {
if (win == undefined) {
create(id);

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,10 +24,11 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'custom-user-agent.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -47,10 +40,8 @@ const create = () => {
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = () => {
if (win == undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
create();
} else {
win.show();

View file

@ -1,18 +1,10 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow, BrowserView, ipcMain } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
let win: any;
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = (viewId: any) => {
const attachToMenubar = getPreference('attachToMenubar');
(global as any).displayMediaRequestedViewId = viewId;
@ -27,10 +19,11 @@ const create = (viewId: any) => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'display-media.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -50,7 +43,6 @@ const create = (viewId: any) => {
win = null;
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = (viewId: any) => {
if (win == undefined) {
create(viewId);

View file

@ -1,18 +1,10 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
let win: any;
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = (id: any) => {
const attachToMenubar = getPreference('attachToMenubar');
(global as any).editWorkspaceId = id;
@ -27,10 +19,11 @@ const create = (id: any) => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'edit-workspace.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -40,7 +33,6 @@ const create = (id: any) => {
(global as any).editWorkspaceId = null;
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = (id: any) => {
if (win == undefined) {
create(id);

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,10 +24,11 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'go-to-url.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -49,12 +42,13 @@ const create = () => {
const show = (url: any) => {
if (win == undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 0 arguments, but got 1.
create(url);
} else {
win.close();
// @ts-expect-error ts-migrate(2554) FIXME: Expected 0 arguments, but got 1.
create(url);
}
};
export { get, create, show };

View file

@ -3,11 +3,8 @@ import windowStateKeeper from 'electron-window-state';
import { menubar, Menubar } from 'menubar';
import path from 'path';
// @ts-expect-error ts-migrate(2306) FIXME: File '/Users/linonetwo/Desktop/repo/TiddlyGit-Desk... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
// @ts-expect-error ts-migrate(2306) FIXME: File '/Users/linonetwo/Desktop/repo/TiddlyGit-Desk... Remove this comment to see the full error message
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2306) FIXME: File '/Users/linonetwo/Desktop/repo/TiddlyGit-Desk... Remove this comment to see the full error message
import formatBytes from '../libs/format-bytes';
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,10 +24,11 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'notifications.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -47,10 +40,8 @@ const create = () => {
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = () => {
if (win == undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
create();
} else {
win.show();

View file

@ -1,18 +1,10 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = (url: any) => {
const attachToMenubar = getPreference('attachToMenubar');
(global as any).incomingUrl = url;
@ -27,10 +19,11 @@ const create = (url: any) => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'open-url-with.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -39,7 +32,6 @@ const create = (url: any) => {
win = null;
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = (url: any) => {
if (win == undefined) {
create(url);

View file

@ -1,18 +1,10 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
let win: any;
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = (scrollTo: any) => {
const attachToMenubar = getPreference('attachToMenubar');
(global as any).preferencesScrollTo = scrollTo;
@ -27,10 +19,11 @@ const create = (scrollTo: any) => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'preferences.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -40,7 +33,6 @@ const create = (scrollTo: any) => {
(global as any).preferencesScrollTo = null;
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = (scrollTo: any) => {
if (win == undefined) {
create(scrollTo);

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,10 +24,11 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'proxy.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -47,10 +40,8 @@ const create = () => {
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = () => {
if (win == undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
create();
} else {
win.show();

View file

@ -1,23 +1,15 @@
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'BrowserWin... Remove this comment to see the full error message
import { BrowserWindow } from 'electron';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'path'.
import path from 'path';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'REACT_PATH... Remove this comment to see the full error message
import { REACT_PATH, isDev } from '../constants/paths';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'getPrefere... Remove this comment to see the full error message
import { REACT_PATH, isDev as isDevelopment } from '../constants/paths';
import { getPreference } from '../libs/preferences';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'mainWindow... Remove this comment to see the full error message
import * as mainWindow from './main';
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'win'.
let win;
let win: any;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'get'.
const get = () => win;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'create'.
const create = () => {
const attachToMenubar = getPreference('attachToMenubar');
@ -32,10 +24,11 @@ const create = () => {
webPreferences: {
nodeIntegration: false,
enableRemoteModule: true,
webSecurity: !isDev,
webSecurity: !isDevelopment,
contextIsolation: true,
preload: path.join(__dirname, '..', 'preload', 'spellcheck-languages.js'),
},
// @ts-expect-error ts-migrate(2322) FIXME: Type 'BrowserWindow | null | undefined' is not ass... Remove this comment to see the full error message
parent: attachToMenubar ? null : mainWindow.get(),
});
win.setMenuBarVisibility(false);
@ -47,10 +40,8 @@ const create = () => {
});
};
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'show'.
const show = () => {
if (win == undefined) {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
create();
} else {
win.show();