refactor: agent log ips can no longer be an array

This commit is contained in:
Miodec 2023-11-28 15:02:04 +00:00
parent 0bbfbb48a3
commit d6f7f77feb

View file

@ -44,7 +44,7 @@ export function base64UrlDecode(data: string): string {
}
interface AgentLog {
ip: string | string[];
ip: string;
agent: string;
device?: string;
}
@ -54,8 +54,8 @@ export function buildAgentLog(req: MonkeyTypes.Request): AgentLog {
const agentLog: AgentLog = {
ip:
req.headers["cf-connecting-ip"] ||
req.headers["x-forwarded-for"] ||
(req.headers["cf-connecting-ip"] as string) ||
(req.headers["x-forwarded-for"] as string) ||
req.ip ||
"255.255.255.255",
agent: `${agent.os.name} ${agent.os.version} ${agent.browser.name} ${agent.browser.version}`,