import { useTranslation } from 'react-i18next';
import { Form, Input, InputNumber, Select, Switch, type FormInstance } from 'antd';
import { HeaderMapEditor } from '@/components/form';
const MASQ_PATH = ['streamSettings', 'hysteriaSettings', 'masquerade'];
export default function HysteriaForm({ form }: { form: FormInstance }) {
const { t } = useTranslation();
return (
<>
{() => {
const m = form.getFieldValue(MASQ_PATH);
return (
form.setFieldValue(
MASQ_PATH,
checked
? {
type: '', dir: '', url: '',
rewriteHost: false, insecure: false,
content: '', headers: {}, statusCode: 0,
}
: undefined,
)
}
/>
);
}}
{() => {
const m = form.getFieldValue(MASQ_PATH) as { type?: string } | undefined;
if (!m) return null;
return (
<>
{m.type === 'proxy' && (
<>
>
)}
{m.type === 'file' && (
)}
{m.type === 'string' && (
<>
>
)}
>
);
}}
>
);
}