Skip to content

Commit

Permalink
Merge pull request #152 from koikiss-dev:performance
Browse files Browse the repository at this point in the history
Performance
  • Loading branch information
koikiss-dev authored Mar 28, 2024
2 parents 6d196d6 + f2913c7 commit cdcd627
Show file tree
Hide file tree
Showing 83 changed files with 3,684 additions and 3,128 deletions.
34 changes: 14 additions & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
{
"env": {
"browser": true,
"es2021": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": ["./tsconfig.json"]
},
"plugins": [
"@typescript-eslint"
],
"root": true,
"rules": {
}
"env": {
"browser": true,
"es2021": true
},
"parser": "@typescript-eslint/parser",
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {}
}
Binary file added bun.lockb
Binary file not shown.
8 changes: 3 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module.exports = {
roots: [
"<rootDir>/src",
],
roots: ["<rootDir>/src"],
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
"**/?(*.)+(spec|test).+(ts|tsx|js)",
],
transform: {
"^.+\\.(ts|tsx)$": [
Expand All @@ -19,4 +17,4 @@ module.exports = {
"!**/*.d.ts",
"!**/node_modules/**",
],
}
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "src/index.ts",
"scripts": {
"start": "node ./build/src/index.js",
"start:pm2": "pm2 start ./build/src/index.js",
"server": "nodemon src/index.ts",
"start:vercel": "node build/index.js",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
Expand Down
4 changes: 2 additions & 2 deletions puppeteer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ const { Configuration } = require("puppeteer");

/** @type {Configuration} */
module.exports = {
cacheDirectory: join(os.homedir(), ".cache", "puppeteer")
}
cacheDirectory: join(os.homedir(), ".cache", "puppeteer"),
};
20 changes: 8 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import morgan from "morgan";
import index from "../src/routes/app";
import providersList from "../src/routes/providers";
import helmet from "helmet";
import cors from 'cors'
import cors from "cors";

/* Anime */
import flv from "../src/routes/v1/anime/animeflv/AnimeflvRoutes";
import latinhd from "../src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes";
import gogoanime from "../src/routes/v1/anime/gogoanime/GogoAnimeRoute";
//import gogoanime from "../src/routes/v1/anime/gogoanime/GogoAnimeRoute";
import zoro from "../src/routes/v1/anime/zoro/ZoroRoutes";
import monoschinos from "../src/routes/v1/anime/monoschinos/MonosChinosRoute";
import tioanime from '../src/routes/v1/anime/tioanime/TioAnimeRoute'
import tioanime from "../src/routes/v1/anime/tioanime/TioAnimeRoute";
import WcoStream from "../src/routes/v1/anime/wcostream/wcostreamRoutes";
import AnimeBlix from "../src/routes/v1/anime/animeblix/AnimeBlixRoutes";
import Animevostfr from "../src/routes/v1/anime/animevostfr/AnimevostfrRoutes";

/* Manga */
import comick from "../src/routes/v1/manga/comick/ComickRoutes";
import inmanga from "../src/routes/v1/manga/inmanga/InmangaRoutes";
import nhentai from "../src/routes/v1/manga/nhentai/NhentaiRoutes"
import nhentai from "../src/routes/v1/manga/nhentai/NhentaiRoutes";
import mangareader from "../src/routes/v1/manga/mangareader/MangaReaderRoutes";
import manganelo from "../src/routes/v1/manga/manganelo/ManganeloRoutes";

Expand All @@ -33,34 +33,31 @@ app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(morgan("dev"));
app.use(helmet());
app.use(cors())
app.use(cors());

//routes

/*anime*/
app.use(flv);
app.use(latinhd);
app.use(gogoanime);
//app.use(gogoanime);
app.use(monoschinos);
app.use(zoro);
app.use(tioanime)
app.use(tioanime);
app.use(WcoStream);
app.use(AnimeBlix);
app.use(Animevostfr);

/* anime */


/*Manga*/
app.use(comick);
app.use(inmanga);
app.use(nhentai)
app.use(nhentai);
app.use(mangareader);
app.use(manganelo);
/*Manga*/



/*error */

interface ErrorResponse {
Expand Down Expand Up @@ -102,7 +99,6 @@ app.use((err, res, _next) => {
res.status(response.error.status).send(response);
});


app.listen(port, () => {
console.log(`Servidor iniciado en el puerto ${port} listo para trabajar :)`);
});
Expand Down
2 changes: 1 addition & 1 deletion src/routes/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ProviderScraper {
status: number | string;
icon: string;
url: string;
apiID: string
apiID: string;
favicon: string | string[];
}

Expand Down
2 changes: 1 addition & 1 deletion src/routes/v1/anime/9anime/9animeRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ r.get("/anime/9anime/name/:name", (req, res) => {
});
});

export default r
export default r;
33 changes: 19 additions & 14 deletions src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,32 @@ const router = Router();

// Filter
router.get("/anime/animeblix/filter", async (req, res) => {
const { search, type, page, year, genre } = req.query

const data = await Anime.GetAnimeByFilter(search as string, type as unknown as number, page as unknown as number, year as string, genre as string)
res.send(data)
const { search, type, page, year, genre } = req.query;

const data = await Anime.GetAnimeByFilter(
search as string,
type as unknown as number,
page as unknown as number,
year as string,
genre as string,
);
res.send(data);
});

// Anime Info +(Episodes list)
router.get("/anime/animeblix/name/:name", async (req, res) => {

const { name } = req.params
const data = await Anime.GetAnimeInfo(name.includes("ver-")? name.replace("ver-","") : name)
res.send(data)

const { name } = req.params;
const data = await Anime.GetAnimeInfo(
name.includes("ver-") ? name.replace("ver-", "") : name,
);
res.send(data);
});

