mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-30 02:36:18 +08:00
fix: Fix the problem of abnormal switching of Chinese nodes (#8685)
This commit is contained in:
parent
7ad31f532a
commit
64e4c23d12
3 changed files with 20 additions and 11 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue