3x-ui/docs/Tasktracking/2026-04-24-clash-yaml-subscription.md
root 11cdb07e89 feat: add Clash YAML subscription endpoint with template injection
Add /clash/:subid endpoint that returns complete Clash YAML config.
User provides full template (DNS, routing, proxy-groups, rules) in
settings, panel generates proxies from inbound/client data and injects
via proxies: [] placeholder replacement.

- New SubClashService reads template, generates vmess/vless/trojan/ss
  proxy entries with transport (ws/grpc/h2/tcp/httpupgrade), TLS, and
  Reality support
- Settings: subClashEnable, subClashPath, subClashURI, subClashTemplate
- UI: Clash settings tab, QR code on subpage, Desktop dropdown with
  clash-verge:// deep link preferring Clash URL
- Version bump to v1.5.2-beta
2026-04-24 11:25:10 +08:00

1.7 KiB

Clash YAML Subscription Endpoint

Date: 2026-04-24

Changes

New Files

  • sub/subClashService.go — Clash YAML subscription service: reads user template, generates proxies from inbound/client data, injects via proxies: [] placeholder replacement
  • web/html/settings/panel/subscription/clash.html — Clash subscription settings panel (path, URI, template textarea)

Backend

  • web/entity/entity.go — Added SubClashEnable, SubClashPath, SubClashURI, SubClashTemplate to AllSetting
  • web/service/setting.go — Added defaults, getter functions, GetSubSettings() auto-build URI for Clash
  • sub/sub.go — Read Clash settings, pass to controller
  • sub/subController.go — Added Clash fields, route GET /clash/:subid, clashSubs() handler returning text/yaml

Frontend

  • web/html/settings.html — Added Clash settings tab (key 6)
  • web/html/settings/panel/subscription/general.html — Added Clash enable toggle
  • web/html/settings/panel/subscription/subpage.html — Added Clash QR code, Desktop dropdown with Clash Verge deep link
  • web/assets/js/subscription.js — Added subClashUrl, clashvergeUrl prefers Clash URL
  • web/assets/js/model/setting.js — Added Clash defaults
  • web/html/inbounds.html — Added subClashEnable, subClashURI to subscription settings
  • web/html/modals/qrcode_modal.html — Added Clash QR code + genSubClashLink()
  • web/html/modals/inbound_info_modal.html — Added Clash subscription link
  • web/translation/translate.en_US.toml — Added subClashEnable i18n
  • web/translation/translate.zh_CN.toml — Added subClashEnable i18n

Version

  • config/version — Bumped to v1.5.2-beta