someone sent nsfw so i fixed that
This commit is contained in:
parent
870a409353
commit
03c64af142
1 changed files with 2 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
const local = ['127.0.0.1', '1', '192.168.1.254'];
|
||||
const disallowRegex = /(https|http):\/\/.*/;
|
||||
const allowed_chars = /^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .,\/?;:'\[\]\{\}\\<>\-_+=*!#$0123456789\^]*$/;
|
||||
export default async function handle(req, res) {
|
||||
// Check if IP matches with the local IP
|
||||
|
@ -9,6 +10,7 @@ export default async function handle(req, res) {
|
|||
const text = req.body?.text;
|
||||
if(!text) return res.status(400).send("Illegal request!");
|
||||
if(!allowed_chars.test(text)) return res.status(400).send("The message you were trying to send contains disallowed symbols!");
|
||||
if(disallowRegex.test(text)) return res.status(400).send("Nuh-uh! You don't send links here.");
|
||||
const webhookRes = await fetch(process.env.WEBHOOK, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
Loading…
Reference in a new issue