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
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
|
||||
"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/session"
|
||||
|
||||
|
|
@ -31,34 +27,34 @@ func NewInboundController(g *gin.RouterGroup) *InboundController {
|
|||
|
||||
// initRouter initializes the routes for inbound-related operations.
|
||||
func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
||||
g.Use(func(c *gin.Context) {
|
||||
defer func() {
|
||||
if rec := recover(); rec != nil {
|
||||
logger.Errorf("PANIC: %v\nStack: %s", rec, debug.Stack())
|
||||
c.AbortWithStatusJSON(500, gin.H{"msg": fmt.Sprintf("panic: %v", rec)})
|
||||
}
|
||||
}()
|
||||
c.Next()
|
||||
})
|
||||
// g.Use(func(c *gin.Context) {
|
||||
// defer func() {
|
||||
// if rec := recover(); rec != nil {
|
||||
// logger.Errorf("PANIC: %v\nStack: %s", rec, debug.Stack())
|
||||
// c.AbortWithStatusJSON(500, gin.H{"msg": fmt.Sprintf("panic: %v", rec)})
|
||||
// }
|
||||
// }()
|
||||
// c.Next()
|
||||
// })
|
||||
|
||||
g.Use(func(c *gin.Context) {
|
||||
// Заголовки
|
||||
logger.Debug("=== REQUEST INFO ===")
|
||||
logger.Debug(fmt.Sprintf("%s %s", c.Request.Method, c.Request.URL.String()))
|
||||
logger.Debug("Headers:")
|
||||
for k, v := range c.Request.Header {
|
||||
logger.Debug(fmt.Sprintf(" %s: %v", k, v))
|
||||
}
|
||||
// g.Use(func(c *gin.Context) {
|
||||
// // Заголовки
|
||||
// logger.Debug("=== REQUEST INFO ===")
|
||||
// logger.Debug(fmt.Sprintf("%s %s", c.Request.Method, c.Request.URL.String()))
|
||||
// logger.Debug("Headers:")
|
||||
// for k, v := range c.Request.Header {
|
||||
// logger.Debug(fmt.Sprintf(" %s: %v", k, v))
|
||||
// }
|
||||
|
||||
// Тело (прочитаем и восстановим)
|
||||
bodyBytes, _ := io.ReadAll(c.Request.Body)
|
||||
logger.Debug(fmt.Sprintf("\nBody:\n%s\n", string(bodyBytes)))
|
||||
logger.Debug("====================")
|
||||
// // Тело (прочитаем и восстановим)
|
||||
// bodyBytes, _ := io.ReadAll(c.Request.Body)
|
||||
// logger.Debug(fmt.Sprintf("\nBody:\n%s\n", string(bodyBytes)))
|
||||
// logger.Debug("====================")
|
||||
|
||||
// Обязательно восстановить тело, чтобы Gin потом смог его обработать
|
||||
c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||
// // Обязательно восстановить тело, чтобы Gin потом смог его обработать
|
||||
// c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||
|
||||
})
|
||||
// })
|
||||
|
||||
g.GET("/list", a.getInbounds)
|
||||
g.GET("/get/:id", a.getInbound)
|
||||
|
|
|
|||
|
|
@ -2521,7 +2521,6 @@ func (s *InboundService) syncWithSlaves(method string, path string, contentType
|
|||
bodyBytes, _ := io.ReadAll(resp.Body)
|
||||
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