mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Fixed vercel region issues.
This commit is contained in:
parent
5864aee043
commit
4ea3eec98c
@ -63,10 +63,15 @@ export async function getLocation(ip, req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (req.headers['x-vercel-ip-country']) {
|
if (req.headers['x-vercel-ip-country']) {
|
||||||
|
const country = req.headers['x-vercel-ip-country'];
|
||||||
|
const region = req.headers['x-vercel-ip-country-region'];
|
||||||
|
const city = req.headers['x-vercel-ip-city'];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
country: req.headers['x-vercel-ip-country'],
|
country,
|
||||||
subdivision1: req.headers['x-vercel-ip-country-region'],
|
// Vercel documentation says they return only region, but that is not always the case
|
||||||
city: decodeURIComponent(req.headers['x-vercel-ip-city']),
|
subdivision1: region.includes('-') ? region : `${country}-${region}`,
|
||||||
|
city: decodeURIComponent(city),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user