From 8177f6dc667f2edca66073e433baf5cff36cda41 Mon Sep 17 00:00:00 2001 From: lolka1333 Date: Tue, 5 May 2026 18:27:49 +0300 Subject: ws/inbounds: realtime fixes + perf for 10k+ client inbounds (#4123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ws/inbounds: realtime fixes + perf for 10k+ client inbounds - hub: dedup, throttle, panic-restart, deadlock fix, race tests - client: backoff cap + slow-retry instead of giving up - broadcast: delta-only payload, count-based invalidate fallback - filter: fix empty online list (Inbound has no .id, use dbInbound.toInbound) - perf: O(N²)→O(N) traffic merge, bulk delete, /setEnable endpoint - traffic: monotonic all_time + UI clamp + propagate in delta handler - session: persist on update/logout (fixes logout-after-password-change) - ui: protocol tags flex, traffic bar normalize * Remove hub_test.go file * fix: ws hub, inbound service, and frontend correctness - propagate DelInbound error on disable path in SetInboundEnable - skip empty emails in updateClientTraffics to avoid constraint violations - use consistent IN ? clause, drop redundant ErrRecordNotFound guards - Hub.Unregister: direct removeClient fallback when channel is full - applyClientStatsDelta: O(1) email lookup via per-inbound Map cache - WS payload size check: Blob.size instead of .length for real byte count * fix: chunk large IN ? queries and fix IPv6 same-origin check * fix: chunk large IN ? queries and fix IPv6 same-origin check * fix: unify clientStats cache, throttle clarity, hub constants * fix(ui): align traffic/expiry cell columns across all rows * style(ui): redesign outbounds table for visual consistency * style(ui): redesign routing table for visual consistency * fix: * fix: * fix: * fix: * fix: * fix: font * refactor: simplify outbound tone functions for consistency and maintainability --------- Co-authored-by: lolka1333 --- web/controller/index.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'web/controller/index.go') diff --git a/web/controller/index.go b/web/controller/index.go index 1325bed5..14791543 100644 --- a/web/controller/index.go +++ b/web/controller/index.go @@ -10,7 +10,6 @@ import ( "github.com/mhsanaei/3x-ui/v2/web/service" "github.com/mhsanaei/3x-ui/v2/web/session" - "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) @@ -95,9 +94,8 @@ func (a *IndexController) login(c *gin.Context) { logger.Infof("%s logged in successfully, Ip Address: %s\n", safeUser, getRemoteIp(c)) a.tgbot.UserLoginNotify(safeUser, ``, getRemoteIp(c), timeStr, 1) - session.SetLoginUser(c, user) - if err := sessions.Default(c).Save(); err != nil { - logger.Warning("Unable to save session: ", err) + if err := session.SetLoginUser(c, user); err != nil { + logger.Warning("Unable to save session:", err) return } @@ -111,9 +109,8 @@ func (a *IndexController) logout(c *gin.Context) { if user != nil { logger.Infof("%s logged out successfully", user.Username) } - session.ClearSession(c) - if err := sessions.Default(c).Save(); err != nil { - logger.Warning("Unable to save session after clearing:", err) + if err := session.ClearSession(c); err != nil { + logger.Warning("Unable to clear session on logout:", err) } c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path")) } -- cgit v1.2.3