mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Pixel route.
This commit is contained in:
parent
3c5c1e48e9
commit
0ac8bd41b6
10 changed files with 139 additions and 64 deletions
|
|
@ -89,8 +89,8 @@ function decodeHeader(s: string | undefined | null): string | undefined | null {
|
|||
|
||||
export async function getLocation(ip: string = '', headers: Headers, hasPayloadIP: boolean) {
|
||||
// Ignore local ips
|
||||
if (await isLocalhost(ip)) {
|
||||
return;
|
||||
if (!ip || (await isLocalhost(ip))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!hasPayloadIP && !process.env.SKIP_LOCATION_HEADERS) {
|
||||
|
|
@ -130,7 +130,7 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadI
|
|||
);
|
||||
}
|
||||
|
||||
const result = globalThis[MAXMIND].get(ip?.split(':')[0]);
|
||||
const result = globalThis[MAXMIND]?.get(ip?.split(':')[0]);
|
||||
|
||||
if (result) {
|
||||
const country = result.country?.iso_code ?? result?.registered_country?.iso_code;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue