mirror of
https://github.com/umami-software/umami.git
synced 2026-02-22 13:35:35 +01:00
Merge branch 'dev' into feat/um-185-event-data-redirect
This commit is contained in:
commit
53a6a8924d
23 changed files with 3791 additions and 98 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { WebsiteStats } from 'lib/types';
|
||||
import { NextApiRequestQueryBody } from 'lib/types';
|
||||
import { canViewWebsite } from 'lib/auth';
|
||||
import { useAuth, useCors } from 'lib/middleware';
|
||||
import { NextApiRequestQueryBody, WebsiteStats } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getWebsiteStats } from 'queries';
|
||||
|
|
@ -13,10 +12,14 @@ export interface WebsiteStatsRequestQuery {
|
|||
endAt: number;
|
||||
url: string;
|
||||
referrer: string;
|
||||
pageTitle: string;
|
||||
os: string;
|
||||
browser: string;
|
||||
device: string;
|
||||
country: string;
|
||||
subdivision1: string;
|
||||
subdivision2: string;
|
||||
city: string;
|
||||
}
|
||||
|
||||
export default async (
|
||||
|
|
@ -26,7 +29,21 @@ export default async (
|
|||
await useCors(req, res);
|
||||
await useAuth(req, res);
|
||||
|
||||
const { id: websiteId, startAt, endAt, url, referrer, os, browser, device, country } = req.query;
|
||||
const {
|
||||
id: websiteId,
|
||||
startAt,
|
||||
endAt,
|
||||
url,
|
||||
referrer,
|
||||
pageTitle,
|
||||
os,
|
||||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
} = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
|
|
@ -46,10 +63,14 @@ export default async (
|
|||
filters: {
|
||||
url,
|
||||
referrer,
|
||||
pageTitle,
|
||||
os,
|
||||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
});
|
||||
const prevPeriod = await getWebsiteStats(websiteId, {
|
||||
|
|
@ -58,10 +79,14 @@ export default async (
|
|||
filters: {
|
||||
url,
|
||||
referrer,
|
||||
pageTitle,
|
||||
os,
|
||||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue