mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-26 13:07:14 +00:00
feat(server): keep this machine's own settings when importing a database (#6227)
* feat(server): keep this machine's own settings when importing a database Import replaces the database wholesale, so the uploaded file's listen addresses, ports, base path, certificate paths and node identity land on the destination. Moving a configuration to a new host therefore leaves the panel answering on an address it does not own, presenting certificates it does not have, and claiming the source machine's identity towards its nodes. Capture the host-bound settings before the swap and write them back once the imported database opens. Everything else — inbounds, clients, templates, the rest of the settings — still comes from the file. A checkbox controls it, defaulting to keeping this machine's values; clearing it restores the old behaviour for anyone deliberately cloning a host. * fix(server): drop imported host settings this machine never had, and cover Postgres Two gaps in the previous commit. The snapshot only recorded rows that existed, so a key with no row here — the default for every certificate path, both listen addresses and all the node mTLS material — kept the imported value: exactly the case the change is meant to fix. The snapshot now records which keys were absent and deletes the imported row for them, letting the default apply again. The PostgreSQL path took the flag and ignored it, so a dump restore still adopted the source machine's settings. It now captures and restores the same way the SQLite path does. * chore: drop the accidentally committed dist build stub internal/web/dist/.gitkeep is what make dist-stub creates locally. Committing it changes fresh-clone behaviour for everyone: today a bare go build fails loudly on //go:embed all:dist, which is the documented signal to run the stub target; with the file present the build succeeds and the panel serves an empty dist instead. --------- Co-authored-by: n0ctal <n0ctal@users.noreply.github.com> Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "إجمالي المرسل/المستقبل",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Total Sent/Received",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Subidas/Descargas Totales",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "دریافت/ارسال کل",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Total Terkirim/Diterima",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "総アップロード / ダウンロード",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Total Enviado/Recebido",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Ошибка",
|
||||
"accessDirect": "НАПРЯМУЮ",
|
||||
"accessBlocked": "ЗАБЛОКИРОВАНО",
|
||||
"accessProxy": "ЧЕРЕЗ ПРОКСИ"
|
||||
"accessProxy": "ЧЕРЕЗ ПРОКСИ",
|
||||
"importKeepHostSettings": "Сохранить настройки этой машины",
|
||||
"importKeepHostSettingsDesc": "Оставляет адреса и порты этой панели, базовый путь, сертификаты и удостоверение для узлов вместо тех, что в загруженном файле."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Отправлено/получено",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Toplam Gönderilen/Alınan",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Помилка",
|
||||
"accessDirect": "НАПРЯМУ",
|
||||
"accessBlocked": "ЗАБЛОКОВАНО",
|
||||
"accessProxy": "ЧЕРЕЗ ПРОКСІ"
|
||||
"accessProxy": "ЧЕРЕЗ ПРОКСІ",
|
||||
"importKeepHostSettings": "Зберегти налаштування цієї машини",
|
||||
"importKeepHostSettingsDesc": "Залишає адреси та порти цієї панелі, базовий шлях, сертифікати та посвідчення для вузлів замість тих, що у завантаженому файлі."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Всього надісланих/отриманих",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "Tổng tải lên/tải xuống",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "总上传 / 下载",
|
||||
|
||||
@@ -266,7 +266,9 @@
|
||||
"logLevelError": "Error",
|
||||
"accessDirect": "DIRECT",
|
||||
"accessBlocked": "BLOCKED",
|
||||
"accessProxy": "PROXY"
|
||||
"accessProxy": "PROXY",
|
||||
"importKeepHostSettings": "Keep this machine's settings",
|
||||
"importKeepHostSettingsDesc": "Keeps this panel's listen addresses, ports, base path, certificates and node identity instead of taking them from the uploaded file."
|
||||
},
|
||||
"inbounds": {
|
||||
"totalDownUp": "總上傳 / 下載",
|
||||
|
||||
Reference in New Issue
Block a user