mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
fix: decode location fields in user detection
This commit is contained in:
parent
b04077db02
commit
ebdd9095ab
1 changed files with 6 additions and 6 deletions
|
|
@ -5,11 +5,11 @@ import ipaddr from 'ipaddr.js';
|
||||||
import maxmind from 'maxmind';
|
import maxmind from 'maxmind';
|
||||||
import {
|
import {
|
||||||
DESKTOP_OS,
|
DESKTOP_OS,
|
||||||
MOBILE_OS,
|
|
||||||
DESKTOP_SCREEN_WIDTH,
|
DESKTOP_SCREEN_WIDTH,
|
||||||
LAPTOP_SCREEN_WIDTH,
|
|
||||||
MOBILE_SCREEN_WIDTH,
|
|
||||||
IP_ADDRESS_HEADERS,
|
IP_ADDRESS_HEADERS,
|
||||||
|
LAPTOP_SCREEN_WIDTH,
|
||||||
|
MOBILE_OS,
|
||||||
|
MOBILE_SCREEN_WIDTH,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
const MAXMIND = 'maxmind';
|
const MAXMIND = 'maxmind';
|
||||||
|
|
@ -146,9 +146,9 @@ export async function getClientInfo(request: Request, payload: Record<string, an
|
||||||
const userAgent = payload?.userAgent || request.headers.get('user-agent');
|
const userAgent = payload?.userAgent || request.headers.get('user-agent');
|
||||||
const ip = payload?.ip || getIpAddress(request.headers);
|
const ip = payload?.ip || getIpAddress(request.headers);
|
||||||
const location = await getLocation(ip, request.headers, !!payload?.ip);
|
const location = await getLocation(ip, request.headers, !!payload?.ip);
|
||||||
const country = location?.country;
|
const country = decodeURIComponent(location?.country);
|
||||||
const region = location?.region;
|
const region = decodeURIComponent(location?.region);
|
||||||
const city = location?.city;
|
const city = decodeURIComponent(location?.city);
|
||||||
const browser = browserName(userAgent);
|
const browser = browserName(userAgent);
|
||||||
const os = detectOS(userAgent) as string;
|
const os = detectOS(userAgent) as string;
|
||||||
const device = getDevice(payload?.screen, os);
|
const device = getDevice(payload?.screen, os);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue