fix: draggable links, torrent and anilist client loading inside setup, adding external subs crashing

This commit is contained in:
ThaUnknown 2025-05-16 16:29:57 +02:00
parent 1542dccf54
commit 2b49145d24
No known key found for this signature in database
15 changed files with 37 additions and 29 deletions

View file

@ -1,6 +1,6 @@
{
"name": "ui",
"version": "6.3.9",
"version": "6.3.10",
"license": "BUSL-1.1",
"private": true,
"packageManager": "pnpm@9.14.4",

View file

@ -107,7 +107,8 @@ body {
font-family: 'Nunito Variable'
}
img {
img,
a {
-webkit-user-drag: none;
}

View file

@ -10,13 +10,13 @@
import { ChevronLeft, Play, ChevronRight } from 'lucide-svelte'
import Pagination from './Pagination.svelte'
import { searchStore } from './SearchModal.svelte'
import { Button } from './ui/button'
import { Load } from './ui/img'
import { Profile } from './ui/profile'
import type { EpisodesResponse } from '$lib/modules/anizip/types'
import { searchStore } from '$lib'
import { episodes as _episodes, dedupeAiring, episodeByAirDate, notes, type Media } from '$lib/modules/anilist'
import { authAggregator, list, progress } from '$lib/modules/auth'
import { click, dragScroll } from '$lib/modules/navigate'

View file

@ -1,6 +1,5 @@
<script lang='ts' context='module'>
import { BadgeCheck, Database } from 'lucide-svelte'
import { writable } from 'svelte/store'
import { Download, MagnifyingGlass } from 'svelte-radix'
import { SingleCombo } from './ui/combobox'
@ -10,7 +9,7 @@
import type { TorrentResult } from 'hayase-extensions'
import * as Dialog from '$lib/components/ui/dialog'
import { title, type Media } from '$lib/modules/anilist'
import { title } from '$lib/modules/anilist'
import { extensions } from '$lib/modules/extensions/extensions'
import { click, dragScroll } from '$lib/modules/navigate'
import { settings, videoResolutions } from '$lib/modules/settings'
@ -50,9 +49,6 @@
for (const term of audio ?? []) simpleName = simpleName.replace(term[0]!, '')
return simpleName.replace(/[[{(]\s*[\]})]/g, '').replace(/\s+/g, ' ').trim()
}
// episode is optional here, but is actually always defined
export const searchStore = writable<{episode?: number, media?: Media}>({})
</script>
<script lang='ts'>
@ -60,6 +56,7 @@
import { Banner } from './ui/img'
import { goto } from '$app/navigation'
import { searchStore } from '$lib'
import { saved } from '$lib/modules/extensions'
import { server } from '$lib/modules/torrent'

View file

@ -1,7 +1,7 @@
<script lang='ts'>
import { onDestroy } from 'svelte'
import { BookmarkButton, FavoriteButton, PlayButton } from '../button'
import { BookmarkButton, FavoriteButton, PlayButton } from '../button/extra'
import { bannerSrc } from './banner-image.svelte'

View file

@ -0,0 +1,9 @@
import Bookmark from './bookmark.svelte'
import Favorite from './favorite.svelte'
import Play from './play.svelte'
export {
Play as PlayButton,
Favorite as FavoriteButton,
Bookmark as BookmarkButton
}

View file

@ -1,9 +1,6 @@
import { type VariantProps, tv } from 'tailwind-variants'
import Bookmark from './bookmark.svelte'
import Root from './button.svelte'
import Favorite from './favorite.svelte'
import Play from './play.svelte'
import type { Button as ButtonPrimitive } from 'bits-ui'
@ -60,8 +57,5 @@ export {
type Props as ButtonProps,
type Events as ButtonEvents,
buttonVariants,
iconSizes,
Play as PlayButton,
Favorite as FavoriteButton,
Bookmark as BookmarkButton
iconSizes
}

View file

@ -3,7 +3,7 @@
import type { Media } from '$lib/modules/anilist'
import { searchStore } from '$lib/components/SearchModal.svelte'
import { searchStore } from '$lib'
import { Button, iconSizes, type Props } from '$lib/components/ui/button'
import { list, progress } from '$lib/modules/auth'
import { clickwrap, keywrap } from '$lib/modules/navigate'

View file

@ -1,5 +1,5 @@
<script lang='ts'>
import { BookmarkButton, FavoriteButton, PlayButton } from '../button'
import { BookmarkButton, FavoriteButton, PlayButton } from '../button/extra'
import { Banner } from '../img'
import YoutubeIframe from './YoutubeIframe.svelte'

View file

@ -5,8 +5,8 @@
import type { MediaInfo } from '$lib/components/ui/player/util'
import type { resolveFilesPoorly, ResolvedFile } from './resolver'
import { searchStore } from '$lib'
import { fillerEpisodes } from '$lib/components/EpisodesList.svelte'
import { searchStore } from '$lib/components/SearchModal.svelte'
import { cover, episodes, title } from '$lib/modules/anilist'
import { settings } from '$lib/modules/settings'

View file

@ -318,14 +318,14 @@ export default class Subtitles {
if (type === 'ass') {
return { type: 'ass', header: text }
} else if (type === 'srt' || type === 'vtt') {
return { type: 'srt', header: srt(text).join('\n') }
return { type: 'srt', header: defaultHeader + srt(text).join('\n') }
} else if (type === 'sub') {
return { type: 'sub', header: sub(text).join('\n') }
return { type: 'sub', header: defaultHeader + sub(text).join('\n') }
} else {
// subbers have a tendency to not set the extensions at all
if (text.startsWith('[Script Info]')) return { type: 'ass', header: text }
if (srtRx.test(text)) return { type: 'srt', header: srt(text).join('\n') }
if (subRx.test(text)) return { type: 'sub', header: sub(text).join('\n') }
if (srtRx.test(text)) return { type: 'srt', header: defaultHeader + srt(text).join('\n') }
if (subRx.test(text)) return { type: 'sub', header: defaultHeader + sub(text).join('\n') }
}
}
}

