mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-25 03:54:47 +03:00
feat(sub): serve Clash/Mihomo YAML to the Rabbit-Hole client (#7063)
RabbitHole runs a Mihomo core and sends a Rabbit-Hole/ User-Agent. The default matcher only knew clash and mihomo, so with automatic format detection on it received the raw link list. Add rabbit-hole to the default Clash/Mihomo User-Agent regex. A panel with its own regex is unaffected. The client's User-Agent joins the auto-serve test table, and the settings placeholder and subscription docs show the new default.
This commit is contained in:
committed by
GitHub
parent
b39ac90f1e
commit
3a27c1c169
@@ -69,8 +69,8 @@ If an administrator has already assigned `/mihomo/` or `/clash-legacy/` to a
|
||||
different configurable subscription path, that existing path is preserved and
|
||||
the conflicting alias is skipped with a warning at startup.
|
||||
|
||||
Automatic Clash format detection keeps the existing `(?i)(clash|mihomo)`
|
||||
default matcher so existing subscription URLs continue returning YAML.
|
||||
Automatic Clash format detection defaults to the `(?i)(clash|mihomo|rabbit-hole)`
|
||||
matcher, so existing subscription URLs continue returning YAML.
|
||||
It does not distinguish legacy clients from Mihomo-based clients; Clash for
|
||||
Windows users must use `/clash-legacy/<sub-id>` for a compatible profile.
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Shadowsocks 节点,并排除 VLESS、Hysteria2、Reality、XHTTP、HTTPUpgrade
|
||||
如果管理员已经把 `/mihomo/` 或 `/clash-legacy/` 分配给其他可配置订阅路径,
|
||||
系统会保留原有路径,并在启动时记录警告、跳过发生冲突的别名。
|
||||
|
||||
Clash 格式自动识别保留原有的 `(?i)(clash|mihomo)` 默认匹配器,确保已有订阅 URL
|
||||
Clash 格式自动识别默认使用 `(?i)(clash|mihomo|rabbit-hole)` 匹配器,确保已有订阅 URL
|
||||
继续返回 YAML。它不区分旧版客户端与 Mihomo 系客户端;Clash for Windows 用户
|
||||
必须使用 `/clash-legacy/<sub-id>` 获取兼容配置。
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ export default function SubscriptionFormatsTab({
|
||||
>
|
||||
<GoRegexInput
|
||||
value={allSetting.subClashUserAgentRegex}
|
||||
placeholder="(?i)(clash|mihomo)"
|
||||
placeholder="(?i)(clash|mihomo|rabbit-hole)"
|
||||
onChange={(value) => updateSetting({ subClashUserAgentRegex: value })}
|
||||
/>
|
||||
</SettingListItem>
|
||||
|
||||
@@ -192,6 +192,7 @@ func TestShouldAutoServeClash(t *testing.T) {
|
||||
{name: "clash case insensitive", autoDetect: true, clashEnabled: true, userAgent: "CLASH-META/1.0", want: true},
|
||||
{name: "flclash covered by clash", autoDetect: true, clashEnabled: true, userAgent: "FlClash/0.8.91", want: true},
|
||||
{name: "clash for windows preserves existing detection", autoDetect: true, clashEnabled: true, userAgent: "ClashforWindows/0.20.39", want: true},
|
||||
{name: "rabbit-hole runs a mihomo core", autoDetect: true, clashEnabled: true, userAgent: "Rabbit-Hole/iOS (1.5.0-207; language en_US)", want: true},
|
||||
{name: "generic client raw fallback", autoDetect: true, clashEnabled: true, userAgent: "GenericClient/1.10.0"},
|
||||
{name: "other client raw fallback", autoDetect: true, clashEnabled: true, userAgent: "OtherClient/2.2"},
|
||||
{name: "unknown raw fallback", autoDetect: true, clashEnabled: true, userAgent: "CustomClient/1.0"},
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
var xrayTemplateConfig string
|
||||
|
||||
const (
|
||||
DefaultSubClashUserAgentRegex = `(?i)(clash|mihomo)`
|
||||
DefaultSubClashUserAgentRegex = `(?i)(clash|mihomo|rabbit-hole)`
|
||||
DefaultExternalSubUserAgent = "v2rayNG/1.8.5"
|
||||
DefaultSubJsonUserAgentRegex = ``
|
||||
DefaultRemarkTemplate = "{{INBOUND}}-{{EMAIL}}|📊{{TRAFFIC_LEFT}}|⏳{{DAYS_LEFT}}D"
|
||||
|
||||
Reference in New Issue
Block a user