mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Filter domain from referrers.
This commit is contained in:
parent
00e232fee8
commit
0a411a9ad6
6 changed files with 15 additions and 8 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import escape from 'escape-string-regexp';
|
||||
import { BROWSERS, ISO_COUNTRIES, DEVICES } from './constants';
|
||||
|
||||
export const browserFilter = data =>
|
||||
|
|
@ -5,8 +6,12 @@ export const browserFilter = data =>
|
|||
|
||||
export const urlFilter = data => data.filter(({ x }) => x !== '' && !x.startsWith('#'));
|
||||
|
||||
export const refFilter = data =>
|
||||
data.filter(({ x }) => x !== '' && !x.startsWith('/') && !x.startsWith('#'));
|
||||
export const refFilter = domain => data => {
|
||||
const regex = new RegExp(escape(domain));
|
||||
return data.filter(
|
||||
({ x }) => x !== '' && !x.startsWith('/') && !x.startsWith('#') && !regex.test(x),
|
||||
);
|
||||
};
|
||||
|
||||
export const deviceFilter = data =>
|
||||
data.map(({ x, ...props }) => ({ x: DEVICES[x] || x, ...props }));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue