[PR #4247] [MERGED] chore: fix remarks shadowrocket subscription #5636

Closed
opened 2026-10-31 20:48:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/4247
Author: @harryngne
Created: 5/11/2026
Status: ✅ Merged
Merged: 5/11/2026
Merged by: @MHSanaei

Base: main ← Head: main


📝 Commits (1)

  • 37b35fc chore: fix remarks shadowrocket subscription

📊 Changes

3 files changed (+54 additions, -41 deletions)

View changed files

📝 frontend/src/pages/sub/SubPage.vue (+10 -1)
📝 sub/subController.go (+1 -1)
📝 sub/subService.go (+43 -39)

📄 Description

What is the pull request?

Fixed Shadowrocket app integration for subscription links. The app was unable to recognize subscription URLs because:

  1. Base64 payload in the custom URI scheme wasn't properly URL-encoded, causing special characters to break parsing
  2. subTitle setting from panel was not being passed to the frontend
  3. Shadowrocket wasn't receiving the subscription name/title as the remark parameter

Changes:

  • Fixed client-side shadowrocketUrl generation to URL-encode the Base64 payload: shadowrocket://add/sub/${encodeURIComponent(btoa(rawUrl))}?remark=${subTitle}
  • Added SubTitle and SubSupportUrl fields to backend PageData struct
  • Updated BuildPageData() function to accept and return subscription title and support URL
  • Updated SubPage.vue frontend component to read subTitle from injected data and use it in the Shadowrocket deep link
  • Fixed handling of existing query parameters (using ? or & as separator for flag=shadowrocket)

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Backend (Go)

  • subService.go: Added SubTitle and SubSupportUrl to PageData struct, updated BuildPageData() signature
  • subController.go: Updated call to BuildPageData() to pass a.subTitle and a.subSupportUrl

Frontend (Vue)

  • SubPage.vue:
    • Added reading of subTitle and subSupportUrl from injected data
    • Updated shadowrocketUrl computed property with proper encoding and remark parameter
    • Fallback chain: subTitle → sId → 'Subscription'

Client-side Legacy (JavaScript)

  • web/assets/js/subscription.js: Updated shadowrocketUrl() to URL-encode Base64 payload and handle query parameters correctly

Testing

  • Shadowrocket app now correctly recognizes and imports subscription links
  • Subscription title displays correctly in Shadowrocket
  • Works with subscription URLs that already contain query parameters
  • Graceful fallback to subscription ID or default name if title is not set

🔄 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/4247 **Author:** [@harryngne](https://github.com/harryngne) **Created:** 5/11/2026 **Status:** ✅ Merged **Merged:** 5/11/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`37b35fc`](https://github.com/MHSanaei/3x-ui/commit/37b35fc621bfa2154528609fee8d5e5b6a9015ca) chore: fix remarks shadowrocket subscription ### 📊 Changes **3 files changed** (+54 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/sub/SubPage.vue` (+10 -1) 📝 `sub/subController.go` (+1 -1) 📝 `sub/subService.go` (+43 -39) </details> ### 📄 Description ## What is the pull request? Fixed Shadowrocket app integration for subscription links. The app was unable to recognize subscription URLs because: 1. Base64 payload in the custom URI scheme wasn't properly URL-encoded, causing special characters to break parsing 2. `subTitle` setting from panel was not being passed to the frontend 3. Shadowrocket wasn't receiving the subscription name/title as the remark parameter **Changes:** - Fixed client-side `shadowrocketUrl` generation to URL-encode the Base64 payload: `shadowrocket://add/sub/${encodeURIComponent(btoa(rawUrl))}?remark=${subTitle}` - Added `SubTitle` and `SubSupportUrl` fields to backend `PageData` struct - Updated `BuildPageData()` function to accept and return subscription title and support URL - Updated SubPage.vue frontend component to read `subTitle` from injected data and use it in the Shadowrocket deep link - Fixed handling of existing query parameters (using `?` or `&` as separator for `flag=shadowrocket`) ## Which part of the application is affected by the change? - [x] Frontend - [x] Backend ## Type of Changes - [x] Bug fix - [ ] New feature - [ ] Refactoring - [ ] Other # **Backend (Go)** - subService.go: Added `SubTitle` and `SubSupportUrl` to `PageData` struct, updated `BuildPageData()` signature - subController.go: Updated call to `BuildPageData()` to pass `a.subTitle` and `a.subSupportUrl` **Frontend (Vue)** - SubPage.vue: - Added reading of `subTitle` and `subSupportUrl` from injected data - Updated `shadowrocketUrl` computed property with proper encoding and remark parameter - Fallback chain: `subTitle` → `sId` → `'Subscription'` **Client-side Legacy (JavaScript)** - `web/assets/js/subscription.js`: Updated `shadowrocketUrl()` to URL-encode Base64 payload and handle query parameters correctly ## Testing - Shadowrocket app now correctly recognizes and imports subscription links - Subscription title displays correctly in Shadowrocket - Works with subscription URLs that already contain query parameters - Graceful fallback to subscription ID or default name if title is not set --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:48:19 +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#5636
No description provided.