[PR #6017] [MERGED] feat(sub): add raw subscription download actions #6055

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6017
Author: @w3struk
Created: 7/17/2026
Status: ✅ Merged
Merged: 7/21/2026
Merged by: @MHSanaei

Base: main ← Head: main


📝 Commits (4)

  • 90d3726 feat(sub): add raw subscription downloads
  • 6d388ad fix(sub): address review feedback
  • cd1383e feat(sub): add download buttons to client subscriptions
  • 3f13ce4 fix(sub): fetch subscription before download

📊 Changes

5 files changed (+146 additions, -14 deletions)

View changed files

📝 frontend/src/pages/clients/ClientInfoModal.tsx (+33 -2)
📝 frontend/src/pages/sub/SubPage.tsx (+21 -0)
📝 internal/sub/controller.go (+26 -8)
📝 internal/sub/controller_test.go (+62 -0)
📝 internal/sub/dist.go (+4 -4)

📄 Description

Summary

  • Add raw subscription download actions on the subscription page for JSON and Clash rows.
  • Keep SUB row unchanged (copy + QR only) with no raw-download button.
  • Keep existing raw client config behavior intact.

Changes

  • Browser subscription page (frontend/src/pages/sub/SubPage.tsx):
    • JSON row now shows Download first, then Copy, then QR.
    • CLASH row now shows Download first, then Copy, then QR.
    • SUB row remains Copy + QR and does not expose raw download.
  • Subscription response handling (internal/sub/controller.go):
    • ?view=raw now bypasses the HTML response and sets attachment headers for Clash/JSON subscription responses.
  • Subscription controller tests updated in internal/sub/controller_test.go.

Why

Browser navigation currently renders subscription endpoints as HTML, which prevents users from directly downloading JSON/YAML exports from the subscription page. This adds explicit raw download actions and ensures ?view=raw returns attachment-style responses suitable for direct download.

Testing

  • go test ./internal/sub
  • go build ./...
  • npm test -- --project=storybook src/components/clients/ConfigBlock.stories.tsx

🔄 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/6017 **Author:** [@w3struk](https://github.com/w3struk) **Created:** 7/17/2026 **Status:** ✅ Merged **Merged:** 7/21/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (4) - [`90d3726`](https://github.com/MHSanaei/3x-ui/commit/90d37261414ee4528a942703c37618c0cbc3151b) feat(sub): add raw subscription downloads - [`6d388ad`](https://github.com/MHSanaei/3x-ui/commit/6d388ade2f6036289dfe790d1d7eecc05ed69439) fix(sub): address review feedback - [`cd1383e`](https://github.com/MHSanaei/3x-ui/commit/cd1383eb15a90d753acfe3b1730d88dc7af71857) feat(sub): add download buttons to client subscriptions - [`3f13ce4`](https://github.com/MHSanaei/3x-ui/commit/3f13ce40eb8092f95a57a5780540a387ac18d41c) fix(sub): fetch subscription before download ### 📊 Changes **5 files changed** (+146 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/clients/ClientInfoModal.tsx` (+33 -2) 📝 `frontend/src/pages/sub/SubPage.tsx` (+21 -0) 📝 `internal/sub/controller.go` (+26 -8) 📝 `internal/sub/controller_test.go` (+62 -0) 📝 `internal/sub/dist.go` (+4 -4) </details> ### 📄 Description ## Summary - Add raw subscription download actions on the subscription page for JSON and Clash rows. - Keep SUB row unchanged (copy + QR only) with no raw-download button. - Keep existing raw client config behavior intact. ## Changes - Browser subscription page (`frontend/src/pages/sub/SubPage.tsx`): - JSON row now shows Download first, then Copy, then QR. - CLASH row now shows Download first, then Copy, then QR. - SUB row remains Copy + QR and does not expose raw download. - Subscription response handling (`internal/sub/controller.go`): - `?view=raw` now bypasses the HTML response and sets attachment headers for Clash/JSON subscription responses. - Subscription controller tests updated in `internal/sub/controller_test.go`. ## Why Browser navigation currently renders subscription endpoints as HTML, which prevents users from directly downloading JSON/YAML exports from the subscription page. This adds explicit raw download actions and ensures `?view=raw` returns attachment-style responses suitable for direct download. ## Testing - `go test ./internal/sub` - `go build ./...` - `npm test -- --project=storybook src/components/clients/ConfigBlock.stories.tsx` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:02 +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#6055
No description provided.