Added search blacklist

main
v00rm 2025-01-26 17:52:27 +00:00
parent 8cd3757f88
commit d671a6b2d9
1 changed files with 23 additions and 0 deletions

View File

@ -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}`