[PR #6466] [MERGED] feat(settings): add Block tab for JSON subscription routing rules #6287

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

📋 Pull Request Information

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

Base: main ← Head: feat/sub-json-block-routing-tab


📝 Commits (2)

  • 11c9c9e feat(settings): add Block tab for JSON subscription routing rules
  • 373accc fix(settings): preserve rule order and clear foreign leftovers

📊 Changes

14 files changed (+124 additions, -46 deletions)

View changed files

📝 frontend/src/pages/settings/SubscriptionFormatsTab.tsx (+98 -46)
📝 internal/web/translation/ar-EG.json (+2 -0)
📝 internal/web/translation/en-US.json (+2 -0)
📝 internal/web/translation/es-ES.json (+2 -0)
📝 internal/web/translation/fa-IR.json (+2 -0)
📝 internal/web/translation/id-ID.json (+2 -0)
📝 internal/web/translation/ja-JP.json (+2 -0)
📝 internal/web/translation/pt-BR.json (+2 -0)
📝 internal/web/translation/ru-RU.json (+2 -0)
📝 internal/web/translation/tr-TR.json (+2 -0)
📝 internal/web/translation/uk-UA.json (+2 -0)
📝 internal/web/translation/vi-VN.json (+2 -0)
📝 internal/web/translation/zh-CN.json (+2 -0)
📝 internal/web/translation/zh-TW.json (+2 -0)

📄 Description

Summary

JSON subscription profiles already ship a block (blackhole) outbound and prepend subJsonRules verbatim, but the subscription formats UI only exposed Direct rules and hardcoded outboundTag: "direct".

This PR adds a Block tab next to Direct so operators can configure block domain/IP rules from the panel.

  • New Block tab writes separate rules with outboundTag: "block" (not blocked).
  • Direct/Block helpers locate rules by outboundTag + key, so enabling/editing one tab cannot clobber the other.
  • Block rules are sorted ahead of direct rules for correct Xray top-down matching.
  • i18n: pages.settings.block / blockDesc in all locales; reuses pages.xray.blockips / blockdomains for field labels.

Out of scope (follow-up): subJsonDomainStrategy UI/setting (requires make gen and backend plumbing).

Addresses #6072

Test plan

  • Open Settings → Subscription formats → enable Block; confirm default geosite:category-ads-all rule is written into subJsonRules with outboundTag: "block".
  • Enable Direct as well; confirm both block and direct rule objects coexist and block rules appear first in the JSON.
  • Toggle Direct off; confirm block rules remain. Toggle Block off; confirm direct rules remain. Toggle both off; confirm subJsonRules becomes empty.
  • Generate a JSON subscription and verify the client config includes the block outbound and the new routing rules.

🔄 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/6466 **Author:** [@mrchatam](https://github.com/mrchatam) **Created:** 9/11/2026 **Status:** ✅ Merged **Merged:** 9/12/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/sub-json-block-routing-tab` --- ### 📝 Commits (2) - [`11c9c9e`](https://github.com/MHSanaei/3x-ui/commit/11c9c9e81e705b14052ac40c88ff64d8361ba33d) feat(settings): add Block tab for JSON subscription routing rules - [`373accc`](https://github.com/MHSanaei/3x-ui/commit/373accc786877ffce10b2a35004effb03cbda933) fix(settings): preserve rule order and clear foreign leftovers ### 📊 Changes **14 files changed** (+124 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/settings/SubscriptionFormatsTab.tsx` (+98 -46) 📝 `internal/web/translation/ar-EG.json` (+2 -0) 📝 `internal/web/translation/en-US.json` (+2 -0) 📝 `internal/web/translation/es-ES.json` (+2 -0) 📝 `internal/web/translation/fa-IR.json` (+2 -0) 📝 `internal/web/translation/id-ID.json` (+2 -0) 📝 `internal/web/translation/ja-JP.json` (+2 -0) 📝 `internal/web/translation/pt-BR.json` (+2 -0) 📝 `internal/web/translation/ru-RU.json` (+2 -0) 📝 `internal/web/translation/tr-TR.json` (+2 -0) 📝 `internal/web/translation/uk-UA.json` (+2 -0) 📝 `internal/web/translation/vi-VN.json` (+2 -0) 📝 `internal/web/translation/zh-CN.json` (+2 -0) 📝 `internal/web/translation/zh-TW.json` (+2 -0) </details> ### 📄 Description ## Summary JSON subscription profiles already ship a `block` (blackhole) outbound and prepend `subJsonRules` verbatim, but the subscription formats UI only exposed Direct rules and hardcoded `outboundTag: "direct"`. This PR adds a **Block** tab next to Direct so operators can configure block domain/IP rules from the panel. - New Block tab writes separate rules with `outboundTag: "block"` (not `blocked`). - Direct/Block helpers locate rules by **outboundTag + key**, so enabling/editing one tab cannot clobber the other. - Block rules are sorted ahead of direct rules for correct Xray top-down matching. - i18n: `pages.settings.block` / `blockDesc` in all locales; reuses `pages.xray.blockips` / `blockdomains` for field labels. **Out of scope (follow-up):** `subJsonDomainStrategy` UI/setting (requires `make gen` and backend plumbing). Addresses #6072 ## Test plan - [ ] Open Settings → Subscription formats → enable Block; confirm default `geosite:category-ads-all` rule is written into `subJsonRules` with `outboundTag: "block"`. - [ ] Enable Direct as well; confirm both block and direct rule objects coexist and block rules appear first in the JSON. - [ ] Toggle Direct off; confirm block rules remain. Toggle Block off; confirm direct rules remain. Toggle both off; confirm `subJsonRules` becomes empty. - [ ] Generate a JSON subscription and verify the client config includes the block outbound and the new routing rules. --- <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:42 +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#6287
No description provided.