mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 07:13:37 +01:00
Remove domain parameter from queries.
This commit is contained in:
parent
278672233e
commit
f7201c9cfc
@ -17,7 +17,6 @@ import styles from './MetricsTable.module.css';
|
||||
|
||||
export default function MetricsTable({
|
||||
websiteId,
|
||||
websiteDomain,
|
||||
type,
|
||||
className,
|
||||
dataFilter,
|
||||
@ -42,7 +41,6 @@ export default function MetricsTable({
|
||||
type,
|
||||
start_at: +startDate,
|
||||
end_at: +endDate,
|
||||
domain: websiteDomain,
|
||||
url,
|
||||
},
|
||||
onDataLoad,
|
||||
|
@ -42,7 +42,6 @@ export default function ReferrersTable({ websiteId, websiteDomain, showFilters,
|
||||
type="referrer"
|
||||
metric={<FormattedMessage id="metrics.views" defaultMessage="Views" />}
|
||||
websiteId={websiteId}
|
||||
websiteDomain={websiteDomain}
|
||||
dataFilter={refFilter}
|
||||
filterOptions={{
|
||||
domain: websiteDomain,
|
||||
|
@ -428,7 +428,7 @@ export function getPageviewMetrics(website_id, start_at, end_at, field, table, f
|
||||
|
||||
if (domain) {
|
||||
domainFilter = `and referrer not like $${params.length + 1} and referrer not like '/%'`;
|
||||
params.push(`%${domain}%`);
|
||||
params.push(`%://${domain}/%`);
|
||||
}
|
||||
|
||||
if (url) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { getPageviewMetrics, getSessionMetrics } from 'lib/queries';
|
||||
import { ok, badRequest, methodNotAllowed, unauthorized } from 'lib/response';
|
||||
import { DOMAIN_REGEX } from 'lib/constants';
|
||||
import { getPageviewMetrics, getSessionMetrics, getWebsiteById } from 'lib/queries';
|
||||
import { ok, methodNotAllowed, unauthorized, badRequest } from 'lib/response';
|
||||
import { allowQuery } from 'lib/auth';
|
||||
|
||||
const sessionColumns = ['browser', 'os', 'device', 'country'];
|
||||
@ -31,11 +30,7 @@ export default async (req, res) => {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { id, type, start_at, end_at, domain, url } = req.query;
|
||||
|
||||
if (domain && !DOMAIN_REGEX.test(domain)) {
|
||||
return badRequest(res);
|
||||
}
|
||||
const { id, type, start_at, end_at, url } = req.query;
|
||||
|
||||
const websiteId = +id;
|
||||
const startDate = new Date(+start_at);
|
||||
@ -47,7 +42,18 @@ export default async (req, res) => {
|
||||
return ok(res, data);
|
||||
}
|
||||
|
||||
if (type === 'event' || pageviewColumns.includes(type)) {
|
||||
if (pageviewColumns.includes(type) || type === 'event') {
|
||||
let domain;
|
||||
if (type === 'referrer') {
|
||||
const website = getWebsiteById(websiteId);
|
||||
|
||||
if (!website) {
|
||||
return badRequest(res);
|
||||
}
|
||||
|
||||
domain = website.domain;
|
||||
}
|
||||
|
||||
const data = await getPageviewMetrics(
|
||||
websiteId,
|
||||
startDate,
|
||||
@ -55,7 +61,7 @@ export default async (req, res) => {
|
||||
getColumn(type),
|
||||
getTable(type),
|
||||
{
|
||||
domain: type !== 'event' && domain,
|
||||
domain,
|
||||
url: type !== 'url' && url,
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user