add blacklist
This commit is contained in:
parent
f11e1e707a
commit
a7bf878a82
|
@ -3,8 +3,18 @@ import axios from 'axios'
|
|||
|
||||
import dbConnect from '../dbConnect'
|
||||
import URLModel from '../schema'
|
||||
import blacklist from './blacklist.json'
|
||||
|
||||
export default async function addURL(url: string, response: VercelResponse) {
|
||||
blacklist.forEach(b=> {
|
||||
if (url.includes(b)) {
|
||||
return response.status(400).json({
|
||||
success: false,
|
||||
message: 'URL in on blacklist'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// fetch url (e.g. check domain exist)
|
||||
try {
|
||||
await axios.get(url)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
"google.com",
|
||||
"google.co",
|
||||
"google.pl",
|
||||
"google.tk",
|
||||
"google.de",
|
||||
"google.cf",
|
||||
"google.bz",
|
||||
"youtube.com",
|
||||
"youtu.be",
|
||||
"twitter.com",
|
||||
"duckduckgo.com",
|
||||
"stackoverflow.com",
|
||||
"github.com",
|
||||
"gitlab.com",
|
||||
"reddit.com",
|
||||
"domains.google",
|
||||
"pingbot.cf",
|
||||
"magicuser.cf"
|
||||
]
|
Loading…
Reference in New Issue