diff options
| author | Factiven <[email protected]> | 2023-04-24 12:15:35 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-04-24 12:15:35 +0700 |
| commit | 7f1f1051f1b28f8e4f522fdfc00bb2b4dcabf8e7 (patch) | |
| tree | 12dfe92ef972fd2f3f724de7ab768ad82c1080ca | |
| parent | mobile fixes (diff) | |
| download | moopa-7f1f1051f1b28f8e4f522fdfc00bb2b4dcabf8e7.tar.xz moopa-7f1f1051f1b28f8e4f522fdfc00bb2b4dcabf8e7.zip | |
Temporary Fix (Manga)
| -rw-r--r-- | pages/manga/chapter/[chapter].js | 47 | ||||
| -rw-r--r-- | pages/manga/detail/id.js | 53 |
2 files changed, 43 insertions, 57 deletions
diff --git a/pages/manga/chapter/[chapter].js b/pages/manga/chapter/[chapter].js index 8d2a5a1..eea14c0 100644 --- a/pages/manga/chapter/[chapter].js +++ b/pages/manga/chapter/[chapter].js @@ -97,7 +97,14 @@ export default function Test({ title, id, aniId, data, provider }) { // console.log(datas); setData(datas); } else { - setData(data); + const dat = data.map((item) => ({ + img: `https://cors.moopa.my.id/?url=${encodeURIComponent( + item.img + )}&referer=${encodeURIComponent(item.headerForImage.Referer)}`, + page: item.page, + title: item.title || null, + })); + setData(dat); } }) .finally(() => { @@ -143,7 +150,14 @@ export default function Test({ title, id, aniId, data, provider }) { // console.log(datas); setData(datas); } else { - setData(data); + const dat = data.map((item) => ({ + img: `https://cors.moopa.my.id/?url=${encodeURIComponent( + item.img + )}&referer=${encodeURIComponent(item.headerForImage.Referer)}`, + page: item.page, + title: item.title || null, + })); + setData(dat); } }) .finally(() => { @@ -219,7 +233,14 @@ export default function Test({ title, id, aniId, data, provider }) { // console.log(datas); setData(datas); } else { - setData(data); + const dat = data.map((item) => ({ + img: `https://cors.moopa.my.id/?url=${encodeURIComponent( + item.img + )}&referer=${encodeURIComponent(item.headerForImage.Referer)}`, + page: item.page, + title: item.title || null, + })); + setData(dat); } }) .finally(() => { @@ -261,7 +282,14 @@ export default function Test({ title, id, aniId, data, provider }) { // console.log(datas); setData(datas); } else { - setData(data); + const dat = data.map((item) => ({ + img: `https://cors.moopa.my.id/?url=${encodeURIComponent( + item.img + )}&referer=${encodeURIComponent(item.headerForImage.Referer)}`, + page: item.page, + title: item.title || null, + })); + setData(dat); } }) .finally(() => { @@ -411,12 +439,21 @@ export async function getServerSideProps(context) { }; } + const data = results.data; + const dat = data.map((item) => ({ + img: `https://cors.moopa.my.id/?url=${encodeURIComponent( + item.img + )}&referer=${encodeURIComponent(item.headerForImage.Referer)}`, + page: item.page, + title: item.title || null, + })); + return { props: { aniId, id, title, - data: results.data, + data: dat, provider, }, }; diff --git a/pages/manga/detail/id.js b/pages/manga/detail/id.js index cfc7076..29cacb1 100644 --- a/pages/manga/detail/id.js +++ b/pages/manga/detail/id.js @@ -34,27 +34,9 @@ export default function MangaDetail({ data, manga, aniId, provider }) { const [selectOption, setSelectedOption] = useState(options[0]); const [recentWatch, setRecentWatch] = useState(); - // const { user, error, loading } = useUser(); - - // if (loading) return <div>Loading...</div>; - // if (error) return <div>{error.message}</div>; - const [load, setLoad] = useState(true); useEffect(() => { - // async function firebase() { - // const colRef = collection(db, "user"); - - // const snapshots = await getDocs(colRef); - - // const docs = snapshots.docs.map((doc) => { - // const data = doc.data(); - // data.id = doc.id; - // return data; - // }); - - // // console.log(docs); - // } function getRecent() { const recentWatch = JSON.parse(localStorage.getItem("watchedManga"))?.map( (data) => data.id @@ -62,7 +44,6 @@ export default function MangaDetail({ data, manga, aniId, provider }) { setRecentWatch(recentWatch); } getRecent(); - // firebase(); }, []); function handleLoad() { @@ -78,40 +59,8 @@ export default function MangaDetail({ data, manga, aniId, provider }) { async function clickDeez(props) { localStorage.setItem("chapters", mangan); localStorage.setItem("currentChapterId", props); - - // const colRef = collection(db, "user"); - // const docRef = doc(colRef, user.sub); - - // const docMangaRef = collection(docRef, "watchedManga"); - // const watchedMangaRef = doc(docMangaRef, data.id); - - // const watchedMangaSnap = await getDoc(watchedMangaRef); - - // if (watchedMangaSnap.exists()) { - // // Update existing chapter - // await updateDoc(watchedMangaRef, { - // chapter: arrayUnion({ - // id: props, - // scrollPercentage: 0, - // timeStamp: null, - // }), - // }); - // // console.log("Chapter updated successfully!"); - // } else { - // // Add new manga with chapter data - // await setDoc(watchedMangaRef, { - // id: data.id, - // image: data.image, - // rating: data.rating, - // title: data.title?.romaji || data.title?.english, - // chapter: [props], - // }); - // // console.log("Manga added successfully with chapter data!"); - // } } - // console.log(data.id); - // console.log(mangan); return ( <> <Head> @@ -268,7 +217,7 @@ export default function MangaDetail({ data, manga, aniId, provider }) { export const getServerSideProps = async (context) => { context.res.setHeader("Cache-Control", "public, max-age=3600"); const { aniId, aniTitle } = context.query; - const prv = "mangapill"; + const prv = "mangahere"; try { const info = await axios.get( |