Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
Update v4.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
DevanAbinaya committed Oct 24, 2023
1 parent 0a30e05 commit 451e4df
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 56 deletions.
4 changes: 1 addition & 3 deletions lib/anify/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { redis } from "../redis";

export async function fetchInfo(id, key) {
try {
const { data } = await axios.get(
`https://api.anify.tv/info/${id}?apikey=${key}`
);
const { data } = await axios.get(`https://api.anify.tv/info/${id}`);
return data;
} catch (error) {
console.error("Error fetching data:", error);
Expand Down
4 changes: 2 additions & 2 deletions lib/anify/page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { redis } from "../redis";

// Function to fetch new data
async function fetchData(id, chapterNumber, providerId, chapterId, key) {
async function fetchData(id, chapterNumber, providerId, chapterId) {
try {
const res = await fetch(
`https://api.anify.tv/pages/${id}/${chapterNumber}/${providerId}/${chapterId}&apikey=${key}`
`https://api.anify.tv/pages/${id}/${chapterNumber}/${providerId}/${chapterId}`
);
const data = await res.json();
return data;
Expand Down
11 changes: 6 additions & 5 deletions lib/anilist/aniAdvanceSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ export async function aniAdvanceSearch({
const response = await fetch("https://api.anify.tv/search-advanced", {
method: "POST",
body: JSON.stringify({
type: "manga",
genres: categorizedGenres,
sort: "averageRating",
sortDirection: "DESC",
...(categorizedGenres && { ...categorizedGenres }),
...(search && { query: search }),
...(page && { page: page }),
...(perPage && { perPage: perPage }),
...(format && { format: format }),
...(seasonYear && { year: seasonYear }),
...(type && { type: type }),
...(format && { format: [format] }),
...(seasonYear && { year: Number(seasonYear) }),
...(type && { type: format === "NOVEL" ? "novel" : type }),
}),
});

Expand Down
4 changes: 2 additions & 2 deletions lib/consumet/manga/getChapters.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let API_URL;
API_URL = process.env.API_URI;
API_URL = process.env.API_URI || null || null;
// remove / from the end of the url if it exists
if (API_URL.endsWith("/")) {
if (API_URL && API_URL.endsWith("/")) {
API_URL = API_URL.slice(0, -1);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/consumet/manga/getPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let API_URL;
API_URL = process.env.API_URI;
API_URL = process.env.API_URI || null;
// remove / from the end of the url if it exists
if (API_URL.endsWith("/")) {
if (API_URL && API_URL.endsWith("/")) {
API_URL = API_URL.slice(0, -1);
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moopa",
"version": "4.2.1",
"version": "4.2.2",
"private": true,
"founder": "Factiven",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions pages/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export async function getServerSideProps(context) {
const admin = sessions?.user?.name === process.env.ADMIN_USERNAME;

let api;
api = process.env.API_URI;
if (api.endsWith("/")) {
api = process.env.API_URI || null;
if (api && api.endsWith("/")) {
api = api.slice(0, -1);
}

Expand Down
14 changes: 4 additions & 10 deletions pages/api/v2/episode/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import appendMetaToEpisodes from "@/utils/appendMetaToEpisodes";

let CONSUMET_URI;

CONSUMET_URI = process.env.API_URI;
if (CONSUMET_URI.endsWith("/")) {
CONSUMET_URI = process.env.API_URI || null;
if (CONSUMET_URI && CONSUMET_URI.endsWith("/")) {
CONSUMET_URI = CONSUMET_URI.slice(0, -1);
}

Expand Down Expand Up @@ -96,13 +96,7 @@ async function fetchConsumet(id) {

async function fetchAnify(id) {
try {
if (!process.env.API_KEY) {
return [];
}

const { data } = await axios.get(
`https://api.anify.tv/episodes/${id}?apikey=${API_KEY}`
);
const { data } = await axios.get(`https://api.anify.tv/episodes/${id}`);

if (!data) {
return [];
Expand Down Expand Up @@ -138,7 +132,7 @@ async function fetchCoverImage(id, available = false) {
}

const { data } = await axios.get(
`https://api.anify.tv/content-metadata/${id}?apikey=${API_KEY}`
`https://api.anify.tv/content-metadata/${id}`
);

if (!data) {
Expand Down
4 changes: 2 additions & 2 deletions pages/api/v2/etc/recent/[page].js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { rateLimiterRedis, redis } from "@/lib/redis";

let API_URL;
API_URL = process.env.API_URI;
if (API_URL.endsWith("/")) {
API_URL = process.env.API_URI || null;
if (API_URL && API_URL.endsWith("/")) {
API_URL = API_URL.slice(0, -1);
}

Expand Down
7 changes: 4 additions & 3 deletions pages/api/v2/info/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function fetchInfo(id) {
try {
// console.log(id);
const { data } = await axios
.get(`https://api.anify.tv/info/${id}?apikey=${API_KEY}`)
.get(`https://api.anify.tv/info/${id}`)
.catch((err) => {
return {
data: null,
Expand All @@ -19,7 +19,7 @@ export async function fetchInfo(id) {
}

const { data: Chapters } = await axios.get(
`https://api.anify.tv/chapters/${data.id}?apikey=${API_KEY}`
`https://api.anify.tv/chapters/${data.id}`
);

if (!Chapters) {
Expand Down Expand Up @@ -53,7 +53,8 @@ export default async function handler(req, res) {
return res.status(404).json({ error: "Manga not found" });
}

if (redis) await redis.set(`manga:${id}`, JSON.stringify(manga), "ex", 60 * 60 * 24);
if (redis)
await redis.set(`manga:${id}`, JSON.stringify(manga), "ex", 60 * 60 * 24);

res.status(200).json(manga);
} catch (error) {
Expand Down
6 changes: 3 additions & 3 deletions pages/api/v2/source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { rateLimiterRedis, redis } from "@/lib/redis";
import axios from "axios";

let CONSUMET_URI;
CONSUMET_URI = process.env.API_URI;
if (CONSUMET_URI.endsWith("/")) {
CONSUMET_URI = process.env.API_URI || null;
if (CONSUMET_URI && CONSUMET_URI.endsWith("/")) {
CONSUMET_URI = CONSUMET_URI.slice(0, -1);
}
const API_KEY = process.env.API_KEY;
Expand All @@ -25,7 +25,7 @@ async function anifySource(providerId, watchId, episode, id, sub) {
const { data } = await axios.get(
`https://api.anify.tv/sources?providerId=${providerId}&watchId=${encodeURIComponent(
watchId
)}&episodeNumber=${episode}&id=${id}&subType=${sub}&apikey=${API_KEY}`
)}&episodeNumber=${episode}&id=${id}&subType=${sub}`
);
return data;
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions pages/en/anime/[...id].js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ export async function getServerSideProps(ctx) {
const { id } = ctx.query;

let API_URI;
API_URI = process.env.API_URI;
if (API_URI.endsWith("/")) {
API_URI = process.env.API_URI || null || null;
if (API_URI && API_URI.endsWith("/")) {
API_URI = API_URI.slice(0, -1);
}

Expand Down
2 changes: 1 addition & 1 deletion pages/en/anime/watch/[...info].js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function getServerSideProps(context) {

let proxy;
proxy = process.env.PROXY_URI;
if (proxy.endsWith("/")) {
if (proxy && proxy.endsWith("/")) {
proxy = proxy.slice(0, -1);
}
const disqus = process.env.DISQUS_SHORTNAME;
Expand Down
17 changes: 9 additions & 8 deletions pages/en/manga/read/[...params].js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ async function fetchAnifyPages(id, number, provider, readId, key) {
try {
let cached;

cached = await redis.get(`pages:${readId}`);
if (redis) cached = await redis.get(`pages:${readId}`);

if (cached) {
return JSON.parse(cached);
Expand All @@ -292,12 +292,13 @@ async function fetchAnifyPages(id, number, provider, readId, key) {
return null;
}

await redis.set(
`pages:${readId}`,
JSON.stringify(data),
"EX",
60 * 60 * 24 * 7
);
if (redis)
await redis.set(
`pages:${readId}`,
JSON.stringify(data),
"EX",
60 * 60 * 24 * 7
);

return data;
} catch (error) {
Expand Down Expand Up @@ -357,7 +358,7 @@ export async function getServerSideProps(context) {
}

const chapters = await (
await fetch("https://api.anify.tv/chapters/" + mediaId + "?apikey=" + key)
await fetch("https://api.anify.tv/chapters/" + mediaId)
).json();

if ((dataManga && dataManga?.error) || dataManga?.length === 0) {
Expand Down
12 changes: 8 additions & 4 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/icon-256x256.png",
"sizes": "256x256",
"type": "image/png"
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
"type": "image/png",
"purpose": "maskable"
}
]
}
9 changes: 5 additions & 4 deletions release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

This document contains a summary of all significant changes made to this release.

## 🎉 Update v4.2.1
## 🎉 Update v4.2.2

### What's Changed

- 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
- fix: anify doesn't return anything
- fix: non-consumet user recieve error when parsing the API url
- fix: manga doesn't work without redis
- fix: fixed some functionality when searching manga

0 comments on commit 451e4df

Please sign in to comment.