diff --git a/src/client/components/monitor/provider/http.tsx b/src/client/components/monitor/provider/http.tsx
index 7ed582e..1455ccb 100644
--- a/src/client/components/monitor/provider/http.tsx
+++ b/src/client/components/monitor/provider/http.tsx
@@ -6,6 +6,7 @@ import { MonitorStatsBlock } from '../MonitorStatsBlock';
import dayjs from 'dayjs';
import { isEmpty } from 'lodash-es';
import { useCurrentWorkspaceId } from '../../../store/user';
+import { z } from 'zod';
const MonitorHttp: React.FC = React.memo(() => {
return (
@@ -13,7 +14,19 @@ const MonitorHttp: React.FC = React.memo(() => {
diff --git a/src/client/components/monitor/provider/ping.tsx b/src/client/components/monitor/provider/ping.tsx
index 41bf584..ea9811d 100644
--- a/src/client/components/monitor/provider/ping.tsx
+++ b/src/client/components/monitor/provider/ping.tsx
@@ -1,6 +1,8 @@
import { Form, Input } from 'antd';
import React from 'react';
import { MonitorProvider } from './types';
+import { z } from 'zod';
+import { hostnameRegex } from '../../../../shared';
export const MonitorPing: React.FC = React.memo(() => {
return (
@@ -8,7 +10,22 @@ export const MonitorPing: React.FC = React.memo(() => {
diff --git a/src/server/trpc/routers/website.ts b/src/server/trpc/routers/website.ts
index 3379223..24994db 100644
--- a/src/server/trpc/routers/website.ts
+++ b/src/server/trpc/routers/website.ts
@@ -12,12 +12,12 @@ import {
FILTER_COLUMNS,
OPENAPI_TAG,
SESSION_COLUMNS,
- hostnameRegex,
} from '../../utils/const';
import { parseDateRange } from '../../utils/common';
import { getSessionMetrics, getPageviewMetrics } from '../../model/website';
import { websiteInfoSchema } from '../../model/_schema';
import { OpenApiMeta } from 'trpc-openapi';
+import { hostnameRegex } from '../../../shared';
export const websiteRouter = router({
onlineCount: workspaceProcedure
diff --git a/src/server/utils/const.ts b/src/server/utils/const.ts
index c744ace..74fa3b3 100644
--- a/src/server/utils/const.ts
+++ b/src/server/utils/const.ts
@@ -120,6 +120,3 @@ export enum OPENAPI_TAG {
WEBSITE = 'Website',
MONITOR = 'Monitor',
}
-
-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;
diff --git a/src/shared/index.ts b/src/shared/index.ts
index c63001a..842b65e 100644
--- a/src/shared/index.ts
+++ b/src/shared/index.ts
@@ -1,2 +1,3 @@
export * from './date';
export * from './server';
+export * from './regex';
diff --git a/src/shared/regex.ts b/src/shared/regex.ts
new file mode 100644
index 0000000..b37ddd3
--- /dev/null
+++ b/src/shared/regex.ts
@@ -0,0 +1,2 @@
+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])$/;