mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5585] Happ: scoped "Hide server settings" with email-based allowlist/blocklist #3901
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#3901
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?
Originally created by @acidmsg on GitHub (Jun 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5585
Problem:
subHideSettingsis a global boolean flag.Hide-Settings: 1header is either applied to all subscription responses, or none. Selective application (some clients see full server config, others get a locked-down profile) is impossible.Proposed solution:
Replace the binary toggle with a filter supporting two modes: blocklist (hide for selected) and allowlist (hide for everyone EXCEPT selected). Input field uses the same chip/tag UX already present across the panel (comma-separated values, each rendered as a removable chip — like Telegram chat IDs, trusted IPs, etc.).
Behavior at subscription request time:
Group resolution:
When a group is selected in the filter, it is resolved to its current members at request time (
getSubs()). Members added to the group later are automatically covered on their next subscription request — no panel settings change needed.Migration:
The old
subHideSettings(bool) is superseded. On startup after upgrade:subHideSettings == true→subHideEnabled = true,subHideFilter = ""(empty filter → hide for all)subHideSettings == false→subHideEnabled = falseNo backward compatibility needed — HTTP headers are served identically.
Where to change:
settings: renamesubHideSettings→subHideEnabled(bool), addsubHideFilter(string, new: JSON{mode, entries})subHideSettingsto new formatcontroller.go:subs(): aftergetSubs(), check clientemailsagainst filter before callingApplyCommonHeadersen,ru, and othersWhy email-based:
getSubs()already returnsemails []string. Email-based matching requires zero changes to the method signature. Using client/group IDs would require extending the return value ofgetSubs().@github-actions[bot] commented on GitHub (Jun 26, 2026):
The technical analysis is accurate. Confirmed against the current source:
subHideSettingsis a global bool stored in the settings table with a default offalse(internal/web/service/setting.go:81).GetSubHideSettings()(line 712) returns it as a single value. It is passed intoSUBControllerat initialization time alongside every other sub setting (internal/sub/sub.go:245), stored in the struct assubHideSettings bool(internal/sub/controller.go:51), and forwarded unchanged to everyApplyCommonHeaders()call (internal/sub/controller.go:194, 378, 395).ApplyCommonHeaderssetsHide-Settings: 1unconditionally when the field istrue(internal/sub/controller.go:439-440). There is currently no per-client or per-email gate.getSubs()does returnemails []stringas its second return value (internal/sub/service.go:180). The emails are populated per-matched client (lines 219, 230) and are available in thesubs()handler immediately after the call (line 159), beforeApplyCommonHeadersis invoked (line 194). The filtering logic proposed could be inserted at that point with no change togetSubs()'s signature.Client groups exist in the data model —
ClientRecord.Group(internal/database/model/model.go:626) and theclient_groupstable (ClientGroup, line 635-642). Group-to-email resolution would require a DB query at subscription request time; this is feasible but adds latency per request when a group entry is present in the filter.One architectural note not addressed in the proposal:
SUBControlleris constructed once at sub-server startup, receiving all settings as constructor arguments. New fields (subHideEnabled,subHideFilter) would follow the same pattern — they would be read from the DB at sub-server initialization and would not reflect settings changes until the sub server is reloaded (which already happens for other setting changes via the existing reload mechanism). This is not a blocker, just something the implementation must account for when wiring up the new fields.Migration note: the proposal's migration —
subHideSettings == true→subHideEnabled = true, subHideFilter = ""(hide for all, preserving current behavior) — is correct and backward-compatible from an HTTP standpoint. The old key can be retired after the migration step runs on startup.A PR that implements this would need changes in at minimum:
internal/web/service/setting.go— new defaults and accessors forsubHideEnabledandsubHideFilterinternal/database/— startup migration fromsubHideSettingsinternal/sub/controller.go— new struct fields, new constructor params, per-email check beforeApplyCommonHeadersinternal/sub/sub.go— pass the new fields at constructioninternal/web/translation/— new i18n keys for all 13 locale filesfrontend/src/— UI for the new radio + chip input on the Happ tabtools/openapigen/or the generated spec — schema update for the two new settings fieldsThis reply was generated automatically; a maintainer may follow up.