mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-23 03:17:14 +00:00
feat(web): vless encryption new modes (#5517)
* feat(web): add vless encryption new modes * feat(web): add translations for vless encryption modes * feat(translation): bring "vlessAuthX25519" and "vlessAuthMlkem768" to general form
This commit is contained in:
@@ -285,8 +285,12 @@ export default function InboundFormModal({
|
||||
) => {
|
||||
if (block?.id === authId) return true;
|
||||
const label = (block?.label || '').toLowerCase().replace(/[-_\s]/g, '');
|
||||
if (authId === 'mlkem768') return label.includes('mlkem768');
|
||||
if (authId === 'x25519') return label.includes('x25519');
|
||||
if (authId === 'mlkem768') return label.includes('mlkem768') && !label.includes('xorpub') && !label.includes('random');
|
||||
if (authId === 'x25519') return label.includes('x25519') && !label.includes('xorpub') && !label.includes('random');
|
||||
if (authId === 'mlkem768_xorpub') return label.includes('mlkem768') && label.includes('xorpub');
|
||||
if (authId === 'mlkem768_random') return label.includes('mlkem768') && label.includes('random');
|
||||
if (authId === 'x25519_xorpub') return label.includes('x25519') && label.includes('xorpub');
|
||||
if (authId === 'x25519_random') return label.includes('x25519') && label.includes('random');
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -319,7 +323,19 @@ export default function InboundFormModal({
|
||||
const parts = enc.split('.').filter(Boolean);
|
||||
const authKey = parts[parts.length - 1] || '';
|
||||
if (!authKey) return t('pages.inbounds.vlessAuthCustom');
|
||||
return authKey.length > 300
|
||||
const mode = parts[1] || 'native';
|
||||
const keyType = authKey.length > 300 ? 'mlkem768' : 'x25519';
|
||||
if (mode === 'xorpub') {
|
||||
return keyType === 'mlkem768'
|
||||
? t('pages.inbounds.vlessAuthMlkem768Xorpub')
|
||||
: t('pages.inbounds.vlessAuthX25519Xorpub');
|
||||
}
|
||||
if (mode === 'random') {
|
||||
return keyType === 'mlkem768'
|
||||
? t('pages.inbounds.vlessAuthMlkem768Random')
|
||||
: t('pages.inbounds.vlessAuthX25519Random');
|
||||
}
|
||||
return keyType === 'mlkem768'
|
||||
? t('pages.inbounds.vlessAuthMlkem768')
|
||||
: t('pages.inbounds.vlessAuthX25519');
|
||||
})();
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Form, Input, InputNumber, Space, Typography } from 'antd';
|
||||
import { Button, Form, Input, InputNumber, Select, Space, Typography } from 'antd';
|
||||
|
||||
type VlessAuthKind =
|
||||
| 'x25519'
|
||||
| 'x25519_xorpub'
|
||||
| 'x25519_random'
|
||||
| 'mlkem768'
|
||||
| 'mlkem768_xorpub'
|
||||
| 'mlkem768_random';
|
||||
|
||||
interface VlessFieldsProps {
|
||||
saving: boolean;
|
||||
selectedVlessAuth: string;
|
||||
network: string;
|
||||
security: string;
|
||||
getNewVlessEnc: (kind: 'x25519' | 'mlkem768') => void;
|
||||
getNewVlessEnc: (kind: VlessAuthKind) => void;
|
||||
clearVlessEnc: () => void;
|
||||
}
|
||||
|
||||
@@ -19,6 +28,17 @@ export default function VlessFields({
|
||||
clearVlessEnc,
|
||||
}: VlessFieldsProps) {
|
||||
const { t } = useTranslation();
|
||||
const [authKind, setAuthKind] = useState<VlessAuthKind>('x25519');
|
||||
|
||||
const authOptions = [
|
||||
{ value: 'x25519', label: t('pages.inbounds.vlessAuthX25519') },
|
||||
{ value: 'x25519_xorpub', label: t('pages.inbounds.vlessAuthX25519Xorpub') },
|
||||
{ value: 'x25519_random', label: t('pages.inbounds.vlessAuthX25519Random') },
|
||||
{ value: 'mlkem768', label: t('pages.inbounds.vlessAuthMlkem768') },
|
||||
{ value: 'mlkem768_xorpub', label: t('pages.inbounds.vlessAuthMlkem768Xorpub') },
|
||||
{ value: 'mlkem768_random', label: t('pages.inbounds.vlessAuthMlkem768Random') },
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form.Item name={['settings', 'decryption']} label={t('pages.inbounds.decryption')}>
|
||||
@@ -27,13 +47,16 @@ export default function VlessFields({
|
||||
<Form.Item name={['settings', 'encryption']} label={t('pages.inbounds.encryption')}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label=" ">
|
||||
<Form.Item label={t('pages.inbounds.vlessAuthGenerate')}>
|
||||
<Space size={8} wrap>
|
||||
<Button type="primary" loading={saving} onClick={() => getNewVlessEnc('x25519')}>
|
||||
{t('pages.inbounds.vlessAuthX25519')}
|
||||
</Button>
|
||||
<Button type="primary" loading={saving} onClick={() => getNewVlessEnc('mlkem768')}>
|
||||
{t('pages.inbounds.vlessAuthMlkem768')}
|
||||
<Select
|
||||
value={authKind}
|
||||
onChange={(v) => setAuthKind(v)}
|
||||
options={authOptions}
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
<Button type="primary" loading={saving} onClick={() => getNewVlessEnc(authKind)}>
|
||||
{t('pages.inbounds.vlessAuthGenerateButton')}
|
||||
</Button>
|
||||
<Button danger onClick={clearVlessEnc}>{t('clear')}</Button>
|
||||
</Space>
|
||||
|
||||
Reference in New Issue
Block a user