From c65a5bd3e4e2041645f33a8f2e475edbeabc6c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9luchu?= Date: Sat, 9 Jan 2021 19:34:53 +0100 Subject: [PATCH] Fix filtering directory --- README.md | 2 +- package-lock.json | 2 +- package.json | 2 +- src/api/api.js | 4 ++-- src/api/routes/index.js | 6 +++--- src/v2/api/api.js | 2 +- src/v2/api/routes/index.js | 6 +++--- src/v2/utils/index.js | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 99b680d..ae7fc79 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# **Aruppi API** (v3.3.2) +# **Aruppi API** (v3.3.3) > This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture > diff --git a/package-lock.json b/package-lock.json index 3d5e9be..f8faeea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "aruppi", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0ff4505..d7afde5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aruppi", - "version": "3.3.2", + "version": "3.3.3", "description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app", "main": "./src/api/api.js", "scripts": { diff --git a/src/api/api.js b/src/api/api.js index 784a797..4031a36 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -75,10 +75,10 @@ const getAllAnimes = async () =>{ }; -const getAllDirectory = async (notNSWF) =>{ +const getAllDirectory = async (genres) =>{ let data - if (notNSWF) { + if (genres === "sfw") { data = JSON.parse(JSON.stringify(require('../assets/directory.json'))).filter(function (item) { return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi"); }) diff --git a/src/api/routes/index.js b/src/api/routes/index.js index e496db3..4840341 100644 --- a/src/api/routes/index.js +++ b/src/api/routes/index.js @@ -59,10 +59,10 @@ router.get('/allAnimes' , (req, res) =>{ }); -router.get('/allDirectory/:notNSWF?' , (req, res) =>{ +router.get('/allDirectory/:genres?' , (req, res) =>{ - let notNSWF = req.params.notNSWF; - api.getAllDirectory(notNSWF) + let genres = req.params.genres; + api.getAllDirectory(genres) .then(directory =>{ if (directory.length > 0) { res.status(200).json({ diff --git a/src/v2/api/api.js b/src/v2/api/api.js index f26b422..f2d21ae 100644 --- a/src/v2/api/api.js +++ b/src/v2/api/api.js @@ -70,7 +70,7 @@ const getAllAnimes = async () =>{ }; -const getAllDirectory = async (notNSWF) =>{ return await getDirectory(notNSWF); }; +const getAllDirectory = async (genres) =>{ return await getDirectory(genres); }; const getAnitakume = async () =>{ diff --git a/src/v2/api/routes/index.js b/src/v2/api/routes/index.js index 1ad33f2..8752c88 100644 --- a/src/v2/api/routes/index.js +++ b/src/v2/api/routes/index.js @@ -61,11 +61,11 @@ router.get('/allAnimes' , (req, res) =>{ }); -router.get('/allDirectory/:notNSWF?' , (req, res) =>{ +router.get('/allDirectory/:genres?' , (req, res) =>{ - let notNSWF = req.params.notNSWF; + let genres = req.params.genres; - api.getAllDirectory(notNSWF) + api.getAllDirectory(genres) .then(directory =>{ if (directory.length > 0) { res.status(200).json({ diff --git a/src/v2/utils/index.js b/src/v2/utils/index.js index 7a32f4b..1c3e35e 100644 --- a/src/v2/utils/index.js +++ b/src/v2/utils/index.js @@ -487,10 +487,10 @@ const getThemes = async (themes) => { const getAnimes = async () => await homgot(`${BASE_ANIMEFLV}api/animes/list`, { parse: true }); -const getDirectory = async (notNSWF) => { +const getDirectory = async (genres) => { let data - if (notNSWF) { + if (genres === "sfw") { data = JSON.parse(JSON.stringify(require('../../assets/directory.json'))).filter(function (item) { return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi"); })