// Episode Info +(Video Servers)
router.get("/anime/animeblix/episode/:episode", async (req, res) => {
const { episode } = req.params
const data = await Anime.GetEpisodeServers(episode)
res.send(data)

const { episode } = req.params;
const data = await Anime.GetEpisodeServers(episode);
res.send(data);
});

export default router
export default router;
13 changes: 10 additions & 3 deletions src/routes/v1/anime/animeflv/AnimeflvRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "../../../../scraper/sites/anime/animeflv/animeflv_helper";
const r = Router();


//anime info
r.get("/anime/flv/name/:name", async (req, res) => {
try {
Expand All @@ -34,7 +33,7 @@ r.get("/anime/flv/episode/:episode", async (req, res) => {
res.status(500).send(error);
}
});

//filter
r.get("/anime/flv/filter", async (req, res) => {
try {
Expand All @@ -47,7 +46,15 @@ r.get("/anime/flv/filter", async (req, res) => {
const title = req.query.title as string;

const flv = new AnimeFlv();
const animeInfo = await flv.Filter(gen, date, type, status, ord, page, title);
const animeInfo = await flv.GetAnimeByFilter(
gen,
date,
type,
status,
ord,
page,
title,
);
res.send(animeInfo);
} catch (error) {
console.log(error);
Expand Down
33 changes: 18 additions & 15 deletions src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ const router = Router();

// Filter
router.get("/anime/animelatinohd/filter", async (req, res) => {
const { search, type, page, year, genre } = req.query

const data = await Anime.GetAnimeByFilter(search as string, type as unknown as number, page as unknown as number, year as string, genre as string)
res.send(data)
const { search, type, page, year, genre } = req.query;

const data = await Anime.GetAnimeByFilter(
search as string,
type as unknown as number,
page as unknown as number,
year as string,
genre as string,
);
res.send(data);
});

// Anime Info +(Episodes list)
router.get("/anime/animelatinohd/name/:name", async (req, res) => {

const { name } = req.params
const data = await Anime.GetAnimeInfo(name)
res.send(data)

const { name } = req.params;
const data = await Anime.GetAnimeInfo(name);
res.send(data);
});

// Episode Info +(Video Servers)
router.get("/anime/animelatinohd/episode/:episode", async (req, res) => {
const { lang } = req.query
const { episode } = req.params
const data = await Anime.GetEpisodeServers(episode, lang as string)
res.send(data)

const { lang } = req.query;
const { episode } = req.params;
const data = await Anime.GetEpisodeServers(episode, lang as string);
res.send(data);
});

export default router
export default router;
31 changes: 17 additions & 14 deletions src/routes/v1/anime/animevostfr/AnimevostfrRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,30 @@ const router = Router();

// Filter
router.get("/anime/animevostfr/filter", async (req, res) => {
const { search, type, page, year, genre } = req.query

const data = await Anime.GetAnimeByFilter(search as string, type as unknown as number, page as unknown as number, year as string, genre as string)
res.send(data)
const { search, type, page, year, genre } = req.query;

const data = await Anime.GetAnimeByFilter(
search as string,
type as unknown as number,
page as unknown as number,
year as string,
genre as string,
);
res.send(data);
});

// Anime Info +(Episodes list)
router.get("/anime/animevostfr/name/:name", async (req, res) => {

const { name } = req.params
const data = await Anime.GetAnimeInfo(name)
res.send(data)

const { name } = req.params;
const data = await Anime.GetAnimeInfo(name);
res.send(data);
});

// Episode Info +(Video Servers)
router.get("/anime/animevostfr/episode/:episode", async (req, res) => {
const { episode } = req.params
const data = await Anime.GetEpisodeServers(episode)
res.send(data)

const { episode } = req.params;
const data = await Anime.GetEpisodeServers(episode);
res.send(data);
});

export default router
export default router;
3 changes: 2 additions & 1 deletion src/routes/v1/anime/gogoanime/GogoAnimeRoute.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Router } from "express";
/* import { Router } from "express";
import {
GogoanimeInfo,
GogoanimeServer,
Expand Down Expand Up @@ -63,3 +63,4 @@ r.get("/anime/gogoanime/filter", async (req, res) => {
});
export default r;
*/
6 changes: 3 additions & 3 deletions src/routes/v1/anime/monoschinos/MonosChinosRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ r.get("/anime/monoschinos/name/:name", async (req, res) => {
const { name } = req.params;
const monos = new Monoschinos();
const animeInfo = await monos.getAnime(
`https://monoschinos2.com/anime/${name}`
`https://monoschinos2.com/anime/${name}`,
);
res.send(animeInfo);
} catch (error) {
Expand All @@ -24,7 +24,7 @@ r.get("/anime/monoschinos/episode/:episode", async (req, res) => {
const { episode } = req.params;
const monos = new Monoschinos();
const animeInfo = await monos.getEpisodeServers(
`https://monoschinos2.com/ver/${episode}`
`https://monoschinos2.com/ver/${episode}`,
);
res.send(animeInfo);
} catch (error) {
Expand All @@ -36,7 +36,7 @@ r.get("/anime/monoschinos/episode/:episode", async (req, res) => {
//filter
r.get("/anime/monoschinos/filter", async (req, res) => {
try {
const title = req.query.title as string
const title = req.query.title as string;
const cat = req.query.category as string;
const gen = req.query.gen as string;
const year = req.query.year as string;
Expand Down
Loading

0 comments on commit cdcd627

Please sign in to comment.