feat(sub): auto-detect subscription format by User-Agent (Updated) (#5826)

* feat(settings): add subscription format controls

* feat(sub): auto-detect subscription formats

* fix(xray): validate balancer regexes before save

* Revert "fix(xray): validate balancer regexes before save"

This reverts commit 8a208ce71b.

* doc(endpoints): align indent spaces

* doc(settings): improve error message formatting in validateSubUserAgentRegex

- Use NewErrorf with proper formatting instead of NewError with string concatenation
- Add comment explaining the rationale for returning original pattern value
- This preserves the intentional design where empty input is stored as empty
  in the DB and inherited as the runtime default at read time

---------

Co-authored-by: Tomilla <5007859+Tomilla@users.noreply.github.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
Tomi lla
2026-07-14 19:01:40 +08:00
committed by GitHub
parent f2b17397f4
commit 129f50d92a
40 changed files with 1588 additions and 89 deletions
+14 -1
View File
@@ -1191,6 +1191,19 @@
"subJsonEnable": "JSON サブスクリプションのエンドポイントを個別に有効/無効にする。",
"subJsonEnableTitle": "JSON サブスクリプション",
"subClashEnableTitle": "Clash / Mihomo サブスクリプション",
"subFormatsTipTitle": "形式別サブスクリプション設定",
"subFormatsTipDesc": "JSON と Clash / Mihomo の URL パス、リバース URL、クライアント自動検出を個別に設定します。",
"subFormatsTipAction": "サブスクリプション形式を開く",
"subJsonAutoDetect": "Xray JSON クライアントを自動検出",
"subJsonAutoDetectDesc": "有効にすると、標準サブスクリプション URL を要求する既知の互換クライアントへ Xray JSON 設定配列を自動的に返します。その他のクライアントには従来の raw/Base64 応答を返します。JSON サブスクリプションを有効にし、適用のためにパネルを再起動する必要があります。",
"subJsonAlwaysArray": "常に JSON 配列を返す",
"subJsonAlwaysArrayDesc": "プロファイルが 1 件でも、明示的な JSON サブスクリプションを XTLS 標準に従う配列として返します。自動検出された JSON 応答は常に配列です。無効時は従来の単一オブジェクト応答を維持します。",
"subJsonUserAgentRegex": "Xray JSON User-Agent 正規表現",
"subJsonUserAgentRegexDesc": "標準サブスクリプション URL で Xray JSON 形式を自動選択するため、クライアントの User-Agent と照合する Go RE2 正規表現です。既定では空欄のため、対象とするクライアント向けのパターンを設定するまで自動判別は無効のままです。その他のクライアントには従来の raw/Base64 応答を返します。変更後にパネルを再起動してください。",
"subClashAutoDetect": "Clash/Mihomo クライアントを自動検出",
"subClashAutoDetectDesc": "有効にすると、標準サブスクリプション URL を要求する既知の Clash/Mihomo クライアントへ Clash YAML を自動的に返します。ブラウザには引き続きサブスクリプションページを表示し、その他のクライアントには従来の raw/Base64 応答を返します。明示的な JSON および Clash URL も引き続き利用できます。Clash/Mihomo サブスクリプションを有効にし、適用のためにパネルを再起動する必要があります。",
"subClashUserAgentRegex": "Clash/Mihomo User-Agent 正規表現",
"subClashUserAgentRegexDesc": "標準サブスクリプション URL で Clash/Mihomo クライアントを識別するため、クライアントの User-Agent と照合する Go RE2 正規表現です。空欄の場合は既定のパターンを使用します。変更後にパネルを再起動してください。",
"subTitle": "サブスクリプションタイトル",
"subTitleDesc": "VPNクライアントに表示されるタイトル",
"subSupportUrl": "サポートURL",
@@ -1281,7 +1294,7 @@
},
"subFormats": {
"finalMask": "Final Mask",
"finalMaskDesc": "すべての JSON サブスクリプションストリームに注入される xray finalmask マスク(TCP/UDPと QUIC チューニング。新しい xray クライアントが必要です。",
"finalMaskDesc": "生成される各 Xray JSON プロファイルへ Xray finalmask TCP/UDP マスクと QUIC パラメーターを追加します。Xray JSON サブスクリプション対応アプリと新しい Xray コアが必要です。",
"packets": "パケット",
"length": "長さ",
"interval": "間隔",