3x-ui/web/controller
MHSanaei cc34dc381c
feat(postgres): in-panel backup/restore and consistent CLI backend
Two PostgreSQL gaps on the panel:

1. x-ui setting and other CLI subcommands read XUI_DB_TYPE/XUI_DB_DSN from
   the process environment, which systemd injects via EnvironmentFile but a
   plain shell invocation does not. On a PostgreSQL install the CLI silently
   fell back to SQLite, so changes made from the management menu never
   reached the panel's database. Load the systemd EnvironmentFile
   (/etc/default/x-ui and distro equivalents) at startup; godotenv.Load does
   not override existing vars, so it stays a no-op for the managed service.

2. DB backup/restore (panel endpoints and the Telegram bot) only handled the
   SQLite file, so on PostgreSQL Back Up returned a stale/absent x-ui.db and
   Restore silently did nothing. Add pg_dump/pg_restore based backup/restore:
   - GetDb/ImportDB run pg_dump (custom format) / pg_restore, passing
     credentials via the PG* environment instead of argv.
   - getDb downloads x-ui.dump on Postgres, x-ui.db on SQLite.
   - Telegram backup sends the matching file via GetDb.
   - BackupModal shows a Postgres note and accepts .dump; the dist page
     injects window.X_UI_DB_TYPE; new strings translated for all locales.
   - install.sh installs postgresql-client for the external-DSN path and
     points the user to in-panel Backup & Restore.

Closes #4658
2026-05-31 17:53:34 +02:00
..
api.go refactor(clients): coherent group management — rename, split, extract 2026-05-28 12:59:20 +02:00
api_docs_test.go refactor(clients): coherent group management — rename, split, extract 2026-05-28 12:59:20 +02:00
base.go v3 2026-05-10 02:13:42 +02:00
client.go refactor(clients): coherent group management — rename, split, extract 2026-05-28 12:59:20 +02:00
custom_geo.go v3 2026-05-10 02:13:42 +02:00
dist.go feat(postgres): in-panel backup/restore and consistent CLI backend 2026-05-31 17:53:34 +02:00
group.go refactor(clients): coherent group management — rename, split, extract 2026-05-28 12:59:20 +02:00
inbound.go feat(inbounds): add multi-select and bulk delete 2026-05-31 00:29:24 +02:00
index.go fix(auth): invalidate sessions when 2FA is enabled, fix dev 401 loop 2026-05-13 14:08:16 +02:00
login_limiter.go Implement CSRF protection and security hardening across the application (#4179) 2026-05-07 23:36:11 +02:00
login_limiter_test.go refactor(websocket): split controller into service + thin controller 2026-05-08 00:00:44 +02:00
node.go feat: complete Zod migration of frontend + bulk client batching (#4599) 2026-05-27 04:26:50 +02:00
server.go feat(postgres): in-panel backup/restore and consistent CLI backend 2026-05-31 17:53:34 +02:00
setting.go feat: complete Zod migration of frontend + bulk client batching (#4599) 2026-05-27 04:26:50 +02:00
util.go Client/inbound resilience + Postgres pool tuning + schema fixes (#4607) 2026-05-27 22:51:37 +02:00
util_test.go Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00
websocket.go v3 2026-05-10 02:13:42 +02:00
xray_setting.go Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00
xui.go feat(frontend): TanStack Query + React Router migration & in-panel API docs (#4541) 2026-05-24 21:34:52 +02:00