🐛 fix(node): Port config
This commit is contained in:
parent
2926abc99e
commit
a20834a9ac
@ -3,7 +3,7 @@ import { z } from '@shadcn/ui/lib/zod';
|
|||||||
export const protocols = ['shadowsocks', 'vmess', 'vless', 'trojan', 'hysteria2', 'tuic'];
|
export const protocols = ['shadowsocks', 'vmess', 'vless', 'trojan', 'hysteria2', 'tuic'];
|
||||||
|
|
||||||
const nullableString = z.string().nullish();
|
const nullableString = z.string().nullish();
|
||||||
const portSchema = z.number().min(1).max(65535);
|
const portSchema = z.number().max(65535).nullish();
|
||||||
const securityConfigSchema = z
|
const securityConfigSchema = z
|
||||||
.object({
|
.object({
|
||||||
sni: nullableString,
|
sni: nullableString,
|
||||||
@ -13,7 +13,7 @@ const securityConfigSchema = z
|
|||||||
reality_public_key: nullableString,
|
reality_public_key: nullableString,
|
||||||
reality_short_id: nullableString,
|
reality_short_id: nullableString,
|
||||||
reality_server_addr: nullableString,
|
reality_server_addr: nullableString,
|
||||||
reality_server_port: portSchema.nullish(),
|
reality_server_port: portSchema,
|
||||||
})
|
})
|
||||||
.nullish();
|
.nullish();
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ const baseFormSchema = z.object({
|
|||||||
group_id: z.number().nullish(),
|
group_id: z.number().nullish(),
|
||||||
enable_relay: z.boolean().nullish().default(false),
|
enable_relay: z.boolean().nullish().default(false),
|
||||||
relay_host: nullableString,
|
relay_host: nullableString,
|
||||||
relay_port: z.number().nullish(),
|
relay_port: portSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const formSchema = z.intersection(baseFormSchema, protocolConfigSchema);
|
export const formSchema = z.intersection(baseFormSchema, protocolConfigSchema);
|
||||||
|
|||||||
@ -249,6 +249,8 @@ export default function NodeForm<T extends { [x: string]: any }>({
|
|||||||
<EnhancedInput
|
<EnhancedInput
|
||||||
{...field}
|
{...field}
|
||||||
type='number'
|
type='number'
|
||||||
|
min={1}
|
||||||
|
max={65535}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue(field.name, value);
|
form.setValue(field.name, value);
|
||||||
}}
|
}}
|
||||||
@ -343,6 +345,8 @@ export default function NodeForm<T extends { [x: string]: any }>({
|
|||||||
<EnhancedInput
|
<EnhancedInput
|
||||||
{...field}
|
{...field}
|
||||||
type='number'
|
type='number'
|
||||||
|
min={1}
|
||||||
|
max={65535}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue(field.name, value);
|
form.setValue(field.name, value);
|
||||||
}}
|
}}
|
||||||
@ -666,6 +670,8 @@ export default function NodeForm<T extends { [x: string]: any }>({
|
|||||||
<EnhancedInput
|
<EnhancedInput
|
||||||
{...field}
|
{...field}
|
||||||
type='number'
|
type='number'
|
||||||
|
min={1}
|
||||||
|
max={65535}
|
||||||
placeholder={t('form.security_config.serverPortPlaceholder')}
|
placeholder={t('form.security_config.serverPortPlaceholder')}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue(field.name, value);
|
form.setValue(field.name, value);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user