diff --git a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx index e323d87e..ec2cf352 100644 --- a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx +++ b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx @@ -26,10 +26,6 @@ import { import { parseOutboundLink } from '@/lib/xray/outbound-link-parser'; import { OutboundFormBaseSchema, - ShadowsocksOutboundFormSettingsSchema, - TrojanOutboundFormSettingsSchema, - VlessOutboundFormSettingsSchema, - VmessOutboundFormSettingsSchema, type OutboundFormValues, } from '@/schemas/forms/outbound-form'; import { @@ -47,7 +43,6 @@ import { canEnableTls, canEnableTlsFlow, } from '@/lib/xray/protocol-capabilities'; -import { SSMethodSchema } from '@/schemas/protocols/shared/shadowsocks'; import { antdRule } from '@/utils/zodForm'; import { @@ -58,9 +53,7 @@ import { MODE_OPTIONS, NETWORK_OPTIONS, PROTOCOL_OPTIONS, - SECURITY_OPTIONS, SERVER_PROTOCOLS, - SS_METHOD_OPTIONS, UTLS_OPTIONS, } from './outbound-form-constants'; import { @@ -69,6 +62,7 @@ import { isMuxAllowed, newStreamSlice, } from './outbound-form-helpers'; +import { OutboundCoreProtocolFields } from './outbound-core-fields'; import { OutboundOnlyProtocolFields } from './outbound-only-fields'; import { FreedomOutboundFields } from './outbound-freedom-fields'; import { WireguardOutboundFields } from './outbound-wireguard-fields'; @@ -418,88 +412,7 @@ export default function OutboundFormModal({ )} - {(protocol === 'vmess' || protocol === 'vless') && ( - - - - )} - {protocol === 'vmess' && ( - - - - - - - - )} - - {(protocol === 'trojan' || protocol === 'shadowsocks') && ( - - - - )} - - {protocol === 'shadowsocks' && ( - <> - - - - - - - - )} + diff --git a/frontend/src/pages/xray/outbounds/outbound-core-fields.tsx b/frontend/src/pages/xray/outbounds/outbound-core-fields.tsx new file mode 100644 index 00000000..c920b9a5 --- /dev/null +++ b/frontend/src/pages/xray/outbounds/outbound-core-fields.tsx @@ -0,0 +1,103 @@ +import { useTranslation } from 'react-i18next'; +import { Form, Input, InputNumber, Select, Switch } from 'antd'; + +import { + ShadowsocksOutboundFormSettingsSchema, + TrojanOutboundFormSettingsSchema, + VlessOutboundFormSettingsSchema, + VmessOutboundFormSettingsSchema, +} from '@/schemas/forms/outbound-form'; +import { SSMethodSchema } from '@/schemas/protocols/shared/shadowsocks'; +import { antdRule } from '@/utils/zodForm'; + +import { SECURITY_OPTIONS, SS_METHOD_OPTIONS } from './outbound-form-constants'; + +export function OutboundCoreProtocolFields({ protocol }: { protocol: string }) { + const { t } = useTranslation(); + return ( + <> + {(protocol === 'vmess' || protocol === 'vless') && ( + + + + )} + {protocol === 'vmess' && ( + + + + + + + + )} + + {(protocol === 'trojan' || protocol === 'shadowsocks') && ( + + + + )} + + {protocol === 'shadowsocks' && ( + <> + + + + + + + + )} + + ); +}