diff --git a/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx index 68743286..05c029e9 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx @@ -928,6 +928,8 @@ function isIPInSubnet(subnet: string, ip: string): boolean { const [subnetIP, maskBits] = subnet.split("/"); const mask = parseInt(maskBits); + const t = useTranslations(); + if (mask < 0 || mask > 32) { throw new Error(t('subnetMaskErrorInvalid')); } @@ -947,7 +949,7 @@ function ipToNumber(ip: string): number { // Validate IP address format const parts = ip.split("."); const t = useTranslations(); - + if (parts.length !== 4) { throw new Error(t('ipAddressErrorInvalidFormat')); } diff --git a/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx index d10e71e6..90c86aea 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx @@ -102,8 +102,8 @@ export default function ResourceRules(props: { const router = useRouter(); const t = useTranslations(); - - RuleAction = { + + const RuleAction = { ACCEPT: t('alwaysAllow'), DROP: t('alwaysDeny') } as const; diff --git a/src/app/[orgId]/settings/sites/CreateSiteForm.tsx b/src/app/[orgId]/settings/sites/CreateSiteForm.tsx index 8d7e711e..2eb670f3 100644 --- a/src/app/[orgId]/settings/sites/CreateSiteForm.tsx +++ b/src/app/[orgId]/settings/sites/CreateSiteForm.tsx @@ -78,6 +78,8 @@ export default function CreateSiteForm({ privateKey: string; } | null>(null); + const t = useTranslations(); + const createSiteFormSchema = z.object({ name: z .string() @@ -115,8 +117,6 @@ export default function CreateSiteForm({ const nameField = form.watch("name"); const methodField = form.watch("method"); - const t = useTranslations(); - useEffect(() => { const nameIsValid = nameField?.length >= 2 && nameField?.length <= 30; const isFormValid = methodField === "local" || isChecked;