From 0a30e0570a5d22dd8c459fd9769fe4386c07aae8 Mon Sep 17 00:00:00 2001 From: Factiven Date: Tue, 24 Oct 2023 11:05:06 +0700 Subject: [PATCH] Update v4.2.1 --- components/anime/mobile/topSection.js | 2 +- components/disqus.js | 2 +- components/home/content.js | 29 +++----------- components/home/genres.js | 21 +---------- components/shared/footer.js | 54 ++++----------------------- components/watch/primary/details.js | 12 ++++-- package-lock.json | 48 +----------------------- package.json | 4 +- pages/api/v2/episode/[id].js | 10 +++-- pages/en/anime/watch/[...info].js | 12 ++++-- pages/id/index.js | 4 +- pages/index.js | 33 ++++------------ release.md | 24 +++--------- 13 files changed, 57 insertions(+), 198 deletions(-) diff --git a/components/anime/mobile/topSection.js b/components/anime/mobile/topSection.js index e5f58da8..6780da50 100644 --- a/components/anime/mobile/topSection.js +++ b/components/anime/mobile/topSection.js @@ -56,7 +56,7 @@ export default function DetailTop({ {/* MAIN */}
- poster anime { const disqusShortname = post.name || "your_disqus_shortname"; const disqusConfig = { url: post.url, - identifier: post.id, // Single post id + identifier: post.url, // Single post id title: `${post.title} - Episode ${post.episode}`, // Single post title }; diff --git a/components/home/content.js b/components/home/content.js index 678549c5..a380e1f6 100644 --- a/components/home/content.js +++ b/components/home/content.js @@ -8,8 +8,6 @@ import { ArrowRightCircleIcon, } from "@heroicons/react/24/outline"; -import { parseCookies } from "nookies"; - import { ChevronLeftIcon } from "@heroicons/react/20/solid"; import { ExclamationCircleIcon, PlayIcon } from "@heroicons/react/24/solid"; import { useRouter } from "next/router"; @@ -30,30 +28,15 @@ export default function Content({ const ref = useRef(); const { events } = useDraggable(ref); - const [cookie, setCookie] = useState(null); const [clicked, setClicked] = useState(false); - const [lang, setLang] = useState("en"); - useEffect(() => { const click = localStorage.getItem("clicked"); if (click) { setClicked(JSON.parse(click)); } - - let lang = null; - if (!cookie) { - const cookie = parseCookies(); - lang = cookie.lang || null; - setCookie(cookie); - } - if (lang === "en" || lang === null) { - setLang("en"); - } else if (lang === "id") { - setLang("id"); - } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -109,22 +92,22 @@ export default function Content({ const goToPage = () => { if (section === "Recently Watched") { - router.push(`/${lang}/anime/recently-watched`); + router.push(`/en/anime/recently-watched`); } if (section === "New Episodes") { - router.push(`/${lang}/anime/recent`); + router.push(`/en/anime/recent`); } if (section === "Trending Now") { - router.push(`/${lang}/anime/trending`); + router.push(`/en/anime/trending`); } if (section === "Popular Anime") { - router.push(`/${lang}/anime/popular`); + router.push(`/en/anime/popular`); } if (section === "Your Plan") { - router.push(`/${lang}/profile/${userName}/#planning`); + router.push(`/en/profile/${userName}/#planning`); } if (section === "On-Going Anime" || section === "Your Watch List") { - router.push(`/${lang}/profile/${userName}/#current`); + router.push(`/en/profile/${userName}/#current`); } }; diff --git a/components/home/genres.js b/components/home/genres.js index cd247ce1..9c80ca6d 100644 --- a/components/home/genres.js +++ b/components/home/genres.js @@ -1,8 +1,6 @@ import Image from "next/image"; import { ChevronRightIcon } from "@heroicons/react/24/outline"; import Link from "next/link"; -import { useEffect, useState } from "react"; -import { parseCookies } from "nookies"; const g = [ { @@ -32,23 +30,6 @@ const g = [ ]; export default function Genres() { - const [lang, setLang] = useState("en"); - const [cookie, setCookie] = useState(null); - - useEffect(() => { - let lang = null; - if (!cookie) { - const cookie = parseCookies(); - lang = cookie.lang || null; - setCookie(cookie); - } - if (lang === "en" || lang === null) { - setLang("en"); - } else if (lang === "id") { - setLang("id"); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); return (
@@ -61,7 +42,7 @@ export default function Genres() {
{g.map((a, index) => ( diff --git a/components/shared/footer.js b/components/shared/footer.js index 0e19f130..a29a3d37 100644 --- a/components/shared/footer.js +++ b/components/shared/footer.js @@ -1,45 +1,18 @@ import Link from "next/link"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useRouter } from "next/router"; -import { parseCookies, setCookie } from "nookies"; -import Image from "next/image"; function Footer() { const [year] = useState(new Date().getFullYear()); const [season] = useState(getCurrentSeason()); - const [lang, setLang] = useState("en"); const [checked, setChecked] = useState(false); - const [cookie, setCookies] = useState(null); const router = useRouter(); - useEffect(() => { - let lang = null; - if (!cookie) { - const cookie = parseCookies(); - lang = cookie.lang || null; - setCookies(cookie); - } - if (lang === "en" || lang === null) { - setLang("en"); - setChecked(false); - } else if (lang === "id") { - setLang("id"); - setChecked(true); - } - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - function switchLang() { setChecked(!checked); if (checked) { - console.log("switching to en"); - setCookie(null, "lang", "en", { - maxAge: 365 * 24 * 60 * 60, - path: "/", - }); router.push("/en"); } else { router.push("/id"); @@ -51,36 +24,25 @@ function Footer() {
- {/*
*/} - {/* Website Logo */}
moopa

This site does not store any files on our server, we only linked to the media which is hosted on 3rd party services.

- {/*
*/}
  • - + This Season
  • - Popular Anime + Popular Anime
  • - Popular Manga + Popular Manga
  • Donate @@ -88,15 +50,13 @@ function Footer() {
  • - - Movies - + Movies
  • - TV Shows + TV Shows
  • - DMCA + DMCA
  • diff --git a/components/watch/primary/details.js b/components/watch/primary/details.js index 32e13917..4af12ac3 100644 --- a/components/watch/primary/details.js +++ b/components/watch/primary/details.js @@ -26,7 +26,12 @@ export default function Details({ } useEffect(() => { - setShowComments(false); + const isMobile = window.matchMedia("(max-width: 768px)").matches; + if (isMobile) { + setShowComments(false); + } else { + setShowComments(true); + } }, [id]); return ( @@ -35,12 +40,11 @@ export default function Details({
    {info ? ( - Anime Cover ) : ( @@ -169,7 +173,7 @@ export default function Details({ {showComments && (
    {info && ( -
    +
    =6" - } - }, "node_modules/cluster-key-slot": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", @@ -6988,23 +6978,6 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" }, - "node_modules/nookies": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/nookies/-/nookies-2.5.2.tgz", - "integrity": "sha512-x0TRSaosAEonNKyCrShoUaJ5rrT5KHRNZ5DwPCuizjgrnkpE5DRf3VL7AyyQin4htict92X1EQ7ejDbaHDVdYA==", - "dependencies": { - "cookie": "^0.4.1", - "set-cookie-parser": "^2.4.6" - } - }, - "node_modules/nookies/node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -7861,18 +7834,6 @@ "react": ">=16.8.0" } }, - "node_modules/react-toastify": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-9.1.3.tgz", - "integrity": "sha512-fPfb8ghtn/XMxw3LkxQBk3IyagNpF/LIKjOBflbexr2AWxAH1MJgvnESwEwBn9liLFXgTKWgBSdZpw9m4OTHTg==", - "dependencies": { - "clsx": "^1.1.1" - }, - "peerDependencies": { - "react": ">=16", - "react-dom": ">=16" - } - }, "node_modules/react-use-draggable-scroll": { "version": "0.4.7", "resolved": "https://registry.npmjs.org/react-use-draggable-scroll/-/react-use-draggable-scroll-0.4.7.tgz", @@ -8399,11 +8360,6 @@ "randombytes": "^2.1.0" } }, - "node_modules/set-cookie-parser": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", - "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" - }, "node_modules/set-function-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", diff --git a/package.json b/package.json index a13c9fe4..9d63838c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moopa", - "version": "4.2.0", + "version": "4.2.1", "private": true, "founder": "Factiven", "scripts": { @@ -30,13 +30,11 @@ "next-auth": "^4.22.0", "next-pwa": "^5.6.0", "nextjs-progressbar": "^0.0.16", - "nookies": "^2.5.2", "rate-limiter-flexible": "^3.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.7.1", "react-loading-skeleton": "^3.2.0", - "react-toastify": "^9.1.3", "react-use-draggable-scroll": "^0.4.7", "sharp": "^0.32.6", "sonner": "^1.0.3", diff --git a/pages/api/v2/episode/[id].js b/pages/api/v2/episode/[id].js index b86a1983..029d131a 100644 --- a/pages/api/v2/episode/[id].js +++ b/pages/api/v2/episode/[id].js @@ -1,6 +1,5 @@ import axios from "axios"; import { rateLimitStrict, rateLimiterRedis, redis } from "@/lib/redis"; -import appendImagesToEpisodes from "@/utils/combineImages"; import appendMetaToEpisodes from "@/utils/appendMetaToEpisodes"; let CONSUMET_URI; @@ -158,8 +157,13 @@ async function fetchCoverImage(id, available = false) { export default async function handler(req, res) { const { id, releasing = "false", dub = false, refresh = null } = req.query; - // if releasing is true then cache for 10 minutes, if it false cache for 1 month; - const cacheTime = releasing === "true" ? 60 * 10 : 60 * 60 * 24 * 30; + // if releasing is true then cache for 1 hour, if it false cache for 1 month; + let cacheTime = null; + if (releasing === "true") { + cacheTime = 60 * 60; // 1 hour + } else if (releasing === "false") { + cacheTime = 60 * 60 * 24 * 30; // 1 month + } let cached; let meta; diff --git a/pages/en/anime/watch/[...info].js b/pages/en/anime/watch/[...info].js index a838b7f8..24276698 100644 --- a/pages/en/anime/watch/[...info].js +++ b/pages/en/anime/watch/[...info].js @@ -354,9 +354,13 @@ export default function Watch({ {episodeNavigation?.playing?.title || `${info?.title?.romaji} - Episode ${epiNumber}`} - {/* Write the best SEO for this watch page with data of anime title from info.title.romaji, episode title from episodeNavigation?.playing?.title, description from episodeNavigation?.playing?.description, episode number from epiNumber */} + - {/* Write the best SEO for this homepage */}
    -

    +

    {episodeNavigation?.playing?.number ? ( `Episode ${episodeNavigation?.playing?.number}` ) : ( )} -

    +

    diff --git a/pages/id/index.js b/pages/id/index.js index b8898e57..5ef870dd 100644 --- a/pages/id/index.js +++ b/pages/id/index.js @@ -4,6 +4,7 @@ import Image from "next/image"; import Link from "next/link"; import Footer from "@/components/shared/footer"; import { NewNavbar } from "@/components/shared/NavBar"; +import MobileNav from "@/components/shared/MobileNav"; export default function Home() { return ( @@ -16,6 +17,7 @@ export default function Home() {
    + {/* Create an under construction page with tailwind css */}

    - 🚧 Work still on progress 🚧 + 🚧 Page Under Construction 🚧

    "Please be patient, as we're still working on this page and it will diff --git a/pages/index.js b/pages/index.js index 56b2c1f2..25d5b200 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,5 +1,4 @@ import Head from "next/head"; -import { parseCookies } from "nookies"; export default function Home() { return ( @@ -23,29 +22,11 @@ export default function Home() { ); } -export async function getServerSideProps(context) { - const cookie = parseCookies(context); - - if (cookie.lang === "en") { - return { - redirect: { - destination: "/en", - permanent: false, - }, - }; - } else if (cookie.lang === "id") { - return { - redirect: { - destination: "/id", - permanent: false, - }, - }; - } else { - return { - redirect: { - destination: "/en", - permanent: false, - }, - }; - } +export async function getServerSideProps() { + return { + redirect: { + destination: "/en", + permanent: false, + }, + }; } diff --git a/release.md b/release.md index cfb7bd11..3fa2d2a3 100644 --- a/release.md +++ b/release.md @@ -2,24 +2,10 @@ This document contains a summary of all significant changes made to this release. -## 🎉 Update v4.2.0 +## 🎉 Update v4.2.1 -### Added +### What's Changed -- Added scene search for anime -- Added next episode button on watch page -- Added episode selector on watch page -- Added dub gogoanime from consumet - -### Fixed - -- Greatly improved search ui/ux -- Fixed when using search palette it focused on other button instead of search input -- Resolved issue: home button on error page doesn't work -- Resolved issue: website showing error when user pressing `pages` button on reader page - -### Changed - -- Searching manga now using Anify instead of AniList -- Info page for Manga now has a similar UI as Anime making it more consistent -- API Key isn't needed anymore +- fix: disqus showing the same comment on every episodes +- fix(premid): discord presence not working properly +- Increased releasing anime episodes cache time to 1 hour