feat(sub): add Happ client integration, routing presets, and app management (#6434)

* feat(sub): add Happ client integration, routing presets, and app management

Implement comprehensive Happ proxy client integration according to official developer specifications.

- Fix header emission on disabled routing and hidden settings to send explicit '0' headers rather than omitting, allowing Happ clients to reset cached settings.
- Add support for 'happ://routing/off' deeplink in routing validation.
- Preserve '?serverDescription=' query parameters in link fragments without escaping to support Happ server subtitles across VMess, VLESS, Trojan and SS.
- Add Happ application management headers: ProviderID, New-Url, Fallback-Url, Sub-Info banners, Sub-Expire notifications, No-Limit mode, hardware ID enforcement, TUN modes/types, route exclusions, APNS exclusions, and per-app proxy settings.
- Add curated routing presets (Iran Bypass, China Direct, AdBlock, Global) and interactive visual rule generator in frontend settings.
- Synchronize all 13 translation locales with native Persian, Russian, and Chinese translations.

* fix(sub): keep Happ header overrides behind the auto-detect opt-in

The Routing-Enable/Hide-Settings off values were emitted on the
User-Agent alone, so every panel that upgraded would push
"Routing-Enable: 0" — documented by happ.su as disabling routing
globally — to every Happ client without the operator enabling anything.
They now ride subHappAutoDetect like every other Happ header.

Two further mismatches against the vendor spec:

- serverDescription was written as a key of the VMess base64 JSON
  object. happ.su documents it as a "#Title?serverDescription=<base64>"
  link parameter or a JSON "meta" entry, so the caption never reached
  Happ while every other VMess consumer received an unknown key.
  Dropped rather than moved: emitting the documented form is unsafe
  here because our own parser base64-decodes the whole VMess body
  (internal/util/link/outbound.go).

- The TUN Mode dropdown stored the literal "default", forwarded as
  "Tun-Mode: default", where happ.su documents system|gvisor only. It
  now stores the unset value so no header is sent. TUN Type "default"
  is a documented value and is unchanged.

Each fix carries a test that fails without it.
This commit is contained in:
Pejman Yousefi
2026-09-10 17:16:12 +03:30
committed by GitHub
parent d5ab84e8d5
commit 1456658028
35 changed files with 3460 additions and 51 deletions
+93 -1
View File
@@ -1466,7 +1466,99 @@
"subExpiredTemplate": "Plantilla de expirado",
"subExpiredTemplateDesc": "Plantilla para el nodo ficticio cuando la suscripción ha expirado.",
"subTrafficDepletedTemplate": "Plantilla de tráfico agotado",
"subTrafficDepletedTemplateDesc": "Plantilla para el nodo ficticio cuando el límite de tráfico se ha agotado."
"subTrafficDepletedTemplateDesc": "Plantilla para el nodo ficticio cuando el límite de tráfico se ha agotado.",
"subHappAutoDetect": "Happ Header Auto-Detection",
"subHappAutoDetectDesc": "Automatically inject Happ routing and headers when client User-Agent indicates Happ.",
"subHappProviderId": "Provider ID",
"subHappProviderIdDesc": "Unique provider identifier for Happ client management, remote configuration binding, and migration.",
"subHappNewUrl": "New Subscription URL",
"subHappNewUrlDesc": "Target URL for automatic client migration. When set, Happ clients will migrate to this subscription link.",
"subHappFallbackUrl": "Fallback Subscription URL",
"subHappFallbackUrlDesc": "Backup subscription address used by Happ if the primary subscription URL becomes unreachable.",
"subHappSubInfoText": "Banner Announcement Text",
"subHappSubInfoTextDesc": "Custom announcement banner displayed at the top of the Happ client (max 200 characters).",
"subHappSubInfoColor": "Banner Accent Color",
"subHappSubInfoColorDesc": "Color theme style for the announcement banner.",
"subHappSubInfoButtonText": "Banner Button Text",
"subHappSubInfoButtonTextDesc": "Button label displayed inside the announcement banner (max 25 characters).",
"subHappSubInfoButtonLink": "Banner Button Link",
"subHappSubInfoButtonLinkDesc": "Target URL opened when the user clicks the banner action button.",
"subHappSubExpire": "Expired Subscription Banner",
"subHappSubExpireDesc": "Show an expired subscription banner in Happ when the user's traffic or validity has ended.",
"subHappSubExpireButtonLink": "Renewal Link",
"subHappSubExpireButtonLinkDesc": "Target URL opened when the user clicks the renewal button on an expired subscription.",
"subHappNotificationExpire": "Expiration Notifications",
"subHappNotificationExpireDesc": "Instruct Happ to alert the user in advance before their subscription expires.",
"subHappNoLimit": "Bypass Rule Limit",
"subHappNoLimitDesc": "Allow routing rule count to exceed default mobile platform limits without truncation.",
"subHappAlwaysHwid": "Enforce Hardware ID (HWID)",
"subHappAlwaysHwidDesc": "Bind subscription sessions to client device hardware identifier for enhanced security.",
"subHappTunMode": "TUN Mode",
"subHappTunModeDesc": "TUN virtual network interface routing mode: default, system, or strict.",
"subHappTunType": "TUN Engine",
"subHappTunTypeDesc": "Underlying network stack implementation for TUN: system, gVisor, or mixed.",
"subHappExcludeRoutes": "Exclude CIDR Routes",
"subHappExcludeRoutesDesc": "Comma-separated IP CIDRs (e.g. 192.168.0.0/16, 10.0.0.0/8) to bypass the VPN tunnel.",
"subHappExcludeApns": "Exclude Apple APNs",
"subHappExcludeApnsDesc": "Bypass Apple Push Notification services to maintain reliable background notifications on iOS.",
"subHappColorProfile": "Client Color Theme",
"subHappColorProfileDesc": "Client color theme profile: default, violet, turquoise, cyberpunk, or custom JSON theme.",
"subHappPingType": "Latency Ping Method",
"subHappPingTypeDesc": "Measurement protocol used by Happ for node latency testing: icmp, tcp, or http.",
"subHappAutoConnect": "Auto-Connect on Launch",
"subHappAutoConnectDesc": "Instruct Happ to automatically connect to VPN when the application starts.",
"subHappAutoConnectType": "Auto-Connect Target",
"subHappAutoConnectTypeDesc": "Connection target strategy for auto-connect: fastest node or last used node.",
"subHappPerAppMode": "Android Per-App Proxy Mode",
"subHappPerAppModeDesc": "Control Android application routing: off, include (proxy only listed apps), or exclude (bypass listed apps).",
"subHappPerAppList": "Android Package Names",
"subHappPerAppListDesc": "Comma-separated package names of Android applications to include or exclude (e.g. com.telegram.messenger).",
"subHappPresetIran": "Iran Bypass",
"subHappPresetChina": "China Direct",
"subHappPresetAdblock": "AdBlock",
"subHappPresetGlobal": "Full Proxy",
"subHappPresetOff": "Desactivar enrutamiento (happ://routing/off)",
"subHappColorBlue": "Azul (estándar / predeterminado)",
"subHappColorGreen": "Verde (éxito)",
"subHappColorRed": "Rojo (advertencia / peligro)",
"subHappTunModeDefault": "Predeterminado",
"subHappTunModeSystem": "Sistema (pila estándar del SO)",
"subHappTunModeGvisor": "gVisor (pila de espacio de usuario)",
"subHappTunTypeSingbox": "sing-box",
"subHappTunTypeTun2proxy": "tun2proxy",
"subHappTunTypeDefault": "Predeterminado (Happ TUN)",
"subHappTunTypeXray": "Xray TUN",
"subHappPingProxy": "Vía proxy (latencia GET)",
"subHappPingProxyHead": "Vía proxy (latencia HEAD)",
"subHappPingTcp": "Ping de saludo TCP",
"subHappPingIcmp": "Ping ICMP",
"subHappAutoConnectLowestDelay": "Menor latencia (nodo más rápido)",
"subHappAutoConnectLastUsed": "Último nodo utilizado",
"subHappAutoConnectRandom": "Nodo aleatorio",
"subHappPerAppOff": "Desactivado",
"subHappPerAppOn": "Activado (solo apps de la lista)",
"subHappPerAppBypass": "Omitir (excluir apps de la lista)",
"subHappPresetApplied": "Happ preset applied to routing rules",
"subHappPresets": "Routing Presets",
"subHappPresetsDesc": "Pre-configured routing rule presets tailored for Happ clients.",
"subHappVisualBuilder": "Visual Rule Generator",
"subHappVisualBuilderDesc": "Create custom routing deeplink from domain and IP lists.",
"subHappBuildDeeplink": "Generate Deeplink",
"subHappModalTitle": "Happ Visual Routing Rule Generator",
"subHappDirectDomains": "Direct Domains (Bypass)",
"subHappProxyDomains": "Proxy Domains (Tunnel)",
"subHappBlockDomains": "Blocked Domains (Ad/Malware)",
"subHappDirectIPs": "Direct IPs / CIDRs",
"subHappProxyIPs": "Proxy IPs / CIDRs",
"subHappBlockIPs": "Blocked IPs / CIDRs",
"subHappDeeplinkGenerated": "Deeplink generated and applied to routing rules",
"subHappGroupRouting": "Routing & Rules",
"subHappGroupBanners": "Banners & Announcements",
"subHappGroupNetwork": "Network & TUN Engine",
"subHappGroupThemes": "Appearance & Theme",
"subHappGroupFailover": "Migration & App Management",
"subHappGroupAndroid": "Android Per-App Proxy"
},
"xray": {
"save": "Guardar configuración",