fix 修复FindProcessMode为空的bug

This commit is contained in:
timerzz 2024-12-11 14:05:57 +08:00
parent 5b102469a2
commit 65b1b0c329

View File

@ -14,6 +14,7 @@ import (
"github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/cors" "github.com/gofiber/fiber/v3/middleware/cors"
"github.com/gofiber/fiber/v3/middleware/recover" "github.com/gofiber/fiber/v3/middleware/recover"
"github.com/metacubex/mihomo/component/process"
clash_config "github.com/metacubex/mihomo/config" clash_config "github.com/metacubex/mihomo/config"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
@ -57,7 +58,7 @@ func main() {
r.Use(cors.New(), recover.New()) r.Use(cors.New(), recover.New())
r.Get("/clash/config", func(ctx fiber.Ctx) error { r.Get("/clash/config", func(ctx fiber.Ctx) error {
mappings := structs.ProxiesList.Mapping() mappings := structs.ProxiesList.Mapping()
rawConfig := clash_config.RawConfig{Proxy: mappings} rawConfig := clash_config.RawConfig{Proxy: mappings, FindProcessMode: process.FindProcessAlways}
return yaml.NewEncoder(ctx.Response().BodyWriter()).Encode(&rawConfig) return yaml.NewEncoder(ctx.Response().BodyWriter()).Encode(&rawConfig)
}) })
_ = r.Listen(":"+config.Config.Port, fiber.ListenConfig{ _ = r.Listen(":"+config.Config.Port, fiber.ListenConfig{