mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Changed session id generation.
This commit is contained in:
parent
d4b786380b
commit
d44be466d8
2 changed files with 6 additions and 7 deletions
|
|
@ -55,7 +55,7 @@ export async function POST(request: Request) {
|
||||||
title,
|
title,
|
||||||
tag,
|
tag,
|
||||||
timestamp,
|
timestamp,
|
||||||
id = '',
|
id,
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
// Cache check
|
// Cache check
|
||||||
|
|
@ -101,7 +101,7 @@ export async function POST(request: Request) {
|
||||||
const sessionSalt = hash(startOfMonth(createdAt).toUTCString());
|
const sessionSalt = hash(startOfMonth(createdAt).toUTCString());
|
||||||
const visitSalt = hash(startOfHour(createdAt).toUTCString());
|
const visitSalt = hash(startOfHour(createdAt).toUTCString());
|
||||||
|
|
||||||
const sessionId = uuid(websiteId, ip, userAgent, sessionSalt, id);
|
const sessionId = id ? uuid(websiteId, id) : uuid(websiteId, ip, userAgent, sessionSalt);
|
||||||
|
|
||||||
// Find session
|
// Find session
|
||||||
if (!clickhouse.enabled && !cache?.sessionId) {
|
if (!clickhouse.enabled && !cache?.sessionId) {
|
||||||
|
|
@ -148,6 +148,10 @@ export async function POST(request: Request) {
|
||||||
const urlQuery = currentUrl.search.substring(1);
|
const urlQuery = currentUrl.search.substring(1);
|
||||||
const urlDomain = currentUrl.hostname.replace(/^www./, '');
|
const urlDomain = currentUrl.hostname.replace(/^www./, '');
|
||||||
|
|
||||||
|
let referrerPath: string;
|
||||||
|
let referrerQuery: string;
|
||||||
|
let referrerDomain: string;
|
||||||
|
|
||||||
// UTM Params
|
// UTM Params
|
||||||
const utmSource = currentUrl.searchParams.get('utm_source');
|
const utmSource = currentUrl.searchParams.get('utm_source');
|
||||||
const utmMedium = currentUrl.searchParams.get('utm_medium');
|
const utmMedium = currentUrl.searchParams.get('utm_medium');
|
||||||
|
|
@ -167,10 +171,6 @@ export async function POST(request: Request) {
|
||||||
urlPath = urlPath.replace(/(.+)\/$/, '$1');
|
urlPath = urlPath.replace(/(.+)\/$/, '$1');
|
||||||
}
|
}
|
||||||
|
|
||||||
let referrerPath: string;
|
|
||||||
let referrerQuery: string;
|
|
||||||
let referrerDomain: string;
|
|
||||||
|
|
||||||
if (referrer) {
|
if (referrer) {
|
||||||
const referrerUrl = new URL(referrer, base);
|
const referrerUrl = new URL(referrer, base);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable no-unused-vars */
|
|
||||||
export const CURRENT_VERSION = process.env.currentVersion;
|
export const CURRENT_VERSION = process.env.currentVersion;
|
||||||
export const AUTH_TOKEN = 'umami.auth';
|
export const AUTH_TOKEN = 'umami.auth';
|
||||||
export const LOCALE_CONFIG = 'umami.locale';
|
export const LOCALE_CONFIG = 'umami.locale';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue