mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
fix: allow subscription links for disabled clients
This commit is contained in:
parent
d6de00cd00
commit
3048950743
4 changed files with 58 additions and 3 deletions
|
|
@ -0,0 +1,55 @@
|
||||||
|
Task Record
|
||||||
|
|
||||||
|
Date: 2026-04-26
|
||||||
|
Related Module: sub subscription services
|
||||||
|
Change Type: Fix
|
||||||
|
|
||||||
|
Background
|
||||||
|
|
||||||
|
Current subscription generation logic filters clients by both `subId` and `enable=true`.
|
||||||
|
As a result, when a client account is disabled, subscription endpoints cannot return Subscription Link or Clash Link content.
|
||||||
|
Requirement is to allow access to subscription and Clash links even when the account is not enabled.
|
||||||
|
|
||||||
|
Changes
|
||||||
|
|
||||||
|
Updated client matching conditions in subscription generation flows to only match `subId` and not require `client.Enable`:
|
||||||
|
- `sub/subService.go` (`GetSubs`)
|
||||||
|
- `sub/subJsonService.go` (`GetJson`)
|
||||||
|
- `sub/subClashService.go` (`GetClash`)
|
||||||
|
|
||||||
|
The inbound-level enable filter remains unchanged.
|
||||||
|
|
||||||
|
Impact
|
||||||
|
|
||||||
|
Affected modules or files.
|
||||||
|
- `sub/subService.go`
|
||||||
|
- `sub/subJsonService.go`
|
||||||
|
- `sub/subClashService.go`
|
||||||
|
|
||||||
|
Whether APIs, database, config, build, or compatibility are affected.
|
||||||
|
- API routes unchanged.
|
||||||
|
- Database schema unchanged.
|
||||||
|
- Configuration schema unchanged.
|
||||||
|
- Runtime behavior changed: disabled clients with valid `subId` can now receive subscription payloads.
|
||||||
|
|
||||||
|
Whether upstream or downstream callers are affected.
|
||||||
|
- Subscription consumers (normal/JSON/Clash links) now receive content even when client enable flag is false.
|
||||||
|
|
||||||
|
Verification
|
||||||
|
|
||||||
|
List validation commands or checks performed.
|
||||||
|
- `go test ./sub/...`
|
||||||
|
|
||||||
|
State the result.
|
||||||
|
- Passed.
|
||||||
|
|
||||||
|
If not verified, explain why.
|
||||||
|
- No remote runtime deployment verification was performed in this local environment.
|
||||||
|
|
||||||
|
Risks And Follow-Up
|
||||||
|
|
||||||
|
Remaining risks.
|
||||||
|
- This change intentionally relaxes access control semantics for disabled clients at subscription layer. If disable is expected to fully revoke access, this behavior is now different by design.
|
||||||
|
|
||||||
|
Recommended follow-up work.
|
||||||
|
- Confirm product expectation on whether this policy should also apply to other export channels (if any).
|
||||||
|
|
@ -92,7 +92,7 @@ func (s *SubClashService) GetClash(subId string) (string, string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
if client.Enable && client.SubID == subId {
|
if client.SubID == subId {
|
||||||
clientTraffics = append(clientTraffics, s.SubService.getClientTraffics(inbound.ClientStats, client.Email))
|
clientTraffics = append(clientTraffics, s.SubService.getClientTraffics(inbound.ClientStats, client.Email))
|
||||||
newProxies := s.getProxy(inbound, client)
|
newProxies := s.getProxy(inbound, client)
|
||||||
proxies = append(proxies, newProxies...)
|
proxies = append(proxies, newProxies...)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ func (s *SubJsonService) GetJson(subId string, host string) (string, string, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
if client.Enable && client.SubID == subId {
|
if client.SubID == subId {
|
||||||
clientTraffics = append(clientTraffics, s.SubService.getClientTraffics(inbound.ClientStats, client.Email))
|
clientTraffics = append(clientTraffics, s.SubService.getClientTraffics(inbound.ClientStats, client.Email))
|
||||||
newConfigs := s.getConfig(inbound, client, host)
|
newConfigs := s.getConfig(inbound, client, host)
|
||||||
configArray = append(configArray, newConfigs...)
|
configArray = append(configArray, newConfigs...)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, int64, xray.C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
if client.Enable && client.SubID == subId {
|
if client.SubID == subId {
|
||||||
link := s.getLink(inbound, client.Email)
|
link := s.getLink(inbound, client.Email)
|
||||||
result = append(result, link)
|
result = append(result, link)
|
||||||
ct := s.getClientTraffics(inbound.ClientStats, client.Email)
|
ct := s.getClientTraffics(inbound.ClientStats, client.Email)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue