mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Converted global to globalThis.
This commit is contained in:
parent
886b7e9e56
commit
c969603001
9 changed files with 25 additions and 22 deletions
|
|
@ -121,13 +121,13 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadI
|
|||
}
|
||||
|
||||
// Database lookup
|
||||
if (!global[MAXMIND]) {
|
||||
if (!globalThis[MAXMIND]) {
|
||||
const dir = path.join(process.cwd(), 'geo');
|
||||
|
||||
global[MAXMIND] = await maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb'));
|
||||
globalThis[MAXMIND] = await maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb'));
|
||||
}
|
||||
|
||||
const result = global[MAXMIND].get(ip);
|
||||
const result = globalThis[MAXMIND].get(ip);
|
||||
|
||||
if (result) {
|
||||
const country = result.country?.iso_code ?? result?.registered_country?.iso_code;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue