[GH-ISSUE #6844] [Feature]: Disable sponsor banner option #4553

Closed
opened 2026-10-31 20:40:28 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @ailinykh on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6844

Some users may perceive the new sponsor banner system not only as a security concern (#6824), but also as an attempt to monetize without their explicit consent.

To avoid excessive repository forks, I propose adding an opt-out setting that lets users who care about this disable sponsor banners.

For monetization purposes, this option could remain undocumented and hidden, available only to users who genuinely need it.

Thank you for the wonderful product and for everything you do!

Describe the solution you'd like

Add IsSponsorDisabled() setting to internal/config/config.go

func IsSponsorDisabled() bool {
	return os.Getenv("XUI_DISABLE_SPONSOR") == "true"
}

read it from internal/web/service/panel/sponsor.go and return an empty sponsor list

Originally created by @ailinykh on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6844 ### Is your feature request related to a problem? Some users may perceive the new sponsor banner system not only as a security concern (#6824), but also as an attempt to monetize without their explicit consent. To avoid excessive repository forks, I propose adding an opt-out setting that lets users who care about this disable sponsor banners. For monetization purposes, this option could remain undocumented and hidden, available only to users who genuinely need it. Thank you for the wonderful product and for everything you do! ### Describe the solution you'd like Add `IsSponsorDisabled()` setting to `internal/config/config.go` ```go func IsSponsorDisabled() bool { return os.Getenv("XUI_DISABLE_SPONSOR") == "true" } ``` read it from `internal/web/service/panel/sponsor.go` and return an empty sponsor list
bsakaguchi 2026-10-31 20:40:28 +07:00
Author
Owner

@MHSanaei commented on GitHub (Oct 16, 2026):

@claude analyze

<!-- gh-comment-id:6212797449 --> @MHSanaei commented on GitHub (Oct 16, 2026): @claude analyze
Author
Owner

@github-actions[bot] commented on GitHub (Oct 16, 2026):

This is a feature request, not a bug. The panel currently has no setting, environment variable or flag that turns sponsor slots off. The maintainer has already declined an opt-out on the same subject: in #6824 they wrote "No opt-out switch or bundling is planned." Whether to reverse that is their decision, so this report only records what the code does today and what the proposed change would need. This is the first analysis on this thread.

What the code does today (default branch, 608ef4e4 / v3.10.2)

  • internal/config/config.go has env toggles such as IsDebug() (XUI_DEBUG, line 103) and IsSkipHSTS() (XUI_SKIP_HSTS, line 108). Nothing in internal/config/ or the settings service mentions sponsors.
  • PanelService.GetSponsors() (internal/web/service/panel/sponsor.go:84) always goes through cachedSponsors(). That function fetches sponsorsURL with an hourly cache:
    sponsorsURL     = "https://raw.githubusercontent.com/MHSanaei/sponsors/refs/heads/main/3X/sponsors.json"
    
    Since 35b5e098 ("fix(sponsor): fetch sponsor data from raw.githubusercontent.com") the data comes from GitHub instead of sponsors.sanaei.dev.
  • Two public routes serve it: /sponsors and /sponsors/logo/:name (internal/web/controller/index.go:47-48). The /sponsors route is public so the login page can show its slot (comment at line 55).
  • Each card can already be closed in the browser. SponsorSlot.tsx filters with isSponsorDismissed(s.id, slot) and stores the choice in localStorage, but only for that sponsor ID in that browser. A new sponsor shows up again.
  • The maintainer's suggestion in #6824 for hiding the server IP from GitHub is Panel Settings → General → Panel Traffic Outbound. That routes the fetch through an outbound; it does not turn it off.

On the proposed change

The proposal would work technically and touches little code. Two points if the maintainer ever takes it:

  1. The check has to go at the top of GetSponsors(), before cachedSponsors() runs. Only then is the outbound request skipped as well as the banner. GetSponsorLogo() calls GetSponsors() first (sponsor.go:124), so with an empty list it already returns ErrSponsorLogoUnknown and makes no logo fetch.
  2. The /sponsors page stays in the sidebar (AppSidebar.tsx:238) and the command palette (CommandPalette.tsx:425). With an empty list, SponsorsPage.tsx:75-76 shows the "your brand here" card. If "disabled" should also hide that page, those entries need the same flag.

Related reports. None of these is a duplicate to close against, since this is a narrower, env-only variant of the same request:

  • #6818: "Option to permanently hide sponsor cards" (closed, not planned)
  • #6776: sponsor fetch exposing the VPS IP (closed, not planned)
  • #6824: offline-first sponsorship; this is where the maintainer gave the decision above (closed)

Verdict: Feature request

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:6212817775 --> @github-actions[bot] commented on GitHub (Oct 16, 2026): This is a feature request, not a bug. The panel currently has no setting, environment variable or flag that turns sponsor slots off. The maintainer has already declined an opt-out on the same subject: in #6824 they wrote *"No opt-out switch or bundling is planned."* Whether to reverse that is their decision, so this report only records what the code does today and what the proposed change would need. This is the first analysis on this thread. **What the code does today (default branch, `608ef4e4` / v3.10.2)** - `internal/config/config.go` has env toggles such as `IsDebug()` (`XUI_DEBUG`, line 103) and `IsSkipHSTS()` (`XUI_SKIP_HSTS`, line 108). Nothing in `internal/config/` or the settings service mentions sponsors. - `PanelService.GetSponsors()` (`internal/web/service/panel/sponsor.go:84`) always goes through `cachedSponsors()`. That function fetches `sponsorsURL` with an hourly cache: ```go sponsorsURL = "https://raw.githubusercontent.com/MHSanaei/sponsors/refs/heads/main/3X/sponsors.json" ``` Since `35b5e098` ("fix(sponsor): fetch sponsor data from raw.githubusercontent.com") the data comes from GitHub instead of `sponsors.sanaei.dev`. - Two public routes serve it: `/sponsors` and `/sponsors/logo/:name` (`internal/web/controller/index.go:47-48`). The `/sponsors` route is public so the login page can show its slot (comment at line 55). - Each card can already be closed in the browser. `SponsorSlot.tsx` filters with `isSponsorDismissed(s.id, slot)` and stores the choice in localStorage, but only for that sponsor ID in that browser. A new sponsor shows up again. - The maintainer's suggestion in #6824 for hiding the server IP from GitHub is **Panel Settings → General → Panel Traffic Outbound**. That routes the fetch through an outbound; it does not turn it off. **On the proposed change** The proposal would work technically and touches little code. Two points if the maintainer ever takes it: 1. The check has to go at the top of `GetSponsors()`, before `cachedSponsors()` runs. Only then is the outbound request skipped as well as the banner. `GetSponsorLogo()` calls `GetSponsors()` first (`sponsor.go:124`), so with an empty list it already returns `ErrSponsorLogoUnknown` and makes no logo fetch. 2. The `/sponsors` page stays in the sidebar (`AppSidebar.tsx:238`) and the command palette (`CommandPalette.tsx:425`). With an empty list, `SponsorsPage.tsx:75-76` shows the "your brand here" card. If "disabled" should also hide that page, those entries need the same flag. **Related reports.** None of these is a duplicate to close against, since this is a narrower, env-only variant of the same request: - #6818: "Option to permanently hide sponsor cards" (closed, not planned) - #6776: sponsor fetch exposing the VPS IP (closed, not planned) - #6824: offline-first sponsorship; this is where the maintainer gave the decision above (closed) Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@ailinykh commented on GitHub (Oct 16, 2026):

I understand an opt-out was previously declined. Would you consider this narrower, undocumented environment-only option?
It preserves the default behavior and requires no UI changes.

If not, I’ll close the PR.

<!-- gh-comment-id:6213271057 --> @ailinykh commented on GitHub (Oct 16, 2026): I understand an opt-out was previously declined. Would you consider this narrower, undocumented environment-only option? It preserves the default behavior and requires no UI changes. If not, I’ll close the PR.
Author
Owner

@jamesliu96 commented on GitHub (Oct 18, 2026):

Hopefully, this can be addressed upstream, at least by making it configurable via an environment variable. Otherwise, a community fork may be the only option.

<!-- gh-comment-id:6254442186 --> @jamesliu96 commented on GitHub (Oct 18, 2026): Hopefully, this can be addressed upstream, at least by making it configurable via an environment variable. Otherwise, a community fork may be the only option.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4553
No description provided.