Attempt to fix build
This commit is contained in:
parent
6d69eb12b9
commit
d96367b101
1 changed files with 5 additions and 8 deletions
13
src/main.ts
13
src/main.ts
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue