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']) {
|
||||
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 {
|
||||
country: req.headers['x-vercel-ip-country'],
|
||||
subdivision1: req.headers['x-vercel-ip-country-region'],
|
||||
city: decodeURIComponent(req.headers['x-vercel-ip-city']),
|
||||
country,
|
||||
// Vercel documentation says they return only region, but that is not always the case
|
||||
subdivision1: region.includes('-') ? region : `${country}-${region}`,
|
||||
city: decodeURIComponent(city),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user