feat(settings): add setting for Reality scan candidates (#6471)

* feat(settings): allow customizing Reality scan candidate list

Persist a realityScanCandidates panel setting (defaulting to the previous
hardcoded list), expose it in General Settings with i18n, and have the
Find Targets scanner use it when the search box is empty.

Fixes #5847

* style(frontend): oxfmt realityScanCandidates in setting.ts

* Fix locale JSON syntax

This change removes the malformed duplicate key and missing comma in the Android per-app proxy translations across the bundled locale files. The JSON now parses correctly while preserving the translated labels for each language.

* docs(i18n): update Happ translations

Localize the remaining Happ subscription settings strings across the translation files and refine the English copy. This aligns the labels and descriptions with the current Happ behavior for notifications, TUN options, HWID enforcement, routing presets, and per-app proxy settings.

* refactor(reality): drop test-only scaffolding from the candidate setting

TestDefaultRealityScanCandidatesCSV compared the CSV against its own
initializer and a defaultValueMap lookup, and
TestRealityScanCandidateTokensFallsBackWithoutDB drove a no-database
state no production caller reaches (the only caller is the
scanRealityTargets handler, served after InitDB). The
s != nil && GetDB() != nil guard existed only for that second test.
None of them could fail except in lockstep with the code they restate.

* docs(api): describe the setting-driven scanRealityTargets fallback

An empty targets value now probes the realityScanCandidates setting,
but the endpoint summary, parameter description and handler comment
still promised the built-in seed list, so API consumers were told the
wrong target set. Regenerated openapi.json and synced the docs copy,
which also lacked the new AllSetting field in the settings reference.

---------

Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
mrchatam
2026-09-13 16:18:28 +03:30
committed by GitHub
parent bf7ce2daaa
commit 768bbd2a29
29 changed files with 857 additions and 735 deletions
+15 -13
View File
@@ -1253,6 +1253,8 @@
"noisesSett": "Noises 设置",
"trustedProxyCidrs": "可信代理 CIDR",
"trustedProxyCidrsDesc": "允许设置转发 host、proto 和客户端 IP 标头的 IP/CIDR(逗号分隔)。",
"realityScanCandidates": "Reality 扫描候选列表",
"realityScanCandidatesDesc": "逗号分隔的 host:port 目标(或 CIDR),作为“查找目标”在搜索框为空时的默认列表。可按常用目标自定义。",
"ldap": {
"enable": "启用 LDAP 同步",
"host": "LDAP host",
@@ -1513,35 +1515,35 @@
"subHappSubInfoButtonLink": "横幅按钮链接",
"subHappSubInfoButtonLinkDesc": "点击横幅按钮时打开的目标网址或 DeepLink。",
"subHappSubExpire": "订阅到期提醒横幅",
"subHappSubExpireDesc": "当用户订阅即将到期或已过期时在 Happ 中显示续费提示横幅。",
"subHappSubExpireDesc": "当用户流量用尽或订阅已过期时在 Happ 中显示订阅过期横幅。",
"subHappSubExpireButtonLink": "续费链接",
"subHappSubExpireButtonLinkDesc": "到期横幅中点击「续费」按钮时跳转的支付或购买页面。",
"subHappNotificationExpire": "订阅到期推送提醒",
"subHappNotificationExpireDesc": "在订阅到期前 3 天向用户发送每日一次的客户端到期提醒。",
"subHappNoLimit": "解除规则数量限制 (No Limit)",
"subHappNoLimitDesc": "提升内核内存上限,允许应用超出移动端默认数量的复杂路由规则。",
"subHappNotificationExpireDesc": "让 Happ 在订阅到期前 3 天提醒用户。",
"subHappNoLimit": "No-Limit 模式",
"subHappNoLimitDesc": "提高 Happ 中 xray-core 的内存上限,以提升稳定性与性能(测试版)。",
"subHappAlwaysHwid": "强制绑定硬件标识 (HWID)",
"subHappAlwaysHwidDesc": "禁止客户端关闭硬件标识符上报,强化多设备防盗刷安全。",
"subHappAlwaysHwidDesc": "禁止用户在 Happ 设置中关闭 HWID 上报。",
"subHappTunMode": "TUN 运行模式",
"subHappTunModeDesc": "TUN 网络接口栈:system (系统网络栈) 或 gvisor (用户态协议栈)。",
"subHappTunModeDesc": "桌面端 TUN 使用的网络栈:system (系统网络栈) 或 gVisor (用户态协议栈)。",
"subHappTunType": "TUN 隧道内核 (TUN Type)",
"subHappTunTypeDesc": "隧道实现引擎singbox、tun2proxy、default (Happ 原生) 或 xray。",
"subHappTunTypeDesc": "桌面端 TUN 连接使用的内核sing-box、tun2proxy、默认 (Happ TUN) 或 Xray。",
"subHappExcludeRoutes": "排除直连网段 (CIDR)",
"subHappExcludeRoutesDesc": "逗号分隔的 IP/CIDR 地址段,此网段流量不 VPN 隧道直连。",
"subHappExcludeRoutesDesc": "逗号分隔的 IP/CIDR 网段(例如 192.168.0.0/16, 10.0.0.0/8),这些网段流量不经过 VPN 隧道。",
"subHappExcludeApns": "排除苹果推送服务 (APNs)",
"subHappExcludeApnsDesc": "让 Apple APNs 流量直连,保障 iOS 设备在后台稳定接收推送通知。",
"subHappColorProfile": "客户端外观主题",
"subHappColorProfileDesc": "Happ 界面配色主题:violet、turquoise、cyberpunk 或自定义 JSON 调色板。",
"subHappColorProfileDesc": "以 JSON 字符串自定义 iOS 配色主题,或填写 resetcolors 恢复默认颜色。",
"subHappPingType": "延迟测速协议",
"subHappPingTypeDesc": "节点测速协议:via Proxy (GET)、via Proxy (HEAD)、TCP 握手或 ICMP。",
"subHappPingTypeDesc": "Happ 测量节点延迟的方式:经由代理 (GET 或 HEAD)、TCP 或 ICMP。",
"subHappAutoConnect": "启动时自动连接",
"subHappAutoConnectDesc": "Happ 客户端打开时自动连接代理节点。",
"subHappAutoConnectType": "自动连接策略",
"subHappAutoConnectTypeDesc": "连接目标选择:lowestdelay (最低延迟)、lastused (上次使用) 或 random。",
"subHappAutoConnectTypeDesc": "自动连接选择的节点:最低延迟、上次使用或随机节点。",
"subHappPerAppMode": "Android 分应用代理",
"subHappPerAppModeDesc": "分应用代理模式:off (关闭)、on (仅代理选定应用) 或 bypass (绕过选定应用)。",
"subHappPerAppModeDesc": "Android 分应用路由:关闭、开启 (仅代理列表中的应用) 或绕过 (排除列表中的应用)。",
"subHappPerAppList": "Android 应用包名列表",
"subHappPerAppListDesc": "以逗号分隔的应用包名(例如 org.telegram.messenger, com.google.android.youtube)。",
"subHappPerAppListDesc": "以逗号分隔的 Android 应用包名,用于包含或排除(例如 org.telegram.messenger)。",
"subHappPresetIran": "伊朗直连规则 (Iran Bypass)",
"subHappPresetChina": "大陆直连规则 (China Direct)",
"subHappPresetAdblock": "广告拦截规则 (AdBlock)",