[PR #6398] [MERGED] feat(outbounds): support custom subscription user agents #6253

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6398
Author: @T3RR7
Created: 9/3/2026
Status: ✅ Merged
Merged: 9/11/2026
Merged by: @MHSanaei

Base: main ← Head: main


📝 Commits (2)

  • 56a0967 feat(outbounds): support custom subscription user agents
  • b13e2a9 chore(merge): sync upstream main

📊 Changes

22 files changed (+135 additions, -10 deletions)

View changed files

📝 docs/public/openapi.json (+14 -0)
📝 frontend/public/openapi.json (+14 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+15 -0)
📝 frontend/src/pages/xray/outbounds/OutboundsTab.tsx (+21 -1)
📝 internal/database/db.go (+11 -0)
📝 internal/database/model/model.go (+1 -0)
📝 internal/web/controller/xray_setting.go (+6 -3)
📝 internal/web/service/outbound_subscription.go (+11 -3)
📝 internal/web/service/outbound_subscription_test.go (+28 -2)
📝 internal/web/translation/ar-EG.json (+1 -0)
📝 internal/web/translation/en-US.json (+1 -0)
📝 internal/web/translation/es-ES.json (+1 -0)
📝 internal/web/translation/fa-IR.json (+1 -0)
📝 internal/web/translation/id-ID.json (+1 -0)
📝 internal/web/translation/ja-JP.json (+1 -0)
📝 internal/web/translation/pt-BR.json (+1 -0)
📝 internal/web/translation/ru-RU.json (+1 -0)
📝 internal/web/translation/tr-TR.json (+2 -1)
📝 internal/web/translation/uk-UA.json (+1 -0)
📝 internal/web/translation/vi-VN.json (+1 -0)

...and 2 more files

📄 Description

Some subscription providers require a client-specific User-Agent before returning outbound links. Persist an optional value per subscription and use it for refreshes and previews while preserving the existing default for blank values.

Summary

Add an optional custom User-Agent setting to outbound subscriptions. The configured value is used for both previews and scheduled/manual refreshes.

Why

Some subscription providers return different content or reject requests unless they receive a supported client-specific User-Agent.

Existing subscriptions remain unchanged: when the field is empty, requests continue using 3x-ui-outbound-sub/1.0.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • Added TestOutboundSubscriptionRefreshUsesCustomUserAgent, which refreshes a subscription from an httptest server and verifies the exact received User-Agent.
  • Ran go test ./internal/web/controller ./internal/web/service ./internal/database.
  • Ran npm run lint.
  • Ran npm run typecheck.
  • Ran npm run test -- --run: 127 test files and 1224 tests passed.
  • Ran npm run build.
  • Ran make format-check.
  • Ran make gen-check.

Screenshots / recordings

N/A.

Breaking changes

None. The new database column is added automatically, and blank values retain the existing default User-Agent.

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.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • 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/6398 **Author:** [@T3RR7](https://github.com/T3RR7) **Created:** 9/3/2026 **Status:** ✅ Merged **Merged:** 9/11/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`56a0967`](https://github.com/MHSanaei/3x-ui/commit/56a0967e3d1e9f644451135dce312283d8ecfbc2) feat(outbounds): support custom subscription user agents - [`b13e2a9`](https://github.com/MHSanaei/3x-ui/commit/b13e2a93f64cc717bdb8eac1423434d38e48459d) chore(merge): sync upstream main ### 📊 Changes **22 files changed** (+135 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `docs/public/openapi.json` (+14 -0) 📝 `frontend/public/openapi.json` (+14 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+15 -0) 📝 `frontend/src/pages/xray/outbounds/OutboundsTab.tsx` (+21 -1) 📝 `internal/database/db.go` (+11 -0) 📝 `internal/database/model/model.go` (+1 -0) 📝 `internal/web/controller/xray_setting.go` (+6 -3) 📝 `internal/web/service/outbound_subscription.go` (+11 -3) 📝 `internal/web/service/outbound_subscription_test.go` (+28 -2) 📝 `internal/web/translation/ar-EG.json` (+1 -0) 📝 `internal/web/translation/en-US.json` (+1 -0) 📝 `internal/web/translation/es-ES.json` (+1 -0) 📝 `internal/web/translation/fa-IR.json` (+1 -0) 📝 `internal/web/translation/id-ID.json` (+1 -0) 📝 `internal/web/translation/ja-JP.json` (+1 -0) 📝 `internal/web/translation/pt-BR.json` (+1 -0) 📝 `internal/web/translation/ru-RU.json` (+1 -0) 📝 `internal/web/translation/tr-TR.json` (+2 -1) 📝 `internal/web/translation/uk-UA.json` (+1 -0) 📝 `internal/web/translation/vi-VN.json` (+1 -0) _...and 2 more files_ </details> ### 📄 Description Some subscription providers require a client-specific User-Agent before returning outbound links. Persist an optional value per subscription and use it for refreshes and previews while preserving the existing default for blank values. ## Summary Add an optional custom `User-Agent` setting to outbound subscriptions. The configured value is used for both previews and scheduled/manual refreshes. ## Why Some subscription providers return different content or reject requests unless they receive a supported client-specific `User-Agent`. Existing subscriptions remain unchanged: when the field is empty, requests continue using `3x-ui-outbound-sub/1.0`. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [x] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - Added `TestOutboundSubscriptionRefreshUsesCustomUserAgent`, which refreshes a subscription from an `httptest` server and verifies the exact received `User-Agent`. - Ran `go test ./internal/web/controller ./internal/web/service ./internal/database`. - Ran `npm run lint`. - Ran `npm run typecheck`. - Ran `npm run test -- --run`: 127 test files and 1224 tests passed. - Ran `npm run build`. - Ran `make format-check`. - Ran `make gen-check`. ## Screenshots / recordings N/A. ## Breaking changes None. The new database column is added automatically, and blank values retain the existing default `User-Agent`. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [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:07:25 +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#6253
No description provided.