mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-11-29 02:42:51 +00:00
revert trash
This commit is contained in:
parent
2ac59a6c46
commit
34e244951e
4 changed files with 26 additions and 31 deletions
|
|
@ -1 +1 @@
|
||||||
x-ui:multi-server-support
|
x-ui
|
||||||
|
|
@ -1 +1 @@
|
||||||
3.0.1
|
2.9.0
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"runtime/debug"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/mhsanaei/3x-ui/v2/database/model"
|
"github.com/mhsanaei/3x-ui/v2/database/model"
|
||||||
"github.com/mhsanaei/3x-ui/v2/logger"
|
|
||||||
"github.com/mhsanaei/3x-ui/v2/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
"github.com/mhsanaei/3x-ui/v2/web/session"
|
"github.com/mhsanaei/3x-ui/v2/web/session"
|
||||||
|
|
||||||
|
|
@ -31,34 +27,34 @@ func NewInboundController(g *gin.RouterGroup) *InboundController {
|
||||||
|
|
||||||
// initRouter initializes the routes for inbound-related operations.
|
// initRouter initializes the routes for inbound-related operations.
|
||||||
func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
||||||
g.Use(func(c *gin.Context) {
|
// g.Use(func(c *gin.Context) {
|
||||||
defer func() {
|
// defer func() {
|
||||||
if rec := recover(); rec != nil {
|
// if rec := recover(); rec != nil {
|
||||||
logger.Errorf("PANIC: %v\nStack: %s", rec, debug.Stack())
|
// logger.Errorf("PANIC: %v\nStack: %s", rec, debug.Stack())
|
||||||
c.AbortWithStatusJSON(500, gin.H{"msg": fmt.Sprintf("panic: %v", rec)})
|
// c.AbortWithStatusJSON(500, gin.H{"msg": fmt.Sprintf("panic: %v", rec)})
|
||||||
}
|
// }
|
||||||
}()
|
// }()
|
||||||
c.Next()
|
// c.Next()
|
||||||
})
|
// })
|
||||||
|
|
||||||
g.Use(func(c *gin.Context) {
|
// g.Use(func(c *gin.Context) {
|
||||||
// Заголовки
|
// // Заголовки
|
||||||
logger.Debug("=== REQUEST INFO ===")
|
// logger.Debug("=== REQUEST INFO ===")
|
||||||
logger.Debug(fmt.Sprintf("%s %s", c.Request.Method, c.Request.URL.String()))
|
// logger.Debug(fmt.Sprintf("%s %s", c.Request.Method, c.Request.URL.String()))
|
||||||
logger.Debug("Headers:")
|
// logger.Debug("Headers:")
|
||||||
for k, v := range c.Request.Header {
|
// for k, v := range c.Request.Header {
|
||||||
logger.Debug(fmt.Sprintf(" %s: %v", k, v))
|
// logger.Debug(fmt.Sprintf(" %s: %v", k, v))
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Тело (прочитаем и восстановим)
|
// // Тело (прочитаем и восстановим)
|
||||||
bodyBytes, _ := io.ReadAll(c.Request.Body)
|
// bodyBytes, _ := io.ReadAll(c.Request.Body)
|
||||||
logger.Debug(fmt.Sprintf("\nBody:\n%s\n", string(bodyBytes)))
|
// logger.Debug(fmt.Sprintf("\nBody:\n%s\n", string(bodyBytes)))
|
||||||
logger.Debug("====================")
|
// logger.Debug("====================")
|
||||||
|
|
||||||
// Обязательно восстановить тело, чтобы Gin потом смог его обработать
|
// // Обязательно восстановить тело, чтобы Gin потом смог его обработать
|
||||||
c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
// c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||||
|
|
||||||
})
|
// })
|
||||||
|
|
||||||
g.GET("/list", a.getInbounds)
|
g.GET("/list", a.getInbounds)
|
||||||
g.GET("/get/:id", a.getInbound)
|
g.GET("/get/:id", a.getInbound)
|
||||||
|
|
|
||||||
|
|
@ -2521,7 +2521,6 @@ func (s *InboundService) syncWithSlaves(method string, path string, contentType
|
||||||
bodyBytes, _ := io.ReadAll(resp.Body)
|
bodyBytes, _ := io.ReadAll(resp.Body)
|
||||||
logger.Warningf("Failed to sync with server %s. Status: %s, Body: %s", server.Name, resp.Status, string(bodyBytes))
|
logger.Warningf("Failed to sync with server %s. Status: %s, Body: %s", server.Name, resp.Status, string(bodyBytes))
|
||||||
}
|
}
|
||||||
//logger.Infof("Synced inbound %v to server %v (%v)", bodyData.(*model.Inbound).Tag, server.Name, resp.Status)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue