From d671a6b2d943b3cca575bd3ae173bf72366bd3f6 Mon Sep 17 00:00:00 2001 From: v00rm Date: Sun, 26 Jan 2025 17:52:27 +0000 Subject: [PATCH] Added search blacklist --- index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.js b/index.js index 9171b00..d467937 100644 --- a/index.js +++ b/index.js @@ -58,11 +58,34 @@ app.get('/monero', (req, res) => { }); app.get('/posts', async (req, res) => { + const blacklisted_searches = [ + "rape", + "child", + "children", + "minor", + "infant", + "kid", + "loli", + "lolita", + "lolicon", + "shota", + "shotacon", + "bestiality", + "underage" + ] const search = req.query.search || ''; const page = parseInt(req.query.page) || 1; const limit = 10; const offset = (page - 1) * limit; + const isBlacklisted = blacklisted_searches.some((base) => + new RegExp(`\\b${base}s?\\b`, 'i').test(search) + ); + + if (isBlacklisted) { + return res.status(403).send('Blacklisted search detected!'); + } + try { const apiUrl = search ? `https://api.rule34.xxx/index.php?page=dapi&s=post&q=index&json=1&tags=${encodeURIComponent(search)}&limit=${limit}&pid=${page - 1}`