diff --git a/package.json b/package.json index 39e7948..8b4568c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "6.4.31", + "version": "6.4.32", "license": "BUSL-1.1", "private": true, "packageManager": "pnpm@9.14.4", diff --git a/src/lib/components/SearchModal.svelte b/src/lib/components/SearchModal.svelte index 41dc0a7..b5e1ddd 100644 --- a/src/lib/components/SearchModal.svelte +++ b/src/lib/components/SearchModal.svelte @@ -54,10 +54,12 @@ diff --git a/src/lib/components/ui/player/keybinds.svelte b/src/lib/components/ui/player/keybinds.svelte index c31c233..71d0567 100644 --- a/src/lib/components/ui/player/keybinds.svelte +++ b/src/lib/components/ui/player/keybinds.svelte @@ -27,7 +27,6 @@ }) async function runBind (e: MouseEvent | KeyboardEvent, code: KeyCode) { - if ('repeat' in e && e.repeat) return const kbn = get(binds) if (cnd(code)) kbn[layout[code] ?? code]?.fn(e) } diff --git a/src/lib/components/ui/player/options.svelte b/src/lib/components/ui/player/options.svelte index e4edeec..6f576a6 100644 --- a/src/lib/components/ui/player/options.svelte +++ b/src/lib/components/ui/player/options.svelte @@ -99,40 +99,44 @@ {:else} - - Audio - - {#each Object.entries(normalizeTracks(video.audioTracks ?? [])) as [lang, tracks] (lang)} - - {lang} - - {#each tracks as track (track.id)} - { selectAudio(track.id); open = false }}> - {track.label} - - {/each} - - - {/each} - - - - Video - - {#each Object.entries(normalizeTracks(video.videoTracks ?? [])) as [lang, tracks] (lang)} - - {lang} - - {#each tracks as track (track.id)} - { selectVideo(track.id); open = false }}> - {track.label} - - {/each} - - - {/each} - - + {#if 'audioTracks' in HTMLVideoElement.prototype} + + Audio + + {#each Object.entries(normalizeTracks(video.audioTracks ?? [])) as [lang, tracks] (lang)} + + {lang} + + {#each tracks as track (track.id)} + { selectAudio(track.id); open = false }}> + {track.label} + + {/each} + + + {/each} + + + {/if} + {#if 'videoTracks' in HTMLVideoElement.prototype} + + Video + + {#each Object.entries(normalizeTracks(video.videoTracks ?? [])) as [lang, tracks] (lang)} + + {lang} + + {#each tracks as track (track.id)} + { selectVideo(track.id); open = false }}> + {track.label} + + {/each} + + + {/each} + + + {/if} {#if subtitles} Subtitles @@ -225,7 +229,7 @@ Fullscreen - pip.pip()} active={!!$pipElement}> + { pip.pip(); close() }} active={!!$pipElement}> Picture in Picture diff --git a/src/lib/components/ui/player/player.svelte b/src/lib/components/ui/player/player.svelte index ec39580..147fb7a 100644 --- a/src/lib/components/ui/player/player.svelte +++ b/src/lib/components/ui/player/player.svelte @@ -24,7 +24,7 @@ import Volume1 from 'lucide-svelte/icons/volume-1' import Volume2 from 'lucide-svelte/icons/volume-2' import VolumeX from 'lucide-svelte/icons/volume-x' - import { onDestroy, onMount } from 'svelte' + import { getContext, onDestroy, onMount } from 'svelte' import { fade } from 'svelte/transition' import { persisted } from 'svelte-persisted-store' import { toast } from 'svelte-sonner' @@ -116,12 +116,13 @@ let ended = false let paused = true let pointerMoving = false + let fastForwarding = false const cast = false $: $isPlaying = !paused $: buffering = readyState < 3 - $: immersed = !buffering && !paused && !ended && !pictureInPictureElement && !pointerMoving + $: immersed = (!buffering && !paused && !ended && !pictureInPictureElement && !pointerMoving) || fastForwarding $: isMiniplayer = $page.route.id !== '/app/player' let pointerMoveTimeout = 0 @@ -466,10 +467,8 @@ } function seekBarKey (event: KeyboardEvent) { - // left right up down return preventdefault if (['ArrowLeft', 'ArrowRight'].includes(event.key)) event.stopPropagation() - if (event.repeat) return switch (event.key) { case 'ArrowLeft': seek(-Number($settings.playerSeek)) @@ -673,8 +672,6 @@ $condition = () => !isMiniplayer - let ff = false - function holdToFF (document: HTMLElement, type: 'key' | 'pointer') { const ctrl = new AbortController() let timeout = 0 @@ -682,22 +679,22 @@ const startFF = () => { timeout = setTimeout(() => { paused = false - ff = true + fastForwarding = true oldPlaybackRate = playbackRate playbackRate = 2 }, 1000) } const endFF = () => { clearTimeout(timeout) - if (ff) { - ff = false + if (fastForwarding) { + fastForwarding = false playbackRate = oldPlaybackRate paused = true } } document.addEventListener(type + 'down' as 'keydown' | 'pointerdown', (event) => { if (isMiniplayer) return - if ('code' in event && (event.code !== 'Space' || event.repeat)) return + if ('code' in event && (event.code !== 'Space')) return if ('pointerId' in event) document.setPointerCapture(event.pointerId) startFF() }, { signal: ctrl.signal }) @@ -736,8 +733,17 @@ setAnimeProgress(mediaInfo.media.id, { episode: mediaInfo.episode, currentTime: video.currentTime, safeduration }) } const saveProgressLoop = setInterval(saveAnimeProgress, 10000) - onDestroy(() => { - clearInterval(saveProgressLoop) + onDestroy(() => clearInterval(saveProgressLoop)) + + let episodeListOpen = false + + const stopProgressBar = getContext<() => void>('stop-progress-bar') + beforeNavigate(({ cancel }) => { + if (episodeListOpen) { + episodeListOpen = false + cancel() + stopProgressBar() + } }) @@ -811,23 +817,23 @@ {/if} - {#if ff} + class='{$settings.minimalPlayerUI ? 'inline-flex' : 'mobile:inline-flex hidden'} p-3 w-12 h-12 absolute top-4 left-4 bg-black/20 pointer-events-auto transition-opacity select:opacity-100 {immersed && 'opacity-0'}' /> + {#if fastForwarding}
x2
{/if} - {#if buffering} @@ -855,7 +861,7 @@
{mediaInfo.session.title} - + {mediaInfo.session.description} {#if mediaInfo.media} diff --git a/src/lib/components/ui/sidebar/sidebar.svelte b/src/lib/components/ui/sidebar/sidebar.svelte index a2f79b9..a4f7eeb 100644 --- a/src/lib/components/ui/sidebar/sidebar.svelte +++ b/src/lib/components/ui/sidebar/sidebar.svelte @@ -4,20 +4,40 @@ import { Button } from '../button' + import { onNavigate } from '$app/navigation' import { breakpoints } from '$lib/utils' let open = false // 152 x 140 + + onNavigate(() => { + open = false + }) + + let container: HTMLDivElement | undefined + + function outsideclick (node: HTMLDivElement) { + const ctrl = new AbortController() + + node.addEventListener('click', e => { + if (!container || container.contains(e.target as Node)) return + open = false + }, { signal: ctrl.signal }) + + return { destroy: () => ctrl.abort() } + } + + {#if !$breakpoints.md} -
+
diff --git a/src/lib/modules/auth/kitsu.ts b/src/lib/modules/auth/kitsu.ts index 291eb7f..77c9018 100644 --- a/src/lib/modules/auth/kitsu.ts +++ b/src/lib/modules/auth/kitsu.ts @@ -449,14 +449,15 @@ export default new class KitsuSync { const kitsuEntry = this.userlist.value[targetMediaId] - const kitsuEntryVariables = { + const kitsuEntryVariables: Partial = { status: AL_TO_KITSU_STATUS[variables.status!], - progress: variables.progress ?? undefined, - rating: (variables.score ?? 0) < 2 ? undefined : variables.score!.toString(), - reconsumeCount: variables.repeat ?? undefined, reconsuming: variables.status === 'REPEATING' } + if (variables.progress) kitsuEntryVariables.progress = variables.progress + if (variables.score) kitsuEntryVariables.rating = (variables.score < 2 ? undefined : variables.score.toString()) + if (variables.repeat) kitsuEntryVariables.reconsumeCount = variables.repeat + if (kitsuEntry) { await this._updateEntry(kitsuEntry.id, kitsuEntryVariables, targetMediaId) } else { diff --git a/src/lib/modules/auth/mal.ts b/src/lib/modules/auth/mal.ts index f81787e..071d2af 100644 --- a/src/lib/modules/auth/mal.ts +++ b/src/lib/modules/auth/mal.ts @@ -436,12 +436,13 @@ export default new class MALSync { const body: MALListUpdate = { status: AL_TO_MAL_STATUS[variables.status!], - num_watched_episodes: variables.progress ?? 0, - score: variables.score ?? 0, - num_times_rewatched: variables.repeat ?? 0, is_rewatching: variables.status === 'REPEATING' } + if (variables.progress) body.num_watched_episodes = variables.progress + if (variables.score) body.score = variables.score + if (variables.repeat) body.num_times_rewatched = variables.repeat + const res = await this._patch(`${ENDPOINTS.API_ANIME}/${malId}/my_list_status`, body) if ('error' in res) return diff --git a/src/lib/modules/extensions/extensions.ts b/src/lib/modules/extensions/extensions.ts index c6308d5..b3c2a62 100644 --- a/src/lib/modules/extensions/extensions.ts +++ b/src/lib/modules/extensions/extensions.ts @@ -14,8 +14,7 @@ import type { TorrentResult } from 'hayase-extensions' import { dev } from '$app/environment' import { options as extensionOptions, saved } from '$lib/modules/extensions' -// TODO: ember exclusions might not be needed anymore as parser was improved -const exclusions = ['DTS', 'TrueHD', '[EMBER]'] +const exclusions = ['DTS', 'TrueHD'] const video = document.createElement('video') diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 322ac71..b9d9614 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,6 +4,7 @@ import '@fontsource/geist-mono' import '$lib/modules/navigate' import { ProgressBar } from '@prgm/sveltekit-progress-bar' + import { setContext } from 'svelte' import { toast } from 'svelte-sonner' import Backplate from '$lib/components/Backplate.svelte' @@ -24,6 +25,14 @@ toast.error('Torrent Process Error!', { description: error?.stack ?? error?.message }) console.error(error) }) + + const displayThresholdMs = 150 + let complete: ((settleTime: number | undefined) => void) | undefined + setContext('stop-progress-bar', () => { + setTimeout(() => { + complete?.(0) + }, displayThresholdMs) + }) @@ -31,7 +40,7 @@
- + diff --git a/src/routes/app/settings/+page.svelte b/src/routes/app/settings/+page.svelte index bcde325..7bcc58e 100644 --- a/src/routes/app/settings/+page.svelte +++ b/src/routes/app/settings/+page.svelte @@ -73,7 +73,7 @@ -
+
sec
diff --git a/src/routes/app/settings/client/+page.svelte b/src/routes/app/settings/client/+page.svelte index 1e877af..798d2c4 100644 --- a/src/routes/app/settings/client/+page.svelte +++ b/src/routes/app/settings/client/+page.svelte @@ -40,7 +40,7 @@ -
+
Mb/s
diff --git a/src/routes/setup/network/+page.svelte b/src/routes/setup/network/+page.svelte index 3c5830e..4d4c2ca 100644 --- a/src/routes/setup/network/+page.svelte +++ b/src/routes/setup/network/+page.svelte @@ -72,7 +72,7 @@ -
+
Mb/s