[PR #6333] [MERGED] Feature/fix external subscription client expiry #6221

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

📋 Pull Request Information

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

Base: main ← Head: feature/fix-external-subscription-client-expiry


📝 Commits (4)

  • b1583f4 fix(sub): honor client expiry for external links
  • f3be5d6 fix(ui): show client expiry on external links
  • 51138c3 fix(sub): address external expiry review
  • f47b1f9 Merge branch 'main' into feature/fix-external-subscription-client-expiry

📊 Changes

16 files changed (+332 additions, -61 deletions)

View changed files

📝 docs/content/docs/en/reference/api/clients.mdx (+10 -4)
📝 docs/public/openapi.json (+2 -2)
📝 frontend/public/openapi.json (+2 -2)
📝 frontend/src/components/form/DateTimePicker.tsx (+21 -6)
➕ frontend/src/lib/clients/external-link.ts (+10 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+2 -2)
📝 frontend/src/pages/clients/ClientFormModal.tsx (+33 -22)
➕ frontend/src/test/client-external-link-expiry.test.ts (+17 -0)
📝 frontend/src/test/date-time-picker.test.tsx (+53 -2)
📝 internal/sub/clash_service.go (+13 -4)
📝 internal/sub/controller.go (+4 -4)
📝 internal/sub/external_config.go (+6 -5)
➕ internal/sub/inactive_external_sub_test.go (+115 -0)
📝 internal/sub/json_service.go (+11 -2)
📝 internal/sub/mutation_audit_test.go (+26 -6)
📝 internal/sub/service.go (+7 -0)

📄 Description

Summary

Ensure external links and remote subscriptions respect the owning client's enabled and expiry state.

On the client page, external-link expiry fields now display the main client's expiry time when no link-specific expiry is configured.

Why

Previously, external links could remain available after the owning client was disabled or expired. The frontend also left the external-link expiry field empty, making the effective expiration unclear.

This change keeps external subscription behavior consistent with the main client.

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?

Backend:

  1. Ran go test ./internal/sub.
  2. Verified external links are excluded when the owning client is disabled.
  3. Verified external links are excluded when the owning client has expired.
  4. Verified link-specific expiry still takes effect.

Frontend:

  1. Opened the client form and selected the Links tab.
  2. Verified external links and external subscriptions display the main client expiry when they have no independent expiry.
  3. Verified an independent external-link expiry takes precedence.
  4. Verified the field remains empty when neither expiry is configured.
  5. Added three unit tests for expiry resolution.
  6. Ran frontend lint on the changed files.
  7. Ran the TypeScript type check.
  8. Ran the production frontend build.

Screenshots / recordings

Not included. The change only populates the existing expiry field and does not add new controls or alter the page layout.

Breaking changes

None.

expiryTime: 0 continues to mean no link-specific expiry. The owning client's enabled state and expiry still apply.

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 full test suite pass locally.
  • For frontend changes: lint, typecheck, and 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/6333 **Author:** [@duqigit](https://github.com/duqigit) **Created:** 8/26/2026 **Status:** ✅ Merged **Merged:** 9/3/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feature/fix-external-subscription-client-expiry` --- ### 📝 Commits (4) - [`b1583f4`](https://github.com/MHSanaei/3x-ui/commit/b1583f4adc2a0b9a9091b3546654181d4e73ac79) fix(sub): honor client expiry for external links - [`f3be5d6`](https://github.com/MHSanaei/3x-ui/commit/f3be5d66326299e260c491cf50a06234fbefcfc6) fix(ui): show client expiry on external links - [`51138c3`](https://github.com/MHSanaei/3x-ui/commit/51138c3d08623e41d542a6cc45628a6846a60ded) fix(sub): address external expiry review - [`f47b1f9`](https://github.com/MHSanaei/3x-ui/commit/f47b1f9d93ae4ae2d4724bbba93bdf0ae179f330) Merge branch 'main' into feature/fix-external-subscription-client-expiry ### 📊 Changes **16 files changed** (+332 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/en/reference/api/clients.mdx` (+10 -4) 📝 `docs/public/openapi.json` (+2 -2) 📝 `frontend/public/openapi.json` (+2 -2) 📝 `frontend/src/components/form/DateTimePicker.tsx` (+21 -6) ➕ `frontend/src/lib/clients/external-link.ts` (+10 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+2 -2) 📝 `frontend/src/pages/clients/ClientFormModal.tsx` (+33 -22) ➕ `frontend/src/test/client-external-link-expiry.test.ts` (+17 -0) 📝 `frontend/src/test/date-time-picker.test.tsx` (+53 -2) 📝 `internal/sub/clash_service.go` (+13 -4) 📝 `internal/sub/controller.go` (+4 -4) 📝 `internal/sub/external_config.go` (+6 -5) ➕ `internal/sub/inactive_external_sub_test.go` (+115 -0) 📝 `internal/sub/json_service.go` (+11 -2) 📝 `internal/sub/mutation_audit_test.go` (+26 -6) 📝 `internal/sub/service.go` (+7 -0) </details> ### 📄 Description ## Summary Ensure external links and remote subscriptions respect the owning client's enabled and expiry state. On the client page, external-link expiry fields now display the main client's expiry time when no link-specific expiry is configured. ## Why Previously, external links could remain available after the owning client was disabled or expired. The frontend also left the external-link expiry field empty, making the effective expiration unclear. This change keeps external subscription behavior consistent with the main client. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [x] Documentation - [x] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [x] 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? Backend: 1. Ran `go test ./internal/sub`. 2. Verified external links are excluded when the owning client is disabled. 3. Verified external links are excluded when the owning client has expired. 4. Verified link-specific expiry still takes effect. Frontend: 1. Opened the client form and selected the **Links** tab. 2. Verified external links and external subscriptions display the main client expiry when they have no independent expiry. 3. Verified an independent external-link expiry takes precedence. 4. Verified the field remains empty when neither expiry is configured. 5. Added three unit tests for expiry resolution. 6. Ran frontend lint on the changed files. 7. Ran the TypeScript type check. 8. Ran the production frontend build. ## Screenshots / recordings Not included. The change only populates the existing expiry field and does not add new controls or alter the page layout. ## Breaking changes None. `expiryTime: 0` continues to mean no link-specific expiry. The owning client's enabled state and expiry still apply. ## 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 full test suite pass locally. - [x] For frontend changes: lint, typecheck, and 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:13 +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#6221
No description provided.