-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
62 lines (39 loc) · 1.1 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const express = require('express')
const app = express()
const gerar = require("./assets/main")
app.use(express.static("views"));
app.set('view engine', 'ejs')
const port = process.env.PORT || 8080
let blockIp = []
app.get("/", (req,res) => {
res.render("home")
})
app.get("/gerar", (req,res) => {
res.render("gerar")
})
app.get("/gen/:partido", async(req, res) => {
const partido = req.params.partido
const nome = req.query.nome
const modelo = req.query.modelo
if(nome.length > 20) return res.status(403)
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if (forwardedIpsStr) {
IP = forwardedIps = forwardedIpsStr.split(',')[0];
}
if(IP == "35.224.35.49") return
console.log(`[+] acess from ${IP}`)
gerar({
modelo,
partido,
nome
}).then(data => {
res.status(200).send(data)
})
})
app.get("addip", (req, res) => {
blockIp.push(req.query.ip)
})
app.listen(port, () => {
console.log(`app listening on ${port}`)
})