[GH-ISSUE #6665] [Feature]: 可以增强一下导出全部入站规则,导入全部入站规则吗 #4454

Open
opened 2026-10-31 20:39:46 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @xiaolv899 on GitHub (Sep 27, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6665

当入站规则比较多的情况这个功能就很有必要了,希望考虑一下

Describe the solution you'd like

当入站规则比较多的情况这个功能就很有必要了,希望考虑一下

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @xiaolv899 on GitHub (Sep 27, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6665 ### Is your feature request related to a problem? 当入站规则比较多的情况这个功能就很有必要了,希望考虑一下 ### Describe the solution you'd like 当入站规则比较多的情况这个功能就很有必要了,希望考虑一下 ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 27, 2026):

这是一个合理的功能请求。目前面板不支持一次导出或导入全部入站,只能逐个处理。下面是现有功能,以及现在可以用的替代办法。

当前代码里有什么

  1. 导出单个入站:入站列表每一行的操作菜单里有“导出入站”(frontend/src/pages/inbounds/list/RowActions.tsx:66-69,键名 pages.inbounds.exportInbound),它把单个入站的 JSON 复制到剪贴板。
  2. 导入单个入站:入站页顶部菜单里的“导入入站”会打开一个 JSON 文本框(frontend/src/pages/inbounds/InboundsPage.tsx:447-463),然后调用 POST /panel/api/inbounds/import。后端 importInbound(internal/web/controller/inbound.go:405-443)一次只解析一个对象:
    inbound := &model.Inbound{}
    err := json.Unmarshal([]byte(c.PostForm("data")), inbound)
    
    所以粘贴一个包含多个入站的 JSON 数组会失败。
  3. “导出全部链接 / 全部订阅”(InboundsPage.tsx:416-445)导出的是分享链接和订阅地址,不是可以重新导入的入站配置。

现在可用的替代办法

  • 整库备份/恢复:如果目的是迁移到另一台服务器,可以用数据库备份,它会带上全部入站、客户端和设置。对应接口是 GET /panel/api/server/getDb 和 POST /panel/api/server/importDB(internal/web/controller/server.go:56,78)。参见文档 docs/content/docs/zh/operations/backup-restore.mdx。
  • 脚本批量处理:先用 GET /panel/api/inbounds/list 拿到全部入站,再对每一项依次调用 POST /panel/api/inbounds/import。

供维护者参考:真正实现批量导入,需要让 importInbound 接受数组(或者新增一个路由),并对每一项做和现在一样的 Id/NodeID/ClientStats 处理。另外要注意,同一批里的端口或 tag 可能和已有入站冲突。客户端的批量导出/导入已经有了(internal/web/service/client_portable.go 里的 ExportAll),可以作为参考。

相关:#4903(客户端导出/导入的请求,现在已经实现)。

Verdict: Feature request

此回复由自动分析生成,维护者可能会进一步跟进。

<!-- gh-comment-id:5854123633 --> @github-actions[bot] commented on GitHub (Sep 27, 2026): 这是一个合理的功能请求。目前面板**不支持**一次导出或导入全部入站,只能逐个处理。下面是现有功能,以及现在可以用的替代办法。 **当前代码里有什么** 1. **导出单个入站**:入站列表每一行的操作菜单里有“导出入站”(`frontend/src/pages/inbounds/list/RowActions.tsx:66-69`,键名 `pages.inbounds.exportInbound`),它把单个入站的 JSON 复制到剪贴板。 2. **导入单个入站**:入站页顶部菜单里的“导入入站”会打开一个 JSON 文本框(`frontend/src/pages/inbounds/InboundsPage.tsx:447-463`),然后调用 `POST /panel/api/inbounds/import`。后端 `importInbound`(`internal/web/controller/inbound.go:405-443`)一次只解析**一个**对象: ```go inbound := &model.Inbound{} err := json.Unmarshal([]byte(c.PostForm("data")), inbound) ``` 所以粘贴一个包含多个入站的 JSON 数组会失败。 3. “导出全部链接 / 全部订阅”(`InboundsPage.tsx:416-445`)导出的是分享链接和订阅地址,**不是**可以重新导入的入站配置。 **现在可用的替代办法** - **整库备份/恢复**:如果目的是迁移到另一台服务器,可以用数据库备份,它会带上全部入站、客户端和设置。对应接口是 `GET /panel/api/server/getDb` 和 `POST /panel/api/server/importDB`(`internal/web/controller/server.go:56,78`)。参见文档 `docs/content/docs/zh/operations/backup-restore.mdx`。 - **脚本批量处理**:先用 `GET /panel/api/inbounds/list` 拿到全部入站,再对每一项依次调用 `POST /panel/api/inbounds/import`。 **供维护者参考**:真正实现批量导入,需要让 `importInbound` 接受数组(或者新增一个路由),并对每一项做和现在一样的 `Id`/`NodeID`/`ClientStats` 处理。另外要注意,同一批里的端口或 tag 可能和已有入站冲突。客户端的批量导出/导入已经有了(`internal/web/service/client_portable.go` 里的 `ExportAll`),可以作为参考。 相关:#4903(客户端导出/导入的请求,现在已经实现)。 Verdict: Feature request *此回复由自动分析生成,维护者可能会进一步跟进。* <!-- claude-issue:analyst -->
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#4454
No description provided.