mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Handling sessions, json response if not logged in
This commit is contained in:
parent
52ae2828e5
commit
4c2c617b96
7 changed files with 110 additions and 23 deletions
|
@ -118,7 +118,13 @@ function LogReq (req, toFile, sc) {
|
|||
dl += C('red')
|
||||
}
|
||||
|
||||
const hostname = req.hostname.replace('www.', '').split('.')[0]
|
||||
let hostname
|
||||
if (req.hostname) {
|
||||
hostname = req.hostname.replace('www.', '').split('.')[0]
|
||||
} else {
|
||||
hostname = 'NOHOST'
|
||||
Log('req.hostname is undefined! req.hostname: ' + req.hostname, GetColor('redbg'))
|
||||
}
|
||||
logEntry += dl + hostname + dl + req.headers['user-agent'] + dl + req.method + dl
|
||||
|
||||
logEntry += GetRandomColor(req.url.split('?')[0]) + req.url
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue