blocklist
This commit is contained in:
20
index.js
20
index.js
@ -8,6 +8,16 @@ const alwaysAllow = [
|
||||
"selenite.skysthelimit.dev"
|
||||
]
|
||||
|
||||
const blockList = [
|
||||
"sber",
|
||||
"cdek",
|
||||
"avito",
|
||||
"pochta",
|
||||
"nalozhka",
|
||||
"blablacar",
|
||||
"youla",
|
||||
]
|
||||
|
||||
const db = new Database("links.sqlite");
|
||||
db.exec("PRAGMA journal_mode = WAL;");
|
||||
|
||||
@ -75,7 +85,13 @@ app.get("/check", async (req, res) => {
|
||||
}
|
||||
|
||||
const hostname = domain.hostname.toLowerCase();
|
||||
if (hostname.split(".").length > 5) {
|
||||
|
||||
for (const blockedWord of blockList) {
|
||||
if (hostname.includes(blockedWord.toLowerCase())) {
|
||||
return res.status(400).end();
|
||||
}
|
||||
}
|
||||
if (hostname.split(".").length > 7) {
|
||||
return res.status(400).end();
|
||||
}
|
||||
|
||||
@ -85,7 +101,7 @@ app.get("/check", async (req, res) => {
|
||||
|
||||
const baseDomain = getBaseDomain(hostname);
|
||||
const { count } = domainCount.get({ $base: baseDomain });
|
||||
if (count >= 100) {
|
||||
if (count >= 500) {
|
||||
return res.status(400).end();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user