mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-21 06:02:16 +03:00
The inbound TLS form offered cipherSuites as a closed single-choice list, but xray reads the value as a colon-separated list and accepts any name Go knows, so several suites or one missing from the list could not be set. Both the inbound and the new host field now use a tag picker that keeps the stored value as the colon-joined string xray expects; old single values open unchanged. A host's cipher suites replace the inbound's in the JSON subscription stream, and a blank field inherits them. Share links and Clash carry no cipher suite parameter, so their output is unchanged.
40 lines
1014 B
TypeScript
40 lines
1014 B
TypeScript
import { Select } from 'antd';
|
|
import type { SelectProps } from 'antd';
|
|
|
|
import { TLS_CIPHER_OPTION } from '@/schemas/primitives';
|
|
|
|
const CIPHER_SUITE_OPTIONS = Object.values(TLS_CIPHER_OPTION).map((v) => ({ value: v, label: v }));
|
|
|
|
type CipherSuitesSelectProps = Omit<
|
|
SelectProps<string[]>,
|
|
'value' | 'onChange' | 'mode' | 'options'
|
|
> & {
|
|
// Injected by FormField:
|
|
value?: string;
|
|
onChange?: (value: string) => void;
|
|
};
|
|
|
|
// xray splits cipherSuites on ':' into a list, so the picker edits tags while
|
|
// the stored value stays the single colon-joined string xray reads.
|
|
export default function CipherSuitesSelect({
|
|
value = '',
|
|
onChange,
|
|
...rest
|
|
}: CipherSuitesSelectProps) {
|
|
const suites = value
|
|
.split(':')
|
|
.map((s) => s.trim())
|
|
.filter(Boolean);
|
|
return (
|
|
<Select
|
|
allowClear
|
|
tokenSeparators={[':', ',']}
|
|
{...rest}
|
|
mode="tags"
|
|
options={CIPHER_SUITE_OPTIONS}
|
|
value={suites}
|
|
onChange={(next) => onChange?.(next.join(':'))}
|
|
/>
|
|
);
|
|
}
|