fix: fix tianji domain update not support hostname problem
This commit is contained in:
parent
9d50b43ebf
commit
fbb091fd2a
@ -6,6 +6,7 @@ import {
|
||||
EVENT_COLUMNS,
|
||||
FILTER_COLUMNS,
|
||||
SESSION_COLUMNS,
|
||||
hostnameRegex,
|
||||
} from '../../utils/const';
|
||||
import { parseDateRange } from '../../utils/common';
|
||||
import { getSessionMetrics, getPageviewMetrics } from '../../model/website';
|
||||
@ -160,7 +161,10 @@ export const websiteRouter = router({
|
||||
z.object({
|
||||
websiteId: z.string().cuid2(),
|
||||
name: z.string().max(100),
|
||||
domain: z.union([z.string().max(500).url(), z.string().max(500).ip()]),
|
||||
domain: z.union([
|
||||
z.string().max(500).regex(hostnameRegex),
|
||||
z.string().max(500).ip(),
|
||||
]),
|
||||
monitorId: z.string().cuid2().nullish(),
|
||||
})
|
||||
)
|
||||
|
@ -117,3 +117,6 @@ export const DEFAULT_RESET_DATE = '2000-01-01';
|
||||
export enum OPENAPI_TAG {
|
||||
USER = 'User',
|
||||
}
|
||||
|
||||
export const hostnameRegex =
|
||||
/^(([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])$/gim;
|
||||
|
Loading…
Reference in New Issue
Block a user