The swiss army knife of lossless video/audio editing
remove clipboard usage
Mikael Finstad260601ac6750
diff --git a/src/main/index.ts b/src/main/index.tsindex 49f60f56..5b370855 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -445,6 +445,8 @@ const remoteApi = {quitApp,setProgressBar,sendOsNotification,+ writeClipboardText: (text: string) => electron.clipboard.writeText(text),+ readClipboardText: () => electron.clipboard.readText(),};export type RemoteApi = typeof remoteApi;diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 4f3bf4b0..23cf9fd5 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -122,10 +122,9 @@ import mainApi from './mainApi.js';import type { AppEvent } from '../../main/index.js';import { appName } from '../../main/common.js';-const electron = window.require('electron');-const { lstat } = window.require('fs/promises');-const { parse: parsePath, join: pathJoin, basename, dirname } = window.require('path');-+const { ipcRenderer, webUtils } = window.require('electron');+const { lstat } = window.require('node:fs/promises');+const { parse: parsePath, join: pathJoin, basename, dirname } = window.require('node:path');const { hasDisabledNetworking, pathToFileURL, lossyMode, isLinux } = window.require('@electron/remote').require('./index.js');@@ -134,7 +133,7 @@ const hevcPlaybackSupportedPromise = doesPlayerSupportHevcPlayback();hevcPlaybackSupportedPromise.catch((err) => console.error(err));function emitEvent(appEvent: AppEvent) {- electron.ipcRenderer.send('appEvent', appEvent satisfies AppEvent);+ ipcRenderer.send('appEvent', appEvent satisfies AppEvent);}function App() {@@ -229,7 +228,7 @@ function App() {useEffect(() => {i18n.changeLanguage(language ?? undefined).catch(console.error);- electron.ipcRenderer.send('setLanguage', language);+ ipcRenderer.send('setLanguage', language);}, [language]);const isFileOpened = !!filePath;@@ -1957,7 +1956,7 @@ function App() {const copySegmentsToClipboard = useCallback(async () => {if (!isFileOpened || selectedSegments.length === 0) return;- electron.clipboard.writeText(formatTsvHuman(selectedSegments));+ mainApi.writeClipboardText(formatTsvHuman(selectedSegments));}, [isFileOpened, selectedSegments]);const showIncludeExternalStreamsDialog = useCallback(async () => {@@ -2200,11 +2199,11 @@ function App() {// eslint-disable-next-line unicorn/prefer-add-event-listenerdocument.ondragend = dragPreventer;- electron.ipcRenderer.send('renderer-ready');+ ipcRenderer.send('renderer-ready');}, []);useEffect(() => {- electron.ipcRenderer.send('setAskBeforeClose', askBeforeClose && isFileOpened);+ ipcRenderer.send('setAskBeforeClose', askBeforeClose && isFileOpened);}, [askBeforeClose, isFileOpened]);const extractSingleStream = useCallback(async (index: number) => {@@ -2390,12 +2389,12 @@ function App() {(_event: IpcRendererEvent, ...args: Parameters<typeof fn>) => actionWithCatch(() => fn(...args)),] as const);- ipcActions.forEach(([key, action]) => electron.ipcRenderer.on(key, action));- electron.ipcRenderer.on('apiAction', tryApiAction);+ ipcActions.forEach(([key, action]) => ipcRenderer.on(key, action));+ ipcRenderer.on('apiAction', tryApiAction);return () => {- ipcActions.forEach(([key, action]) => electron.ipcRenderer.off(key, action));- electron.ipcRenderer.off('apiAction', tryApiAction);+ ipcActions.forEach(([key, action]) => ipcRenderer.off(key, action));+ ipcRenderer.off('apiAction', tryApiAction);};}, [checkFileOpened, customOutDir, detectedFps, filePath, getFrameCount, getKeyboardAction, goToTimecodeDirect, handleError, importEdlFile, loadCutSegments, mainActions, promptDownloadMediaUrlWrapper, selectedSegments, toggleKeyboardShortcuts, tryExportEdlFile, userOpenFiles]);@@ -2403,7 +2402,7 @@ function App() {ev.preventDefault();if (!ev.dataTransfer) return;await withErrorHandling(async () => {- const filePaths = [...ev.dataTransfer.files].map((f) => electron.webUtils.getPathForFile(f));+ const filePaths = [...ev.dataTransfer.files].map((f) => webUtils.getPathForFile(f));await mainApi.focusWindow();batchLoadPaths(filePaths, true);});@@ -2413,7 +2412,7 @@ function App() {ev.preventDefault();if (!ev.dataTransfer) return;await withErrorHandling(async () => {- const filePaths = [...ev.dataTransfer.files].map((f) => electron.webUtils.getPathForFile(f));+ const filePaths = [...ev.dataTransfer.files].map((f) => webUtils.getPathForFile(f));if (filePaths.length !== 1) return;await mainApi.focusWindow();addStreamSourceFile(filePaths[0]!);@@ -2424,7 +2423,7 @@ function App() {async function onDrop(ev: DragEvent) {ev.preventDefault();if (!ev.dataTransfer) return;- const filePaths = [...ev.dataTransfer.files].map((f) => electron.webUtils.getPathForFile(f));+ const filePaths = [...ev.dataTransfer.files].map((f) => webUtils.getPathForFile(f));await mainApi.focusWindow();userOpenFiles(filePaths);}diff --git a/src/renderer/src/BottomBar.tsx b/src/renderer/src/BottomBar.tsxindex 59dcd423..963c364b 100644--- a/src/renderer/src/BottomBar.tsx+++ b/src/renderer/src/BottomBar.tsx@@ -29,8 +29,7 @@ import { askForPlaybackRate, checkAppPath } from './dialogs';import type { FormatTimecode, GetFrameCount, ParseTimecode, PlaybackMode, SegmentColorIndex, SegmentToExport, StateSegment } from './types';import type { WaveformMode } from '../../common/types';import type { Frame } from './ffmpeg';--const { clipboard } = window.require('electron');+import mainApi from './mainApi';const zoomOptions = Array.from({ length: 13 }).fill(undefined).map((_unused, z) => 2 ** z);@@ -202,8 +201,8 @@ const CutTimeInput = memo(({ disabled, darkMode, cutTime, setCutTime, startTimeO}}, [parseAndSetCutTime]);- const handleContextMenu = useCallback(() => {- const text = clipboard.readText();+ const handleContextMenu = useCallback(async () => {+ const text = await mainApi.readClipboardText();if (text) {try {setCutTimeManual(text);diff --git a/src/renderer/src/NoFileLoaded.tsx b/src/renderer/src/NoFileLoaded.tsxindex d819cf39..3494a4f1 100644--- a/src/renderer/src/NoFileLoaded.tsx+++ b/src/renderer/src/NoFileLoaded.tsx@@ -13,7 +13,8 @@ import { splitKeyboardKeys } from './util';import { getModifier } from './hooks/useTimelineScroll';import Kbd from './components/Kbd';-const electron = window.require('electron');+const { shell } = window.require('@electron/remote');+function Keys({ keys }: { keys: string | undefined }) {if (keys == null || keys === '') {@@ -88,7 +89,7 @@ function NoFileLoaded({ mifiLink, currentCutSeg, onClick, darkMode, keyBindingBy<div style={{ position: 'relative', margin: '.3em', width: '24em', height: '8em' }}><iframe src={`${mifiLink.loadUrl}#dark=${darkMode ? 'true' : 'false'}`} title="iframe" style={{ background: 'rgba(0,0,0,0)', border: 'none', pointerEvents: 'none', width: '100%', height: '100%', position: 'absolute', colorScheme: 'initial' }} />{/* eslint-disable-next-line jsx-a11y/interactive-supports-focus */}- <div style={{ width: '100%', height: '100%', position: 'absolute', cursor: 'pointer' }} title={t('Open link in browser')} role="button" onClick={(e) => { e.stopPropagation(); if ('targetUrl' in mifiLink && typeof mifiLink.targetUrl === 'string') electron.shell.openExternal(mifiLink.targetUrl); }} />+ <div style={{ width: '100%', height: '100%', position: 'absolute', cursor: 'pointer' }} title={t('Open link in browser')} role="button" onClick={(e) => { e.stopPropagation(); if ('targetUrl' in mifiLink && typeof mifiLink.targetUrl === 'string') shell.openExternal(mifiLink.targetUrl); }} /></div>) : undefined}</motion.div>diff --git a/src/renderer/src/TopMenu.tsx b/src/renderer/src/TopMenu.tsxindex ade811ba..7f0292a4 100644--- a/src/renderer/src/TopMenu.tsx+++ b/src/renderer/src/TopMenu.tsx@@ -15,7 +15,7 @@ import styles from './TopMenu.module.css';import OutDirSelector from './components/OutDirSelector';-const { stat } = window.require('fs/promises');+const { stat } = window.require('node:fs/promises');const { webUtils } = window.require('electron');const outFmtStyle = { maxWidth: 100 };diff --git a/src/renderer/src/components/ConcatDialog.tsx b/src/renderer/src/components/ConcatDialog.tsxindex 88c7d62b..8b866fd0 100644--- a/src/renderer/src/components/ConcatDialog.tsx+++ b/src/renderer/src/components/ConcatDialog.tsx@@ -26,7 +26,7 @@ import type { FileStats } from '../types';import OutDirSelector from './OutDirSelector';import { parseRatio } from '../../../common/util';-const { basename } = window.require('path');+const { basename } = window.require('node:path');const rowStyle: CSSProperties = {diff --git a/src/renderer/src/components/CopyClipboardButton.tsx b/src/renderer/src/components/CopyClipboardButton.tsxindex 7f380991..350bade6 100644--- a/src/renderer/src/components/CopyClipboardButton.tsx+++ b/src/renderer/src/components/CopyClipboardButton.tsx@@ -4,9 +4,7 @@ import { FaClipboard } from 'react-icons/fa';import type { MotionStyle } from 'motion/react';import { motion, useAnimation } from 'motion/react';import { useTranslation } from 'react-i18next';--const electron = window.require('electron');-const { clipboard } = electron;+import mainApi from '../mainApi';function CopyClipboardButton({ text, style, children }: {text: string,@@ -18,7 +16,7 @@ function CopyClipboardButton({ text, style, children }: {const animation = useAnimation();const onClick = useCallback(() => {- clipboard.writeText(text);+ mainApi.writeClipboardText(text);animation.start({scale: [1, 1.5, 1],transition: { duration: 0.2 },diff --git a/src/renderer/src/components/ExportConfirm.tsx b/src/renderer/src/components/ExportConfirm.tsxindex 9b169a64..52085563 100644--- a/src/renderer/src/components/ExportConfirm.tsx+++ b/src/renderer/src/components/ExportConfirm.tsx@@ -35,8 +35,7 @@ import type { FindNearestKeyframeTime } from '../hooks/useKeyframes';import { troubleshootingUrl } from '../../../common/constants';import OutDirSelector from './OutDirSelector';-const remote = window.require('@electron/remote');-const { shell } = remote;+const { shell } = window.require('@electron/remote');const noticeStyle: CSSProperties = { marginBottom: '.5em' };diff --git a/src/renderer/src/components/FileNameTemplateEditor.tsx b/src/renderer/src/components/FileNameTemplateEditor.tsxindex d8e897d8..7be1cddf 100644--- a/src/renderer/src/components/FileNameTemplateEditor.tsx+++ b/src/renderer/src/components/FileNameTemplateEditor.tsx@@ -18,7 +18,7 @@ import * as Dialog from './Dialog';import { dangerColor, warningColor } from '../colors';import { exportedFileNameTemplateHelpUrl } from '../../../common/constants';-const electron = window.require('electron');+const { shell } = window.require('@electron/remote');const formatVariable = (variable: string) => `\${${variable}}`;@@ -231,7 +231,7 @@ function FileNameTemplateEditor(opts: {<div style={{ fontSize: '.9em', color: 'var(--gray-11)', display: 'flex', gap: '.3em', flexWrap: 'wrap', alignItems: 'center', marginBottom: '.7em' }}>{`${t('Variables')}:`}- <IoIosHelpCircle fontSize="1.3em" color="var(--gray-12)" role="button" cursor="pointer" onClick={() => electron.shell.openExternal(exportedFileNameTemplateHelpUrl)} />+ <IoIosHelpCircle fontSize="1.3em" color="var(--gray-12)" role="button" cursor="pointer" onClick={() => shell.openExternal(exportedFileNameTemplateHelpUrl)} />{availableVariables.map((variable) => (<span key={variable} role="button" style={{ cursor: 'copy', marginRight: '.2em', textDecoration: 'underline', textDecorationStyle: 'dashed', fontSize: '.9em' }} onClick={() => onVariableClick(variable)}>{variable}</span>))}diff --git a/src/renderer/src/components/TagEditor.tsx b/src/renderer/src/components/TagEditor.tsxindex ab007359..7dd4d453 100644--- a/src/renderer/src/components/TagEditor.tsx+++ b/src/renderer/src/components/TagEditor.tsx@@ -13,11 +13,10 @@ import { errorToast } from '../swal';import TextInput from './TextInput';import Button from './Button';import Warning from './Warning';+import mainApi from '../mainApi';-const { clipboard } = window.require('electron');-const remote = window.require('@electron/remote');-const { shell } = remote;+const { shell } = window.require('@electron/remote');const activeColor = 'var(--gray-12)';@@ -56,7 +55,7 @@ function TagEditor({ existingTags = emptyObject, customTags = emptyObject, editi}, [editingTag, onTagReset, setEditingTag]);const onPasteClick = useCallback(async () => {- const text = clipboard.readText();+ const text = await mainApi.readClipboardText();try {const json = JSON.parse(text);const newTags = segmentTagsSchema.parse(json);diff --git a/src/renderer/src/components/WhatsNew.tsx b/src/renderer/src/components/WhatsNew.tsxindex 31a4788a..4f520a07 100644--- a/src/renderer/src/components/WhatsNew.tsx+++ b/src/renderer/src/components/WhatsNew.tsx@@ -17,8 +17,7 @@ import { compareReleasesUrl, getReleaseUrl } from '../../../common/constants';// see also generateVersions.tsconst versions: { version: string, highlightsMd?: string | undefined }[] = versionsJson;-const remote = window.require('@electron/remote');-const { shell } = remote;+const { shell } = window.require('@electron/remote');export default function WhatsNew() {const { t } = useTranslation();diff --git a/src/renderer/src/dialogs/index.tsx b/src/renderer/src/dialogs/index.tsxindex 1217d58a..400b6593 100644--- a/src/renderer/src/dialogs/index.tsx+++ b/src/renderer/src/dialogs/index.tsx@@ -16,11 +16,8 @@ import getSwal from '../swal';import isDev from '../isDev';import mainApi from '../mainApi';-const { lstat } = window.require('fs/promises');-const remote = window.require('@electron/remote');-const electron = window.require('electron');-const { clipboard } = electron;-const { dialog } = remote;+const { lstat } = window.require('node:fs/promises');+const { dialog } = window.require('@electron/remote');// https://github.com/mifi/lossless-cut/issues/1495@@ -455,7 +452,7 @@ export async function openYouTubeChaptersDialog(text: string) {});if (isConfirmed) {- clipboard.writeText(text);+ mainApi.writeClipboardText(text);}}diff --git a/src/renderer/src/edlStore.ts b/src/renderer/src/edlStore.tsindex e822edd9..e9edf0e0 100644--- a/src/renderer/src/edlStore.ts+++ b/src/renderer/src/edlStore.ts@@ -11,9 +11,9 @@ import { llcProjectV1Schema, llcProjectV2Schema } from './types';import { mapSaveableSegments } from './segments';import isDev from './isDev';-const { readFile, writeFile } = window.require('fs/promises');+const { readFile, writeFile } = window.require('node:fs/promises');const cueParser = window.require('cue-parser');-const { basename } = window.require('path');+const { basename } = window.require('node:path');const { dialog } = window.require('@electron/remote');diff --git a/src/renderer/src/hooks/useDirectoryAccess.ts b/src/renderer/src/hooks/useDirectoryAccess.tsindex ba69f792..a133d738 100644--- a/src/renderer/src/hooks/useDirectoryAccess.ts+++ b/src/renderer/src/hooks/useDirectoryAccess.ts@@ -10,7 +10,7 @@ import mainApi from '../mainApi';// import isDev from '../isDev';-const { lstat } = window.require('fs/promises');+const { lstat } = window.require('node:fs/promises');// MacOS App Store sandbox doesn't allow reading/writing anywhere,diff --git a/src/renderer/src/hooks/useFfmpegOperations.ts b/src/renderer/src/hooks/useFfmpegOperations.tsindex 37562429..565f8a39 100644--- a/src/renderer/src/hooks/useFfmpegOperations.ts+++ b/src/renderer/src/hooks/useFfmpegOperations.ts@@ -18,8 +18,8 @@ import { UserFacingError } from '../../errors';import mainApi from '../mainApi';import { formatFfmpegNumber, getHwaccelArgs } from '../../../common/util';-const { join, resolve, dirname } = window.require('path');-const { writeFile, mkdir, access, constants: { W_OK } } = window.require('fs/promises');+const { join, resolve, dirname } = window.require('node:path');+const { writeFile, mkdir, access, constants: { W_OK } } = window.require('node:fs/promises');export class OutputNotWritableError extends Error {diff --git a/src/renderer/src/hooks/useFrameCapture.ts b/src/renderer/src/hooks/useFrameCapture.tsindex 56121286..78812f21 100644--- a/src/renderer/src/hooks/useFrameCapture.ts+++ b/src/renderer/src/hooks/useFrameCapture.ts@@ -10,7 +10,7 @@ import type { FormatTimecode } from '../types';import type { CaptureFormat } from '../../../common/types';const mime = window.require('mime-types');-const { rename, readdir, writeFile } = window.require('fs/promises');+const { rename, readdir, writeFile } = window.require('node:fs/promises');function getFrameFromVideo(video: HTMLVideoElement, format: CaptureFormat, quality: number) {diff --git a/src/renderer/src/hooks/useNativeMenu.ts b/src/renderer/src/hooks/useNativeMenu.tsindex 2322a799..44a2dd06 100644--- a/src/renderer/src/hooks/useNativeMenu.ts+++ b/src/renderer/src/hooks/useNativeMenu.ts@@ -1,10 +1,9 @@-import type { Menu as MenuType, MenuItemConstructorOptions, MenuItem } from 'electron';+import type { MenuItemConstructorOptions, MenuItem } from 'electron';import { useCallback, useMemo } from 'react';// TODO pull out?-const remote = window.require('@electron/remote');+const { getCurrentWindow, Menu } = window.require('@electron/remote');// eslint-disable-next-line prefer-destructuring-const Menu: typeof MenuType = remote.Menu;// https://github.com/transflow/use-electron-context-menu// https://www.electronjs.org/docs/latest/api/menu-item@@ -19,7 +18,7 @@ export default function useNativeMenu(const openMenu = useCallback((e: MouseEvent) => {// @ts-expect-error todo type thismenu.popup({- window: remote.getCurrentWindow(),+ window: getCurrentWindow(),x,y,callback: onClose,diff --git a/src/renderer/src/hooks/useSegments.tsx b/src/renderer/src/hooks/useSegments.tsxindex ac3c6ad5..69563906 100644--- a/src/renderer/src/hooks/useSegments.tsx+++ b/src/renderer/src/hooks/useSegments.tsx@@ -34,8 +34,8 @@ import type { Segment as ScopeSegment } from '../../../common/userTypes';import type { FfmpegHwAccel } from '../../../common/types';const remote = window.require('@electron/remote');-const { shell } = remote;const { ffmpeg: { blackDetect, silenceDetect } } = remote.require('./index.js');+const { shell } = remote;type ParameterDialogParameters = Record<string, string>;diff --git a/src/renderer/src/hooks/useStreamsMeta.tsx b/src/renderer/src/hooks/useStreamsMeta.tsxindex dbb50f19..8a02cbe5 100644--- a/src/renderer/src/hooks/useStreamsMeta.tsx+++ b/src/renderer/src/hooks/useStreamsMeta.tsx@@ -14,8 +14,7 @@ import ExpressionDialog from '../components/ExpressionDialog';import type { ShowGenericDialog } from '../components/GenericDialog';import { changeEnabledStreamsExpressionHelpUrl } from '../../../common/constants';-const remote = window.require('@electron/remote');-const { shell } = remote;+const { shell } = window.require('@electron/remote');export default function useStreamsMeta({ mainStreams, externalFilesMeta, filePath, autoExportExtraStreams, showGenericDialog }: {diff --git a/src/renderer/src/hooks/useUserSettingsRoot.ts b/src/renderer/src/hooks/useUserSettingsRoot.tsindex 3be66151..4730ad4a 100644--- a/src/renderer/src/hooks/useUserSettingsRoot.ts+++ b/src/renderer/src/hooks/useUserSettingsRoot.ts@@ -8,8 +8,9 @@ import { errorToast } from '../swal';import isDev from '../isDev';import { mySpring, emitter as animationsEmitter } from '../animations';-const { configStore } = window.require('@electron/remote').require('./index.js');-const { systemPreferences } = window.require('@electron/remote');+const remote = window.require('@electron/remote');+const { systemPreferences } = remote;+const { configStore } = remote.require('./index.js');const animationSettings = systemPreferences.getAnimationSettings();diff --git a/src/renderer/src/i18n.ts b/src/renderer/src/i18n.tsindex a183c34d..f7df35bb 100644--- a/src/renderer/src/i18n.ts+++ b/src/renderer/src/i18n.ts@@ -4,6 +4,7 @@ import { initReactI18next } from 'react-i18next';const Backend = window.require('i18next-fs-backend');const remote = window.require('@electron/remote');+const { app } = remote;const { i18n: { commonI18nOptions, loadPath, addPath } } = remote.require('./index.js');@@ -13,7 +14,7 @@ const { i18n: { commonI18nOptions, loadPath, addPath } } = remote.require('./ind// https://github.com/i18next/i18next/issues/869i18n.use(Backend)- .use({ type: 'languageDetector', async: false, detect: () => remote.app.getLocale() })+ .use({ type: 'languageDetector', async: false, detect: () => app.getLocale() }).use(initReactI18next)// See also i18next.config.base.ts.init({diff --git a/src/renderer/src/index.tsx b/src/renderer/src/index.tsxindex 5e955eb5..a326c769 100644--- a/src/renderer/src/index.tsx+++ b/src/renderer/src/index.tsx@@ -1,7 +1,7 @@import { Suspense, StrictMode } from 'react';import { createRoot } from 'react-dom/client';import { enableMapSet } from 'immer';-import type * as Electron from 'electron';+import type * as ElectronRenderer from 'electron/renderer';import type Remote from '@electron/remote';import type path from 'node:path';import type fsPromises from 'node:fs/promises';@@ -47,10 +47,8 @@ declare global {interface Window {require: <T extends string>(module: T) => (T extends '@electron/remote' ? TypedRemote :- T extends 'electron' ? typeof Electron :- T extends 'path' ? typeof path :+ T extends 'electron' ? typeof ElectronRenderer :T extends 'node:path' ? typeof path :- T extends 'fs/promises' ? typeof fsPromises :T extends 'node:fs/promises' ? typeof fsPromises :T extends 'mime-types' ? typeof mimeTypes :T extends 'i18next-fs-backend' ? typeof i18nextFsBackend :diff --git a/src/renderer/src/reporting.tsx b/src/renderer/src/reporting.tsxindex 50601e27..082bbd7f 100644--- a/src/renderer/src/reporting.tsx+++ b/src/renderer/src/reporting.tsx@@ -6,10 +6,8 @@ import { isStoreBuild, isMasBuild, isWindowsStoreBuild, isExecaError, appVersionimport getSwal from './swal';import { discussionsUrl, githubUrl, publicBugReportUrl, supportEmail } from '../../common/constants';-const electron = window.require('electron');-const remote = window.require('@electron/remote');-+const { shell } = remote;const { platform, arch } = remote.require('./index.js');@@ -22,14 +20,14 @@ export function openSendReportDialog({ err, message, state }: {}) {const reportInstructions = isStoreBuild? (- <p><Trans>Please send an email to <span className="link-button" role="button" onClick={() => electron.shell.openExternal(`mailto:${supportEmail}`)}>{supportEmail}</span> where you describe what you were doing.</Trans></p>+ <p><Trans>Please send an email to <span className="link-button" role="button" onClick={() => shell.openExternal(`mailto:${supportEmail}`)}>{supportEmail}</span> where you describe what you were doing.</Trans></p>) : (<Trans><p>- If you're having a problem or question about LosslessCut, please first check the links in the <b>Help</b> menu. If you cannot find any resolution, you may ask a question in <span className="link-button" role="button" onClick={() => electron.shell.openExternal(discussionsUrl)}>GitHub discussions</span> or on <span className="link-button" role="button" onClick={() => electron.shell.openExternal(githubUrl)}>Discord.</span>+ If you're having a problem or question about LosslessCut, please first check the links in the <b>Help</b> menu. If you cannot find any resolution, you may ask a question in <span className="link-button" role="button" onClick={() => shell.openExternal(discussionsUrl)}>GitHub discussions</span> or on <span className="link-button" role="button" onClick={() => shell.openExternal(githubUrl)}>Discord.</span></p><p>- If you believe that you found a bug in LosslessCut, you may <span className="link-button" role="button" onClick={() => electron.shell.openExternal(publicBugReportUrl)}>report a bug</span>.+ If you believe that you found a bug in LosslessCut, you may <span className="link-button" role="button" onClick={() => shell.openExternal(publicBugReportUrl)}>report a bug</span>.</p></Trans>);diff --git a/src/renderer/src/util.ts b/src/renderer/src/util.tsindex e107ff54..d00e68d9 100644--- a/src/renderer/src/util.ts+++ b/src/renderer/src/util.ts@@ -14,14 +14,15 @@ import type { EnableImportChapters, Html5ifyMode } from '../../common/types';import { UserFacingError } from '../errors';import type { FFprobeFormat } from '../../common/ffprobe';-const { dirname, parse: parsePath, join, extname, isAbsolute, resolve, basename } = window.require('path');-const { stat, lstat, readdir, utimes, unlink, open, access, constants: { R_OK, W_OK } } = window.require('fs/promises');-const { ipcRenderer } = window.require('electron');+const { dirname, parse: parsePath, join, extname, isAbsolute, resolve, basename } = window.require('node:path');+const { stat, lstat, readdir, utimes, unlink, open, access, constants: { R_OK, W_OK } } = window.require('node:fs/promises');const remote = window.require('@electron/remote');+const { app } = remote;const { isWindows, isMac } = remote.require('./index.js');+const { ipcRenderer } = window.require('electron');-const appVersion = remote.app.getVersion();-const appPath = remote.app.getAppPath();+const appVersion = app.getVersion();+const appPath = app.getAppPath();export { isWindows, isMac, appVersion, appPath };diff --git a/src/renderer/src/util/outputNameTemplate.ts b/src/renderer/src/util/outputNameTemplate.tsindex 98f16e84..d43be543 100644--- a/src/renderer/src/util/outputNameTemplate.ts+++ b/src/renderer/src/util/outputNameTemplate.ts@@ -26,7 +26,7 @@ export const segTagsVariable = 'SEG_TAGS';// I don't remember why I set it to 200, but on Windows max length seems to be 256, on MacOS it seems to be 255.export const maxFileNameLength = 250;-const { parse: parsePath, sep: pathSep, join: pathJoin, normalize: pathNormalize, basename }: PlatformPath = window.require('path');+const { parse: parsePath, sep: pathSep, join: pathJoin, normalize: pathNormalize, basename }: PlatformPath = window.require('node:path');export interface GeneratedOutFileNames {