浏览代码

surge check

zu1k 5 年之前
父节点
当前提交
222800134f
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 2 2
      api/router.go
  2. 2 1
      app/task.go

+ 2 - 2
api/router.go

@@ -19,9 +19,9 @@ func setupRouter() {
 	router.StaticFile("/clash/config", "assets/clash-config.yaml")
 	router.StaticFile("/surge/config", "assets/surge.conf")
 	router.GET("/clash/proxies", func(c *gin.Context) {
-		proxyTypes := c.DefaultQuery("type", "all")
+		proxyTypes := c.DefaultQuery("type", "")
 		text := ""
-		if proxyTypes == "all" {
+		if proxyTypes == "all" || proxyTypes == "" {
 			text = cache.GetString("clashproxies")
 			if text == "" {
 				proxies := cache.GetProxies()

+ 2 - 1
app/task.go

@@ -68,13 +68,14 @@ func CrawlGo() {
 	for i := 0; i < num; i++ {
 		proxies[i].SetName(strconv.Itoa(rand.Int()))
 	}
+
 	log.Println("CrawlGo node count:", num)
 	cache.SetProxies(proxies)
-	cache.SetString("surgeproxies", provider.Surge{Proxies: proxies}.Provide())
 
 	proxies = checker.CleanProxies(provider.Clash{Proxies: proxies}.CleanProxies())
 	log.Println("CrawlGo clash useable node count:", len(proxies))
 	cache.SetString("clashproxies", provider.Clash{Proxies: proxies}.Provide())
+	cache.SetString("surgeproxies", provider.Surge{Proxies: proxies}.Provide())
 }
 
 func FetchNewConfigFileThenInit() {