Commit graph

2322 commits

Author SHA1 Message Date
Sora39831
6eba2ac375 Remove docs from repository 2026-04-06 17:09:15 +08:00
Sora39
74a51e4265
Merge pull request #8 from Sora39831/Limit
Limit
2026-04-06 17:05:43 +08:00
Sora39831
2fad726ee1 Change IP limit to 3-minute temporary disable 2026-04-06 16:58:43 +08:00
Sora39831
e468a08a54 Fix IP limit fallback Xray API port resolution 2026-04-06 16:31:39 +08:00
Sora39831
9864224897 fix(iplimit): enforce limit without fail2ban via xray api fallback 2026-04-06 16:04:27 +08:00
Sora39831
2008ae6dc3 style(go): gofmt check_client_ip_job 2026-04-06 15:52:25 +08:00
Sora39831
c085fc3814 fix(iplimit): keep IP records working without fail2ban 2026-04-06 15:45:55 +08:00
Sora39831
03144a16ca fix(mariadb): quote settings key column in xray template queries 2026-04-06 11:04:43 +08:00
Sora39831
15144e199d test(limit): add regression tests for reentry and disabled-limit unban
- inject lightweight hooks in CheckDeviceLimitJob for deterministic tests

- add tests for run re-entrancy, disabled enforcement unban, and stale ban cleanup
2026-04-06 10:49:11 +08:00
Sora39831
83b61d9da4 feat(limit): add inbound device-limit enforcement with safe unban flow
- add inbound deviceLimit model/frontend fields and translations

- add CheckDeviceLimitJob with observation window and xray API ban/unban

- prevent job re-entrancy and restore users when limit is disabled

