Ignore session check for clickhouse.
This commit is contained in:
@@ -88,11 +88,11 @@ export async function POST(request: Request) {
|
|||||||
const sessionId = uuid(websiteId, hostname, ip, userAgent);
|
const sessionId = uuid(websiteId, hostname, ip, userAgent);
|
||||||
|
|
||||||
// Find session
|
// Find session
|
||||||
if (!cache?.sessionId) {
|
if (!clickhouse.enabled && !cache?.sessionId) {
|
||||||
const session = await fetchSession(websiteId, sessionId);
|
const session = await fetchSession(websiteId, sessionId);
|
||||||
|
|
||||||
// Create a session if not found
|
// Create a session if not found
|
||||||
if (!session && !clickhouse.enabled) {
|
if (!session) {
|
||||||
try {
|
try {
|
||||||
await createSession({
|
await createSession({
|
||||||
id: sessionId,
|
id: sessionId,
|
||||||
@@ -133,7 +133,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
let urlPath = currentUrl.pathname;
|
let urlPath = currentUrl.pathname;
|
||||||
const urlQuery = currentUrl.search.substring(1);
|
const urlQuery = currentUrl.search.substring(1);
|
||||||
const urlDomain = currentUrl.hostname;
|
const urlDomain = currentUrl.hostname.replace(/^www./, '');
|
||||||
|
|
||||||
if (process.env.REMOVE_TRAILING_SLASH) {
|
if (process.env.REMOVE_TRAILING_SLASH) {
|
||||||
urlPath = urlPath.replace(/(.+)\/$/, '$1');
|
urlPath = urlPath.replace(/(.+)\/$/, '$1');
|
||||||
@@ -150,7 +150,7 @@ export async function POST(request: Request) {
|
|||||||
referrerQuery = referrerUrl.search.substring(1);
|
referrerQuery = referrerUrl.search.substring(1);
|
||||||
|
|
||||||
if (referrerUrl.hostname !== 'localhost') {
|
if (referrerUrl.hostname !== 'localhost') {
|
||||||
referrerDomain = referrerUrl.hostname;
|
referrerDomain = referrerUrl.hostname.replace(/^www\./, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { getWebsiteDateRange } from '@/queries';
|
|||||||
|
|
||||||
export async function getJsonBody(request: Request) {
|
export async function getJsonBody(request: Request) {
|
||||||
try {
|
try {
|
||||||
return request.clone().json();
|
return await request.clone().json();
|
||||||
} catch {
|
} catch {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user