handle registration

This commit is contained in:
2023-03-03 20:14:18 +01:00
parent a882160d5e
commit fa52b4d498
2 changed files with 22 additions and 9 deletions
+7 -4
View File
@@ -1,4 +1,4 @@
import { Router } from 'express'
import { NextFunction, Router } from 'express'
import expressBasicAuth from 'express-basic-auth'
import { body, header, validationResult } from 'express-validator'
import register from './register'
@@ -10,7 +10,7 @@ router.use('/', register)
//auth middleware
router.post(
'/servers/:serverId/kill',
'/servers/:serverId/*',
header('authorization')
.exists({ checkFalsy: true })
.withMessage('Missing Authorization Header')
@@ -36,6 +36,10 @@ router.post(
}
)
router.post('/servers/:serverId', (req, res) => {
res.send(200)
})
const serversCount: { [id: string]: number } = {}
const serversTimeout: { [id: string]: NodeJS.Timeout } = {}
@@ -116,7 +120,6 @@ router.post(
console.log(JSON.stringify(errors))
return res.status(400).json({ errors: errors.array() })
}
const server = 1 // set server ID here
const {
killstat_version,
match_id,
@@ -153,7 +156,7 @@ router.post(
} = req.body
CreateKillRecord({
killstat_version,
server,
server: req.body.serverId,
match_id,
game_mode,
map,