[PR #5677] [MERGED] feat(hosts): bulk-add multiple hosts to multiple inbounds #5958

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5677
Author: @AmirRnz
Created: 6/30/2026
Status: ✅ Merged
Merged: 7/8/2026
Merged by: @MHSanaei

Base: main ← Head: feat/multi-hosts-bulk


📝 Commits (10+)

  • 849e075 feat(hosts): bulk-add multiple hosts to multiple inbounds
  • 79eb894 feat(hosts): group override records by group_id and support group editing
  • 368a9fe fix: import Popover in HostList
  • 9659de3 fix: use messageApi in HostFormModal
  • 5d347c9 fix(hosts): resolve 4 bugs found in host-group code review
  • 54d02d4 Merge remote-tracking branch 'origin/main' into feat/multi-hosts-bulk
  • 9db9002 Merge branch 'main' into feat/multi-hosts-bulk
  • 2e5e4ff fix(hosts): address code review feedback (optimize bulk inserts, add validation tests, and remove comments)
  • 41815f4 Merge remote-tracking branch 'origin/main' into feat/multi-hosts-bulk
  • 77b88d4 Merge branch 'main' into feat/multi-hosts-bulk

📊 Changes

33 files changed (+1815 additions, -1081 deletions)

View changed files

📝 frontend/public/openapi.json (+474 -328)
📝 frontend/src/api/queries/useHostMutations.ts (+19 -19)
📝 frontend/src/generated/examples.ts (+48 -0)
📝 frontend/src/generated/schemas.ts (+174 -159)
📝 frontend/src/generated/types.ts (+35 -0)
📝 frontend/src/generated/zod.ts (+36 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+35 -25)
📝 frontend/src/pages/hosts/HostFormModal.tsx (+67 -35)
📝 frontend/src/pages/hosts/HostList.tsx (+92 -37)
📝 frontend/src/pages/hosts/HostsPage.tsx (+29 -40)
📝 frontend/src/schemas/api/host.ts (+9 -21)
📝 internal/database/db.go (+42 -95)
📝 internal/database/host_test.go (+1 -2)
📝 internal/database/model/model.go (+1 -4)
📝 internal/web/controller/host.go (+24 -41)
📝 internal/web/controller/host_test.go (+55 -33)
📝 internal/web/entity/entity.go (+119 -101)
📝 internal/web/service/host.go (+273 -61)
📝 internal/web/service/host_test.go (+243 -55)
📝 internal/web/translation/ar-EG.json (+3 -2)

...and 13 more files

📄 Description

Summary

Adds a bulk host creation flow that lets users select multiple inbounds
and enter multiple host addresses in one form submission, with optional
per-host port overrides (e.g. host.com, host.com:443, [2001:db8::1]:80).

Why

Managing hosts becomes painful at scale. A user with many inbounds and
repeated host addresses (e.g. 1.1.1.1 and 1.1.1.2 for every inbound)
was forced to do it one by one. This change lets them set up all
combinations in a single submit.

A common real-world example: using Cloudflare CDN clean IPs. You may
have a set of working Cloudflare IPs (e.g. 104.21.x.x, 172.67.x.x)
that you want to attach to all of your inbounds so clients can find the
fastest route. With 10 inbounds and 5 IPs that's 50 individual form
submissions. This change reduces that to a single submit — pick all 10
inbounds, paste the 5 IPs, done.

The same pain applies when IPs need to be rotated or updated. Cloudflare
clean IPs change over time and users periodically need to swap out stale
addresses for fresh ones. Previously that meant deleting the old entries
and re-adding the new ones one by one across every inbound. With bulk add,
re-populating a fresh set of IPs across all inbounds takes seconds.

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?

Deployed and tested on a live VPS (Linux) — all scenarios below were
verified end-to-end with a real SQLite database and the full Go binary.

Screenshots / recordings

you can find it in the next comment

Breaking changes

None.

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 test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run 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/5677 **Author:** [@AmirRnz](https://github.com/AmirRnz) **Created:** 6/30/2026 **Status:** ✅ Merged **Merged:** 7/8/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/multi-hosts-bulk` --- ### 📝 Commits (10+) - [`849e075`](https://github.com/MHSanaei/3x-ui/commit/849e075db25ea1d3084dc67a9cf3bb3291ddbf12) feat(hosts): bulk-add multiple hosts to multiple inbounds - [`79eb894`](https://github.com/MHSanaei/3x-ui/commit/79eb894827efbb1138cf30534d2e402bf520a0d2) feat(hosts): group override records by group_id and support group editing - [`368a9fe`](https://github.com/MHSanaei/3x-ui/commit/368a9feb8bd965547c74f6df96c11c1f37857fd2) fix: import Popover in HostList - [`9659de3`](https://github.com/MHSanaei/3x-ui/commit/9659de35ea1e2fdaef4db054aaf7dd75b3f67787) fix: use messageApi in HostFormModal - [`5d347c9`](https://github.com/MHSanaei/3x-ui/commit/5d347c9dad2fc58cb59c9fd7494eaef7cbcb97f3) fix(hosts): resolve 4 bugs found in host-group code review - [`54d02d4`](https://github.com/MHSanaei/3x-ui/commit/54d02d470af4cabd49923cefeba2119ef96e47ff) Merge remote-tracking branch 'origin/main' into feat/multi-hosts-bulk - [`9db9002`](https://github.com/MHSanaei/3x-ui/commit/9db900247cce2958dbb941eec58e0aecd16514c6) Merge branch 'main' into feat/multi-hosts-bulk - [`2e5e4ff`](https://github.com/MHSanaei/3x-ui/commit/2e5e4ff6758d16d22e367546d1b213991dd36b91) fix(hosts): address code review feedback (optimize bulk inserts, add validation tests, and remove comments) - [`41815f4`](https://github.com/MHSanaei/3x-ui/commit/41815f4f1c9c73a332d336dace2437757d2ff272) Merge remote-tracking branch 'origin/main' into feat/multi-hosts-bulk - [`77b88d4`](https://github.com/MHSanaei/3x-ui/commit/77b88d4182c15e41fd3df55a8a918d3714aa4148) Merge branch 'main' into feat/multi-hosts-bulk ### 📊 Changes **33 files changed** (+1815 additions, -1081 deletions) <details> <summary>View changed files</summary> 📝 `frontend/public/openapi.json` (+474 -328) 📝 `frontend/src/api/queries/useHostMutations.ts` (+19 -19) 📝 `frontend/src/generated/examples.ts` (+48 -0) 📝 `frontend/src/generated/schemas.ts` (+174 -159) 📝 `frontend/src/generated/types.ts` (+35 -0) 📝 `frontend/src/generated/zod.ts` (+36 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+35 -25) 📝 `frontend/src/pages/hosts/HostFormModal.tsx` (+67 -35) 📝 `frontend/src/pages/hosts/HostList.tsx` (+92 -37) 📝 `frontend/src/pages/hosts/HostsPage.tsx` (+29 -40) 📝 `frontend/src/schemas/api/host.ts` (+9 -21) 📝 `internal/database/db.go` (+42 -95) 📝 `internal/database/host_test.go` (+1 -2) 📝 `internal/database/model/model.go` (+1 -4) 📝 `internal/web/controller/host.go` (+24 -41) 📝 `internal/web/controller/host_test.go` (+55 -33) 📝 `internal/web/entity/entity.go` (+119 -101) 📝 `internal/web/service/host.go` (+273 -61) 📝 `internal/web/service/host_test.go` (+243 -55) 📝 `internal/web/translation/ar-EG.json` (+3 -2) _...and 13 more files_ </details> ### 📄 Description ## Summary Adds a bulk host creation flow that lets users select multiple inbounds and enter multiple host addresses in one form submission, with optional per-host port overrides (e.g. `host.com`, `host.com:443`, `[2001:db8::1]:80`). ## Why Managing hosts becomes painful at scale. A user with many inbounds and repeated host addresses (e.g. `1.1.1.1` and `1.1.1.2` for every inbound) was forced to do it one by one. This change lets them set up all combinations in a single submit. A common real-world example: using Cloudflare CDN clean IPs. You may have a set of working Cloudflare IPs (e.g. `104.21.x.x`, `172.67.x.x`) that you want to attach to all of your inbounds so clients can find the fastest route. With 10 inbounds and 5 IPs that's 50 individual form submissions. This change reduces that to a single submit — pick all 10 inbounds, paste the 5 IPs, done. The same pain applies when IPs need to be rotated or updated. Cloudflare clean IPs change over time and users periodically need to swap out stale addresses for fresh ones. Previously that meant deleting the old entries and re-adding the new ones one by one across every inbound. With bulk add, re-populating a fresh set of IPs across all inbounds takes seconds. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [x] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? **Deployed and tested on a live VPS (Linux)** — all scenarios below were verified end-to-end with a real SQLite database and the full Go binary. ## Screenshots / recordings you can find it in the next comment ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run 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:05:18 +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#5958
No description provided.