|
@@ -166,6 +166,7 @@ func (a *InboundController) addInbound(c *gin.Context) {
|
|
|
a.xrayService.SetToNeedRestart()
|
|
a.xrayService.SetToNeedRestart()
|
|
|
}
|
|
}
|
|
|
a.broadcastInboundsUpdate(user.Id)
|
|
a.broadcastInboundsUpdate(user.Id)
|
|
|
|
|
+ notifyClientsChanged()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// delInbound deletes an inbound configuration by its ID.
|
|
// delInbound deletes an inbound configuration by its ID.
|
|
@@ -186,6 +187,7 @@ func (a *InboundController) delInbound(c *gin.Context) {
|
|
|
}
|
|
}
|
|
|
user := session.GetLoginUser(c)
|
|
user := session.GetLoginUser(c)
|
|
|
a.broadcastInboundsUpdate(user.Id)
|
|
a.broadcastInboundsUpdate(user.Id)
|
|
|
|
|
+ notifyClientsChanged()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// updateInbound updates an existing inbound configuration.
|
|
// updateInbound updates an existing inbound configuration.
|
|
@@ -221,6 +223,7 @@ func (a *InboundController) updateInbound(c *gin.Context) {
|
|
|
}
|
|
}
|
|
|
user := session.GetLoginUser(c)
|
|
user := session.GetLoginUser(c)
|
|
|
a.broadcastInboundsUpdate(user.Id)
|
|
a.broadcastInboundsUpdate(user.Id)
|
|
|
|
|
+ notifyClientsChanged()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// setInboundEnable flips only the enable flag of an inbound. This is a
|
|
// setInboundEnable flips only the enable flag of an inbound. This is a
|
|
@@ -299,6 +302,9 @@ func (a *InboundController) importInbound(c *gin.Context) {
|
|
|
user := session.GetLoginUser(c)
|
|
user := session.GetLoginUser(c)
|
|
|
inbound.Id = 0
|
|
inbound.Id = 0
|
|
|
inbound.UserId = user.Id
|
|
inbound.UserId = user.Id
|
|
|
|
|
+ if inbound.NodeID != nil && *inbound.NodeID == 0 {
|
|
|
|
|
+ inbound.NodeID = nil
|
|
|
|
|
+ }
|
|
|
if inbound.Tag == "" {
|
|
if inbound.Tag == "" {
|
|
|
if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" {
|
|
if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" {
|
|
|
inbound.Tag = fmt.Sprintf("inbound-%v", inbound.Port)
|
|
inbound.Tag = fmt.Sprintf("inbound-%v", inbound.Port)
|
|
@@ -312,12 +318,17 @@ func (a *InboundController) importInbound(c *gin.Context) {
|
|
|
inbound.ClientStats[index].Enable = true
|
|
inbound.ClientStats[index].Enable = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- needRestart := false
|
|
|
|
|
- inbound, needRestart, err = a.inboundService.AddInbound(inbound)
|
|
|
|
|
- jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, err)
|
|
|
|
|
- if err == nil && needRestart {
|
|
|
|
|
|
|
+ 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, nil)
|
|
|
|
|
+ if needRestart {
|
|
|
a.xrayService.SetToNeedRestart()
|
|
a.xrayService.SetToNeedRestart()
|
|
|
}
|
|
}
|
|
|
|
|
+ a.broadcastInboundsUpdate(user.Id)
|
|
|
|
|
+ notifyClientsChanged()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// resolveHost mirrors what sub.SubService.ResolveRequest does for the host
|
|
// resolveHost mirrors what sub.SubService.ResolveRequest does for the host
|