Added search blacklist
parent
8cd3757f88
commit
d671a6b2d9
23
index.js
23
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}`
|
||||
|
|
Loading…
Reference in New Issue