- reduce lock scope via snapshots to avoid blocking log parsing
2026-04-06 10:46:48 +08:00
Sora39831
4a1dac89b6 fix(inbounds): avoid undefined filterEmailOption in client form 2026-04-05 04:40:24 +08:00
Sora39
ba06dcbfb8
Merge pull request #7 from Sora39831/codex
Delete user inbounds and sync-remove inbound clients
2026-04-05 03:59:25 +08:00
Sora39831
67d24ca0e6 fix(user): sync-remove inbound clients when deleting managed user 2026-04-05 03:52:41 +08:00
Sora39831
dfbe02c2b8 feat(user): delete all user inbounds when deleting user 2026-04-05 03:40:32 +08:00
Sora39
d3897398bd
Merge pull request #6 from Sora39831/codex
Fix turnstile rendering and migration panic; update release workflow
2026-04-05 03:17:42 +08:00
Sora39831
062f2bd714 fix migrate panic and include release workflow updates 2026-04-05 03:12:29 +08:00
Sora39831
7db5b9e214 fix(login): reliably render turnstile on register tab 2026-04-05 02:55:28 +08:00
Sora39831
67e0fb62b4 ci: optimize release workflow 2026-04-05 02:31:22 +08:00
Sora39831
78767c082e feat(users): cascade delete user-owned inbounds when deleting user 2026-04-04 22:35:33 +08:00
Sora39831
0775c5f10d fix(panel): correct user.html i18n quoting to avoid template parse failure 2026-04-04 22:16:34 +08:00
Sora39831
b03bb96899 fix(panel): resolve blank /panel/user caused by invalid i18n template quotes 2026-04-04 20:04:38 +08:00
Sora39831
ec70c4ce07 feat: add user email dropdown for inbound clients 2026-04-04 15:05:37 +08:00
Sora39831
2a9d9a0a6b feat: add admin user management 2026-04-04 14:59:40 +08:00
Sora39831
b0ce1a7ace refactor(settings): organize x-ui.json by module and purpose 2026-04-04 14:46:24 +08:00
Sora39831
4a5d8aa702 fix(settings): preserve turnstile and omitted config fields 2026-04-04 14:45:31 +08:00
Sora39831
37c184aa45 Fix shared-email client traffic deletion scope 2026-04-04 14:29:37 +08:00
Sora39831
d192056af2 ci: run analyze and build jobs in parallel
Remove build's dependency on analyze so both jobs execute concurrently.
2026-04-03 16:37:22 +08:00
Sora39
5026795c0e
Merge pull request #3 from Sora39831/dev
Add MariaDB installation detection and fix auth failure
2026-04-03 11:21:34 +08:00
Sora39831
90c5e72f1d fix: set AllowNativePasswords in MariaDB DSN to fix auth failure
Zero-value struct literal caused allowNativePasswords=false to be
written into the DSN, rejecting mysql_native_password auth from
the MariaDB server.
2026-04-03 11:20:54 +08:00
Sora39831
9fe77450b9 feat: add MariaDB installation detection and database creation in x-ui.sh 2026-04-03 10:28:46 +08:00
Sora39831
0cfa431107 feat: add MariaDB installation detection and database creation in x-ui.sh 2026-04-03 10:28:25 +08:00
Sora39
e74ae4ef1f
Merge pull request #2 from Sora39831/dev
Enhance user registration, dashboard, and MariaDB support
2026-04-03 10:04:19 +08:00
Sora39831
c94372a22c fix: address all code review issues for MariaDB support
- Prevent DBPassword from leaking to frontend (json:"-")
- Make migration direction explicit via --direction flag, set dbType only after success
- Use driver-appropriate DROP INDEX IF EXISTS for SQLite vs MariaDB
- Build DSN with mysql.Config.FormatDSN() to prevent injection with special chars
- Close DB before re-initialization in InitDB
- Add migration tests (5 tests using SQLite in-memory DBs)
- Parse JSON once in GetDBConfigFromJSON instead of 7 times
- Use Go binary for dbType in shell script instead of fragile grep
- Add rollback on failure in db_switch_to_sqlite
- Validate DB settings in CheckValid
2026-04-03 09:53:20 +08:00
Sora39831
7f015ad27b fix: address code review issues for MariaDB support
- Close migration DB connections with defer to prevent leaks
- Truncate destination tables before migration to avoid duplicates
- Wrap migration in transaction for atomicity
- Pass DB password via env var instead of CLI args to avoid process list exposure
- Improve error messages for MariaDB export/import with alternatives
- Update package doc to reflect dual DB support
- DRY migration logic with shared migrateAllTables function
2026-04-03 09:39:53 +08:00
Sora39831
cf720b6c5b fix: prevent double-hashing of passwords in fresh DB init 2026-04-03 09:34:17 +08:00
Sora39831
3a9dcd10df feat: add migrate-db subcommand and DB setting CLI flags 2026-04-03 09:33:15 +08:00
Sora39831
f81075fa9e deps: add gorm.io/driver/mysql for MariaDB support 2026-04-03 09:32:55 +08:00
Sora39831
ecc724b787 feat: add database management menu (option 27) to x-ui.sh 2026-04-03 09:31:56 +08:00
Sora39831
d0592a1be8 feat: add DB fields to AllSetting struct for web panel API 2026-04-03 09:30:26 +08:00
Sora39831
8a20cbd5c2 feat: guard GetDb/ImportDB for MariaDB (unsupported SQLite-specific operations) 2026-04-03 09:29:53 +08:00
Sora39831
fd910efec2 feat: add bidirectional SQLite<->MariaDB data migration 2026-04-03 09:29:30 +08:00
Sora39831
2647c2c2ce refactor: update InitDB callers to use new parameterless signature 2026-04-03 09:27:10 +08:00
Sora39831
283892c548 feat: refactor InitDB to be driver-agnostic with SQLite/MariaDB dispatch 2026-04-03 09:26:42 +08:00
Sora39831
e3d1a94d89 feat: add JSON config helpers for DB type and MariaDB settings 2026-04-03 09:24:39 +08:00
Sora39831
5ed8037464 feat: add MariaDB settings to SettingService 2026-04-03 09:24:18 +08:00
Sora39831
82a1b85d45 docs: add MariaDB support design spec
Design for adding MariaDB as alternative database backend with
data migration, x-ui.sh switching UI, and driver-agnostic InitDB.
2026-04-03 09:14:20 +08:00
Sora39831
09f84782b0 test: add unit tests for critical modules and fix flaky redirect middleware
- Add tests for config, database, model, util/common, util/crypto,
  util/random, web/middleware, web/service, and xray packages
- Fix redirect middleware using slice instead of map to guarantee
  deterministic longest-prefix-first matching order
2026-04-03 08:44:51 +08:00
Sora39831
d43f8683b0 feat: enhance user dashboard, set default creds to admin, trim i18n to en/zh only
- install.sh: default username/password to admin on fresh install
- user.go: UpdateFirstUser resets Role to admin, preventing lockout
- user.html: show remaining traffic and last online time
- i18n: remove 11 translation files, keep only en_US and zh_CN
- LanguageManager: trim supportedLanguages to 2 entries, remove simularLangs
2026-04-03 08:13:27 +08:00
Sora39831
463b07db52 feat: add user dashboard with role-based access control
Add a simplified dashboard page for non-admin users showing username,
traffic usage, expiry time, and logout button. Implement role-based
routing so user-role accounts are redirected to their own dashboard
instead of the admin panel. Add getUserInfo API endpoint and i18n
translations across all 13 supported locales.
2026-04-03 03:29:51 +08:00
Sora39831
3045b630f0 fix: use render=explicit and HTMLElement for Turnstile to fix Rocket Loader conflict
- Add ?render=explicit to api.js URL to disable auto-initialization
- Pass HTMLElement (not selector string) to turnstile.render() and turnstile.reset()
- Prevents race condition where Turnstile auto-renders before body DOM is parsed
2026-04-03 03:01:18 +08:00