fix: Fix the problem of abnormal switching of Chinese nodes (#8685)

This commit is contained in:
ssongliu 2025-05-16 10:47:21 +08:00 committed by GitHub
parent 7ad31f532a
commit 64e4c23d12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 11 deletions

View file

@ -2,17 +2,19 @@ package router
import (
"context"
"net"
"net/http"
"net/http/httputil"
"net/url"
"os"
"strconv"
"strings"
"github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/1Panel-dev/1Panel/core/cmd/server/res"
"github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/global"
"github.com/1Panel-dev/1Panel/core/utils/security"
"net"
"net/http"
"net/http/httputil"
"os"
"strconv"
"strings"
"github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/utils/xpack"
@ -30,12 +32,17 @@ func Proxy() gin.HandlerFunc {
c.Next()
return
}
var currentNode string
var nodeItem string
queryNode := c.Query("operateNode")
if queryNode != "" && queryNode != "undefined" {
currentNode = queryNode
nodeItem = queryNode
} else {
currentNode = c.Request.Header.Get("CurrentNode")
nodeItem = c.Request.Header.Get("CurrentNode")
}
currentNode, err := url.QueryUnescape(nodeItem)
if err != nil {
helper.ErrorWithDetail(c, http.StatusBadRequest, "ErrProxy", err)
return
}
apiReq := c.GetBool("API_AUTH")

View file

@ -28,7 +28,9 @@ class RequestHttp {
...config.headers,
};
if (config.headers.CurrentNode == undefined) {
config.headers.CurrentNode = globalStore.currentNode;
config.headers.CurrentNode = encodeURIComponent(globalStore.currentNode);
} else {
config.headers.CurrentNode = encodeURIComponent(String(config.headers.CurrentNode));
}
if (config.url === '/core/auth/login' || config.url === '/core/auth/mfalogin') {
let entrance = Base64.encode(globalStore.entrance);

View file

@ -3323,7 +3323,7 @@ const message = {
addNode: 'Add Node',
connInfo: 'Connection Information',
nodeInfo: 'Node Information',
syncInfo: 'Data synchronization',
syncInfo: 'Sync',
syncHelper: 'When master node data changes, it synchronizes to this child node in real-time',
syncBackupAccount: 'Backup account settings',
syncProxy: 'System proxy settings',