diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 867c44d..70cda24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: - name: Setup PNPM uses: pnpm/action-setup@v4 with: - version: 9.4.0 + version: 9.15.4 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/common/components/Menubar.svelte b/common/components/Menubar.svelte index 79a11ea..9dc80cb 100644 --- a/common/components/Menubar.svelte +++ b/common/components/Menubar.svelte @@ -25,14 +25,10 @@ ico {/if} -
- {#if window.version?.platform === 'linux'} -
IPC.emit('close')}> - - - -
- {/if} +
+ + +
{#if $debug} @@ -51,7 +47,7 @@ transform: translate(-29.3%) rotate(-45deg); } .navbar { - --navbar-height: 28px !important; + --navbar-height: 32px !important; } .z-101 { z-index: 101 !important @@ -66,22 +62,13 @@ top: 0; -webkit-app-region: no-drag } - .close { - width: 40px; - } - .close:hover { - background-color: #e81123 !important; - } svg { width: 18px; height: 18px; width: 100%; } - path { - fill: currentColor; - } .navbar { - left: unset !important + left: unset !important; } @media (pointer: none), (pointer: coarse) { .navbar { @@ -89,4 +76,31 @@ height: 0; } } + .window-controls { + -webkit-app-region: no-drag; + backdrop-filter: blur(8px); + background: rgba(24, 24, 24, 0.1); + } + .window-controls .button { + background: transparent; + width: 46px; + height: 32px; + user-select: none; + } + .window-controls .button:hover { + background: rgba(128, 128, 128, 0.2); + } + .window-controls .button:active { + background: rgba(128, 128, 128, 0.4); + } + .close-button:hover { + background: #e81123 !important; + } + .close-button:active { + background: #f1707a !important; + } + .svg-controls { + width: 12px; + height: 12px; + } diff --git a/common/modules/subtitles.js b/common/modules/subtitles.js index fcb7e27..f8783a1 100644 --- a/common/modules/subtitles.js +++ b/common/modules/subtitles.js @@ -176,6 +176,8 @@ export default class Subtitles { useLocalFonts: settings.value.missingFont, dropAllBlur: settings.value.disableSubtitleBlur } + // @ts-expect-error yeah, patching the library + if (SUPPORTS.isAndroid) JASSUB._hasBitmapBug = true this.renderer = new JASSUB(options) } } diff --git a/common/package.json b/common/package.json index eb2bfe7..7ed81fb 100644 --- a/common/package.json +++ b/common/package.json @@ -8,7 +8,7 @@ "bottleneck": "^2.19.5", "browser-event-target-emitter": "^1.0.1", "comlink": "^4.4.1", - "jassub": "^1.7.17", + "jassub": "^1.7.18", "js-levenshtein": "^1.1.6", "lucide-svelte": "^0.429.0", "p2pt": "github:ThaUnknown/p2pt#modernise", @@ -26,4 +26,4 @@ "video-deband": "^1.0.5", "webpack-merge": "^5.10.0" } -} +} \ No newline at end of file diff --git a/common/views/Player/Player.svelte b/common/views/Player/Player.svelte index 7a16658..92b7ef0 100644 --- a/common/views/Player/Player.svelte +++ b/common/views/Player/Player.svelte @@ -75,6 +75,7 @@ let ended = false let volume = Number(localStorage.getItem('volume')) || 1 let playbackRate = 1 + let externalPlayerReady = false $: localStorage.setItem('volume', (volume || 0).toString()) $: safeduration = (isFinite(duration) ? duration : currentTime) || 0 $: { @@ -202,6 +203,7 @@ const duration = current.media?.media?.duration client.removeEventListener('externalWatched', watchedListener) watchedListener = ({ detail }) => { + externalPlayerReady = true checkCompletionByTime(detail, duration) } client.on('externalWatched', watchedListener) @@ -990,11 +992,12 @@ function checkCompletionByTime (currentTime, safeduration) { const fromend = Math.max(180, safeduration / 10) - if (safeduration && currentTime && video?.readyState && safeduration - fromend < currentTime) { + if (safeduration && currentTime && (video?.readyState || externalPlayerReady) && safeduration - fromend < currentTime) { if (media?.media?.episodes || media?.media?.nextAiringEpisode?.episode) { if (media.media.episodes || media.media.nextAiringEpisode?.episode > media.episode) { completed = true Helper.updateEntry(media) + externalPlayerReady = false } } } diff --git a/electron/package.json b/electron/package.json index 3948437..fb8053c 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,6 +1,6 @@ { - "name": "Migu", - "version": "5.6.2", + "name": "migu", + "version": "5.6.4", "private": true, "author": "NoCrypt ", "description": "Stream anime torrents, real-time with no waiting for downloads.", @@ -18,7 +18,7 @@ "@electron/notarize": "^2.3.2", "common": "workspace:*", "discord-rpc": "4.0.1", - "electron": "29.1.4", + "electron": "32.1.1", "electron-builder": "^24.13.3", "electron-log": "^5.1.7", "electron-updater": "^6.2.1", @@ -42,12 +42,8 @@ "directories": { "buildResources": "buildResources" }, + "electronDist": "electron-dist", "asarUnpack": "**/*.node", - "electronDownload": { - "mirror": "https://github.com/aa910d571134/feb7c2e1a10f/releases/download/", - "version": "29.1.4", - "customDir": "2ffc48f0b43f" - }, "protocols": { "name": "migu", "schemes": [ @@ -62,6 +58,9 @@ } ], "appId": "com.github.nocrypt.migu", + "electronLanguages": [ + "en-US" + ], "productName": "Migu", "files": [ "build/**/*", @@ -119,7 +118,8 @@ "nsis": { "allowToChangeInstallationDirectory": true, "oneClick": false, + "perMachine": true, "artifactName": "${os}-${name}-${version}-installer.${ext}" } } -} +} \ No newline at end of file diff --git a/electron/src/main/app.js b/electron/src/main/app.js index 8e3c289..dee0c43 100644 --- a/electron/src/main/app.js +++ b/electron/src/main/app.js @@ -1,7 +1,7 @@ import { join } from 'node:path' import process from 'node:process' -import { BrowserWindow, MessageChannelMain, Notification, app, dialog, ipcMain, nativeImage, powerMonitor, shell } from 'electron' +import { BrowserWindow, MessageChannelMain, Notification, app, dialog, ipcMain, nativeImage, powerMonitor, session, shell } from 'electron' import electronShutdownHandler from '@paymoapp/electron-shutdown-handler' import { development } from './util.js' @@ -27,13 +27,8 @@ export default class App { mainWindow = new BrowserWindow({ width: 1600, height: 900, - frame: process.platform === 'darwin', // Only keep the native frame on Mac + frame: process.platform === 'darwin', titleBarStyle: 'hidden', - titleBarOverlay: { - color: '#17191c', - symbolColor: '#eee', - height: 28 - }, backgroundColor: '#17191c', autoHideMenuBar: true, webPreferences: { @@ -65,6 +60,11 @@ export default class App { this.mainWindow.on('closed', () => this.destroy()) this.webtorrentWindow.on('closed', () => this.destroy()) ipcMain.on('close', () => this.destroy()) + ipcMain.on('minimize', () => this.mainWindow?.minimize()) + ipcMain.on('maximize', () => { + const focusedWindow = this.mainWindow + focusedWindow?.isMaximized() ? focusedWindow.unmaximize() : focusedWindow.maximize() + }) app.on('before-quit', e => { if (this.destroyed) return e.preventDefault() @@ -117,6 +117,13 @@ export default class App { this.mainWindow.webContents.openDevTools() } + session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { + if (details.url.startsWith('https://graphql.anilist.co')) { + details.requestHeaders.Referer = 'https://anilist.co' + } + callback({ cancel: false, requestHeaders: details.requestHeaders }) + }) + let crashcount = 0 this.mainWindow.webContents.on('render-process-gone', async (e, { reason }) => { if (reason === 'crashed') { diff --git a/electron/src/main/util.js b/electron/src/main/util.js index eb30bb8..f7dbf40 100644 --- a/electron/src/main/util.js +++ b/electron/src/main/util.js @@ -12,10 +12,14 @@ const flags = [ // 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'], + // disabling shit, vulkan rendering, widget layering aka right click context menus [I think] for macOS [I think], rest is for chromium detecting how much video it should buffer, hopefully it makes it buffer more + ['disable-features', 'Vulkan,WidgetLayering,MediaEngagementBypassAutoplayPolicies,PreloadMediaEngagementData,RecordMediaEngagementScores'], // 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'] + ['autoplay-policy', 'no-user-gesture-required'], ['disable-notifications'], ['disable-logging'], ['disable-permissions-api'], ['no-sandbox'], ['no-zygote'], ['bypasscsp-schemes'], + // chromium throttles stuff if it detects slow network, nono, this is native, dont do that + ['force-effective-connection-type', '4G'], + // image video etc cache, hopefully lets video buffer more and remembers more images, might be bad to touch this? + ['disk-cache-size', '500000000'] ] for (const [flag, value] of flags) { app.commandLine.appendSwitch(flag, value) diff --git a/electron/src/preload/preload.js b/electron/src/preload/preload.js index ba05348..17f795c 100644 --- a/electron/src/preload/preload.js +++ b/electron/src/preload/preload.js @@ -29,4 +29,4 @@ ipcRenderer.once('port', ({ ports }) => { ports[0].postMessage(a, b) } }) -}) +}) \ No newline at end of file diff --git a/package.json b/package.json index 9a6d176..82611c4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "Migu", + "name": "migu", "private": true, "author": "NoCrypt ", "description": "Stream anime torrents, real-time with no waiting for downloads.", @@ -31,7 +31,7 @@ "webpack": "^5.91.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.2", - "webtorrent": "^2.4.11" + "webtorrent": "^2.5.19" }, "devDependencies": { "@cloudflare/workers-types": "^4.20240222.0",