This commit is contained in:
NoCrypt 2025-02-24 17:20:52 +07:00
commit 2348a80f25
10 changed files with 75 additions and 45 deletions

View file

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

View file

@ -25,14 +25,10 @@
<img src='./logo_filled.png' class='position-absolute w-50 h-50 m-10 pointer d-md-block d-none p-5' alt='ico' use:click={close} />
{/if}
</div>
<div class='h-full bg-dark flex-grow-1'>
{#if window.version?.platform === 'linux'}
<div class='d-flex align-items-center close h-full' use:click={() => IPC.emit('close')}>
<svg viewBox='0 0 24 24'>
<path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z' />
</svg>
</div>
{/if}
<div class='window-controls d-flex position-absolute top-0 right-0 height-full'>
<button class='button max-button d-flex border-0 color-white align-items-center justify-content-center' on:click={() => IPC.emit('minimize')}><svg class='svg-controls' height='12' role='img' viewBox='0 0 12 12'width='12'><rect fill='currentColor' height='1' width='10' x='1' y='6' /></svg></button>
<button class='button restore-button d-flex border-0 color-white align-items-center justify-content-center' on:click={() => IPC.emit('maximize')}><svg class='svg-controls' height='12' role='img' viewBox='0 0 12 12'width='12'><rect fill='none' height='9' stroke='currentColor' width='9' x='1.5' y='1.5' /></svg></button>
<button class='button close-button d-flex border-0 color-white align-items-center justify-content-center' on:click={() => IPC.emit('close')}><svg class='svg-controls' height='12' role='img' viewBox='0 0 12 12'width='12'><polygon fill='currentColor' fill-rule='evenodd' points='11 1.576 6.583 6 11 10.424 10.424 11 6 6.583 1.576 11 1 10.424 5.417 6 1 1.576 1.576 1 6 5.417 10.424 1' /></svg></button>
</div>
</div>
{#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;
}
</style>

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "Migu",
"version": "5.6.2",
"name": "migu",
"version": "5.6.4",
"private": true,
"author": "NoCrypt <NoCrypt@users.noreply.github.com>",
"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}"
}
}
}
}

View file

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

View file

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

View file

@ -29,4 +29,4 @@ ipcRenderer.once('port', ({ ports }) => {
ports[0].postMessage(a, b)
}
})
})
})

View file

@ -1,5 +1,5 @@
{
"name": "Migu",
"name": "migu",
"private": true,
"author": "NoCrypt <NoCrypt@users.noreply.github.com>",
"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",