mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-08 14:36:13 +00:00
fix(panel): silence update-check WARN spam when offline
The panel polls api.github.com on every page load. When the host has no internet (DNS fails, GitHub blocked, etc.) jsonMsg's auto-WARN logging floods the log with the same error every poll. Bypass jsonMsg for getPanelUpdateInfo: log the error at Debug level and return Success:false with the existing localized message so the frontend popover behavior is unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||
"github.com/mhsanaei/3x-ui/v2/web/entity"
|
||||
"github.com/mhsanaei/3x-ui/v2/web/global"
|
||||
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||
"github.com/mhsanaei/3x-ui/v2/web/websocket"
|
||||
@@ -135,10 +137,17 @@ func (a *ServerController) getXrayVersion(c *gin.Context) {
|
||||
}
|
||||
|
||||
// getPanelUpdateInfo retrieves the current and latest panel version.
|
||||
// Network failures (e.g. no internet, GitHub blocked) are logged at debug
|
||||
// level only — the panel keeps working offline and we don't want to spam
|
||||
// WARN every time a user opens the page.
|
||||
func (a *ServerController) getPanelUpdateInfo(c *gin.Context) {
|
||||
info, err := a.panelService.GetUpdateInfo()
|
||||
if err != nil {
|
||||
jsonMsg(c, I18nWeb(c, "pages.index.panelUpdateCheckPopover"), err)
|
||||
logger.Debug("panel update check failed:", err)
|
||||
c.JSON(http.StatusOK, entity.Msg{
|
||||
Success: false,
|
||||
Msg: I18nWeb(c, "pages.index.panelUpdateCheckPopover"),
|
||||
})
|
||||
return
|
||||
}
|
||||
jsonObj(c, info, nil)
|
||||
|
||||
Reference in New Issue
Block a user