Attempt to fix build

This commit is contained in:
Pieter Vander Vennet 2024-06-17 18:42:08 +02:00
parent 6d69eb12b9
commit d96367b101

View file

@ -154,7 +154,6 @@ export class Main {
"ip", "ip",
"ipNo" "ipNo"
] as const ] as const
private readonly keysSet = new Set<string>(this.allowedKeys)
constructor() { constructor() {
console.log("Loading databases from ./data/") console.log("Loading databases from ./data/")
@ -190,14 +189,12 @@ export class Main {
//see : https://github.com/kirsch33/realip/issues/14 //see : https://github.com/kirsch33/realip/issues/14
const ipAddress = <string>request.headers['x-forwarded-for'] const ipAddress = <string>request.headers['x-forwarded-for']
const db = ipAddress.match(Main.ipv4Regex) ? this.ipv4 : this.ipv6 const db = ipAddress.match(Main.ipv4Regex) ? this.ipv4 : this.ipv6
const result: IP2LocationResult = db.getAll(ipAddress) const fullResult = db.getAll(ipAddress)
for (const k in result) { const result = {}
if (!this.keysSet.has(k)) { for (const k in this.allowedKeys) {
// @ts-ignore result[k] = fullResult[k]
delete result[k]
}
} }
return result return <any>result
} }
} }