feat: add safety checks to loading last torrent
Some checks are pending
Check / check (push) Waiting to run

This commit is contained in:
ThaUnknown 2025-07-29 22:03:52 +02:00
parent 0963c69a2b
commit e76e01df46
No known key found for this signature in database
4 changed files with 9 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{
"name": "ui",
"version": "6.4.95",
"version": "6.4.96",
"license": "BUSL-1.1",
"private": true,
"packageManager": "pnpm@9.15.5",

View file

@ -3,7 +3,7 @@
import Heart from 'lucide-svelte/icons/heart'
import House from 'lucide-svelte/icons/house'
import LogIn from 'lucide-svelte/icons/log-in'
// import MessagesSquare from 'lucide-svelte/icons/messages-square'
import MessagesSquare from 'lucide-svelte/icons/messages-square'
import Play from 'lucide-svelte/icons/play'
import Search from 'lucide-svelte/icons/search'
import Settings from 'lucide-svelte/icons/settings'
@ -59,9 +59,9 @@
<SidebarButton href='/app/w2g/'>
<Users size={18} />
</SidebarButton>
<!-- <SidebarButton href='/app/chat/'>
<SidebarButton href='/app/chat/'>
<MessagesSquare size={18} />
</SidebarButton> -->
</SidebarButton>
<SidebarButton href='/app/client/' id='sidebar-client' data-down='#sidebar-donate'>
<Download size={18} />
</SidebarButton>
@ -71,8 +71,8 @@
<SidebarButton href='/app/settings/'>
<Settings size={18} />
</SidebarButton>
<SidebarButton href='/app/profile/'>
<!-- <SidebarButton href='/app/profile/' class='hidden md:flex py-0'> -->
<!-- <SidebarButton href='/app/profile/'> -->
<SidebarButton href='/app/profile/' class='hidden md:flex py-0'>
{#if hasAuth}
{@const viewer = client.profile()}
<Avatar.Root class='size-6 rounded-md'>

View file

@ -67,7 +67,8 @@
async function playEntry ({ mediaID, episode, hash }: LibraryEntry) {
if (!mediaID || !hash) return
const media = await client.single(mediaID)
server.play(hash, media.data!.Media!, episode)
if (!media.data?.Media) return // TODO: log this?
server.play(hash, media.data.Media, episode)
goto('/app/player/')
}

View file

@ -77,6 +77,7 @@ export const server = new class ServerClient {
}
play (id: string, media: Media, episode: number) {
if (!media || !id) return
debug('playing torrent', id, media.id, episode)
this.last.set({ id, media, episode })
this.active.value = this._play(id, media, episode)