View file

@ -93,14 +93,14 @@
.miniplayer {
transform: translate3d(
clamp(
calc(-100vi + 100% + 20px),
calc(-100vi + 100% + 1rem),
var(--left),
-20px
-1rem
),
clamp(
calc(-100vb + 100% + 20px),
calc(-100vb + 100% + 1rem),
var(--top),
-20px
-1rem
),
0
);

View file

@ -1,6 +1,12 @@
// TODO: update these
import { writable } from 'simple-store-svelte'
import type { Media } from './modules/anilist'
export const CHANGELOG_URL = 'https://api.github.com/repos/ThaUnknown/miru/releases'
export const WEB_URL = 'https://miru.watch'
export const DEFAULT_EXTENSIONS = 'gh:hayase-app/extensions'
export const SETUP_VERSION = 2
// episode is optional here, but is actually always defined
export const searchStore = writable<{episode?: number, media?: Media}>({})

View file

@ -9,7 +9,8 @@
import Anilist from '$lib/components/icons/Anilist.svelte'
import MyAnimeList from '$lib/components/icons/MyAnimeList.svelte'
import { bannerSrc, hideBanner } from '$lib/components/ui/banner'
import { PlayButton, Button, BookmarkButton, FavoriteButton } from '$lib/components/ui/button'
import { Button } from '$lib/components/ui/button'
import { PlayButton, BookmarkButton, FavoriteButton } from '$lib/components/ui/button/extra'
import * as Dialog from '$lib/components/ui/dialog'
import { Load } from '$lib/components/ui/img'
import { Profile } from '$lib/components/ui/profile'

View file

@ -23,7 +23,7 @@
"strictNullChecks": true,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"noEmit": false,
"noEmit": true,
"noUncheckedIndexedAccess": true,
"declaration": true,
"alwaysStrict": true,