From 68e3b424c838edb07d59e677bc9debd6d5a32fd4 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 20 Oct 2023 16:37:53 -0700 Subject: feat(settings): change to checkbox --- src/lib/Settings/SettingCheckboxToggle.svelte | 54 ++++++++++++++++ src/routes/settings/+page.svelte | 90 ++++++++++----------------- src/stores/settings.ts | 4 +- 3 files changed, 90 insertions(+), 58 deletions(-) create mode 100644 src/lib/Settings/SettingCheckboxToggle.svelte diff --git a/src/lib/Settings/SettingCheckboxToggle.svelte b/src/lib/Settings/SettingCheckboxToggle.svelte new file mode 100644 index 00000000..ab603278 --- /dev/null +++ b/src/lib/Settings/SettingCheckboxToggle.svelte @@ -0,0 +1,54 @@ + + + + +{#if disabled} + + {text} + + +{:else} + {text} + +{/if} + +
+ +{#if sectionBreak} +

+{/if} diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index b0885436..ca27dfe9 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -5,7 +5,7 @@ import manga from '../../stores/manga'; import anime from '../../stores/anime'; import settings from '../../stores/settings'; - import SettingToggle from '$lib/Settings/SettingToggle.svelte'; + import SettingCheckboxToggle from '$lib/Settings/SettingCheckboxToggle.svelte'; import SettingHint from '$lib/Settings/SettingHint.svelte'; import { pruneAllManga } from '$lib/Media/manga'; @@ -44,55 +44,32 @@

Display - - theme - - - - paused media - - - - social button - - -

- - unresolved - Displays unresolved chapter counts as "?" - -

- - - media with zero progress - - - May cause - rate-limiting - depending on how much releasing manga are on your lists - - -

- - - anime panel by default - - - manga panel by default - - - Sort anime by {@html !$settings.sortByDifference - ? 'difference between last watched and next episode' - : 'days left until next episode'} - + + + + + + + + + May cause + rate-limiting + depending on how much releasing manga are on your lists + + + +
+ + + + + + By default, anime will be sorted by the number of days left until the next episode airs. + +

@@ -100,12 +77,11 @@

Calculation - - chapters - - - 50/50.6 would {@html $settings.roundDownChapters ? '' : 'not'} be due - + + + Round down to the nearest whole number. 50/50.6 would not be due + +

@@ -115,7 +91,7 @@ Re-cache ALL unresolved manga -

+
Re-cache ALL manga Force a re-cache of all cached manga chapter counts diff --git a/src/stores/settings.ts b/src/stores/settings.ts index 0c9742ee..6863ae99 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -15,6 +15,7 @@ export interface Settings { displayPausedMedia: boolean; limitListHeight: boolean; displaySocialButton: boolean; + disableGuessing: boolean; } const defaultSettings: Settings = { @@ -30,7 +31,8 @@ const defaultSettings: Settings = { linkToAniList: true, displayPausedMedia: true, limitListHeight: false, - displaySocialButton: false + displaySocialButton: false, + disableGuessing: false }; const createStore = () => { -- cgit v1.2.3 From 45c128e0be6bfaeefd809c745275ee8d9798ff4c Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 20 Oct 2023 16:54:53 -0700 Subject: feat(manga): disable chapter guessing --- src/lib/List/Template/MangaListTemplate.svelte | 4 +++- src/lib/Media/manga.ts | 13 +++++++++---- src/routes/settings/+page.svelte | 9 +++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/lib/List/Template/MangaListTemplate.svelte b/src/lib/List/Template/MangaListTemplate.svelte index 9823f97f..a0b48bdf 100644 --- a/src/lib/List/Template/MangaListTemplate.svelte +++ b/src/lib/List/Template/MangaListTemplate.svelte @@ -69,7 +69,9 @@ ($settings.displayNotStarted === true ? 0 : 1) ); let finalMedia = releasingMedia; - const chapterPromises = finalMedia.map((m: Media) => chapterCount(identity, m)); + const chapterPromises = finalMedia.map((m: Media) => + chapterCount(identity, m, $settings.disableGuessing) + ); const chapterCounts = await Promise.all(chapterPromises); finalMedia.forEach((m: Media, i) => { diff --git a/src/lib/Media/manga.ts b/src/lib/Media/manga.ts index 9d0e08a6..3c0cf837 100644 --- a/src/lib/Media/manga.ts +++ b/src/lib/Media/manga.ts @@ -14,7 +14,8 @@ export const pruneAllManga = async () => { export const chapterCount = async ( identity: UserIdentity, manga: Media, - preferActivity = false + disableGuessing: boolean + // preferActivity = false ): Promise => { const chapters = await chapterDatabase.chapters.get(manga.id); @@ -22,11 +23,15 @@ export const chapterCount = async ( return chapters.chapters === -1 ? null : chapters.chapters; } - if (preferActivity) { - return await recentMediaActivities(identity, manga); - } + // if (preferActivity) { + // return await recentMediaActivities(identity, manga); + // } const tryRecentMediaActivities = async () => { + if (disableGuessing) { + return null; + } + const anilistData = await recentMediaActivities(identity, manga); await chapterDatabase.chapters.put({ diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index ca27dfe9..0435a862 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -82,6 +82,15 @@ Round down to the nearest whole number. 50/50.6 would not be due + +
+ + + + Enabling this setting will disable light novel chapter counts and may cause inaccuracy in + unresolved manga chapter counts + +

-- cgit v1.2.3 From 9a9515eb69458c0e28fedc66072eecc25b326a45 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 20 Oct 2023 18:15:26 -0700 Subject: fix(settings): change livechart mode --- src/lib/List/Anime/CleanAnimeList.svelte | 8 ++++---- src/routes/settings/+page.svelte | 2 +- src/stores/settings.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte index ffd34788..ce64f141 100644 --- a/src/lib/List/Anime/CleanAnimeList.svelte +++ b/src/lib/List/Anime/CleanAnimeList.svelte @@ -37,11 +37,11 @@ {@const progress = (anime.mediaListEntry || { progress: 0 }).progress}

  • {#if lastUpdatedMedia === anime.id} diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index 0435a862..029bca1c 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -45,7 +45,7 @@ Display - + diff --git a/src/stores/settings.ts b/src/stores/settings.ts index 6863ae99..5ffae4f5 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -11,7 +11,7 @@ export interface Settings { roundDownChapters: boolean; sortByDifference: boolean; forceLightTheme: boolean; - linkToAniList: boolean; + linkToLiveChart: boolean; displayPausedMedia: boolean; limitListHeight: boolean; displaySocialButton: boolean; @@ -28,7 +28,7 @@ const defaultSettings: Settings = { roundDownChapters: true, sortByDifference: false, forceLightTheme: false, - linkToAniList: true, + linkToLiveChart: true, displayPausedMedia: true, limitListHeight: false, displaySocialButton: false, -- cgit v1.2.3 From c0562f85fbdda536b6002f28916c25716916eb5f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 20 Oct 2023 20:10:00 -0700 Subject: fix(settings): hint formatting --- src/routes/settings/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index 029bca1c..b8d368cc 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -79,7 +79,7 @@ - Round down to the nearest whole number. 50/50.6 would not be due + Round down to the nearest whole number. (e.g., 50/50.6 would not be due) -- cgit v1.2.3 From 95d76ef56500e6cf22e89531a8139be493bdb53d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 21 Oct 2023 03:40:44 -0700 Subject: fix(list): hide caught up last updated highlight --- src/lib/List/Anime/CleanAnimeList.svelte | 2 +- src/lib/List/CleanMangaList.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte index ce64f141..d480aca7 100644 --- a/src/lib/List/Anime/CleanAnimeList.svelte +++ b/src/lib/List/Anime/CleanAnimeList.svelte @@ -44,7 +44,7 @@ : `https://anilist.co/anime/${anime.id}`} target="_blank" > - {#if lastUpdatedMedia === anime.id} + {#if lastUpdatedMedia === anime.id && anime.mediaListEntry?.progress !== progress} {anime.title.english || anime.title.romaji || anime.title.native} diff --git a/src/lib/List/CleanMangaList.svelte b/src/lib/List/CleanMangaList.svelte index a56a1c81..55fb72fc 100644 --- a/src/lib/List/CleanMangaList.svelte +++ b/src/lib/List/CleanMangaList.svelte @@ -33,7 +33,7 @@
  • - {#if lastUpdatedMedia === manga.id} + {#if lastUpdatedMedia === manga.id && manga.mediaListEntry?.progress !== progress} {manga.title.english || manga.title.romaji || manga.title.native} -- cgit v1.2.3 From 814e8d817bf2cccb1b8a4a4ac2e9cf52b115a539 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 22 Oct 2023 11:14:05 -0700 Subject: feat(tools): use string query parameters --- src/routes/tools/+page.svelte | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index 3976aeba..75bf5a40 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -6,25 +6,27 @@ export let data; - let tool = browser ? Number(new URLSearchParams(window.location.search).get('tool')) || 0 : 0; + let tool = browser + ? String(new URLSearchParams(window.location.search).get('tool')) || 'default' + : 'default';

    -{#if tool === 0} +{#if tool === 'default'} Select a tool to continue. -{:else if tool === 2} +{:else if tool === 'activity_history_hole_risks'} -{:else if tool === 3} +{:else if tool === 'wrapped'}
    -{:else if tool === 1} +{:else if tool === 'todays_character_birthdays'}
      {#await todaysCharacterBirthdays()}
    • Loading ...
    • -- cgit v1.2.3 From 3214a2ed1c81a2ef39a5b6123c713a31b11c3222 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 22 Oct 2023 13:00:12 -0700 Subject: feat(tools): default selection query --- src/routes/tools/+page.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index 75bf5a40..8ddc0aac 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -6,14 +6,13 @@ export let data; - let tool = browser - ? String(new URLSearchParams(window.location.search).get('tool')) || 'default' - : 'default'; + const urlParameters = browser ? new URLSearchParams(window.location.search) : null; + let tool = browser && urlParameters?.size !== 0 ? urlParameters?.get('tool') : 'default';

      + (searchInputFinal = searchInput)}>Search +

      + +{#if searchInputFinal !== ''} + {#await threads(searchInputFinal)} + Loading ... + {:then threads} +
        + {#each threads + .filter((thread) => thread.title.includes('[Spoilers]') && thread.title.includes('Episode')) + .sort((a, b) => b.createdAt - a.createdAt) as thread} +
      • + + {thread.title.replace('[Spoilers]', '')} + +
      • + {/each} +
      + {:catch} +

      + Threads could not be loaded. You might have been rate limited. +

      +

      + Try again in a few minutes. If the problem persists, please contact @fuwn on AniList. +

      + {/await} +{:else} +

      Enter a username to search for to continue.

      +{/if} diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index 8ddc0aac..5a12fb0f 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -3,6 +3,7 @@ import { todaysCharacterBirthdays } from '$lib/AniList/character'; import Wrapped from '$lib/Tools/Wrapped.svelte'; import { browser } from '$app/environment'; + import EpisodeDiscussionCollector from '$lib/Tools/EpisodeDiscussionCollector.svelte'; export let data; @@ -16,6 +17,7 @@ +

      @@ -25,6 +27,8 @@ {:else if tool === 'wrapped'}
      +{:else if tool === 'episode_discussion_collector'} + {:else if tool === 'todays_character_birthdays'}
        {#await todaysCharacterBirthdays()} -- cgit v1.2.3 From 2000b8695898070020b55727fd7f6a026f7e6687 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 23 Oct 2023 11:51:16 -0700 Subject: fix(list): compare episodes to progress highlight --- src/lib/List/Anime/CleanAnimeList.svelte | 2 +- src/lib/List/CleanMangaList.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte index d480aca7..30443e83 100644 --- a/src/lib/List/Anime/CleanAnimeList.svelte +++ b/src/lib/List/Anime/CleanAnimeList.svelte @@ -44,7 +44,7 @@ : `https://anilist.co/anime/${anime.id}`} target="_blank" > - {#if lastUpdatedMedia === anime.id && anime.mediaListEntry?.progress !== progress} + {#if lastUpdatedMedia === anime.id && anime.episodes !== progress} {anime.title.english || anime.title.romaji || anime.title.native} diff --git a/src/lib/List/CleanMangaList.svelte b/src/lib/List/CleanMangaList.svelte index 55fb72fc..180c12f2 100644 --- a/src/lib/List/CleanMangaList.svelte +++ b/src/lib/List/CleanMangaList.svelte @@ -33,7 +33,7 @@
      • - {#if lastUpdatedMedia === manga.id && manga.mediaListEntry?.progress !== progress} + {#if lastUpdatedMedia === manga.id && manga.chapters !== progress} {manga.title.english || manga.title.romaji || manga.title.native} -- cgit v1.2.3 From 78a6e2f7b1d8b46f98bf27562cc6a646871fda5c Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 23 Oct 2023 16:52:02 -0700 Subject: fix(feeds): html encode title --- src/routes/feeds/activity-notifications/+server.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/routes/feeds/activity-notifications/+server.ts b/src/routes/feeds/activity-notifications/+server.ts index 06c55ace..dd4ee0b4 100644 --- a/src/routes/feeds/activity-notifications/+server.ts +++ b/src/routes/feeds/activity-notifications/+server.ts @@ -1,5 +1,9 @@ import { notifications, type Notification } from '$lib/AniList/notifications'; +const htmlEncode = (input: string) => { + return input.replace(/[\u00A0-\u9999<>&]/g, (i) => '&#' + i.charCodeAt(0) + ';'); +}; + const render = (posts: Notification[] = []) => ` ` ${notification.id} -${title} +${htmlEncode(title)} ${link} ${notification.user.name} -- cgit v1.2.3 From ab00423409358eace0aa66017bfb252cdf680fd5 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 17:23:09 -0700 Subject: feat(badges): add safe limits --- src/lib/userBadgesDatabase.ts | 6 +++--- src/routes/user/[user]/badges/+page.svelte | 34 ++++++++++++++++++------------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/lib/userBadgesDatabase.ts b/src/lib/userBadgesDatabase.ts index c129770e..ae1b1176 100644 --- a/src/lib/userBadgesDatabase.ts +++ b/src/lib/userBadgesDatabase.ts @@ -15,9 +15,9 @@ const database = new Database('./due_moe.sqlite3', { database.exec(`create table if not exists user_badges ( id integer primary key, user_id integer not null, - post text not null, - image text not null, - description text default null, + post text(1000) not null, + image text(1000) not null, + description text(1000) default null, time timestamp default current_timestamp )`); diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte index 276bf1ca..8ed7b878 100644 --- a/src/routes/user/[user]/badges/+page.svelte +++ b/src/routes/user/[user]/badges/+page.svelte @@ -186,18 +186,12 @@ // } // ]; - // onMount(async () => { - // const id = (await user(data.username)).id; - - // for (const badge of badges) { - // await fetch(`/api/badges-add?id=${id}`, { - // method: 'POST', - // body: JSON.stringify(badge) - // }); - // } - // }); - onMount(async () => { + // await fetch(`/api/badges/add`, { + // method: 'POST', + // body: JSON.stringify(badges) + // }); + if (data.user) { currentUserIdentity = userIdentity(data.user); } else { @@ -258,9 +252,21 @@

        - - - + + + Add Badge

        {/if} -- cgit v1.2.3 From f7ac01d320e825e0ee7962149923614fb37af843 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 17:24:48 -0700 Subject: feat(badges): remove test values --- src/routes/user/[user]/badges/+page.svelte | 183 ----------------------------- 1 file changed, 183 deletions(-) diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte index 8ed7b878..293a7ba5 100644 --- a/src/routes/user/[user]/badges/+page.svelte +++ b/src/routes/user/[user]/badges/+page.svelte @@ -8,190 +8,7 @@ let editMode = false; let currentUserIdentity: ReturnType; - // const badges: Badge[] = [ - // { - // post: 'https://anilist.co/activity/611973592', - // image: 'https://files.catbox.moe/6tvw17.png' - // }, - // { post: 'https://anilist.co/activity/611972285', image: 'https://files.catbox.moe/rn5qr5.png' }, - // { post: 'https://anilist.co/activity/611977824', image: 'https://i.imgur.com/DFkT4zB.png' }, - // { - // post: 'https://anilist.co/activity/612036793', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1144851101414326333/Badge2_26-08-23.png' - // }, - // { - // post: 'https://anilist.co/activity/612273794', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1144773312468234351/DOGDAY_5_v2.png' - // }, - // { post: 'https://anilist.co/activity/613961295', image: 'https://files.catbox.moe/6rebg8.png' }, - // { post: 'https://anilist.co/activity/614793182', image: 'https://imgur.com/QhJbw4l.png' }, - // { post: 'https://anilist.co/activity/615002857', image: 'https://files.catbox.moe/oc8g02.png' }, - // { post: 'https://anilist.co/activity/615426233', image: 'https://files.catbox.moe/4z226e.png' }, - // { post: 'https://anilist.co/activity/615427328', image: 'https://files.catbox.moe/tqcltp.png' }, - // { post: 'https://anilist.co/activity/615920191', image: 'https://files.catbox.moe/frw5p5.png' }, - // { post: 'https://anilist.co/activity/616629257', image: 'https://files.catbox.moe/15st7d.png' }, - // { post: 'https://anilist.co/activity/617442391', image: 'https://i.imgur.com/aHkSRCz.gif' }, - // { - // post: 'https://anilist.co/activity/617445099', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1148663790452346961/chondyunbday.gif' - // }, - // { - // post: 'https://anilist.co/activity/617616590', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1148678438551568444/Badge_3.png' - // }, - // { post: 'https://anilist.co/activity/617842237', image: 'https://i.imgur.com/Zx4uiAz.gif' }, - // { post: 'https://anilist.co/activity/618296369', image: 'https://i.imgur.com/V6UsqYI.gif' }, - // { post: 'https://anilist.co/activity/618664650', image: 'https://imgur.com/x98vT7p.png' }, - // { post: 'https://anilist.co/activity/619306471', image: 'https://i.imgur.com/GppbpqE.png' }, - // { post: 'https://anilist.co/activity/619657632', image: 'https://files.catbox.moe/barla6.png' }, - // { post: 'https://anilist.co/activity/619659847', image: 'https://i.imgur.com/e81dgSB.gif' }, - // { post: 'https://anilist.co/activity/619661657', image: 'https://i.imgur.com/S0fSeD4.gif' }, - // { post: 'https://anilist.co/activity/619664832', image: 'https://i.imgur.com/EXNQE3n.gif' }, - // { - // post: 'https://anilist.co/activity/619764622', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1151314632942817290/persona_5_3.png' - // }, - // { post: 'https://anilist.co/activity/620025361', image: 'https://i.imgur.com/DmEl13g.gif' }, - // { post: 'https://anilist.co/activity/620125206', image: 'https://i.imgur.com/SmzhGyu.gif' }, - // { post: 'https://anilist.co/activity/620125762', image: 'https://i.imgur.com/38I5gUM.gif' }, - // { post: 'https://anilist.co/activity/620126356', image: 'https://i.imgur.com/9I7Xggm.gif' }, - // { post: 'https://anilist.co/activity/620600819', image: 'https://i.imgur.com/nHREaUc.png' }, - // { post: 'https://anilist.co/activity/620989269', image: 'https://imgur.com/XjhyOHU.png' }, - // { - // post: 'https://anilist.co/activity/621253410', - // image: - // 'https://cdn.discordapp.com/attachments/1139717993845239849/1147701375707381760/0028HLA.png' - // }, - // { post: 'https://anilist.co/activity/621787546', image: 'https://i.imgur.com/tn5yVsk.gif' }, - // { - // post: 'https://anilist.co/activity/621789551', - // image: 'https://i.postimg.cc/Z5325GDx/ota-day-otaku-academia-ittle-witch-academia.png' - // }, - // { post: 'https://anilist.co/activity/622236894', image: 'https://i.imgur.com/vicrIfS.png' }, - // { post: 'https://anilist.co/activity/622237728', image: 'https://i.imgur.com/TLSC65A.jpg' }, - // { post: 'https://anilist.co/activity/623156563', image: 'https://files.catbox.moe/ujf0ym.png' }, - // { post: 'https://anilist.co/activity/623990926', image: 'https://files.catbox.moe/gkalwm.png' }, - // { - // post: 'https://anilist.co/activity/623995806', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1154888665638649916/monikabday.png' - // }, - // { post: 'https://anilist.co/activity/624542383', image: 'https://files.catbox.moe/9tzs66.png' }, - // { - // post: 'https://anilist.co/activity/624542383', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1154540564671377459/EMILIA_BADGE_2.png' - // }, - // { post: 'https://anilist.co/activity/624543474', image: 'https://imgur.com/WQuXh6g.png' }, - // { - // post: 'https://anilist.co/activity/624544489', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1154736156093726870/fsdfwefewfwf.png' - // }, - // { - // post: 'https://anilist.co/activity/624545233', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1153606849464111134/katoubadge1.png' - // }, - // { post: 'https://anilist.co/activity/624548754', image: 'https://imgur.com/j5aqX5w.png' }, - // { - // post: 'https://anilist.co/activity/624549956', - // image: - // 'https://cdn.discordapp.com/attachments/1152962059126972417/1154745849465811015/Day_of_Mid_2.png' - // }, - // { post: 'https://anilist.co/activity/626483669', image: 'https://files.catbox.moe/lz0r48.png' }, - // { - // post: 'https://anilist.co/activity/626483669', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1156396779332456538/jojobdayb.png' - // }, - // { - // post: 'https://anilist.co/activity/626770819', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1156582649779994664/kikurihiroi.png' - // }, - // { post: 'https://anilist.co/activity/626772329', image: 'https://i.imgur.com/P09v438.gif' }, - // { - // post: 'https://anilist.co/activity/627283326', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1157124224197083226/coffeeday2.png' - // }, - // { - // post: 'https://anilist.co/activity/628202238', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1156472801457340506/rinshima1.png' - // }, - // { - // post: 'https://anilist.co/activity/628202913', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1157574135069806592/Badge-1_-_01_10_23.png' - // }, - // { - // post: 'https://anilist.co/activity/628305048', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1157650582094479370/SakeDay2.png' - // }, - // { post: 'https://anilist.co/activity/629168789', image: 'https://files.catbox.moe/0mwudd.png' }, - // { post: 'https://anilist.co/activity/629592629', image: 'https://files.catbox.moe/pyjy0z.png' }, - // { post: 'https://anilist.co/activity/629593251', image: 'https://files.catbox.moe/e9xx50.png' }, - // { post: 'https://anilist.co/activity/630084060', image: 'https://i.imgur.com/zVU0gie.gif' }, - // { post: 'https://anilist.co/activity/630462423', image: 'https://files.catbox.moe/b63wxi.png' }, - // { - // post: 'https://anilist.co/activity/630464366', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1158527481486266490/codegeass1.png' - // }, - // { post: 'https://anilist.co/activity/630996180', image: 'https://files.catbox.moe/ap15dx.png' }, - // { post: 'https://anilist.co/activity/631494022', image: 'https://files.catbox.moe/fw4rqx.png' }, - // { - // post: 'https://anilist.co/activity/631503062', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1158787682231660684/rize1.png' - // }, - // { - // post: 'https://anilist.co/activity/632259051', - // image: - // 'https://cdn.discordapp.com/attachments/1154438205731524638/1158943217459412992/Luna_Bday2023_Axel5.png' - // }, - // { post: 'https://anilist.co/activity/632260829', image: 'https://files.catbox.moe/ighico.png' }, - // { post: 'https://anilist.co/activity/632311940', image: 'https://files.catbox.moe/ukv6tv.png' }, - // { - // post: 'https://anilist.co/activity/632311940', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1160915207711895593/Gintoki_2.png' - // }, - // { - // post: 'https://anilist.co/activity/632407688', - // image: - // 'https://cdn.discordapp.com/attachments/1136989514653519924/1159856849735127110/Nishinoya_1.png' - // }, - // { post: 'https://anilist.co/activity/632832412', image: 'https://files.catbox.moe/9lk6s1.png' }, - // { post: 'https://anilist.co/activity/633710355', image: 'https://i.imgur.com/JmpriDr.gif' }, - // { post: 'https://anilist.co/activity/633710743', image: 'https://files.catbox.moe/it9d7q.png' }, - // { - // post: 'https://anilist.co/activity/633711260', - // image: - // 'https://cdn.discordapp.com/attachments/1118627570074800264/1160674827670134804/Sonia1.png' - // }, - // { post: 'https://anilist.co/activity/634118108', image: 'https://files.catbox.moe/tzudpj.png' }, - // { - // post: 'https://anilist.co/activity/634119722', - // image: - // 'https://cdn.discordapp.com/attachments/1085425937933418578/1162583650840354846/Mystery_Day_badge_4.png' - // } - // ]; - onMount(async () => { - // await fetch(`/api/badges/add`, { - // method: 'POST', - // body: JSON.stringify(badges) - // }); - if (data.user) { currentUserIdentity = userIdentity(data.user); } else { -- cgit v1.2.3 From dc9755d709b5bc88fd81f6e11641c1e78659283d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 17:28:39 -0700 Subject: fix(database): change path for docker --- src/lib/userBadgesDatabase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/userBadgesDatabase.ts b/src/lib/userBadgesDatabase.ts index ae1b1176..78655cd3 100644 --- a/src/lib/userBadgesDatabase.ts +++ b/src/lib/userBadgesDatabase.ts @@ -8,7 +8,7 @@ export interface Badge { id?: number; } -const database = new Database('./due_moe.sqlite3', { +const database = new Database('./data/due_moe.sqlite3', { verbose: dev ? console.log : undefined }); -- cgit v1.2.3 From 8f79277aeb3e3ac8182653dfdd62d85d06c77706 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 17:30:44 -0700 Subject: fix(node): add better-sqlite3 --- bun.lockb | Bin 99944 -> 111875 bytes package.json | 77 ++++++++++++++++++++++++++++++----------------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/bun.lockb b/bun.lockb index 344904f0..4b02c555 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index f77943cd..241a036b 100644 --- a/package.json +++ b/package.json @@ -1,40 +1,41 @@ { - "name": "due.moe", - "version": "0.0.0", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/kit": "^1.20.4", - "@types/dom-to-image": "^2.6.5", - "@types/file-saver": "^2.0.5", - "@typescript-eslint/eslint-plugin": "^5.45.0", - "@typescript-eslint/parser": "^5.45.0", - "eslint": "^8.28.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-svelte": "^2.30.0", - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.10.1", - "svelte": "^4.0.5", - "svelte-adapter-bun": "^0.5.0", - "svelte-check": "^3.4.3", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^4.4.2" - }, - "type": "module", - "dependencies": { - "dexie": "^4.0.1-alpha.25", - "dom-to-image": "^2.6.0", - "html2canvas": "^1.4.1", - "rss-parser": "^3.13.0" - } + "name": "due.moe", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write ." + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^2.0.0", + "@sveltejs/kit": "^1.20.4", + "@types/dom-to-image": "^2.6.5", + "@types/file-saver": "^2.0.5", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.30.0", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.10.1", + "svelte": "^4.0.5", + "svelte-adapter-bun": "^0.5.0", + "svelte-check": "^3.4.3", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^4.4.2" + }, + "type": "module", + "dependencies": { + "better-sqlite3": "^9.0.0", + "dexie": "^4.0.1-alpha.25", + "dom-to-image": "^2.6.0", + "html2canvas": "^1.4.1", + "rss-parser": "^3.13.0" + } } -- cgit v1.2.3 From ac4aa30628943b4f8f1c853497ec662376387d77 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 18:04:59 -0700 Subject: fix(docker): build with node --- Dockerfile | 8 ++++--- package.json | 78 ++++++++++++++++++++++++++++++------------------------------ 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f0208e8..615c0343 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,16 @@ -FROM oven/bun:1.0.1 as build +FROM node:19-bullseye as build WORKDIR /due +RUN apt update -y && apt upgrade -y + COPY package.json ./ -RUN bun install +RUN yarn install COPY ./ ./ -RUN bun --bun vite build +RUN yarn run build FROM oven/bun:1.0.1 diff --git a/package.json b/package.json index 241a036b..51f13df7 100644 --- a/package.json +++ b/package.json @@ -1,41 +1,41 @@ { - "name": "due.moe", - "version": "0.0.0", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/kit": "^1.20.4", - "@types/dom-to-image": "^2.6.5", - "@types/file-saver": "^2.0.5", - "@typescript-eslint/eslint-plugin": "^5.45.0", - "@typescript-eslint/parser": "^5.45.0", - "eslint": "^8.28.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-svelte": "^2.30.0", - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.10.1", - "svelte": "^4.0.5", - "svelte-adapter-bun": "^0.5.0", - "svelte-check": "^3.4.3", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^4.4.2" - }, - "type": "module", - "dependencies": { - "better-sqlite3": "^9.0.0", - "dexie": "^4.0.1-alpha.25", - "dom-to-image": "^2.6.0", - "html2canvas": "^1.4.1", - "rss-parser": "^3.13.0" - } + "name": "due.moe", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write ." + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^2.0.0", + "@sveltejs/kit": "^1.20.4", + "@types/dom-to-image": "^2.6.5", + "@types/file-saver": "^2.0.5", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.30.0", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.10.1", + "svelte": "^4.0.5", + "svelte-adapter-bun": "^0.5.0", + "svelte-check": "^3.4.3", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^4.4.2" + }, + "type": "module", + "dependencies": { + "better-sqlite3": "^9.0.0", + "dexie": "^4.0.1-alpha.25", + "dom-to-image": "^2.6.0", + "html2canvas": "^1.4.1", + "rss-parser": "^3.13.0" + } } -- cgit v1.2.3 From 36d2b84670a096550b03ceb276184ab309b5364a Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 18:09:27 -0700 Subject: feat(layout): profile item navigation --- src/routes/+layout.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 19df3f1c..20ae9ef4 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -52,11 +52,17 @@

        HomeCompletedManga & LN Updates • - ToolsSettings 」 + Tools • {#if data.user} + Profile • + {/if} Settings

        - HomeCompletedTools
        + HomeCompletedTools + {#if data.user} + • Profile + {/if} +
        Settings Manga & LN Updates -- cgit v1.2.3 From 4a97d2608aaae9ff7711acf8f37ef45cdb349293 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 18:13:12 -0700 Subject: fix(routes): remove old user route --- src/routes/@[user]/+page.server.ts | 5 ----- src/routes/@[user]/+page.svelte | 45 -------------------------------------- 2 files changed, 50 deletions(-) delete mode 100644 src/routes/@[user]/+page.server.ts delete mode 100644 src/routes/@[user]/+page.svelte diff --git a/src/routes/@[user]/+page.server.ts b/src/routes/@[user]/+page.server.ts deleted file mode 100644 index 76d2d889..00000000 --- a/src/routes/@[user]/+page.server.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const load = ({ params }) => { - return { - username: params.user - }; -}; diff --git a/src/routes/@[user]/+page.svelte b/src/routes/@[user]/+page.svelte deleted file mode 100644 index 1763193a..00000000 --- a/src/routes/@[user]/+page.svelte +++ /dev/null @@ -1,45 +0,0 @@ - - -{#if userData === null} - Could not load user profile for @{data.username}. - -

        - - Does this user exist? -{:else if userData === undefined} - Loading ... -{:else} - @{userData.name} - -

        - - This user has watched {(userData.statistics.anime.minutesWatched / 60 / 24).toFixed(1)} days of anime - and read - {((userData.statistics.manga.chaptersRead * 8.58) / 60 / 24).toFixed(1)} days of manga. -{/if} - -

        - -


        - -This page is under construction! -- cgit v1.2.3 From f99fd41ee23d7669812ff1d88d23a9b7f22db901 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 18:18:37 -0700 Subject: feat(user): prettier user route --- src/lib/AniList/user.ts | 5 ++++- src/routes/user/[user]/+page.svelte | 44 ++++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/lib/AniList/user.ts b/src/lib/AniList/user.ts index dd9995fd..fdc98a58 100644 --- a/src/lib/AniList/user.ts +++ b/src/lib/AniList/user.ts @@ -15,6 +15,9 @@ export interface User { volumesRead: number; }; }; + avatar: { + large: string; + }; } export const user = async (username: string): Promise => { @@ -28,7 +31,7 @@ export const user = async (username: string): Promise => { }, body: JSON.stringify({ query: `{ User(name: "${username}") { - name id statistics { + name id avatar { large } statistics { anime { count meanScore minutesWatched episodesWatched } diff --git a/src/routes/user/[user]/+page.svelte b/src/routes/user/[user]/+page.svelte index 227ba252..858e6aec 100644 --- a/src/routes/user/[user]/+page.svelte +++ b/src/routes/user/[user]/+page.svelte @@ -27,14 +27,38 @@ {:else if userData === undefined} Loading ... {:else} -

        - @{userData.name} - • Badge Wall -

        - - This user has watched {(userData.statistics.anime.minutesWatched / 60 / 24).toFixed(1)} days of anime - and read - {((userData.statistics.manga.chaptersRead * 8.58) / 60 / 24).toFixed(1)} days of manga. +
        +

        + + + +

        + +
        +

        + @{userData.name} + • Badge Wall +

        + + This user has watched {(userData.statistics.anime.minutesWatched / 60 / 24).toFixed(1)} days of + anime and read + {((userData.statistics.manga.chaptersRead * 8.58) / 60 / 24).toFixed(1)} days of manga. +
        +
        {/if} + + -- cgit v1.2.3 From deb6fb9c0dd8af78bcac23350d1543e9fb3b01ec Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 18:43:27 -0700 Subject: fix(docker): move back to node :( --- Dockerfile | 6 ++--- bun.lockb | Bin 111875 -> 121044 bytes package.json | 78 +++++++++++++++++++++++++++---------------------------- svelte.config.js | 2 +- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 615c0343..94719c00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,12 +12,12 @@ COPY ./ ./ RUN yarn run build -FROM oven/bun:1.0.1 +FROM node:19-bullseye WORKDIR /due -COPY --from=build /due/build . +COPY --from=build /due . EXPOSE 3000 -CMD ["bun", "./index.js"] \ No newline at end of file +CMD ["node", "build"] \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 4b02c555..113a5979 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 51f13df7..b7ee27da 100644 --- a/package.json +++ b/package.json @@ -1,41 +1,41 @@ { - "name": "due.moe", - "version": "0.0.0", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/kit": "^1.20.4", - "@types/dom-to-image": "^2.6.5", - "@types/file-saver": "^2.0.5", - "@typescript-eslint/eslint-plugin": "^5.45.0", - "@typescript-eslint/parser": "^5.45.0", - "eslint": "^8.28.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-svelte": "^2.30.0", - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.10.1", - "svelte": "^4.0.5", - "svelte-adapter-bun": "^0.5.0", - "svelte-check": "^3.4.3", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^4.4.2" - }, - "type": "module", - "dependencies": { - "better-sqlite3": "^9.0.0", - "dexie": "^4.0.1-alpha.25", - "dom-to-image": "^2.6.0", - "html2canvas": "^1.4.1", - "rss-parser": "^3.13.0" - } + "name": "due.moe", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write ." + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^2.0.0", + "@sveltejs/adapter-node": "^1.3.1", + "@sveltejs/kit": "^1.20.4", + "@types/dom-to-image": "^2.6.5", + "@types/file-saver": "^2.0.5", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.30.0", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.10.1", + "svelte": "^4.0.5", + "svelte-check": "^3.4.3", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^4.4.2" + }, + "type": "module", + "dependencies": { + "better-sqlite3": "^9.0.0", + "dexie": "^4.0.1-alpha.25", + "dom-to-image": "^2.6.0", + "html2canvas": "^1.4.1", + "rss-parser": "^3.13.0" + } } diff --git a/svelte.config.js b/svelte.config.js index 7d4f3f34..2214c60d 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,4 @@ -import adapter from 'svelte-adapter-bun'; +import adapter from '@sveltejs/adapter-node'; import { vitePreprocess } from '@sveltejs/kit/vite'; /** @type {import('@sveltejs/kit').Config} */ -- cgit v1.2.3 From 93b6b1ae0370a11aa8a3183969a9ade8f993c482 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 24 Oct 2023 18:49:00 -0700 Subject: chore(git): ignore data folder --- .dockerignore | 2 +- .eslintignore | 2 +- .prettierignore | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index f1e46035..5e958bbb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,7 +13,7 @@ node_modules .env .env.* !.env.example -*.sqlite3 +/data # PNPM pnpm-lock.yaml diff --git a/.eslintignore b/.eslintignore index f1e46035..5e958bbb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -13,7 +13,7 @@ node_modules .env .env.* !.env.example -*.sqlite3 +/data # PNPM pnpm-lock.yaml diff --git a/.prettierignore b/.prettierignore index f1e46035..5e958bbb 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,7 +13,7 @@ node_modules .env .env.* !.env.example -*.sqlite3 +/data # PNPM pnpm-lock.yaml -- cgit v1.2.3