fix(xray): keep XDRIVE storage and Vision flow within what xray-core runs

xray-core opens an XDRIVE stream's storage only when the inbound starts
listening, so a Google Drive inbound saved with the form's defaults (no
folder, no secrets), a local one without a folder, or a template one
whose template xray cannot use stopped xray and every other inbound with
it. validateXDriveStorage applies the core's storage rules at save, on
inbound add/update and on the xray template's inbounds and outbounds:
the service must be local, Google Drive or template; local and Google
Drive need a remoteFolder; Google Drive needs its three non-empty
secrets; a template must pass newTemplateStorage's checks (put, get,
list and delete urls, and a list namesRegex with one capture group).

A VLESS client kept its xtls-rprx-vision flow when its inbound moved to
a transport that cannot carry it, and GetXrayConfig only honoured
DisableFlow, so the server demanded Vision there and refused every
client. GetXrayConfig and the outbound form now apply the Vision gate,
and that gate now follows the core in the backend, the subscription
service and the frontend: TLS/REALITY on raw TCP, or VLESS encryption on
any transport (xray runs Vision inside encryption.CommonConn whatever
the transport, not only on XHTTP). The outbound modal passes the VLESS
encryption into the gate and gates Mux on the effective flow.
This commit is contained in:
MHSanaei
2026-10-12 00:49:11 +02:00
parent 8fe7be943f
commit c5e1e54c75
22 changed files with 439 additions and 72 deletions
@@ -104,7 +104,11 @@ export default function OutboundFormModal({
'') as string;
const security = (useWatch({ control: methods.control, name: 'streamSettings.security' }) ??
'none') as string;
const flow = (useWatch({ control: methods.control, name: 'settings.flow' }) ?? '') as string;
const storedFlow = (useWatch({ control: methods.control, name: 'settings.flow' }) ??
'') as string;
const encryption = useWatch({ control: methods.control, name: 'settings.encryption' }) as
| string
| undefined;
const reverseTag = useWatch({ control: methods.control, name: 'settings.reverseTag' });
const wgSecretKey = useWatch({ control: methods.control, name: 'settings.secretKey' }) as
| string
@@ -113,7 +117,12 @@ export default function OutboundFormModal({
const streamAllowed = canEnableStream({ protocol });
const tlsAllowed = canEnableOutboundTls({ protocol, streamSettings: { network, security } });
const realityAllowed = canEnableReality({ protocol, streamSettings: { network, security } });
const tlsFlowAllowed = canEnableTlsFlow({ protocol, streamSettings: { network, security } });
const tlsFlowAllowed = canEnableTlsFlow({
protocol,
settings: { encryption },
streamSettings: { network, security },
});
const flow = tlsFlowAllowed ? storedFlow : '';
/*
* Parse a share link (vmess:// / vless:// / trojan:// / ss:// /
@@ -527,7 +536,7 @@ export default function OutboundFormModal({
{/* Vision seed knobs only meaningful for the exact
xtls-rprx-vision flow, on TCP+(tls|reality). */}
{tlsFlowAllowed && flow === 'xtls-rprx-vision' && (
{flow === 'xtls-rprx-vision' && (
<>
<FormField
label={t('pages.xray.outboundForm.visionTestpre')}
@@ -590,7 +599,7 @@ export default function OutboundFormModal({
)}
/>
<MuxForm protocol={protocol} network={network} />
<MuxForm protocol={protocol} network={network} flow={flow} />
</>
),
},
@@ -9,12 +9,12 @@ import { isMuxAllowed } from '../outbound-form-helpers';
interface MuxFormProps {
protocol: string;
network: string;
flow?: string;
}
export default function MuxForm({ protocol, network }: MuxFormProps) {
export default function MuxForm({ protocol, network, flow = '' }: MuxFormProps) {
const { t } = useTranslation();
const { control } = useFormContext();
const flow = (useWatch({ control, name: 'settings.flow' }) ?? '') as string;
const muxEnabled = !!useWatch({ control, name: 'mux.enabled' });
if (!isMuxAllowed(protocol, flow, network)) return null;
return (