Update ban route
This commit is contained in:
parent
6fca101b0a
commit
5f9ae240bc
@ -5,19 +5,21 @@ const express = require("express")
|
|||||||
const router = express()
|
const router = express()
|
||||||
|
|
||||||
router.post("/iam", (req, res) => {
|
router.post("/iam", (req, res) => {
|
||||||
|
console.log(req.body)
|
||||||
if (!req.body || !req.body.hwid) {
|
if (!req.body || !req.body.hwid) {
|
||||||
const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress
|
const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress
|
||||||
utils.handleError(req, res, 422, "Paramètre manquant dans le corp de la requête : <hwid>")
|
utils.handleError(req, res, 422, "Paramètre manquant dans le corp de la requête : <hwid>")
|
||||||
logger.log(`{Route:"/api/v1/ban/iam"} Strange request from ip<${ip}>`)
|
logger.log(`{Route:"/api/v1/ban/iam"} Strange request from ip<${ip}>`)
|
||||||
} else {
|
} else {
|
||||||
const potentialBan = controller.getBan(req.body.hwid)
|
const potentialBan = controller.getBan(req.body.hwid)
|
||||||
|
console.log(potentialBan)
|
||||||
if (potentialBan != undefined) {
|
if (potentialBan != undefined) {
|
||||||
delete potentialBan.remote_ip
|
delete potentialBan.remote_ip
|
||||||
delete potentialBan.hardware_id
|
delete potentialBan.hardware_id
|
||||||
delete potentialBan.last_minecraft_uuid
|
delete potentialBan.last_minecraft_uuid
|
||||||
res.status(200).json(potentialBan)
|
res.status(200).json(potentialBan)
|
||||||
} else {
|
} else {
|
||||||
res.status(200).json({ sucess: true })
|
res.status(200).json({ success: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user