fix: subtitles not working

fix: some performance flags potentially not working
feat: log renderer output in .log files
This commit is contained in:
ThaUnknown 2024-07-04 12:23:44 +02:00
parent 98a9c25ada
commit 248ff4f3c1
4 changed files with 9 additions and 7 deletions

View file

@ -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()

View file

@ -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 })
}
}

View file

@ -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', () => {

View file

@ -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)