diff --git a/common/modules/webtorrent.js b/common/modules/webtorrent.js index d209362..5c88fc1 100644 --- a/common/modules/webtorrent.js +++ b/common/modules/webtorrent.js @@ -245,16 +245,16 @@ export default class TorrentClient extends WebTorrent { case 'current': { if (data.data) { const torrent = await this.get(data.data.current.infoHash) - if (!torrent) return + if (!torrent || torrent.destroyed) return const found = torrent.files.find(file => file.path === data.data.current.path) - if (!found) return + if (!found || found._destroyed) return if (this.playerProcess) { this.playerProcess.kill() this.playerProcess = null } if (this.current) { this.current.removeAllListeners('stream') - this.current.deselect() + if (!this.current._destroyed) this.current.deselect() } this.parser?.destroy() found.select() diff --git a/common/views/Player/Player.svelte b/common/views/Player/Player.svelte index bc0ea70..d35156f 100644 --- a/common/views/Player/Player.svelte +++ b/common/views/Player/Player.svelte @@ -175,8 +175,6 @@ subs = null } current = file - emit('current', current) - client.send('current', { current: file, external: settings.value.enableExternal }) if (!settings.value.enableExternal) { src = file.url subs = new Subtitles(video, files, current, handleHeaders) @@ -190,6 +188,8 @@ } client.on('externalWatched', watchedListener) } + emit('current', current) + client.send('current', { current: file, external: settings.value.enableExternal }) } } diff --git a/electron/src/main/updater.js b/electron/src/main/updater.js index a869281..ef426f9 100644 --- a/electron/src/main/updater.js +++ b/electron/src/main/updater.js @@ -2,6 +2,7 @@ import log from 'electron-log' import { autoUpdater } from 'electron-updater' import { ipcMain } from 'electron' +log.initialize({ spyRendererConsole: true }) log.transports.file.level = 'info' autoUpdater.logger = log ipcMain.on('update', () => { diff --git a/electron/src/main/util.js b/electron/src/main/util.js index 9fe224f..ec039ee 100644 --- a/electron/src/main/util.js +++ b/electron/src/main/util.js @@ -6,15 +6,16 @@ export const development = process.env.NODE_ENV?.trim() === 'development' const flags = [ // not sure if safe? ['disable-gpu-sandbox'], ['disable-direct-composition-video-overlays'], ['double-buffer-compositing'], ['enable-zero-copy'], ['ignore-gpu-blocklist'], + ['force_high_performance_gpu'], // should be safe ['enable-hardware-overlays', 'single-fullscreen,single-on-top,underlay'], // safe performance stuff ['enable-features', 'PlatformEncryptedDolbyVision,CanvasOopRasterization,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation'], + ['disable-renderer-backgrounding'], // disabling shit, vulkan rendering, widget layering aka right click context menus [I think] for macOS [I think] ['disable-features', 'Vulkan,WidgetLayering'], // utility stuff, aka website security that's useless for a native app: - ['autoplay-policy', 'no-user-gesture-required'], ['disable-notifications'], ['disable-logging'], ['disable-permissions-api'], ['no-sandbox'], ['no-zygote'], ['bypasscsp-schemes'], - ['force_high_performance_gpu', 'disable-renderer-backgroundin'] + ['autoplay-policy', 'no-user-gesture-required'], ['disable-notifications'], ['disable-logging'], ['disable-permissions-api'], ['no-sandbox'], ['no-zygote'], ['bypasscsp-schemes'] ] for (const [flag, value] of flags) { app.commandLine.appendSwitch(flag, value)