From 74813bc7ce91277f68905be5ea8876784683f7ca Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 30 Nov 2023 11:10:11 -0800 Subject: fix(birthdays): current day --- src/lib/ACDB.ts | 18 ++++++++++++++++++ src/lib/Tools/CharacterBirthdays.svelte | 24 ++++++++++++++++++------ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 src/lib/ACDB.ts (limited to 'src/lib') diff --git a/src/lib/ACDB.ts b/src/lib/ACDB.ts new file mode 100644 index 00000000..29537fb8 --- /dev/null +++ b/src/lib/ACDB.ts @@ -0,0 +1,18 @@ +export interface ACDBBirthdaysEntry { + character_image: string; + name: string; + origin: string; +} + +export const ACDBBirthdays = async (month: number, day: number): Promise => + ( + await ( + await fetch(`/api/acdb-birthdays?month=${month}&day=${day}`, { + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0' + } + }) + ).json() + )['characters']; diff --git a/src/lib/Tools/CharacterBirthdays.svelte b/src/lib/Tools/CharacterBirthdays.svelte index 1ba8f9b9..d1d03ed0 100644 --- a/src/lib/Tools/CharacterBirthdays.svelte +++ b/src/lib/Tools/CharacterBirthdays.svelte @@ -1,17 +1,29 @@ -{#await todaysCharacterBirthdays()} - Loading ... +{#await ACDBBirthdays(date.getMonth() + 1, date.getDate())} +

Loading ...

{:then birthdays} +

+ This tool does not use AniList's API, so it will have more characters than AniList, but also + some unexpected characters which may not be present in AniList. +

+
{#each birthdays as birthday}
- - {birthday.name.full} - Character (Large) + + {birthday.name} + Character (Large)
{/each} -- cgit v1.2.3