Commit graph

16 commits

Author SHA1 Message Date
MHSanaei
8e7d215b4a
feat(nodes): traffic-writer queue, full-mirror sync, WS event fixes
- Traffic-writer single-consumer queue (web/service/traffic_writer.go)
  serialises every DB write that touches up/down/all_time/last_online
  (AddTraffic, SetRemoteTraffic, Reset*, UpdateClientTrafficByEmail) so
  overlapping goroutines can no longer clobber each other's column-scoped
  Updates with a stale tx.Save.

- DB pool: WAL + busy_timeout=10s + synchronous=NORMAL + _txlock=
  immediate, MaxOpenConns=8 / MaxIdleConns=4. The immediate-tx PRAGMA
  fixes residual "database is locked [0ms]" cases where deferred-tx
  writer-upgrade conflicts bypass busy_timeout.

- SetRemoteTraffic full-mirrors node-authoritative state into central:
  settings JSON, remark, listen, port, total, expiry, all_time, enable,
  plus per-client total/expiry/reset/all_time. Inbounds and
  client_traffics rows present on node but missing from central are
  created; rows missing from snap are deleted (with cascading
  client_traffics removal).

- NodeTrafficSyncJob detects structural changes from the mirror and
  broadcasts invalidate(inbounds) so open central UIs re-fetch via REST
  on node-side add/del/edit without manual refresh.

- XrayTrafficJob broadcasts invalidate(inbounds) when auto-disable flips
  client_traffics.enable so the per-client toggle reflects depletion
  without manual refresh.

- Frontend: inbounds page now subscribes to the BroadcastInbounds 'inbounds'
  WS event (full-list pushes from add/del/update controllers were silently
  dropped). Fixes invalidate payload field (dataType -> type). Restart-
  panel modal switched from Promise-wrap to onOk-only so Cancel actually
  cancels.

- Node files trimmed of stale prose-comments; cron cadence dropped
  10s -> 5s to match the inbounds page UX.

- README badges and Go module path bumped v2 -> v3 to match module rename.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 16:25:23 +02:00
MHSanaei
3349dcbc13
fix(fail2ban): fix banning regression and Docker zero-jail issue
- DockerEntrypoint.sh: create jail.d/filter.d/action.d config files
  before starting fail2ban so Docker containers no longer start with
  0 active jails (fixes #4134)

- x-ui.sh create_iplimit_jails: lower maxretry from 2 to 1 so
  fail2ban bans on the first log entry; with maxretry=2 and the
  partitionLiveIps logic the second occurrence could arrive after the
  32 s findtime window, silently preventing any ban (fixes #4163)

- x-ui.sh: fix datepattern (%%Y -> %Y) so fail2ban parses the Go
  log timestamp correctly instead of looking for a literal %%Y string

- x-ui.sh / DockerEntrypoint.sh: fix date command in actionban /
  actionunban echo (%%Y -> %Y) so the ban log records actual dates

- check_client_ip_job.go: replace log.SetOutput / log.SetFlags on
  the global standard-library logger with a local log.New instance,
  eliminating the dangling closed-file-handle between calls and
  stopping unrelated stdlib log output from polluting 3xipl.log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 13:53:34 +02:00
fgsfds
6879a8fbcb
Moved DB to same app folder on Windows (#3340)
Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
* moved db to user folder on windows

* moved db to local appdata

* made getDBFolderPath func private

* added getWindowsDbPath() func

* fix

---------

Co-authored-by: mhsanaei <ho3ein.sanaei@gmail.com>
2025-08-13 23:19:59 +02:00
Ali Golzar
1b1cbfff42
feat: support .env file (#3013)
Some checks failed
Release 3X-UI / build (386) (push) Has been cancelled
Release 3X-UI / build (amd64) (push) Has been cancelled
Release 3X-UI / build (arm64) (push) Has been cancelled
Release 3X-UI / build (armv5) (push) Has been cancelled
Release 3X-UI / build (armv6) (push) Has been cancelled
Release 3X-UI / build (armv7) (push) Has been cancelled
Release 3X-UI / build (s390x) (push) Has been cancelled
2025-05-17 12:33:22 +02:00
mhsanaei
3ded4ee658
minor changes 2025-04-07 00:45:52 +02:00
Pk-web6936
7c58bcbb46
Consolidate and Optimize .gitignore Files (#2838)
* Update .gitignore
2025-03-30 11:32:42 +07:00
Hamidreza
64a5a9f1bc
Some fixes and improvements (#1997)
* [refactor] api controller

* [fix] access log path

better to not hardcode the access log path, maybe some ppl dont want to use the default ./access.log

* [fix] set select options from logs paths in xray settings

* [update] .gitignore

* [lint] all .go files

* [update] use status code for jsonMsg and 401 to unauthorize

* [update] handle response status code via axios

* [fix] set correct value if log paths is set to 'none'

we also use the default value for the paths if its set to none

* [fix] iplimit - only warning access log if f2b is installed
2024-03-11 01:01:24 +03:30
Hamidreza Ghavami
3166d497f9
Update .gitignore 2023-05-20 19:03:31 +04:30
Hamidreza Ghavami
733a011b28 update .gitignore 2023-05-05 22:59:31 +04:30
kaveh-ahangar
1680bb36c3 feat: Rollback files (.gitignore) 2023-05-05 12:43:09 +03:30
kaveh-ahangar
cd483c191a feat: Rollback files (.gitignore) 2023-05-05 12:42:05 +03:30
kaveh-ahangar
7d09b4e840 feat: Rollback files (main.go , Makefile) 2023-05-05 12:41:21 +03:30
kaveh-ahangar
9e63b0e2b3 feat: add Makefile and improve building 2023-05-04 19:20:52 +03:30
Hamidreza Ghavami
40a0297499 update .gitignore 2023-04-18 10:16:43 +04:30
MHSanaei
6d28c39ae8 en lang edit, new designed 2023-02-12 17:20:09 +03:30
MHSanaei
b73e4173a3 3x-ui 2023-02-09 22:48:06 +03:30