mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6338] [MERGED] feat(sub): add legacy Clash subscription endpoint #6224
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6224
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6338
Author: @duqigit
Created: 8/27/2026
Status: ✅ Merged
Merged: 9/10/2026
Merged by: @MHSanaei
Base:
main← Head:feature/add-clash-legacy-subscription📝 Commits (5)
e29c271feat(sub): add legacy Clash subscription endpointb0778b0fix(deps): update js-yaml to patched releaseff63793fix(sub): preserve client detection and normalize legacy ciphercc58a26Merge branch 'main' into feature/add-clash-legacy-subscriptiond98ca8frefactor(sub): drop an unreachable guard and make the alias test assert📊 Changes
6 files changed (+520 additions, -16 deletions)
View changed files
📝
docs/content/docs/en/config/subscription.mdx(+26 -5)📝
docs/content/docs/zh/config/subscription.mdx(+22 -5)📝
internal/sub/clash_service.go(+115 -1)📝
internal/sub/clash_service_test.go(+79 -0)📝
internal/sub/controller.go(+62 -5)📝
internal/sub/controller_test.go(+216 -0)📄 Description
Summary
Adds explicit Mihomo and legacy Clash for Windows subscription endpoints while preserving the existing
/clash/<sub-id>behavior and default User-Agent detection. The legacy endpoint filters unsupported proxies and configuration syntax before generating YAML.Why
Legacy Clash for Windows cannot parse modern Mihomo proxy types and options such as VLESS, Hysteria2, Reality, XHTTP, HTTPUpgrade, and Shadowsocks 2022. A subscription containing these entries may fail to import completely.
This change provides:
/mihomo/<sub-id>for the full modern Mihomo profile./clash-legacy/<sub-id>for a conservative Clash for Windows-compatible profile.422response when no compatible proxies are available.(?i)(clash|mihomo)auto-detection remains unchanged; legacy clients use the explicit legacy endpoint.chacha20-poly1305tochacha20-ietf-poly1305instead of dropping a compatible node.Type of change
Areas affected
How was this tested?
The following test suites passed locally:
Regression tests exercise the real subscription HTTP endpoints for Clash/Mihomo User-Agents and both Shadowsocks cipher spellings. Existing custom-regex, incompatible-protocol and legacy-routing tests pass.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.