Merge branch 'master' of gitlab.com:MrFry/mrfrys-node-server

This commit is contained in:
mrfry 2022-08-24 18:47:29 +02:00
commit 70e7af0ba0

View file

@ -108,7 +108,7 @@ function LogReq(
if (req.url.includes('lred')) { if (req.url.includes('lred')) {
dl += C('red') dl += C('red')
} }
if (!shouldLog(req.session.user.id, noLogIds)) { if (req.session && req.session.user && !shouldLog(req.session.user.id, noLogIds)) {
return return
} }
@ -220,14 +220,13 @@ function Load(): void {
} }
export function shouldLog(userId: string | number, nolog: string[]): boolean { export function shouldLog(userId: string | number, nolog: string[]): boolean {
return nolog.some((noLogId) => { return !nolog.some((noLogId) => {
return noLogId === userId.toString() return noLogId === userId.toString()
}) })
} }
function LogStat(url: string, hostname: string, userId: number | string): void { function LogStat(url: string, hostname: string, userId: number | string): void {
const nolog = shouldLog(userId, noLogIds) if (!shouldLog(userId, noLogIds)) {
if (nolog) {
return return
} }