mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Changed getClientInfo method. Refactored send logic.
This commit is contained in:
parent
ada332f174
commit
698f0c6bbd
3 changed files with 9 additions and 9 deletions
|
|
@ -123,9 +123,9 @@ export async function getLocation(ip: string, req: NextApiRequestCollect) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getClientInfo(req: NextApiRequestCollect, { screen }) {
|
||||
export async function getClientInfo(req: NextApiRequestCollect) {
|
||||
const userAgent = req.headers['user-agent'];
|
||||
const ip = req.body.payload.ip || getIpAddress(req);
|
||||
const ip = req.body?.payload?.ip || getIpAddress(req);
|
||||
const location = await getLocation(ip, req);
|
||||
const country = location?.country;
|
||||
const subdivision1 = location?.subdivision1;
|
||||
|
|
@ -133,7 +133,7 @@ export async function getClientInfo(req: NextApiRequestCollect, { screen }) {
|
|||
const city = location?.city;
|
||||
const browser = browserName(userAgent);
|
||||
const os = detectOS(userAgent);
|
||||
const device = getDevice(screen, os);
|
||||
const device = getDevice(req.body?.payload?.screen, os);
|
||||
|
||||
return { userAgent, browser, os, ip, country, subdivision1, subdivision2, city, device };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export async function findSession(req: NextApiRequestCollect): Promise<{
|
|||
await checkUserBlock(website.userId);
|
||||
|
||||
const { userAgent, browser, os, ip, country, subdivision1, subdivision2, city, device } =
|
||||
await getClientInfo(req, payload);
|
||||
await getClientInfo(req);
|
||||
|
||||
const sessionId = uuid(websiteId, hostname, ip, userAgent);
|
||||
const visitId = uuid(sessionId, visitSalt());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue