diff --git a/package.json b/package.json index bf0ffb7..0d7a518 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "6.4.149", + "version": "6.4.150", "license": "BUSL-1.1", "private": true, "packageManager": "pnpm@9.15.5", diff --git a/src/lib/components/ui/player/pip.ts b/src/lib/components/ui/player/pip.ts index abb5ef2..7a3b94b 100644 --- a/src/lib/components/ui/player/pip.ts +++ b/src/lib/components/ui/player/pip.ts @@ -75,8 +75,7 @@ export default class PictureInPicture { const renderFrame = (noskip?: number) => { if (noskip) this.video!.paused ? video.pause() : video.play() context.drawImage(this.deband?.canvas ?? this.video!, 0, 0) - // @ts-expect-error internal call on canvas - if (canvas.width && canvas.height && this.subtitles.renderer?._canvas) context.drawImage(this.subtitles.renderer._canvas, 0, 0, canvas.width, canvas.height) + if (canvas.width && canvas.height && this.subtitles?.renderer?._canvas) context.drawImage(this.subtitles.renderer._canvas, 0, 0, canvas.width, canvas.height) loop = this.video!.requestVideoFrameCallback(renderFrame) } ctrl.signal.addEventListener('abort', () => { diff --git a/src/lib/modules/anilist/client.ts b/src/lib/modules/anilist/client.ts index 18cb604..3f9d632 100644 --- a/src/lib/modules/anilist/client.ts +++ b/src/lib/modules/anilist/client.ts @@ -3,6 +3,8 @@ import Debug from 'debug' import lavenshtein from 'js-levenshtein' import { derived, get, readable, writable, type Writable } from 'svelte/store' +import { nsfw } from '../settings/settings' + import { Comments, DeleteEntry, DeleteThreadComment, Entry, Following, type FullMedia, IDMedia, RecrusiveRelations, SaveThreadComment, Schedule, Search, Threads, ToggleFavourite, ToggleLike, UserLists } from './queries' import urqlClient from './urql-client' import { currentSeason, currentYear, lastSeason, lastYear, nextSeason, nextYear } from './util' @@ -105,7 +107,7 @@ class AnilistClient { }) search (variables: VariablesOf, pause?: boolean) { - return queryStore({ client: this.client, query: Search, variables, pause }) + return queryStore({ client: this.client, query: Search, variables: { ...variables, nsfw: get(nsfw) }, pause }) } async searchCompound (flattenedTitles: Array<{key: string, title: string, year?: string, isAdult: boolean}>) { @@ -199,8 +201,8 @@ class AnilistClient { return Object.fromEntries(Object.values(res.data ?? {}).flatMap(({ media }) => media).map(media => [media.idMal, media.id])) } - schedule (ids?: number[], onList = true) { - return queryStore({ client: this.client, query: Schedule, variables: { ids, onList, seasonCurrent: currentSeason, seasonYearCurrent: currentYear, seasonLast: lastSeason, seasonYearLast: lastYear, seasonNext: nextSeason, seasonYearNext: nextYear } }) + schedule (ids?: number[], onList: boolean | null = true) { + return queryStore({ client: this.client, query: Schedule, variables: { ids, onList, seasonCurrent: currentSeason, seasonYearCurrent: currentYear, seasonLast: lastSeason, seasonYearLast: lastYear, seasonNext: nextSeason, seasonYearNext: nextYear, formatNot: onList ? null : 'TV_SHORT', nsfw: get(nsfw) } }) } async toggleFav (id: number) { diff --git a/src/lib/modules/anilist/queries.ts b/src/lib/modules/anilist/queries.ts index 1d6508a..639c0db 100644 --- a/src/lib/modules/anilist/queries.ts +++ b/src/lib/modules/anilist/queries.ts @@ -153,12 +153,12 @@ export const UserFrag = gql(` `) export const Search = gql(` - query Search($page: Int, $perPage: Int, $search: String, $genre: [String], $format: [MediaFormat], $status: [MediaStatus], $statusNot: [MediaStatus], $season: MediaSeason, $seasonYear: Int, $isAdult: Boolean, $sort: [MediaSort], $onList: Boolean, $ids: [Int]) { + query Search($page: Int, $perPage: Int, $search: String, $genre: [String], $format: [MediaFormat], $status: [MediaStatus], $statusNot: [MediaStatus], $season: MediaSeason, $seasonYear: Int, $isAdult: Boolean, $sort: [MediaSort], $onList: Boolean, $ids: [Int], $nsfw: [String]) { Page(page: $page, perPage: $perPage) { pageInfo { hasNextPage }, - media(type: ANIME, format_not: MUSIC, id_in: $ids, search: $search, genre_in: $genre, format_in: $format, status_in: $status, status_not_in: $statusNot, season: $season, seasonYear: $seasonYear, isAdult: $isAdult, sort: $sort, onList: $onList) { + media(type: ANIME, format_not: MUSIC, id_in: $ids, search: $search, genre_in: $genre, format_in: $format, status_in: $status, status_not_in: $statusNot, season: $season, seasonYear: $seasonYear, isAdult: $isAdult, sort: $sort, onList: $onList, genre_not_in: $nsfw) { ...FullMedia } } @@ -254,34 +254,34 @@ export const ScheduleMedia = gql(` `) export const Schedule = gql(` - query Schedule($seasonCurrent: MediaSeason, $seasonYearCurrent: Int, $seasonLast: MediaSeason, $seasonYearLast: Int, $seasonNext: MediaSeason, $seasonYearNext: Int, $onList: Boolean, $ids: [Int]) { + query Schedule($seasonCurrent: MediaSeason, $seasonYearCurrent: Int, $seasonLast: MediaSeason, $seasonYearLast: Int, $seasonNext: MediaSeason, $seasonYearNext: Int, $onList: Boolean, $ids: [Int], $formatNot: MediaFormat, $nsfw: [String]) { curr1: Page(page: 1) { - media(type: ANIME, season: $seasonCurrent, seasonYear: $seasonYearCurrent, countryOfOrigin: JP, format_not: TV_SHORT, onList: $onList, id_in: $ids) { + media(type: ANIME, season: $seasonCurrent, seasonYear: $seasonYearCurrent, format_not: $formatNot, onList: $onList, id_in: $ids, genre_not_in: $nsfw) { ...ScheduleMedia } } curr2: Page(page: 2) { - media(type: ANIME, season: $seasonCurrent, seasonYear: $seasonYearCurrent, countryOfOrigin: JP, format_not: TV_SHORT, onList: $onList, id_in: $ids) { + media(type: ANIME, season: $seasonCurrent, seasonYear: $seasonYearCurrent, format_not: $formatNot, onList: $onList, id_in: $ids, genre_not_in: $nsfw) { ...ScheduleMedia } } curr3: Page(page: 3) { - media(type: ANIME, season: $seasonCurrent, seasonYear: $seasonYearCurrent, countryOfOrigin: JP, format_not: TV_SHORT, onList: $onList, id_in: $ids) { + media(type: ANIME, season: $seasonCurrent, seasonYear: $seasonYearCurrent, format_not: $formatNot, onList: $onList, id_in: $ids, genre_not_in: $nsfw) { ...ScheduleMedia } } residue: Page(page: 1) { - media(type: ANIME, season: $seasonLast, seasonYear: $seasonYearLast, episodes_greater: 16, countryOfOrigin: JP, format_not: TV_SHORT, onList: $onList, id_in: $ids) { + media(type: ANIME, season: $seasonLast, seasonYear: $seasonYearLast, episodes_greater: 11, format_not: $formatNot, onList: $onList, id_in: $ids, genre_not_in: $nsfw) { ...ScheduleMedia } }, next1: Page(page: 1) { - media(type: ANIME, season: $seasonNext, seasonYear: $seasonYearNext, sort: [START_DATE], countryOfOrigin: JP, format_not: TV_SHORT, onList: $onList, id_in: $ids) { + media(type: ANIME, season: $seasonNext, seasonYear: $seasonYearNext, sort: [START_DATE], format_not: $formatNot, onList: $onList, id_in: $ids, genre_not_in: $nsfw) { ...ScheduleMedia } }, next2: Page(page: 2) { - media(type: ANIME, season: $seasonNext, seasonYear: $seasonYearNext, sort: [START_DATE], countryOfOrigin: JP, format_not: TV_SHORT, onList: $onList, id_in: $ids) { + media(type: ANIME, season: $seasonNext, seasonYear: $seasonYearNext, sort: [START_DATE], format_not: $formatNot, onList: $onList, id_in: $ids, genre_not_in: $nsfw) { ...ScheduleMedia } } diff --git a/src/lib/modules/auth/client.ts b/src/lib/modules/auth/client.ts index 8b1ebd4..bd64bb6 100644 --- a/src/lib/modules/auth/client.ts +++ b/src/lib/modules/auth/client.ts @@ -72,7 +72,7 @@ export default new class AuthAggregator { // QUERIES/MUTATIONS - schedule (onList = true) { + schedule (onList: boolean | null = true) { if (this.anilist()) return client.schedule(undefined, onList) if (this.kitsu()) return kitsu.schedule(onList) if (this.mal()) return mal.schedule(onList) diff --git a/src/lib/modules/auth/kitsu.ts b/src/lib/modules/auth/kitsu.ts index 14c8ae9..f7a5f44 100644 --- a/src/lib/modules/auth/kitsu.ts +++ b/src/lib/modules/auth/kitsu.ts @@ -417,7 +417,7 @@ export default new class KitsuSync { // QUERIES/MUTATIONS - schedule (onList = true) { + schedule (onList: boolean | null = true) { const ids = Object.keys(this.userlist.value).map(id => parseInt(id)) debug('Kitsu schedule called with onList:', onList, 'and ids:', ids) return client.schedule(onList && ids.length ? ids : undefined) diff --git a/src/lib/modules/auth/local.ts b/src/lib/modules/auth/local.ts index 9ff5553..34f103a 100644 --- a/src/lib/modules/auth/local.ts +++ b/src/lib/modules/auth/local.ts @@ -45,7 +45,7 @@ export default new class LocalSync { } } - schedule (onList = true): ReturnType { + schedule (onList: boolean | null = true): ReturnType { const ids = Object.values(this.entries.value).map(({ mediaListEntry }) => mediaListEntry?.id).filter(e => e != null) return client.schedule(onList && ids.length ? ids : undefined) } diff --git a/src/lib/modules/auth/mal.ts b/src/lib/modules/auth/mal.ts index 01abdb2..8b715d3 100644 --- a/src/lib/modules/auth/mal.ts +++ b/src/lib/modules/auth/mal.ts @@ -430,7 +430,7 @@ export default new class MALSync { // QUERIES/MUTATIONS - schedule (onList = true) { + schedule (onList: boolean | null = true) { const ids = Object.keys(this.userlist.value).map(id => parseInt(id)) debug('Fetching MAL schedule with IDs:', ids) return client.schedule(onList && ids.length ? ids : undefined) diff --git a/src/lib/modules/settings/defaults.ts b/src/lib/modules/settings/defaults.ts index 229c690..f9cf7a1 100644 --- a/src/lib/modules/settings/defaults.ts +++ b/src/lib/modules/settings/defaults.ts @@ -42,5 +42,6 @@ export default { playerSkip: false, playerSkipFiller: false, minimalPlayerUI: false, - androidStorageType: 'cache' + androidStorageType: 'cache', + showHentai: false } diff --git a/src/lib/modules/settings/settings.ts b/src/lib/modules/settings/settings.ts index a87601d..0b20bf6 100644 --- a/src/lib/modules/settings/settings.ts +++ b/src/lib/modules/settings/settings.ts @@ -14,6 +14,8 @@ export const settings = persisted('settings', defaults, { beforeRead: value => ( export const debug = persisted('debug-key', '') +export const nsfw = derived(settings, $settings => ($settings.showHentai ? null : ['Hentai']) as ['Hentai'] | null) + debug.subscribe((value) => { native.debug(value) Debug.enable(value) diff --git a/src/routes/app/schedule/+page.svelte b/src/routes/app/schedule/+page.svelte index a3ede49..3931ddc 100644 --- a/src/routes/app/schedule/+page.svelte +++ b/src/routes/app/schedule/+page.svelte @@ -21,7 +21,7 @@ const onList = persisted('schedule-on-list', true) - $: query = authAggregator.schedule($onList) + $: query = authAggregator.schedule($onList || null) let now = new Date() $: monthName = now.toLocaleString('en-US', { month: 'long' }) @@ -200,7 +200,7 @@ {#each episodes.slice(5) as episode, i (i)} {@const status = _list(episode)} - +
{#if status}