mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
Merge branch 'dev' into jajaja
This commit is contained in:
commit
b331da193f
27 changed files with 217 additions and 50 deletions
|
|
@ -397,6 +397,14 @@ export const PAID_AD_PARAMS = [
|
|||
'epik=',
|
||||
'ttclid=',
|
||||
'scid=',
|
||||
'aid=',
|
||||
'pc_id=',
|
||||
'ad_id=',
|
||||
'rdt_cid=',
|
||||
'ob_click_id=',
|
||||
'utm_medium=cpc',
|
||||
'utm_medium=paid',
|
||||
'utm_medium=paid_social',
|
||||
];
|
||||
|
||||
export const GROUPED_DOMAINS = [
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ export async function getClientInfo(request: Request, payload: Record<string, an
|
|||
const userAgent = payload?.userAgent || request.headers.get('user-agent');
|
||||
const ip = payload?.ip || getIpAddress(request.headers);
|
||||
const location = await getLocation(ip, request.headers, !!payload?.ip);
|
||||
const country = payload?.userAgent || location?.country;
|
||||
const country = location?.country;
|
||||
const subdivision1 = location?.subdivision1;
|
||||
const subdivision2 = location?.subdivision2;
|
||||
const city = location?.city;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ZodSchema } from 'zod';
|
||||
import { z, ZodSchema } from 'zod';
|
||||
import { FILTER_COLUMNS } from '@/lib/constants';
|
||||
import { badRequest, unauthorized } from '@/lib/response';
|
||||
import { getAllowedUnits, getMinimumUnit } from '@/lib/date';
|
||||
|
|
@ -24,12 +24,21 @@ export async function parseRequest(
|
|||
let error: () => void | undefined;
|
||||
let auth = null;
|
||||
|
||||
const getErrorMessages = (error: z.ZodError) => {
|
||||
return Object.entries(error.format())
|
||||
.map(([key, value]) => {
|
||||
const messages = (value as any)._errors;
|
||||
return messages ? `${key}: ${messages.join(', ')}` : null;
|
||||
})
|
||||
.filter(Boolean);
|
||||
};
|
||||
|
||||
if (schema) {
|
||||
const isGet = request.method === 'GET';
|
||||
const result = schema.safeParse(isGet ? query : body);
|
||||
|
||||
if (!result.success) {
|
||||
error = () => badRequest(result.error);
|
||||
error = () => badRequest(getErrorMessages(result.error));
|
||||
} else if (isGet) {
|
||||
query = result.data;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue