[PR #3975] [CLOSED] fix: 17 bugs - wrong error toasts, duplicate calls, hardcoded strings, dead code #5573

Closed
opened 2026-10-31 20:47:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3975
Author: @FluxLuFFy
Created: 3/28/2026
Status: ❌ Closed

Base: main ← Head: bugfix/comprehensive-fixes


📝 Commits (2)

  • 71dc7d9 fix: comprehensive bug fixes - wrong toast messages, duplicate calls, hardcoded strings
  • bb732e0 remove workflows (token lacks workflow scope)

📊 Changes

6 files changed (+22 additions, -404 deletions)

View changed files

➖ .github/workflows/cleanup_caches.yml (+0 -31)
➖ .github/workflows/docker.yml (+0 -62)
➖ .github/workflows/release.yml (+0 -283)
📝 web/controller/inbound.go (+17 -19)
📝 web/controller/server.go (+3 -3)
📝 web/service/inbound.go (+2 -6)

📄 Description

Summary

Extends and goes beyond PR #3974 by fixing all instances of wrong toast messages across the entire codebase, plus additional bugs found during full code audit.

Bugs Fixed (17 total)

web/controller/inbound.go (14 fixes)

1-11. Wrong error toast messages on error paths (same class as PR #3974):

  • addInbound: showed inboundCreateSuccess on bind error → somethingWentWrong
  • delInbound: showed inboundDeleteSuccess on ID parse error → somethingWentWrong
  • updateInbound (2 errors): showed inboundUpdateSuccess on parse & bind errors → somethingWentWrong
  • clearClientIps: showed updateSuccess on clear error → somethingWentWrong
  • addInboundClient: showed inboundUpdateSuccess on bind error → somethingWentWrong
  • delInboundClient: showed inboundUpdateSuccess on ID parse error → somethingWentWrong
  • updateInboundClient: showed inboundUpdateSuccess on bind error → somethingWentWrong
  • resetClientTraffic: showed inboundUpdateSuccess on ID parse error → somethingWentWrong
  • resetAllClientTraffics: showed inboundUpdateSuccess on ID parse error → somethingWentWrong
  • delDepletedClients: showed inboundUpdateSuccess on ID parse error → somethingWentWrong

12-13. Duplicate SetToNeedRestart() calls:

  • resetAllTraffics(): SetToNeedRestart() was called both in else branch AND unconditionally after
  • resetAllClientTraffics(): same duplicate pattern

14-16. Hardcoded strings in delInboundClientByEmail:

  • "Invalid inbound ID" → I18nWeb(c, "somethingWentWrong")
  • "Failed to delete client by email" → I18nWeb(c, "somethingWentWrong")
  • "Client deleted successfully" → I18nWeb(c, "pages.inbounds.toasts.inboundClientDeleteSuccess")

web/controller/server.go (3 fixes)

17. Hardcoded strings not using I18n:

  • getNewUUID: "Failed to generate UUID" → somethingWentWrong
  • getNewmlkem768: "Failed to generate mlkem768 keys" → somethingWentWrong
  • getNewEchCert: "get ech certificate" → somethingWentWrong

web/service/inbound.go (1 fix)

18. Duplicate dead code in disableInvalidClients:

  • Nested if strings.Contains(...) was duplicated identically inside itself

Files Changed

 web/controller/inbound.go | 36 +++++++++++++++++-------------------
 web/controller/server.go  |  6 +++---
 web/service/inbound.go    |  8 ++------
 3 files changed, 22 insertions(+), 28 deletions(-)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/3975 **Author:** [@FluxLuFFy](https://github.com/FluxLuFFy) **Created:** 3/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `bugfix/comprehensive-fixes` --- ### 📝 Commits (2) - [`71dc7d9`](https://github.com/MHSanaei/3x-ui/commit/71dc7d983d151cf3e8465cb3a6e4c6b9fb9049de) fix: comprehensive bug fixes - wrong toast messages, duplicate calls, hardcoded strings - [`bb732e0`](https://github.com/MHSanaei/3x-ui/commit/bb732e027a8ed278aab79b18558ea04da94f08c4) remove workflows (token lacks workflow scope) ### 📊 Changes **6 files changed** (+22 additions, -404 deletions) <details> <summary>View changed files</summary> ➖ `.github/workflows/cleanup_caches.yml` (+0 -31) ➖ `.github/workflows/docker.yml` (+0 -62) ➖ `.github/workflows/release.yml` (+0 -283) 📝 `web/controller/inbound.go` (+17 -19) 📝 `web/controller/server.go` (+3 -3) 📝 `web/service/inbound.go` (+2 -6) </details> ### 📄 Description ## Summary Extends and goes beyond PR #3974 by fixing **all** instances of wrong toast messages across the entire codebase, plus additional bugs found during full code audit. ## Bugs Fixed (17 total) ### web/controller/inbound.go (14 fixes) **1-11. Wrong error toast messages on error paths** (same class as PR #3974): - `addInbound`: showed `inboundCreateSuccess` on bind error → `somethingWentWrong` - `delInbound`: showed `inboundDeleteSuccess` on ID parse error → `somethingWentWrong` - `updateInbound` (2 errors): showed `inboundUpdateSuccess` on parse & bind errors → `somethingWentWrong` - `clearClientIps`: showed `updateSuccess` on clear error → `somethingWentWrong` - `addInboundClient`: showed `inboundUpdateSuccess` on bind error → `somethingWentWrong` - `delInboundClient`: showed `inboundUpdateSuccess` on ID parse error → `somethingWentWrong` - `updateInboundClient`: showed `inboundUpdateSuccess` on bind error → `somethingWentWrong` - `resetClientTraffic`: showed `inboundUpdateSuccess` on ID parse error → `somethingWentWrong` - `resetAllClientTraffics`: showed `inboundUpdateSuccess` on ID parse error → `somethingWentWrong` - `delDepletedClients`: showed `inboundUpdateSuccess` on ID parse error → `somethingWentWrong` **12-13. Duplicate `SetToNeedRestart()` calls**: - `resetAllTraffics()`: `SetToNeedRestart()` was called both in `else` branch AND unconditionally after - `resetAllClientTraffics()`: same duplicate pattern **14-16. Hardcoded strings in `delInboundClientByEmail`**: - "Invalid inbound ID" → `I18nWeb(c, "somethingWentWrong")` - "Failed to delete client by email" → `I18nWeb(c, "somethingWentWrong")` - "Client deleted successfully" → `I18nWeb(c, "pages.inbounds.toasts.inboundClientDeleteSuccess")` ### web/controller/server.go (3 fixes) **17. Hardcoded strings not using I18n**: - `getNewUUID`: "Failed to generate UUID" → `somethingWentWrong` - `getNewmlkem768`: "Failed to generate mlkem768 keys" → `somethingWentWrong` - `getNewEchCert`: "get ech certificate" → `somethingWentWrong` ### web/service/inbound.go (1 fix) **18. Duplicate dead code in `disableInvalidClients`**: - Nested `if strings.Contains(...)` was duplicated identically inside itself ## Files Changed ``` web/controller/inbound.go | 36 +++++++++++++++++------------------- web/controller/server.go | 6 +++--- web/service/inbound.go | 8 ++------ 3 files changed, 22 insertions(+), 28 deletions(-) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:47:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5573
No description provided.