mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Merge branch 'dev' of https://github.com/umami-software/umami into dev
This commit is contained in:
commit
28f15a9173
7 changed files with 23 additions and 22 deletions
|
|
@ -14,6 +14,7 @@ export function UpdateNotice({ user, config }) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const [dismissed, setDismissed] = useState(checked);
|
const [dismissed, setDismissed] = useState(checked);
|
||||||
const allowUpdate =
|
const allowUpdate =
|
||||||
|
process.env.NODE_ENV === 'production' &&
|
||||||
user?.isAdmin &&
|
user?.isAdmin &&
|
||||||
!config?.updatesDisabled &&
|
!config?.updatesDisabled &&
|
||||||
!pathname.includes('/share/') &&
|
!pathname.includes('/share/') &&
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { badRequest, json, forbidden, serverError } from '@/lib/response';
|
||||||
import { fetchSession, fetchWebsite } from '@/lib/load';
|
import { fetchSession, fetchWebsite } from '@/lib/load';
|
||||||
import { getClientInfo, hasBlockedIp } from '@/lib/detect';
|
import { getClientInfo, hasBlockedIp } from '@/lib/detect';
|
||||||
import { secret, uuid, visitSalt } from '@/lib/crypto';
|
import { secret, uuid, visitSalt } from '@/lib/crypto';
|
||||||
import { COLLECTION_TYPE } from '@/lib/constants';
|
import { COLLECTION_TYPE, DOMAIN_REGEX } from '@/lib/constants';
|
||||||
import { createSession, saveEvent, saveSessionData } from '@/queries';
|
import { createSession, saveEvent, saveSessionData } from '@/queries';
|
||||||
import { urlOrPathParam } from '@/lib/schema';
|
import { urlOrPathParam } from '@/lib/schema';
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ const schema = z.object({
|
||||||
payload: z.object({
|
payload: z.object({
|
||||||
website: z.string().uuid(),
|
website: z.string().uuid(),
|
||||||
data: z.object({}).passthrough().optional(),
|
data: z.object({}).passthrough().optional(),
|
||||||
hostname: z.string().max(100).optional(),
|
hostname: z.string().regex(DOMAIN_REGEX).max(100).optional(),
|
||||||
language: z.string().max(35).optional(),
|
language: z.string().max(35).optional(),
|
||||||
referrer: urlOrPathParam.optional(),
|
referrer: urlOrPathParam.optional(),
|
||||||
screen: z.string().max(11).optional(),
|
screen: z.string().max(11).optional(),
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export function useSessionDataProperties(
|
||||||
const params = useFilterParams(websiteId);
|
const params = useFilterParams(websiteId);
|
||||||
|
|
||||||
return useQuery<any>({
|
return useQuery<any>({
|
||||||
queryKey: ['websites:event-data:properties', { websiteId, ...params }],
|
queryKey: ['websites:session-data:properties', { websiteId, ...params }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/session-data/properties`, { ...params }),
|
queryFn: () => get(`/websites/${websiteId}/session-data/properties`, { ...params }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export function usePagedQuery<T = any>({
|
||||||
const { query: queryParams } = useNavigation();
|
const { query: queryParams } = useNavigation();
|
||||||
const [params, setParams] = useState<PageParams>({
|
const [params, setParams] = useState<PageParams>({
|
||||||
search: '',
|
search: '',
|
||||||
page: queryParams.page || '1',
|
page: +queryParams.page || 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { useQuery } = useApi();
|
const { useQuery } = useApi();
|
||||||
|
|
|
||||||
|
|
@ -241,12 +241,6 @@ export const CHART_COLORS = [
|
||||||
export const DOMAIN_REGEX =
|
export const DOMAIN_REGEX =
|
||||||
/^(localhost(:[1-9]\d{0,4})?|((?=[a-z0-9-_]{1,63}\.)(xn--)?[a-z0-9-_]+(-[a-z0-9-_]+)*\.)+(xn--)?[a-z0-9-_]{2,63})$/;
|
/^(localhost(:[1-9]\d{0,4})?|((?=[a-z0-9-_]{1,63}\.)(xn--)?[a-z0-9-_]+(-[a-z0-9-_]+)*\.)+(xn--)?[a-z0-9-_]{2,63})$/;
|
||||||
export const SHARE_ID_REGEX = /^[a-zA-Z0-9]{8,16}$/;
|
export const SHARE_ID_REGEX = /^[a-zA-Z0-9]{8,16}$/;
|
||||||
export const UUID_REGEX =
|
|
||||||
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;
|
|
||||||
export const HOSTNAME_REGEX =
|
|
||||||
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-_]*[A-Za-z0-9])$/;
|
|
||||||
export const IP_REGEX =
|
|
||||||
/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^(?:(?:[0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:(?:(:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))$/;
|
|
||||||
export const DATETIME_REGEX =
|
export const DATETIME_REGEX =
|
||||||
/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{3}(Z|\+[0-9]{2}:[0-9]{2})?)?$/;
|
/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{3}(Z|\+[0-9]{2}:[0-9]{2})?)?$/;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export type ReportType = ObjectValues<typeof REPORT_TYPES>;
|
||||||
|
|
||||||
export interface PageParams {
|
export interface PageParams {
|
||||||
search?: string;
|
search?: string;
|
||||||
page?: string;
|
page?: string | number;
|
||||||
pageSize?: string;
|
pageSize?: string;
|
||||||
orderBy?: string;
|
orderBy?: string;
|
||||||
sortDescending?: boolean;
|
sortDescending?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,16 @@ async function relationalQuery(
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
select
|
select
|
||||||
data_key as "propertyName",
|
data_key as "propertyName",
|
||||||
count(*) as "total"
|
count(*) as "total"
|
||||||
from session_data
|
from website_event e
|
||||||
where website_id = {{websiteId::uuid}}
|
left join session_data d
|
||||||
and created_at between {{startDate}} and {{endDate}}
|
on d.session_id = e.session_id
|
||||||
${filterQuery}
|
where e.website_id = {{websiteId:uuid}}
|
||||||
group by data_key
|
and e.created_at between {{startDate}} and {{endDate}}
|
||||||
|
and d.data_key is not null
|
||||||
|
${filterQuery}
|
||||||
|
group by 1
|
||||||
order by 2 desc
|
order by 2 desc
|
||||||
limit 500
|
limit 500
|
||||||
`,
|
`,
|
||||||
|
|
@ -52,11 +55,14 @@ async function clickhouseQuery(
|
||||||
select
|
select
|
||||||
data_key as propertyName,
|
data_key as propertyName,
|
||||||
count(*) as total
|
count(*) as total
|
||||||
from session_data final
|
from website_event e
|
||||||
where website_id = {websiteId:UUID}
|
left join session_data d
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
on d.session_id = e.session_id
|
||||||
|
where e.website_id = {websiteId:UUID}
|
||||||
|
and e.created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
|
and d.data_key != ''
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
group by data_key
|
group by 1
|
||||||
order by 2 desc
|
order by 2 desc
|
||||||
limit 500
|
limit 500
|
||||||
`,
|
`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue