mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Allow setting visitor IP when registering event through API
This commit is contained in:
parent
784237bfab
commit
ebb29b8207
3 changed files with 5 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import ipaddr from 'ipaddr.js';
|
||||
import isbot from 'isbot';
|
||||
import { COLLECTION_TYPE, HOSTNAME_REGEX } from 'lib/constants';
|
||||
import { COLLECTION_TYPE, HOSTNAME_REGEX, IP_REGEX } from 'lib/constants';
|
||||
import { secret } from 'lib/crypto';
|
||||
import { getIpAddress } from 'lib/detect';
|
||||
import { useCors, useSession, useValidate } from 'lib/middleware';
|
||||
|
|
@ -14,6 +14,7 @@ export interface CollectRequestBody {
|
|||
payload: {
|
||||
data: { [key: string]: any };
|
||||
hostname: string;
|
||||
ip: string;
|
||||
language: string;
|
||||
referrer: string;
|
||||
screen: string;
|
||||
|
|
@ -53,6 +54,7 @@ const schema = {
|
|||
.shape({
|
||||
data: yup.object(),
|
||||
hostname: yup.string().matches(HOSTNAME_REGEX).max(100),
|
||||
ip: yup.string().matches(IP_REGEX),
|
||||
language: yup.string().max(35),
|
||||
referrer: yup.string().max(500),
|
||||
screen: yup.string().max(11),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue