From 253dc24e408371e167e82d26ae7098f4f0692760 Mon Sep 17 00:00:00 2001 From: MetaCubeX Date: Mon, 4 Jul 2022 18:53:24 +0800 Subject: [PATCH] chore: clash.mini hack. --- config/config.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index dc4ba2b4..cabac15b 100644 --- a/config/config.go +++ b/config/config.go @@ -240,6 +240,12 @@ type RawSniffer struct { Ports []string `yaml:"port-whitelist" json:"port-whitelist"` } +var ( + GroupsList = list.New() + ProxiesList = list.New() + ParsingProxiesCallback func(groupsList *list.List, proxiesList *list.List) +) + // Parse config func Parse(buf []byte) (*Config, error) { rawCfg, err := UnmarshalRawConfig(buf) @@ -527,7 +533,12 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ []providerTypes.ProxyProvider{pd}, ) proxies["GLOBAL"] = adapter.NewProxy(global) - + ProxiesList = proxiesList + GroupsList = groupsList + if ParsingProxiesCallback != nil { + // refresh tray menu + go ParsingProxiesCallback(GroupsList, ProxiesList) + } return proxies, providersMap, nil }