diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 84cd9be..7049061 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ "usernamehw.errorlens", "dbaeumer.vscode-eslint", "GraphQL.vscode-graphql-syntax", + "bierner.comment-tagged-templates", "YoavBls.pretty-ts-errors", "svelte.svelte-vscode", // 109.5.2 or older NOT NEWER "ardenivanov.svelte-intellisense", diff --git a/package.json b/package.json index b01c732..1b5c59f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "6.3.33", + "version": "6.3.34", "license": "BUSL-1.1", "private": true, "packageManager": "pnpm@9.14.4", diff --git a/src/app.css b/src/app.css index 956cfbd..bf1d434 100644 --- a/src/app.css +++ b/src/app.css @@ -132,12 +132,7 @@ a { } } -.donate { - filter: drop-shadow(0 0 1rem #fa68b6); - animation: glow 1s ease-in-out infinite alternate; -} - -@keyframes glow { +@keyframes hearbeat { from { transform: translate3d(var(--tw-translate-x), var(--tw-translate-y), 0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(1) scaleY(1); } diff --git a/src/lib/components/ui/player/subtitles.ts b/src/lib/components/ui/player/subtitles.ts index 8b07039..5fc68db 100644 --- a/src/lib/components/ui/player/subtitles.ts +++ b/src/lib/components/ui/player/subtitles.ts @@ -252,7 +252,7 @@ export default class Subtitles { lastSubtitleStyle: typeof defaults.subtitleStyle | undefined = undefined _applyStyleOverride (subtitleStyle: typeof defaults.subtitleStyle) { if (this.lastSubtitleStyle === subtitleStyle) return - this.lastSubtitleStyle = subtitleStyle + if (this.renderer) this.lastSubtitleStyle = subtitleStyle if (subtitleStyle !== 'none') { const font = OVERRIDE_FONTS[subtitleStyle] if (font && !this.fonts.includes(font)) { diff --git a/src/lib/components/ui/sidebar/sidebarlist.svelte b/src/lib/components/ui/sidebar/sidebarlist.svelte index 9cabcc3..53a0b00 100644 --- a/src/lib/components/ui/sidebar/sidebarlist.svelte +++ b/src/lib/components/ui/sidebar/sidebarlist.svelte @@ -54,7 +54,7 @@ native.openURL('https://github.com/sponsors/ThaUnknown/')} class='px-2 w-full relative mt-auto select:!bg-transparent text-[#fa68b6] select:text-[#fa68b6]'> - + diff --git a/src/lib/components/ui/themes/Themes.svelte b/src/lib/components/ui/themes/Themes.svelte new file mode 100644 index 0000000..73a51cb --- /dev/null +++ b/src/lib/components/ui/themes/Themes.svelte @@ -0,0 +1,49 @@ + + +{#await themesRes} + Loading + +{:then themes} + {#if themes?.anime?.[0]?.animethemes?.length} + {#each themes.anime[0].animethemes as theme (theme.id)} + {theme.type} + {/each} + {/if} +{/await} + + + + OP + + + Oishi Survivor by HANABIE + + + + + v1 + + + Episodes 1-2 + + + + + v2 + + + Episodes 3-13 + + + diff --git a/src/lib/components/ui/themes/index.ts b/src/lib/components/ui/themes/index.ts new file mode 100644 index 0000000..9c0badb --- /dev/null +++ b/src/lib/components/ui/themes/index.ts @@ -0,0 +1 @@ +export { default as Themes } from './Themes.svelte' diff --git a/src/lib/modules/animethemes/index.ts b/src/lib/modules/animethemes/index.ts new file mode 100644 index 0000000..a24cb2a --- /dev/null +++ b/src/lib/modules/animethemes/index.ts @@ -0,0 +1,7 @@ +import type { AnimeThemesResponse } from './types' + +import { safefetch } from '$lib/utils' + +export function themes (id: number, _fetch = fetch) { + return safefetch(_fetch, `https://api.animethemes.moe/anime/?fields[audio]=id,basename,link,size&fields[video]=id,basename,link,tags&filter[external_id]=${id}&filter[has]=resources&filter[site]=AniList&include=animethemes.animethemeentries.videos,animethemes.animethemeentries.videos.audio,animethemes.song,animethemes.song.artists`) +} diff --git a/src/lib/modules/animethemes/types.d.ts b/src/lib/modules/animethemes/types.d.ts new file mode 100644 index 0000000..2a9771d --- /dev/null +++ b/src/lib/modules/animethemes/types.d.ts @@ -0,0 +1,84 @@ +export interface AnimeThemesResponse { + anime?: Anime[] + links?: Links + meta?: Meta +} + +export interface Anime { + id?: number + name?: string + media_format?: string + season?: string + slug?: string + synopsis?: string + year?: number + animethemes?: AnimeTheme[] +} + +export interface AnimeTheme { + id?: number + sequence?: null + slug?: string + type?: string + song?: Song + animethemeentries?: AnimeThemeEntry[] +} + +export interface AnimeThemeEntry { + id?: number + episodes?: string + notes?: null + nsfw?: boolean + spoiler?: boolean + version?: null + videos?: Video[] +} + +export interface Video { + id?: number + basename?: string + tags?: string + link?: string + audio?: Audio +} + +export interface Audio { + id?: number + basename?: string + size?: number + link?: string +} + +export interface Song { + id?: number + title?: string + artists?: Artist[] +} + +export interface Artist { + id?: number + name?: string + slug?: string + information?: null + artistsong?: ArtistSong +} + +export interface ArtistSong { + alias?: null + as?: null +} + +export interface Links { + first?: string + last?: null + prev?: null + next?: null +} + +export interface Meta { + current_page?: number + from?: number + path?: string + per_page?: number + to?: number +} diff --git a/src/lib/modules/anizip/index.ts b/src/lib/modules/anizip/index.ts index be2ba0b..9dbc5c4 100644 --- a/src/lib/modules/anizip/index.ts +++ b/src/lib/modules/anizip/index.ts @@ -1,13 +1,6 @@ import type { EpisodesResponse, MappingsResponse } from './types' -const safefetch = async (_fetch: typeof fetch, ...args: Parameters): Promise => { - try { - const res = await _fetch(...args) - return await res.json() - } catch (e) { - return null - } -} +import { safefetch } from '$lib/utils' // const episodes = safefetch(`https://hayase.ani.zip/v1/episodes?anilist_id=${params.id}`) // const mappings = safefetch(fetch, `https://hayase.ani.zip/v1/mappings?anilist_id=${params.id}`) diff --git a/src/lib/modules/auth/util.ts b/src/lib/modules/auth/util.ts index 6663995..4734e9a 100644 --- a/src/lib/modules/auth/util.ts +++ b/src/lib/modules/auth/util.ts @@ -9,8 +9,9 @@ export function progress ({ mediaListEntry, id }: Pick): boolean { - return media.isFavourite || (local.get(media.id)?.isFavourite ?? false) +export function fav (media: Pick): boolean { + // TODO: idk how to handle this properly + return media.mediaListEntry ? media.isFavourite : (local.get(media.id)?.isFavourite ?? false) } export function list (media: Pick): 'CURRENT' | 'PLANNING' | 'COMPLETED' | 'DROPPED' | 'PAUSED' | 'REPEATING' | null | undefined { diff --git a/src/lib/modules/native.ts b/src/lib/modules/native.ts index fbcdcb1..e7fda42 100644 --- a/src/lib/modules/native.ts +++ b/src/lib/modules/native.ts @@ -88,8 +88,8 @@ export default Object.assign>({ setZoom: async () => undefined, // @ts-expect-error yeah navigate: async (cb) => { globalThis.___navigate = cb }, - downloadProgress: async (percent: number) => undefined, - updateProgress: async (cb: (progress: number) => void) => undefined, + downloadProgress: async () => undefined, + updateProgress: async () => undefined, torrentStats: async (): Promise => ({ peers: rnd(), seeders: rnd(), leechers: rnd(), progress: Math.random(), down: rnd(100000000), up: rnd(100000000), name: 'Amebku.webm', downloaded: rnd(100000), hash: '1234567890abcdef', size: 1234567890, eta: rnd() }), torrents: async (): Promise => [{ peers: rnd(), seeders: rnd(), leechers: rnd(), progress: Math.random(), down: rnd(100000000), up: rnd(100000000), name: 'Amebku.webm', downloaded: rnd(100000), hash: '1234567890abcdef', size: 1234567890, eta: rnd() }] // @ts-expect-error idk diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 15462c6..4691650 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -266,3 +266,12 @@ export const videoRx = new RegExp(`.(${videoExtensions.join('|')})$`, 'i') export const fontExtensions = ['ttf', 'ttc', 'woff', 'woff2', 'otf', 'cff', 'otc', 'pfa', 'pfb', 'pcf', 'fnt', 'bdf', 'pfr', 'eot'] export const fontRx = new RegExp(`.(${fontExtensions.join('|')})$`, 'i') + +export const safefetch = async (_fetch: typeof fetch, ...args: Parameters): Promise => { + try { + const res = await _fetch(...args) + return await res.json() + } catch (e) { + return null + } +} diff --git a/src/routes/app/anime/[id]/+page.svelte b/src/routes/app/anime/[id]/+page.svelte index 48dfb63..837517e 100644 --- a/src/routes/app/anime/[id]/+page.svelte +++ b/src/routes/app/anime/[id]/+page.svelte @@ -6,6 +6,7 @@ import { Threads } from '$lib/components/ui/forums' import { Load } from '$lib/components/ui/img' import * as Tabs from '$lib/components/ui/tabs' + import { Themes } from '$lib/components/ui/themes' import { format, relation } from '$lib/modules/anilist' import { authAggregator } from '$lib/modules/auth' import { dragScroll } from '$lib/modules/navigate' @@ -77,4 +78,11 @@ {/if} {/key} + + {#key mediaId} + {#if value === 'themes'} + + {/if} + {/key} + diff --git a/src/routes/setup/+page.svelte b/src/routes/setup/+page.svelte index 43b0467..ba0ef3d 100644 --- a/src/routes/setup/+page.svelte +++ b/src/routes/setup/+page.svelte @@ -12,7 +12,10 @@ - Welcome to Hayase + + Welcome to Hayase + Previously known as Miru! + Let's set up your perfect streaming environment.