Skip to content

Commit f453eb2

Browse files
committed
feat: Add deprecation warning for noise and fragment settings across multiple locales
1 parent 8674bc5 commit f453eb2

6 files changed

Lines changed: 45 additions & 2 deletions

File tree

dashboard/public/statics/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,7 @@
14311431
"randRange": "Rand Range",
14321432
"randRangePlaceholder": "Enter rand range (e.g. 10-20)"
14331433
},
1434+
"fragmentNoiseDeprecated": "`noise` and `fragment` are being removed in newer versions — use `finalMask` instead.",
14341435
"finalmask": {
14351436
"title": "FinalMask Settings",
14361437
"enable": "Enable FinalMask",
@@ -2797,6 +2798,7 @@
27972798
"noiseDelay": "Delay (ms)",
27982799
"addNoise": "Add noise",
27992800
"removeNoise": "Remove noise",
2801+
"fragmentNoiseDeprecated": "`noise` and `fragment` are being removed in newer versions — use `finalMask` instead.",
28002802
"finalRulesTitle": "Final rules",
28012803
"finalRulesHint": "Applied at Freedom’s final outbound stage. IP: one CIDR or geoip tag per line.",
28022804
"addRule": "Add rule",

dashboard/public/statics/locales/fa.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,7 @@
12661266
"randRange": "محدوده تصادفی",
12671267
"randRangePlaceholder": "محدوده تصادفی را وارد کنید (مثلاً 10-20)"
12681268
},
1269+
"fragmentNoiseDeprecated": "`noise` و `fragment` در نسخه‌های جدیدتر حذف می‌شوند — به‌جای آن از `finalMask` استفاده کنید.",
12691270
"finalmask": {
12701271
"title": "تنظیمات FinalMask",
12711272
"enable": "فعال‌سازی FinalMask",
@@ -2680,6 +2681,7 @@
26802681
"noiseDelay": "تأخیر (میلی‌ثانیه)",
26812682
"addNoise": "افزودن نویز",
26822683
"removeNoise": "حذف نویز",
2684+
"fragmentNoiseDeprecated": "`noise` و `fragment` در نسخه‌های جدیدتر حذف می‌شوند — به‌جای آن از `finalMask` استفاده کنید.",
26832685
"finalRulesTitle": "قوانین نهایی",
26842686
"finalRulesHint": "در مرحله نهایی Freedom اعمال می‌شود. IP: هر خط یک CIDR یا برچسب geoip.",
26852687
"addRule": "افزودن قانون",

dashboard/public/statics/locales/ru.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,7 @@
16491649
"randRange": "Случайный диапазон",
16501650
"randRangePlaceholder": "Введите случайный диапазон (например 10-20)"
16511651
},
1652+
"fragmentNoiseDeprecated": "`noise` и `fragment` удаляются в новых версиях — используйте `finalMask`.",
16521653
"finalmask": {
16531654
"title": "Настройки FinalMask",
16541655
"enable": "Включить FinalMask",
@@ -2655,6 +2656,7 @@
26552656
"noiseDelay": "Задержка (мс)",
26562657
"addNoise": "Добавить шум",
26572658
"removeNoise": "Удалить шум",
2659+
"fragmentNoiseDeprecated": "`noise` и `fragment` удаляются в новых версиях — используйте `finalMask`.",
26582660
"finalRulesTitle": "Финальные правила",
26592661
"finalRulesHint": "Применяются на финальной стадии Freedom. IP: по одному CIDR или geoip на строку.",
26602662
"addRule": "Добавить правило",

dashboard/public/statics/locales/zh.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@
14041404
"randRange": "随机范围",
14051405
"randRangePlaceholder": "输入随机范围(例如 10-20)"
14061406
},
1407+
"fragmentNoiseDeprecated": "`noise` 和 `fragment` 将在新版本中移除 — 请改用 `finalMask`。",
14071408
"finalmask": {
14081409
"title": "FinalMask 设置",
14091410
"enable": "启用 FinalMask",
@@ -2724,6 +2725,7 @@
27242725
"noiseDelay": "延迟(毫秒)",
27252726
"addNoise": "添加噪声",
27262727
"removeNoise": "删除噪声",
2728+
"fragmentNoiseDeprecated": "`noise` 和 `fragment` 将在新版本中移除 — 请改用 `finalMask`。",
27272729
"finalRulesTitle": "最终规则 (finalRules)",
27282730
"finalRulesHint": "在 Freedom 最终出站阶段匹配。IP:每行一个 CIDR 或 geoip 标签。",
27292731
"addRule": "添加规则",

dashboard/src/features/core-editor/components/xray/outbound-special-protocol-settings.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'
2+
import { Alert, AlertDescription } from '@/components/ui/alert'
23
import { Button } from '@/components/ui/button'
34
import { StringArrayPopoverInput } from '@/components/common/string-array-popover-input'
45
import { Input } from '@/components/ui/input'
@@ -10,7 +11,7 @@ import { normalizeSettingsFromEditor } from '@/features/core-editor/kit/outbound
1011
import { useCoreEditorStore } from '@/features/core-editor/state/core-editor-store'
1112
import type { Outbound } from '@pasarguard/xray-config-kit'
1213
import type { TFunction } from 'i18next'
13-
import { Globe2, ListOrdered, Plus, Radio, Scissors, Trash2 } from 'lucide-react'
14+
import { AlertTriangle, Globe2, ListOrdered, Plus, Radio, Scissors, Trash2 } from 'lucide-react'
1415
import { useEffect, useMemo, useState } from 'react'
1516

1617
type PatchOutbound = (next: Outbound) => void
@@ -186,6 +187,10 @@ function OutboundFreedomSettings({ ob, patchOutbound, t }: { ob: Outbound; patch
186187
commitFreedom(next)
187188
}
188189

190+
const hasFragmentPopulated = Boolean(fragPackets.trim() || fragLength.trim() || fragInterval.trim())
191+
const hasNoisePopulated = noiseRows.some(row => row.packet.trim() || row.delay.trim())
192+
const showFragmentNoiseDeprecatedWarning = hasFragmentPopulated || hasNoisePopulated
193+
189194
return (
190195
<div className="flex flex-col gap-4">
191196
<p className="text-muted-foreground text-xs">
@@ -194,6 +199,17 @@ function OutboundFreedomSettings({ ob, patchOutbound, t }: { ob: Outbound; patch
194199
})}
195200
</p>
196201

202+
{showFragmentNoiseDeprecatedWarning && (
203+
<Alert className="border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-100">
204+
<AlertTriangle className="h-4 w-4 text-amber-600 dark:text-amber-400" />
205+
<AlertDescription className="text-xs sm:text-sm">
206+
{t('coreEditor.outbound.freedom.fragmentNoiseDeprecated', {
207+
defaultValue: '`noise` and `fragment` are being removed in newer versions — use `finalMask` instead.',
208+
})}
209+
</AlertDescription>
210+
</Alert>
211+
)}
212+
197213
<div className="grid w-full gap-4 sm:grid-cols-2">
198214
<div className="flex w-full min-w-0 flex-col gap-2">
199215
<Label className="text-xs font-medium">{t('coreEditor.outbound.freedom.domainStrategy', { defaultValue: 'Domain strategy' })}</Label>

dashboard/src/features/hosts/dialogs/host-modal.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'
2+
import { Alert, AlertDescription } from '@/components/ui/alert'
23
import { Badge } from '@/components/ui/badge'
34
import { Button } from '@/components/ui/button'
45
import { StringArrayPopoverInput } from '@/components/common/string-array-popover-input'
@@ -17,7 +18,7 @@ import { cn } from '@/lib/utils'
1718
import { ClientTemplateType, UserStatus, getHosts, useGetClientTemplatesSimple } from '@/service/api'
1819
import { queryClient } from '@/utils/query-client'
1920
import { useQuery } from '@tanstack/react-query'
20-
import { Cable, ChevronsLeftRightEllipsis, Copy, Pencil, GlobeLock, Info, Loader2, Lock, Network, Plus, Route, Trash2, X, ListTodo } from 'lucide-react'
21+
import { AlertTriangle, Cable, ChevronsLeftRightEllipsis, Copy, Pencil, GlobeLock, Info, Loader2, Lock, Network, Plus, Route, Trash2, X, ListTodo } from 'lucide-react'
2122
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
2223
import { UseFormReturn } from 'react-hook-form'
2324
import { useTranslation } from 'react-i18next'
@@ -324,9 +325,17 @@ const HostModal: React.FC<HostModalProps> = ({ isDialogOpen, onOpenChange, onSub
324325
const [_isSubmitting, setIsSubmitting] = useState(false)
325326
const selectedInboundTag = form.watch('inbound_tag')
326327
const selectedNoiseSettings = form.watch('noise_settings.xray')
328+
const selectedFragmentSettings = form.watch('fragment_settings.xray')
327329
const xPaddingObfsEnabled = form.watch('transport_settings.xhttp_settings.x_padding_obfs_mode') === true
328330
const infoPopoverSide = isMobile ? 'bottom' : dir === 'rtl' ? 'left' : 'right'
329331
const infoPopoverAlign = isMobile ? 'center' : 'start'
332+
const hasFragmentPopulated = Boolean(
333+
String(selectedFragmentSettings?.packets ?? '').trim() || String(selectedFragmentSettings?.length ?? '').trim() || String(selectedFragmentSettings?.interval ?? '').trim(),
334+
)
335+
const hasNoisePopulated = (selectedNoiseSettings || []).some(
336+
noise => noise && (String(noise.packet ?? '').trim() || String(noise.delay ?? '').trim() || String(noise.rand_range ?? '').trim()),
337+
)
338+
const showFragmentNoiseDeprecatedWarning = hasFragmentPopulated || hasNoisePopulated
330339

331340
const renderCamouflageSection = () => {
332341
return (
@@ -345,6 +354,16 @@ const HostModal: React.FC<HostModalProps> = ({ isDialogOpen, onOpenChange, onSub
345354
</TabsList>
346355
<TabsContent dir={dir} value="xray">
347356
<div className="space-y-6">
357+
{showFragmentNoiseDeprecatedWarning && (
358+
<Alert className="border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-100">
359+
<AlertTriangle className="h-4 w-4 text-amber-600 dark:text-amber-400" />
360+
<AlertDescription className="text-xs sm:text-sm">
361+
{t('hostsDialog.fragmentNoiseDeprecated', {
362+
defaultValue: '`noise` and `fragment` are being removed in newer versions — use `finalMask` instead.',
363+
})}
364+
</AlertDescription>
365+
</Alert>
366+
)}
348367
{/* Fragment Settings */}
349368
<div className="space-y-4">
350369
<div className="flex items-center justify-between">

0 commit comments

Comments
 (0)