mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
added / fixed some types
This commit is contained in:
parent
5f12284bb8
commit
bc5c293539
41 changed files with 4378 additions and 8304 deletions
|
@ -1,4 +1,6 @@
|
|||
import logger from '../utils/logger'
|
||||
import type { Response, NextFunction } from 'express'
|
||||
import type { Request } from '../types/basicTypes'
|
||||
|
||||
interface Options {
|
||||
loggableKeywords: Array<string>
|
||||
|
@ -13,7 +15,7 @@ export default function (options: Options): any {
|
|||
const exceptions = options.exceptions || []
|
||||
const excludeFromStats = options.excludeFromStats || []
|
||||
|
||||
return function (req, res, next) {
|
||||
return function (req: Request, res: Response, next: NextFunction) {
|
||||
res.on('finish', function () {
|
||||
// TODO: test this
|
||||
const isException = exceptions.some((ex) => {
|
||||
|
@ -24,7 +26,6 @@ export default function (options: Options): any {
|
|||
return
|
||||
}
|
||||
|
||||
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
||||
let hostname = 'NOHOST'
|
||||
if (req.hostname) {
|
||||
hostname = req.hostname.replace('www.', '').split('.')[0]
|
||||
|
@ -59,7 +60,6 @@ export default function (options: Options): any {
|
|||
if (res.statusCode !== 404 && shouldLogStat) {
|
||||
logger.LogStat(
|
||||
req.url,
|
||||
ip,
|
||||
hostname,
|
||||
req.session && req.session.user ? req.session.user.id : 'NOUSER'
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue