Beta 2, quite a bit of changes

This commit is contained in:
Red Duck 2022-02-15 19:08:29 +02:00
parent c81e7b793f
commit 8f8260d383
43 changed files with 702 additions and 345 deletions

View file

@ -1,21 +1,27 @@
export default async function handle(req, res) {
if((""+req?.body?.text).includes("@")) return res.status(400).send("sussy baka");
let resp = await fetch("https://discord.com/api/webhooks/923258963758284871/NzXO2vAS3C4dGeL-Ml6zsbBHvfHduAkHxQWkGPnaUlHxmmPr6rfxHT2eyREe05MRnG_7", {
let amogus = ['127.0.0.1', '1', '192.168.1.254']
export default async function handle(REQ, RES) {
// Check if IP matches with the local IP
// if(!amogus.includes(REQ.socket.remoteAddress.split('::ffff:')[1])) {
// return RES.status(403).send('Forbidden. IP: '+REQ.socket.remoteAddress.split('::ffff:')[1]+'; Your IP in no way is logged!');
// }
if(!/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .,/?;:'\[\]\{\}\\<>\-_+=*!#$0123456789\^]*$/.test(""+REQ?.body?.text)) return RES.status(400).send("The message you were trying to send contains disallowed symbols!");
let RESPONSE = await fetch(process.env.WEBHOOK, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: "TheRed.SH / User Feedback",
content: req?.body?.text ?? "Illegal request",
content: REQ?.body?.text ?? "The request that was sent was an illegal request!",
avatar_url: "https://cdn.discordapp.com/avatars/574110505254256640/049c51674d7ccd748ca123556d351da5.webp?size=1024"
// why would this work? its running on discord so it cant see it
})
})
if(resp.ok) {
res.status(200).send("Your message was successfully sent!");
if(RESPONSE.ok) {
RES.status(200).send("Your message has been successfully sent!");
await RESPONSE.text().then(i => console.log(i));
} else {
res.status(500).send("error");
await resp.text().then(console.log);
RES.status(500).send("Error! The message has failed to send!");
await RESPONSE.text().then(i => console.log(i));
}
} // ill do it rq
}