fix: try fixing automatic policy

This commit is contained in:
xishang0128 2023-12-26 03:49:00 +08:00
parent 41a05d96a5
commit 0d07cf40b8
No known key found for this signature in database
GPG key ID: 44A1E10B5ADF68CB
3 changed files with 10 additions and 2 deletions

View file

@ -89,6 +89,7 @@ func (f *Fallback) MarshalJSON() ([]byte, error) {
"all": all,
"testUrl": f.testUrl,
"expectedStatus": f.expectedStatus,
"fixed": f.selected,
})
}

View file

@ -170,6 +170,7 @@ func (u *URLTest) MarshalJSON() ([]byte, error) {
"all": all,
"testUrl": u.testUrl,
"expectedStatus": u.expectedStatus,
"fixed": u.selected,
})
}

View file

@ -2,15 +2,17 @@ package route
import (
"context"
"github.com/go-chi/chi/v5"
"github.com/go-chi/render"
"net/http"
"strconv"
"time"
"github.com/go-chi/chi/v5"
"github.com/go-chi/render"
"github.com/metacubex/mihomo/adapter"
"github.com/metacubex/mihomo/adapter/outboundgroup"
"github.com/metacubex/mihomo/common/utils"
"github.com/metacubex/mihomo/component/profile/cachefile"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/tunnel"
)
@ -63,6 +65,10 @@ func getGroupDelay(w http.ResponseWriter, r *http.Request) {
URLTestGroup.ForceSet("")
}
if proxy.(*adapter.Proxy).Type() != C.Selector {
cachefile.Cache().SetSelected(proxy.Name(), "")
}
query := r.URL.Query()
url := query.Get("url")
timeout, err := strconv.ParseInt(query.Get("timeout"), 10, 32)