import { useTranslation } from 'react-i18next'; import { Button, Form, Input, InputNumber, Radio, Select, Space, Switch } from 'antd'; import { CloudDownloadOutlined, FileProtectOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons'; import { ALPN_OPTION, DOMAIN_STRATEGY_OPTION, TLS_CIPHER_OPTION, TLS_VERSION_OPTION, USAGE_OPTION, UTLS_FINGERPRINT, } from '@/schemas/primitives'; import { SockoptStreamSettingsSchema } from '@/schemas/protocols/stream/sockopt'; const { TextArea } = Input; interface TlsFormProps { saving: boolean; setCertFromPanel: (certName: number) => void; clearCertFiles: (certName: number) => void; pinFromCert: () => void; pinFromRemote: () => void; getNewEchCert: () => void; clearEchCert: () => void; } export default function TlsForm({ saving, setCertFromPanel, clearCertFiles, pinFromCert, pinFromRemote, getNewEchCert, clearEchCert, }: TlsFormProps) { const { t } = useTranslation(); return ( <> ({ value: v, label: v }))} /> ({ value: fp, label: fp })), ]} /> ({ value: c, label: c, }))} /> {(certFields, { add, remove }) => ( <> {certFields.map((certField, idx) => (
{t('pages.inbounds.certificatePath')} {t('pages.inbounds.certificateContent')} {certFields.length > 1 && ( )} prev.streamSettings?.tlsSettings?.certificates?.[certField.name]?.useFile !== curr.streamSettings?.tlsSettings?.certificates?.[certField.name]?.useFile } > {({ getFieldValue }) => { const useFile = getFieldValue([ 'streamSettings', 'tlsSettings', 'certificates', certField.name, 'useFile', ]); return useFile ? ( <> ) : ( <> typeof v === 'string' ? v.split('\n') : v} getValueProps={(v) => ({ value: Array.isArray(v) ? v.join('\n') : v, })} >