mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5004] [Feature]: Add toggles for not exporting host-specific options #3520
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#3520
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 @Michael-YS on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5004
Is your feature request related to a problem?
The db export right now would also export machine specific configs such as cert details, which makes transferring to another host almost impossible.
Describe the solution you'd like
In the export page, add options to not include ssl configurations
Alternatives you've considered
I tried manually edit the exported db files to remove those ssl lines. However, after uploading it to the panel, it overwrites the existing ssl configs.
Concrete use case
Say I have 2 machines, with 3x-ui installed on machine A. Now I want to install the same config on machine B. I export the db from Machine A and import it to Machine B. And now the panel broke due to ssl config errors.
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Other
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 6, 2026):
Thanks for the well-described report — this is a valid and reproducible issue with the current export/import flow.
What's happening under the hood
GET /panel/api/server/getDb(the "Export Database" button inBackupModal.tsx) sends the entire raw SQLite file byte-for-byte. All panel settings are stored as key-value rows in a singlesettingstable, so there's no filtering — everything is exported together: inbounds, clients, users, and host-specific panel settings.POST /panel/api/server/importDBthen replaces the entire database (web/service/server.go~L1300), overwriting every setting on the destination machine, including its own cert paths, ports, and base path.Which settings are host-specific
The keys that typically differ between machines (defined in
web/service/setting.go):webCertFile/webKeyFilesubCertFile/subKeyFilewebPort/webListen/webDomainwebBasePathsubPort/subListen/subDomain/subPathsecretapiTokenAfter an import these are all overwritten with the values from machine A, so if machine B doesn't have certs at the same file paths (or uses a different port/base path) the panel will fail to start TLS.
Possible implementation approaches
"Export without settings" endpoint — a new backend route that dumps only the
inbounds,client_traffics,users, and related tables (notsettings), and a matching import that merges only those tables while leavingsettingsuntouched on the destination. This is the cleanest solution because it clearly separates inbound configuration from host configuration.Selective import — on import, copy the uploaded DB but then restore a list of known host-specific keys from the destination's current DB before swapping. Simpler to implement but requires maintaining a hardcoded allowlist of keys to preserve.
Export with UI toggles (as requested) — add checkboxes in
BackupModal.tsxto include/exclude thesettingstable or specific key groups. This requires a parameterized export endpoint and a non-raw export format (e.g. JSON or a filtered SQL dump), since the current raw-file approach can't omit individual table rows.Approach 1 or 2 are probably the most practical starting points. If you or someone wants to implement this, the main files to touch are:
web/service/server.go—GetDb/ImportDB(or new variants)web/controller/server.go— add/modify routesfrontend/src/pages/index/BackupModal.tsx— add the UI controls@AndreyKaller commented on GitHub (Jun 6, 2026):
Indeed, I agree with the author. Migrating is completely pointless without a complete reinstallation of 3x-ui. Because the old server settings (the path to the subscriptions, the subscription links themselves, the ports) simply don't work on the new hardware. And you have to reissue keys. Even if you manually enter everything and replicate the old paths on the new host, subscriptions will still return an error and won't be able to update. Because these paths don't create new user settings. I think a complete, turnkey migration function needs to be developed!