fix(xray): adopt freedom finalRules delay and logLevel

xray-core 26.11.9 (#7329) renamed a final rule's blockDelay to delay, added
logLevel, and now refuses either on a rule whose action is not block. A
stored template with a blockDelay on an allow rule therefore stops the core
at startup after the upgrade.

A one-time seeder strips delay, blockDelay and logLevel from non-block rules
of the template's freedom outbounds and moves blockDelay to delay on block
rules. The outbound form reads both spellings (blockDelay wins, as in the
core), writes delay, gains a log level control on block rules and emits
neither key on an allow rule.
This commit is contained in:
Sanaei
2026-11-12 19:10:18 +01:00
parent 192dc93c16
commit a748f799c7
7 changed files with 263 additions and 16 deletions
@@ -6,6 +6,7 @@ import { useFieldArray, useFormContext, useWatch } from 'react-hook-form';
import { selectTagRender } from '@/components/form';
import { FormField } from '@/components/form/rhf';
import { LOG_LEVELS } from '@/pages/xray/basics/constants';
import { activateOnKey } from '@/utils/a11y';
import { OutboundDomainStrategies } from '@/schemas/primitives';
@@ -220,7 +221,14 @@ export default function FreedomFields() {
icon={<PlusOutlined aria-hidden />}
aria-label={t('add')}
onClick={() =>
appendFinalRule({ action: 'allow', network: '', port: '', ip: [], blockDelay: '' })
appendFinalRule({
action: 'allow',
network: '',
port: '',
ip: [],
delay: '',
logLevel: '',
})
}
/>
<span className="ml-8" style={{ opacity: 0.6 }}>
@@ -281,12 +289,24 @@ export default function FreedomFields() {
/>
</FormField>
{finalRulesValues[index]?.action === 'block' && (
<FormField
label={t('pages.xray.outboundForm.blockDelay')}
name={['settings', 'finalRules', index, 'blockDelay']}
>
<Input placeholder="optional: 5000-10000" />
</FormField>
<>
<FormField
label={t('pages.xray.outboundForm.blockDelay')}
name={['settings', 'finalRules', index, 'delay']}
>
<Input placeholder="optional: 5000-10000" />
</FormField>
<FormField
label={t('pages.xray.logLevel')}
name={['settings', 'finalRules', index, 'logLevel']}
>
<Select
allowClear
placeholder="info"
options={LOG_LEVELS.map((v) => ({ value: v, label: v }))}
/>
</FormField>
</>
)}
</div>
))}