[PR #6845] [CLOSED] feat(panel): add environment opt-out for sponsor banners #6477

Closed
opened 2026-11-02 04:09:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6845
Author: @ailinykh
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: feat/disable-sponsor


📝 Commits (2)

  • 6a08ebb feat(panel): add environment opt-out for sponsor banners
  • 6389811 test(panel): cover sponsor opt-out behavior

📊 Changes

3 files changed (+63 additions, -0 deletions)

View changed files

📝 internal/config/config.go (+5 -0)
📝 internal/web/service/panel/sponsor.go (+3 -0)
📝 internal/web/service/panel/sponsor_test.go (+55 -0)

📄 Description

Summary

Add config.IsSponsorDisabled() backed by XUI_DISABLE_SPONSOR=true. When enabled, GetSponsors returns an empty sponsor array before consulting the cache or fetching remote data. Sponsor logo requests are also rejected through the existing active-sponsor check.

No UI setting or documentation changes; the opt-out remains hidden as requested.

Why

Allow administrators to opt out of sponsor banners.

Closes #6844

Type of change

  • New feature

Areas affected

  • Backend (API endpoints, login, settings)

How was this tested?

  • go test -shuffle=on -count=1 ./internal/config ./internal/web/service/panel — passed.
  • go test -race -shuffle=on -count=1 ./internal/config ./internal/web/service/panel — passed.
  • Added a table-driven service regression test covering cold and populated caches: disabled sponsors return {"sponsors":[]}, reject even cached logos, and make no additional outbound requests. The TRUE case verifies activation remains case-sensitive.
  • Proved the regression test fails with the opt-out guard removed and separately with case-insensitive activation; restored the implementation and passed the full Go suite, focused race checks, and Go lint.
  • Code generation/freshness, Go lint (0 issues), frontend lint, formatting, and TypeScript checks — passed.
  • make test-go — passed (full Go suite).
  • npm test in frontend/ — passed: 189 test files, 1,843 tests, including browser tests.
  • make build — passed (frontend build and go build ./...).
  • make build-storybook — passed.
  • make verify stops at the unrelated msw-worker-check: the tracked worker is MSW 2.15.0, while the locked dependency installs MSW 3.0.3. All subsequent test/build targets were run separately and passed; the worker mismatch is left outside this PR's scope.

Breaking changes

None. Sponsors remain enabled unless XUI_DISABLE_SPONSOR is exactly true.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • Frontend lint, typecheck, formatting, build, and Storybook build pass locally.
  • My commits follow the project’s existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6845 **Author:** [@ailinykh](https://github.com/ailinykh) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/disable-sponsor` --- ### 📝 Commits (2) - [`6a08ebb`](https://github.com/MHSanaei/3x-ui/commit/6a08ebba61bd6705c7d09871eea13e176d4f232c) feat(panel): add environment opt-out for sponsor banners - [`6389811`](https://github.com/MHSanaei/3x-ui/commit/6389811a4fee6ccbc9882020f8635ba9a0231eb7) test(panel): cover sponsor opt-out behavior ### 📊 Changes **3 files changed** (+63 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `internal/config/config.go` (+5 -0) 📝 `internal/web/service/panel/sponsor.go` (+3 -0) 📝 `internal/web/service/panel/sponsor_test.go` (+55 -0) </details> ### 📄 Description ## Summary Add `config.IsSponsorDisabled()` backed by `XUI_DISABLE_SPONSOR=true`. When enabled, `GetSponsors` returns an empty sponsor array before consulting the cache or fetching remote data. Sponsor logo requests are also rejected through the existing active-sponsor check. No UI setting or documentation changes; the opt-out remains hidden as requested. ## Why Allow administrators to opt out of sponsor banners. Closes #6844 ## Type of change - [x] New feature ## Areas affected - [x] Backend (API endpoints, login, settings) ## How was this tested? - `go test -shuffle=on -count=1 ./internal/config ./internal/web/service/panel` — passed. - `go test -race -shuffle=on -count=1 ./internal/config ./internal/web/service/panel` — passed. - Added a table-driven service regression test covering cold and populated caches: disabled sponsors return `{"sponsors":[]}`, reject even cached logos, and make no additional outbound requests. The `TRUE` case verifies activation remains case-sensitive. - Proved the regression test fails with the opt-out guard removed and separately with case-insensitive activation; restored the implementation and passed the full Go suite, focused race checks, and Go lint. - Code generation/freshness, Go lint (`0 issues`), frontend lint, formatting, and TypeScript checks — passed. - `make test-go` — passed (full Go suite). - `npm test` in `frontend/` — passed: 189 test files, 1,843 tests, including browser tests. - `make build` — passed (frontend build and `go build ./...`). - `make build-storybook` — passed. - `make verify` stops at the unrelated `msw-worker-check`: the tracked worker is MSW 2.15.0, while the locked dependency installs MSW 3.0.3. All subsequent test/build targets were run separately and passed; the worker mismatch is left outside this PR's scope. ## Breaking changes None. Sponsors remain enabled unless `XUI_DISABLE_SPONSOR` is exactly `true`. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] Frontend lint, typecheck, formatting, build, and Storybook build pass locally. - [x] My commits follow the project’s existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:09:03 +07:00
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#6477
No description provided.