mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Added browser / os / device override in payload
This commit is contained in:
parent
92a7355ce3
commit
805bc57bbb
2 changed files with 6 additions and 3 deletions
|
|
@ -41,6 +41,9 @@ const schema = z.object({
|
|||
userAgent: z.string().optional(),
|
||||
timestamp: z.coerce.number().int().optional(),
|
||||
id: z.string().optional(),
|
||||
browser: z.string().optional(),
|
||||
os: z.string().optional(),
|
||||
device: z.string().optional(),
|
||||
})
|
||||
.refine(
|
||||
data => {
|
||||
|
|
|
|||
|
|
@ -114,9 +114,9 @@ export async function getClientInfo(request: Request, payload: Record<string, an
|
|||
const country = safeDecodeURIComponent(location?.country);
|
||||
const region = safeDecodeURIComponent(location?.region);
|
||||
const city = safeDecodeURIComponent(location?.city);
|
||||
const browser = browserName(userAgent);
|
||||
const os = detectOS(userAgent) as string;
|
||||
const device = getDevice(userAgent, payload?.screen);
|
||||
const browser = payload?.browser ?? browserName(userAgent);
|
||||
const os = payload?.os ?? (detectOS(userAgent) as string);
|
||||
const device = payload?.device ?? getDevice(userAgent, payload?.screen);
|
||||
|
||||
return { userAgent, browser, os, ip, country, region, city, device };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue