mirror of
https://github.com/umami-software/umami.git
synced 2026-02-18 19:45:35 +01:00
maybe geoip is an array
This commit is contained in:
parent
065984f8f7
commit
2e535d86c7
1 changed files with 13 additions and 6 deletions
|
|
@ -61,13 +61,20 @@ export async function getLocation(req, ip) {
|
|||
|
||||
const result = await geoip.lookup(ip);
|
||||
console.log(result);
|
||||
|
||||
if (Array.isArray(result)) {
|
||||
return {
|
||||
country: result[0]?.country,
|
||||
region: result[0]?.region,
|
||||
city: result[0]?.city,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
country: result?.country,
|
||||
region: result?.region,
|
||||
city: result?.city,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getClientInfo(req, { screen }) {
|
||||
const userAgent = req.headers['user-agent'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue