[PR #6579] [MERGED] fix(sub): send panel guid as X-HWID on outbound subscription fetch #6359

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6579
Author: @sdhfsl
Created: 9/17/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @MHSanaei

Base: main ← Head: fix-outbound-sub-hwid


📝 Commits (10+)

  • 959e6fd fix(panel): accept 2FA codes from adjacent TOTP windows
  • f3096bb fix(panel): share TOTP skew tolerance with VerifyTwoFactorCode
  • 198ac75 Merge branch 'main' into main
  • acb0297 Merge branch 'MHSanaei:main' into main
  • 35b92a1 Merge branch 'MHSanaei:main' into main
  • ea72001 fix(sub): send panel guid as X-HWID on outbound subscription fetch
  • 92bfc4d Merge branch 'main' into fix-outbound-sub-hwid
  • 86920a2 Merge branch 'main' into fix-outbound-sub-hwid
  • 05bba91 Merge remote-tracking branch 'origin/main' into pr-6579
  • bef0d4d fix(sub): send the external-subscription X-HWID from outbound fetches too

📊 Changes

5 files changed (+114 additions, -70 deletions)

View changed files

📝 internal/sub/external_hwid_test.go (+3 -32)
📝 internal/sub/external_subscription.go (+2 -38)
➕ internal/web/service/external_hwid.go (+45 -0)
➕ internal/web/service/outbound_hwid_test.go (+60 -0)
📝 internal/web/service/outbound_subscription.go (+4 -0)

📄 Description

Problem

Fixes #6574 — same LOT as #6559 (fixed by #6567), other fetch path.

Outbound Subscriptions (fetchAndStore) set only User-Agent. Against an HWID-limited donor, EnforceHwidForSubID rejects the empty HWID and answers 404: Failed to fetch/parse subscription (http 404). #6567 fixed the client-external-links path; this path was missed.

Fix

  • Send the panel's stable id via official GetPanelGuid() as X-HWID plus X-Device-OS: 3x-ui (exactly what the issue suggests), honoring the same externalSubSendHwid opt-out introduced in #6567 (default send).
  • Uses the official guid instead of minting another id, so a panel occupies one donor slot across both fetch paths.

Tests

New TestOutboundFetchSendsHwid drives Refresh against httptest: header present with the panel guid by default, absent after opt-out. Mutation-checked (header lines removed -> test red, restored -> green). go vet + gofmt clean.


🔄 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/6579 **Author:** [@sdhfsl](https://github.com/sdhfsl) **Created:** 9/17/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix-outbound-sub-hwid` --- ### 📝 Commits (10+) - [`959e6fd`](https://github.com/MHSanaei/3x-ui/commit/959e6fd62b07efd1038d70ecc18c3bc59ce2e3c2) fix(panel): accept 2FA codes from adjacent TOTP windows - [`f3096bb`](https://github.com/MHSanaei/3x-ui/commit/f3096bb3c1e3091647101d80939da52ab054b21d) fix(panel): share TOTP skew tolerance with VerifyTwoFactorCode - [`198ac75`](https://github.com/MHSanaei/3x-ui/commit/198ac751d71b3b063a61b59efed80d50444febbf) Merge branch 'main' into main - [`acb0297`](https://github.com/MHSanaei/3x-ui/commit/acb0297c9b95da9d4157e751fe2789e851b34746) Merge branch 'MHSanaei:main' into main - [`35b92a1`](https://github.com/MHSanaei/3x-ui/commit/35b92a16d3770ee1c0351a1f5db75b635788fa32) Merge branch 'MHSanaei:main' into main - [`ea72001`](https://github.com/MHSanaei/3x-ui/commit/ea72001f3f2d460d03a54ced04513d783ca03019) fix(sub): send panel guid as X-HWID on outbound subscription fetch - [`92bfc4d`](https://github.com/MHSanaei/3x-ui/commit/92bfc4d802e68342eacfa8a003ee6aecaaa68e5e) Merge branch 'main' into fix-outbound-sub-hwid - [`86920a2`](https://github.com/MHSanaei/3x-ui/commit/86920a218c906c1cf5026071ff53fb6a05adaecf) Merge branch 'main' into fix-outbound-sub-hwid - [`05bba91`](https://github.com/MHSanaei/3x-ui/commit/05bba9190568ecf4e3c336e534d23241d687b9ba) Merge remote-tracking branch 'origin/main' into pr-6579 - [`bef0d4d`](https://github.com/MHSanaei/3x-ui/commit/bef0d4d731f7def2c8b6800db9bd65e19f38b724) fix(sub): send the external-subscription X-HWID from outbound fetches too ### 📊 Changes **5 files changed** (+114 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `internal/sub/external_hwid_test.go` (+3 -32) 📝 `internal/sub/external_subscription.go` (+2 -38) ➕ `internal/web/service/external_hwid.go` (+45 -0) ➕ `internal/web/service/outbound_hwid_test.go` (+60 -0) 📝 `internal/web/service/outbound_subscription.go` (+4 -0) </details> ### 📄 Description ## Problem Fixes #6574 — same LOT as #6559 (fixed by #6567), other fetch path. Outbound Subscriptions (`fetchAndStore`) set only `User-Agent`. Against an HWID-limited donor, `EnforceHwidForSubID` rejects the empty HWID and answers 404: `Failed to fetch/parse subscription (http 404)`. #6567 fixed the client-external-links path; this path was missed. ## Fix - Send the panel's stable id via official `GetPanelGuid()` as `X-HWID` plus `X-Device-OS: 3x-ui` (exactly what the issue suggests), honoring the same `externalSubSendHwid` opt-out introduced in #6567 (default send). - Uses the official guid instead of minting another id, so a panel occupies one donor slot across both fetch paths. ## Tests New `TestOutboundFetchSendsHwid` drives `Refresh` against httptest: header present with the panel guid by default, absent after opt-out. Mutation-checked (header lines removed -> test red, restored -> green). `go vet` + gofmt clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:12 +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#6359
No description provided.