Merge pull request #264 from komari-monitor/dev

fix: 修正 WebSocket 升级逻辑
This commit is contained in:
github-actions[bot]
2025-09-14 05:06:52 +00:00
committed by GitHub

View File

@@ -23,8 +23,8 @@ import (
func OnRpcRequest(c *gin.Context) {
cfg, _ := config.Get()
// 如果是 WebSocket Upgrade (常见于 GET) 则走原有逻辑
if strings.EqualFold(c.GetHeader("Upgrade"), "websocket") || strings.Contains(strings.ToLower(c.GetHeader("Connection")), "upgrade") {
// GET -> WebSocket
if c.Request.Method == http.MethodGet {
_conn, err := ws.UpgradeRequest(c, func(r *http.Request) bool {
if cfg.AllowCors {
return true