chore: restore unselected

clear selected node in outboundgoup/URLtest when getGroupDelay triggered
This commit is contained in:
Larvan2 2023-08-18 22:17:07 +08:00
parent db68d55a0e
commit b8a60261ef

View file

@ -9,6 +9,7 @@ import (
"time" "time"
"github.com/Dreamacro/clash/adapter" "github.com/Dreamacro/clash/adapter"
"github.com/Dreamacro/clash/adapter/outboundgroup"
"github.com/Dreamacro/clash/common/utils" "github.com/Dreamacro/clash/common/utils"
C "github.com/Dreamacro/clash/constant" C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/tunnel" "github.com/Dreamacro/clash/tunnel"
@ -57,6 +58,11 @@ func getGroupDelay(w http.ResponseWriter, r *http.Request) {
return return
} }
if proxy.(*adapter.Proxy).Type() == C.URLTest {
URLTestGroup := proxy.(*adapter.Proxy).ProxyAdapter.(*outboundgroup.URLTest)
URLTestGroup.ForceSet("")
}
query := r.URL.Query() query := r.URL.Query()
url := query.Get("url") url := query.Get("url")
timeout, err := strconv.ParseInt(query.Get("timeout"), 10, 32) timeout, err := strconv.ParseInt(query.Get("timeout"), 10, 32)
@ -77,7 +83,6 @@ func getGroupDelay(w http.ResponseWriter, r *http.Request) {
defer cancel() defer cancel()
dm, err := group.URLTest(ctx, url, expectedStatus) dm, err := group.URLTest(ctx, url, expectedStatus)
if err != nil { if err != nil {
render.Status(r, http.StatusGatewayTimeout) render.Status(r, http.StatusGatewayTimeout)
render.JSON(w, r, newError(err.Error())) render.JSON(w, r, newError(err.Error()))