mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5222] [Feature]: Implement separated (modular) backup files for Inbounds and Clients in Telegram bot notifications #3659
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3659
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @solidwar on GitHub (Jun 12, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5222
Is your feature request related to a problem?
Yes. While the panel already provides a full backup file, it contains all the database configurations mixed together. If an administrator only needs to migrate, review, or restore specific Inbounds or just the Clients' data, they have to deal with a large, cluttered file. It is inefficient to filter through system logs, panel settings, and core configs just to extract user or inbound data during an emergency or migration.
Describe the solution you'd like
Since the full backup is already available, I would like to propose an option to generate and send separated (modular) backup files specifically for Inbounds and Clients.
How it should work:
inbounds_backup.jsonandclients_backup.json).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?
Before submitting
@github-actions[bot] commented on GitHub (Jun 12, 2026):
This is a valid feature request. Here is what the current implementation does and what a contribution would need to touch.
Current backup behavior (confirmed in source)
sendBackup()ininternal/web/service/tgbot/tgbot_report.go(lines 398–443) sends two files:x-ui.db) or a PostgreSQL dump (x-ui.dump), viaserverService.GetDb().config.jsongenerated by Xray.This is the only backup path. There is no existing option to export inbounds or clients as separate JSON documents. The feature is triggered on-demand via the "DB Backup" inline keyboard button (
tgbot_send.go:34, callbackget_backupintgbot_router.go:1130) and optionally on a schedule when thetgBotBackupsetting is enabled (internal/web/service/setting.go:55).What a PR would need to implement
Data serialization —
InboundService.GetAllInbounds()(defined ininternal/web/service/inbound.go:341) already returns a[]*model.Inboundslice including nested client stats. The inbound model (internal/database/model/) stores settings as JSON strings in columns likesettingsandstream_settings; encoding the slice to JSON and wrapping it in atu.FileFromBytesdocument is the straightforward path. Clients can be derived from the same inbound slice (eachInbound.ClientStatscontains the per-client records) or queried separately.New setting — A new boolean key (similar to
tgBotBackupininternal/web/service/setting.go:55) would control whether modular backups are sent. The UI for it lives in the Telegram Bot section of the settings page (frontend/src/); a toggle there would need to persist the new key via the settings API.New tgbot functions — A
sendModularBackup(chatId int64)(or two separate functions) intgbot_report.gothat serialize and send the JSON documents. A new callback case intgbot_router.goand an optional new inline keyboard button intgbot_send.goif on-demand triggering is desired.i18n — New message/button keys in all 13 translation files under
internal/web/translation/.Scheduled send — If the modular backups should be sent automatically alongside the existing full backup, the dispatch point is
internal/web/service/tgbot/tgbot_report.go:40–43.Design note
The
Inbound.SettingsandInbound.StreamSettingsfields are already serialized JSON stored as strings in the database, so a round-trip export is clean. However, the exported JSON would not be directly importable via the panel's existing import flow without a matching import endpoint being added as well; that is a separate concern and out of scope for this request as written.If you intend to open a PR, the above gives a concrete list of files to modify. The bot is in
internal/web/service/tgbot/, settings service ininternal/web/service/setting.go, and the data layer ininternal/web/service/inbound.go.This reply was generated automatically; a maintainer may follow up.