3x-ui/web
Ali Golzar 3850e2f070
feat: Add MySQL database support (#3024)
* feat: Add MySQL database support

- Add MySQL database support with environment-based configuration
- Fix MySQL compatibility issue with 'key' column name
- Maintain SQLite as default database
- Add proper validation for MySQL configuration
- Test and verify compatibility with existing database
- Replaced raw SQL queries using JSON_EACH functions with standard GORM queries
- Modified functions to handle JSON parsing in Go code instead of database since JSON_EACH is not available on MySQL or MariaDB:
  - getAllEmails()
  - GetClientTrafficByID()
  - getFallbackMaster()
  - MigrationRemoveOrphanedTraffics()

The system now supports both MySQL and SQLite databases, with SQLite remaining as the default option. MySQL connection is only used when explicitly configured through environment variables.

* refactor: prefix env variables of database with XUI_ to support direct environment usage without .env file

All database configuration environment variables now start with the XUI_ prefix to avoid conflicts and allow configuration via system-level environment variables, not just the .env file.
2025-05-21 12:04:38 +02:00
..
assets chore: implement 2fa auth (#2968) 2025-05-08 16:20:58 +02:00
controller fix: handle inbounds interaction errors (#3009) 2025-05-16 23:56:56 +07:00
entity chore: implement 2fa auth (#2968) 2025-05-08 16:20:58 +02:00
global Some fixes and improvements (#1997) 2024-03-11 01:01:24 +03:30
html fix: 2fa qr-code (#2996) 2025-05-11 02:12:43 +02:00
job Refactor: Use any instead of interface{} 2025-03-12 20:43:43 +01:00
locale Refactor: Use any instead of interface{} 2025-03-12 20:43:43 +01:00
middleware Fix domain validation for Nginx/CDN compatibility #2450 2024-08-08 17:39:12 +02:00
network Add tgLang option 2023-05-20 19:15:20 +04:30
service feat: Add MySQL database support (#3024) 2025-05-21 12:04:38 +02:00
session fix session 2024-12-16 14:24:59 +01:00
translation chore: simplified chinese translate improved 2025-05-10 22:42:23 +07:00
web.go revert group management (#2656) 2025-02-04 11:27:58 +01:00