From 3e78826658c7d2a4e9b3c1d73e63dacc1d39c361 Mon Sep 17 00:00:00 2001 From: Factiven Date: Sat, 12 Aug 2023 22:54:26 +0700 Subject: Update v3.9.3 - Merged Beta to Main (#51) * commit * update db * Update v3.9.1-beta-v3.1 * Update v3.9.1 * Fix watched progress not showing * Secure headers * Fix recently watched image * Update v3.9.2 > Added custom lists for AniList > Fixed episode listMode progress * Update db route * Fixed AniList * Fix next button on dub anime > video is playing sub anime instead dub * small adjusment for premid * fix eslint * small updates > added ability to remove episode from recently watched * Update v3.9.3 --- components/anime/episode.js | 1 + components/anime/infoDetails.js | 5 +- components/anime/viewMode/listMode.js | 18 +++- components/anime/viewMode/thumbnailDetail.js | 4 +- components/anime/viewMode/thumbnailOnly.js | 4 +- components/anime/watch/primary/details.js | 18 ++-- components/anime/watch/primarySide.js | 20 ++++- components/anime/watch/secondarySide.js | 4 +- components/home/content.js | 126 +++++++++++++++++++++------ components/home/schedule.js | 4 +- components/manga/info/topSection.js | 2 +- components/manga/rightBar.js | 1 + components/videoPlayer.js | 23 ++--- 13 files changed, 174 insertions(+), 56 deletions(-) (limited to 'components') diff --git a/components/anime/episode.js b/components/anime/episode.js index c889c25..5d3451b 100644 --- a/components/anime/episode.js +++ b/components/anime/episode.js @@ -246,6 +246,7 @@ export default function AnimeEpisode({ info, progress }) { info={info} episode={episode} index={index} + artStorage={artStorage} providerId={providerId} progress={progress} dub={isDub} diff --git a/components/anime/infoDetails.js b/components/anime/infoDetails.js index 0cf233c..814e49b 100644 --- a/components/anime/infoDetails.js +++ b/components/anime/infoDetails.js @@ -45,7 +45,10 @@ export default function DesktopDetails({
-

+

{info ? ( info?.title?.romaji || info?.title?.english ) : ( diff --git a/components/anime/viewMode/listMode.js b/components/anime/viewMode/listMode.js index 2016262..f3bcf05 100644 --- a/components/anime/viewMode/listMode.js +++ b/components/anime/viewMode/listMode.js @@ -4,10 +4,16 @@ export default function ListMode({ info, episode, index, + artStorage, providerId, progress, dub, }) { + const time = artStorage?.[episode?.id]?.timeWatched; + const duration = artStorage?.[episode?.id]?.duration; + let prog = (time / duration) * 100; + if (prog > 90) prog = 100; + return (
90) prog = 100; @@ -33,7 +33,7 @@ export default function ThumbnailDetail({ className="object-cover z-30 rounded-lg h-[110px] lg:h-[160px] brightness-[65%]" /> 90) prog = 100; @@ -25,7 +25,7 @@ export default function ThumbnailOnly({ Episode {episode?.number} )}
-
+

Studios @@ -93,11 +97,15 @@ export default function Details({
{info ? ( <> -
{info.title?.romaji || ""}
-
+
+ {info.title?.romaji || ""} +
+
{info.title?.english || ""}
-
{info.title?.native || ""}
+
+ {info.title?.native || ""} +
) : ( @@ -120,7 +128,7 @@ export default function Details({
{info && (

)} diff --git a/components/anime/watch/primarySide.js b/components/anime/watch/primarySide.js index c601795..b032fd6 100644 --- a/components/anime/watch/primarySide.js +++ b/components/anime/watch/primarySide.js @@ -27,6 +27,7 @@ export default function PrimarySide({ setOnList, episodeList, timeWatched, + dub, }) { const [episodeData, setEpisodeData] = useState(); const [open, setOpen] = useState(false); @@ -148,6 +149,7 @@ export default function PrimarySide({ aniTitle={info.title?.romaji || info.title?.english} track={navigation} timeWatched={timeWatched} + dub={dub} /> ) ) : ( @@ -162,13 +164,14 @@ export default function PrimarySide({ {navigation?.playing?.title || info.title?.romaji}

-

+

Episode {epiNumber} -

+

@@ -180,7 +183,11 @@ export default function PrimarySide({ (episode) => episode.number === parseInt(e.target.value) ); router.push( - `/en/anime/watch/${info.id}/${providerId}?id=${selectedEpisode.id}&num=${selectedEpisode.number}` + `/en/anime/watch/${info.id}/${providerId}?id=${ + selectedEpisode.id + }&num=${selectedEpisode.number}${ + dub ? `&dub=${dub}` : "" + }` ); }} > @@ -199,7 +206,11 @@ export default function PrimarySide({ }relative group`} onClick={() => { router.push( - `/en/anime/watch/${info.id}/${providerId}?id=${navigation?.next.id}&num=${navigation?.next.number}` + `/en/anime/watch/${info.id}/${providerId}?id=${ + navigation?.next.id + }&num=${navigation?.next.number}${ + dub ? `&dub=${dub}` : "" + }` ); }} > @@ -229,6 +240,7 @@ export default function PrimarySide({
0 ? ( episode.some((item) => item.title && item.description) > 0 ? ( episode.map((item) => { - const time = artStorage?.[item.id]?.time; + const time = artStorage?.[item.id]?.timeWatched; const duration = artStorage?.[item.id]?.duration; let prog = (time / duration) * 100; if (prog > 90) prog = 100; @@ -50,7 +50,7 @@ export default function SecondarySide({ }`} /> { + if (userName) { + // remove from database + const res = await fetch(`/api/user/update/episode`, { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + name: userName, + id: id, + }), + }); + const data = await res.json(); + + // remove from local storage + const artplayerSettings = + JSON.parse(localStorage.getItem("artplayer_settings")) || {}; + if (artplayerSettings[id]) { + delete artplayerSettings[id]; + localStorage.setItem( + "artplayer_settings", + JSON.stringify(artplayerSettings) + ); + } + + // update client + setRemoved(id); + + if (data?.message === "Episode deleted") { + toast.success("Episode removed from history", { + position: "bottom-right", + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + draggable: true, + theme: "dark", + }); + } + } else { + const artplayerSettings = + JSON.parse(localStorage.getItem("artplayer_settings")) || {}; + if (artplayerSettings[id]) { + delete artplayerSettings[id]; + localStorage.setItem( + "artplayer_settings", + JSON.stringify(artplayerSettings) + ); + } + + setRemoved(id); + } + }; + return (
- {ids !== "recentlyWatched" ? slicedData?.map((anime) => { const progress = og?.find((i) => i.mediaId === anime.id); @@ -273,14 +329,27 @@ export default function Content({ if (prog > 90) prog = 100; return ( - -
+
+
removeItem(i.watchId)} + > + + + Remove from history + +
+
+
@@ -299,6 +368,7 @@ export default function Content({ width: `${prog}%`, }} /> + {i?.image && ( )} -
+ -
+ {/*

{i.title}

*/}

{" "} | Episode {i.episode}

-
- + +
); })} - {userData?.length >= 10 && section !== "Recommendations" && ( -
-
-

- More on {section} -

- + {userData?.filter((i) => i.aniId !== null)?.length >= 10 && + section !== "Recommendations" && ( +
+
+

+ More on {section} +

+ +
-
- )} + )} {filteredData?.length >= 10 && section !== "Recommendations" && (
{scheduleData[days[currentPage]] - .filter((show, index, self) => { + ?.filter((show, index, self) => { return index === self.findIndex((s) => s.id === show.id); }) - .map((i, index) => { + ?.map((i, index) => { const currentTime = Date.now(); const hasAired = i.airingAt < currentTime; diff --git a/components/manga/info/topSection.js b/components/manga/info/topSection.js index 14dc5e5..40b5a37 100644 --- a/components/manga/info/topSection.js +++ b/components/manga/info/topSection.js @@ -66,7 +66,7 @@ export default function TopSection({ info, firstEp, setCookie }) {
-

+

{info.title?.romaji || info.title?.english || info.title?.native}

diff --git a/components/manga/rightBar.js b/components/manga/rightBar.js index 6d37e4a..18c5e55 100644 --- a/components/manga/rightBar.js +++ b/components/manga/rightBar.js @@ -151,6 +151,7 @@ export default function RightBar({ Chapter Progress { + art.subtitle.style({ + fontSize: art.height * 0.05 + "px", + }); + }); + art.on("video:timeupdate", async () => { if (!session) return; @@ -313,7 +314,9 @@ export default function VideoPlayer({ router.push( `/en/anime/watch/${aniId}/${provider}?id=${encodeURIComponent( track?.next?.id - )}&num=${track?.next?.number}` + )}&num=${track?.next?.number}${ + dub ? `&dub=${dub}` : "" + }` ); } }, @@ -332,7 +335,7 @@ export default function VideoPlayer({ router.push( `/en/anime/watch/${aniId}/${provider}?id=${encodeURIComponent( track?.next?.id - )}&num=${track?.next?.number}` + )}&num=${track?.next?.number}${dub ? `&dub=${dub}` : ""}` ); } }, 7000); -- cgit v1.2.3