Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-05-16 19:56:56 +0300
committerGitHub <noreply@github.com>2025-05-16 19:56:56 +0300
commitc988d55256d98d6133558dad3a7d96cad2339acf (patch)
treee6e945b11af36dc3815092965aeda37eaa185735 /web/controller
parentef625c75d8ddd06b55524caef24f1ad8da45ccc9 (diff)
fix: handle inbounds interaction errors (#3009)
eliminates messages like: “Inbound created successfully (Port 100 is already busy)”.
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/inbound.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/web/controller/inbound.go b/web/controller/inbound.go
index 6c38b4ac..592a4bd0 100644
--- a/web/controller/inbound.go
+++ b/web/controller/inbound.go
@@ -104,6 +104,10 @@ func (a *InboundController) addInbound(c *gin.Context) {
needRestart := false
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
+ if err != nil {
+ jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
+ return
+ }
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, err)
if err == nil && needRestart {
a.xrayService.SetToNeedRestart()
@@ -118,6 +122,10 @@ func (a *InboundController) delInbound(c *gin.Context) {
}
needRestart := true
needRestart, err = a.inboundService.DelInbound(id)
+ if err != nil {
+ jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
+ return
+ }
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, err)
if err == nil && needRestart {
a.xrayService.SetToNeedRestart()
@@ -140,6 +148,10 @@ func (a *InboundController) updateInbound(c *gin.Context) {
}
needRestart := true
inbound, needRestart, err = a.inboundService.UpdateInbound(inbound)
+ if err != nil {
+ jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
+ return
+ }
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, err)
if err == nil && needRestart {
a.xrayService.SetToNeedRestart()