Added Request type with cookies and session, and fixed stuff that it broke

This commit is contained in:
mrfry 2020-12-16 17:22:15 +01:00
parent 865e97a754
commit 3b902d736f
9 changed files with 117 additions and 95 deletions

View file

@ -39,6 +39,8 @@ const DELIM = C('green') + '|' + C()
// import express from 'express'
import utils from '../utils/utils'
import { Request } from '../types/basicTypes'
const vlogDir = './stats/vlogs/'
const logDir = './stats/logs/'
const statFile = 'stats/stats'
@ -109,13 +111,10 @@ function Log(msg: string | object, color?: string): void {
)
}
function LogReq(
req: any /*express.Request*/,
toFile?: boolean,
statusCode?: string
): void {
function LogReq(req: Request, toFile?: boolean, statusCode?: string): void {
try {
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
const ip: any =
req.headers['cf-connecting-ip'] || req.connection.remoteAddress
const nolog = noLogips.some((noLogip) => {
return ip.includes(noLogip)