Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08d07498b9 | ||
|
|
d5aa09949a | ||
|
|
fd1dfe5c60 | ||
|
|
9f89fe8b29 | ||
|
|
78081a12e8 | ||
|
|
6896837f28 | ||
|
|
85eb903402 | ||
|
|
9aa9180f1f | ||
|
|
feb9688a29 | ||
|
|
5c71992174 | ||
|
|
74c3d0ae25 | ||
|
|
ecd1bcafd5 | ||
|
|
184d2d117a | ||
|
|
89e6f17794 | ||
|
|
aef50fe0e3 | ||
|
|
fc0767ed25 | ||
|
|
dbf1724cca | ||
|
|
909aa4038e | ||
|
|
2d0a7d8d46 | ||
|
|
ca96cd1d82 |
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -89,7 +89,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -101,13 +101,13 @@ jobs:
|
||||
- name: Pre Release
|
||||
run: |
|
||||
pip install gitchangelog pystache mustache markdown
|
||||
prelease=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
|
||||
if [ -z "$prelease" ]; then
|
||||
pre=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
|
||||
if [ -z "pre" ]; then
|
||||
echo "init" > release.md
|
||||
else
|
||||
current="${{ github.ref_name }}"
|
||||
echo -e "\n\n<details markdown=1><summary>All changes from $current to the latest commit:</summary>\n\n" >> release.md
|
||||
gitchangelog "${prelease}" >> release.md 2>&1 || echo "Error in gitchangelog"
|
||||
gitchangelog "${pre}.." >> release.md 2>&1 || echo "Error in gitchangelog"
|
||||
echo -e "\n\n</details>" >> release.md
|
||||
fi
|
||||
- name: Release
|
||||
|
||||
Submodule core/Clash.Meta updated: 0096393b3a...1c46eb82bf
206
core/common.go
206
core/common.go
@@ -7,14 +7,18 @@ import (
|
||||
"github.com/metacubex/mihomo/component/process"
|
||||
"github.com/metacubex/mihomo/component/resolver"
|
||||
"github.com/metacubex/mihomo/config"
|
||||
"github.com/metacubex/mihomo/constant/provider"
|
||||
"github.com/metacubex/mihomo/dns"
|
||||
"github.com/metacubex/mihomo/hub/executor"
|
||||
"github.com/metacubex/mihomo/listener"
|
||||
"github.com/metacubex/mihomo/log"
|
||||
"github.com/metacubex/mihomo/tunnel"
|
||||
"math"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -46,6 +50,11 @@ type Process struct {
|
||||
Target string `json:"target"`
|
||||
}
|
||||
|
||||
type Now struct {
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
func restartExecutable(execPath string) {
|
||||
var err error
|
||||
executor.Shutdown()
|
||||
@@ -106,6 +115,152 @@ func decorationConfig(profilePath *string, cfg config.RawConfig) *config.RawConf
|
||||
return prof
|
||||
}
|
||||
|
||||
func Reduce[T any, U any](s []T, initVal U, f func(U, T) U) U {
|
||||
for _, v := range s {
|
||||
initVal = f(initVal, v)
|
||||
}
|
||||
return initVal
|
||||
}
|
||||
|
||||
func Map[T, U any](slice []T, fn func(T) U) []U {
|
||||
result := make([]U, len(slice))
|
||||
for i, v := range slice {
|
||||
result[i] = fn(v)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func replaceFromMap(s string, m map[string]string) string {
|
||||
for k, v := range m {
|
||||
s = strings.ReplaceAll(s, k, v)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func removeDuplicateFromSlice[T any](slice []T) []T {
|
||||
result := make([]T, 0)
|
||||
seen := make(map[any]struct{})
|
||||
for _, value := range slice {
|
||||
if _, ok := seen[value]; !ok {
|
||||
result = append(result, value)
|
||||
seen[value] = struct{}{}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func generateProxyGroupAndRule(proxyGroup *[]map[string]any, rule *[]string) {
|
||||
var replacements = map[string]string{}
|
||||
var selectArr []map[string]any
|
||||
var urlTestArr []map[string]any
|
||||
var fallbackArr []map[string]any
|
||||
for _, group := range *proxyGroup {
|
||||
switch group["type"] {
|
||||
case "select":
|
||||
selectArr = append(selectArr, group)
|
||||
replacements[group["name"].(string)] = "Proxy"
|
||||
break
|
||||
case "url-test":
|
||||
urlTestArr = append(urlTestArr, group)
|
||||
replacements[group["name"].(string)] = "Auto"
|
||||
break
|
||||
case "fallback":
|
||||
fallbackArr = append(fallbackArr, group)
|
||||
replacements[group["name"].(string)] = "Fallback"
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
ProxyProxies := Reduce(selectArr, []string{}, func(res []string, cur map[string]any) []string {
|
||||
if cur["proxies"] == nil {
|
||||
return res
|
||||
}
|
||||
for _, proxyName := range cur["proxies"].([]interface{}) {
|
||||
if str, ok := proxyName.(string); ok {
|
||||
str = replaceFromMap(str, replacements)
|
||||
if str != "Proxy" {
|
||||
res = append(res, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
})
|
||||
|
||||
ProxyProxies = removeDuplicateFromSlice(ProxyProxies)
|
||||
|
||||
AutoProxies := Reduce(urlTestArr, []string{}, func(res []string, cur map[string]any) []string {
|
||||
if cur["proxies"] == nil {
|
||||
return res
|
||||
}
|
||||
for _, proxyName := range cur["proxies"].([]interface{}) {
|
||||
if str, ok := proxyName.(string); ok {
|
||||
str = replaceFromMap(str, replacements)
|
||||
if str != "Auto" {
|
||||
res = append(res, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
})
|
||||
|
||||
AutoProxies = removeDuplicateFromSlice(AutoProxies)
|
||||
|
||||
FallbackProxies := Reduce(fallbackArr, []string{}, func(res []string, cur map[string]any) []string {
|
||||
if cur["proxies"] == nil {
|
||||
return res
|
||||
}
|
||||
for _, proxyName := range cur["proxies"].([]interface{}) {
|
||||
if str, ok := proxyName.(string); ok {
|
||||
str = replaceFromMap(str, replacements)
|
||||
if str != "Fallback" {
|
||||
res = append(res, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
})
|
||||
|
||||
FallbackProxies = removeDuplicateFromSlice(FallbackProxies)
|
||||
|
||||
var computedProxyGroup []map[string]any
|
||||
|
||||
if len(ProxyProxies) > 0 {
|
||||
computedProxyGroup = append(computedProxyGroup,
|
||||
map[string]any{
|
||||
"name": "Proxy",
|
||||
"type": "select",
|
||||
"proxies": ProxyProxies,
|
||||
})
|
||||
}
|
||||
|
||||
if len(AutoProxies) > 0 {
|
||||
computedProxyGroup = append(computedProxyGroup,
|
||||
map[string]any{
|
||||
"name": "Auto",
|
||||
"type": "url-test",
|
||||
"proxies": AutoProxies,
|
||||
})
|
||||
}
|
||||
|
||||
if len(FallbackProxies) > 0 {
|
||||
computedProxyGroup = append(computedProxyGroup,
|
||||
map[string]any{
|
||||
"name": "Fallback",
|
||||
"type": "fallback",
|
||||
"proxies": FallbackProxies,
|
||||
})
|
||||
}
|
||||
|
||||
computedRule := Map(*rule, func(value string) string {
|
||||
return replaceFromMap(value, replacements)
|
||||
})
|
||||
|
||||
*proxyGroup = computedProxyGroup
|
||||
*rule = computedRule
|
||||
}
|
||||
|
||||
func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfig) {
|
||||
targetConfig.ExternalController = ""
|
||||
targetConfig.ExternalUI = ""
|
||||
@@ -121,22 +276,19 @@ func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfi
|
||||
targetConfig.Tun.Device = patchConfig.Tun.Device
|
||||
targetConfig.Tun.DNSHijack = patchConfig.Tun.DNSHijack
|
||||
targetConfig.Tun.Stack = patchConfig.Tun.Stack
|
||||
targetConfig.GeodataLoader = "standard"
|
||||
targetConfig.Profile.StoreSelected = false
|
||||
if targetConfig.DNS.Enable == false {
|
||||
targetConfig.DNS = patchConfig.DNS
|
||||
} else {
|
||||
targetConfig.DNS.UseHosts = patchConfig.DNS.UseHosts
|
||||
targetConfig.DNS.EnhancedMode = patchConfig.DNS.EnhancedMode
|
||||
targetConfig.DNS.IPv6 = patchConfig.DNS.IPv6
|
||||
targetConfig.DNS.DefaultNameserver = append(patchConfig.DNS.DefaultNameserver, targetConfig.DNS.DefaultNameserver...)
|
||||
targetConfig.DNS.NameServer = append(patchConfig.DNS.NameServer, targetConfig.DNS.NameServer...)
|
||||
targetConfig.DNS.FakeIPFilter = append(patchConfig.DNS.FakeIPFilter, targetConfig.DNS.FakeIPFilter...)
|
||||
targetConfig.DNS.Fallback = append(patchConfig.DNS.Fallback, targetConfig.DNS.Fallback...)
|
||||
if runtime.GOOS == "android" {
|
||||
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, "dhcp://"+dns.SystemDNSPlaceholder)
|
||||
} else if runtime.GOOS == "windows" {
|
||||
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, dns.SystemDNSPlaceholder)
|
||||
}
|
||||
}
|
||||
if runtime.GOOS == "android" {
|
||||
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, "dhcp://"+dns.SystemDNSPlaceholder)
|
||||
} else if runtime.GOOS == "windows" {
|
||||
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, dns.SystemDNSPlaceholder)
|
||||
}
|
||||
targetConfig.ProxyProvider = make(map[string]map[string]any)
|
||||
targetConfig.RuleProvider = make(map[string]map[string]any)
|
||||
generateProxyGroupAndRule(&targetConfig.ProxyGroup, &targetConfig.Rule)
|
||||
}
|
||||
|
||||
func patchConfig(general *config.General) {
|
||||
@@ -164,10 +316,29 @@ func patchConfig(general *config.General) {
|
||||
resolver.DisableIPv6 = !general.IPv6
|
||||
}
|
||||
|
||||
func applyConfig(isPatch bool) bool {
|
||||
if currentConfig == nil {
|
||||
return false
|
||||
const concurrentCount = math.MaxInt
|
||||
|
||||
func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
|
||||
wg := sync.WaitGroup{}
|
||||
ch := make(chan struct{}, concurrentCount)
|
||||
for _, proxyProvider := range proxyProviders {
|
||||
proxyProvider := proxyProvider
|
||||
if proxyProvider.VehicleType() == provider.Compatible {
|
||||
log.Infoln("Start initial Compatible provider %s", proxyProvider.Name())
|
||||
wg.Add(1)
|
||||
ch <- struct{}{}
|
||||
go func() {
|
||||
defer func() { <-ch; wg.Done() }()
|
||||
if err := proxyProvider.Initial(); err != nil {
|
||||
log.Errorln("initial Compatible provider %s error: %v", proxyProvider.Name(), err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func applyConfig(isPatch bool) {
|
||||
cfg, err := config.ParseRawConfig(currentConfig)
|
||||
if err != nil {
|
||||
cfg, _ = config.ParseRawConfig(config.DefaultRawConfig())
|
||||
@@ -176,7 +347,6 @@ func applyConfig(isPatch bool) bool {
|
||||
patchConfig(cfg.General)
|
||||
} else {
|
||||
executor.ApplyConfig(cfg, true)
|
||||
|
||||
healthcheck()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func InitDartApi(api unsafe.Pointer) {
|
||||
}
|
||||
}
|
||||
|
||||
func sendToPort(port int64, msg string) {
|
||||
func SendToPort(port int64, msg string) {
|
||||
var obj C.Dart_CObject
|
||||
obj._type = C.Dart_CObject_kString
|
||||
msgString := C.CString(msg)
|
||||
|
||||
@@ -10,6 +10,7 @@ const (
|
||||
Log MessageType = "log"
|
||||
Tun MessageType = "tun"
|
||||
Delay MessageType = "delay"
|
||||
Now MessageType = "now"
|
||||
Process MessageType = "process"
|
||||
)
|
||||
|
||||
@@ -18,11 +19,11 @@ type Message struct {
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
func (message *Message) toJson() string {
|
||||
func (message *Message) Json() string {
|
||||
data, _ := json.Marshal(message)
|
||||
return string(data)
|
||||
}
|
||||
|
||||
func SendMessage(message Message) {
|
||||
sendToPort(*Port, message.toJson())
|
||||
SendToPort(*Port, message.Json())
|
||||
}
|
||||
|
||||
120
core/hub.go
120
core/hub.go
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/metacubex/mihomo/adapter"
|
||||
"github.com/metacubex/mihomo/adapter/outboundgroup"
|
||||
"github.com/metacubex/mihomo/adapter/provider"
|
||||
"github.com/metacubex/mihomo/common/utils"
|
||||
"github.com/metacubex/mihomo/config"
|
||||
"github.com/metacubex/mihomo/constant"
|
||||
@@ -63,21 +64,25 @@ func validateConfig(s *C.char) bool {
|
||||
}
|
||||
|
||||
//export updateConfig
|
||||
func updateConfig(s *C.char) bool {
|
||||
paramsString := C.GoString(s)
|
||||
var params = &GenerateConfigParams{}
|
||||
err := json.Unmarshal([]byte(paramsString), params)
|
||||
if err != nil {
|
||||
log.Errorln("generateConfig Unmarshal error %v", err)
|
||||
return false
|
||||
}
|
||||
prof := decorationConfig(params.ProfilePath, *params.Config)
|
||||
currentConfig = prof
|
||||
if *params.IsPatch {
|
||||
return applyConfig(true)
|
||||
} else {
|
||||
return applyConfig(false)
|
||||
}
|
||||
func updateConfig(s *C.char, port C.longlong) {
|
||||
i := int64(port)
|
||||
go func() {
|
||||
paramsString := C.GoString(s)
|
||||
var params = &GenerateConfigParams{}
|
||||
err := json.Unmarshal([]byte(paramsString), params)
|
||||
if err != nil {
|
||||
bridge.SendToPort(i, err.Error())
|
||||
return
|
||||
}
|
||||
prof := decorationConfig(params.ProfilePath, *params.Config)
|
||||
currentConfig = prof
|
||||
if *params.IsPatch {
|
||||
applyConfig(true)
|
||||
} else {
|
||||
applyConfig(false)
|
||||
}
|
||||
bridge.SendToPort(i, "")
|
||||
}()
|
||||
}
|
||||
|
||||
//export getProxies
|
||||
@@ -91,27 +96,28 @@ func getProxies() *C.char {
|
||||
|
||||
//export changeProxy
|
||||
func changeProxy(s *C.char) bool {
|
||||
paramsString := C.GoString(s)
|
||||
var params = &ChangeProxyParams{}
|
||||
err := json.Unmarshal([]byte(paramsString), params)
|
||||
if err != nil {
|
||||
log.Infoln("Unmarshal ChangeProxyParams %v", err)
|
||||
return false
|
||||
}
|
||||
proxies := tunnel.ProxiesWithProviders()
|
||||
proxy := proxies[*params.GroupName]
|
||||
if proxy == nil {
|
||||
return false
|
||||
}
|
||||
log.Infoln("change proxy %s", proxy.Name())
|
||||
adapterProxy := proxy.(*adapter.Proxy)
|
||||
selector, ok := adapterProxy.ProxyAdapter.(*outboundgroup.Selector)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
if err := selector.Set(*params.ProxyName); err != nil {
|
||||
return false
|
||||
}
|
||||
go func() {
|
||||
paramsString := C.GoString(s)
|
||||
var params = &ChangeProxyParams{}
|
||||
err := json.Unmarshal([]byte(paramsString), params)
|
||||
if err != nil {
|
||||
log.Infoln("Unmarshal ChangeProxyParams %v", err)
|
||||
}
|
||||
proxies := tunnel.ProxiesWithProviders()
|
||||
proxy := proxies[*params.GroupName]
|
||||
if proxy == nil {
|
||||
return
|
||||
}
|
||||
log.Infoln("change proxy %s", proxy.Name())
|
||||
adapterProxy := proxy.(*adapter.Proxy)
|
||||
selector, ok := adapterProxy.ProxyAdapter.(*outboundgroup.Selector)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if err := selector.Set(*params.ProxyName); err != nil {
|
||||
return
|
||||
}
|
||||
}()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -131,7 +137,8 @@ func getTraffic() *C.char {
|
||||
}
|
||||
|
||||
//export asyncTestDelay
|
||||
func asyncTestDelay(s *C.char) {
|
||||
func asyncTestDelay(s *C.char, port C.longlong) {
|
||||
i := int64(port)
|
||||
go func() {
|
||||
paramsString := C.GoString(s)
|
||||
var params = &TestDelayParams{}
|
||||
@@ -139,42 +146,34 @@ func asyncTestDelay(s *C.char) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
expectedStatus, err := utils.NewUnsignedRanges[uint16]("")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*time.Duration(params.Timeout))
|
||||
defer cancel()
|
||||
|
||||
proxies := tunnel.ProxiesWithProviders()
|
||||
proxy := proxies[params.ProxyName]
|
||||
|
||||
delayData := &Delay{
|
||||
Name: params.ProxyName,
|
||||
}
|
||||
|
||||
message := bridge.Message{
|
||||
Type: bridge.Delay,
|
||||
Data: delayData,
|
||||
}
|
||||
|
||||
if proxy == nil {
|
||||
delayData.Value = -1
|
||||
bridge.SendMessage(message)
|
||||
bridge.SendToPort(i, message.Json())
|
||||
return
|
||||
}
|
||||
|
||||
delay, err := proxy.URLTest(ctx, constant.DefaultTestURL, expectedStatus)
|
||||
if err != nil || delay == 0 {
|
||||
delayData.Value = -1
|
||||
bridge.SendMessage(message)
|
||||
bridge.SendToPort(i, message.Json())
|
||||
return
|
||||
}
|
||||
|
||||
delayData.Value = int32(delay)
|
||||
bridge.SendMessage(message)
|
||||
bridge.SendToPort(i, message.Json())
|
||||
}()
|
||||
}
|
||||
|
||||
@@ -239,17 +238,38 @@ func getProviders() *C.char {
|
||||
func getProvider(name *C.char) *C.char {
|
||||
providerName := C.GoString(name)
|
||||
providers := tunnel.Providers()
|
||||
var provider = providers[providerName]
|
||||
data, err := json.Marshal(provider)
|
||||
data, err := json.Marshal(providers[providerName])
|
||||
if err != nil {
|
||||
return C.CString("")
|
||||
}
|
||||
return C.CString(string(data))
|
||||
}
|
||||
|
||||
//export healthcheck
|
||||
func healthcheck() {
|
||||
hcCompatibleProvider(tunnel.Providers())
|
||||
}
|
||||
|
||||
//export initNativeApiBridge
|
||||
func initNativeApiBridge(api unsafe.Pointer, port C.longlong) {
|
||||
bridge.InitDartApi(api)
|
||||
i := int64(port)
|
||||
bridge.Port = &i
|
||||
}
|
||||
|
||||
func init() {
|
||||
provider.HealthcheckHook = func(name string, delay uint16) {
|
||||
delayData := &Delay{
|
||||
Name: name,
|
||||
}
|
||||
if delay == 0 {
|
||||
delayData.Value = -1
|
||||
} else {
|
||||
delayData.Value = int32(delay)
|
||||
}
|
||||
bridge.SendMessage(bridge.Message{
|
||||
Type: bridge.Delay,
|
||||
Data: delayData,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:fl_clash/l10n/l10n.dart';
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
@@ -25,8 +27,13 @@ runAppWithPreferences(
|
||||
ChangeNotifierProvider<Config>(
|
||||
create: (_) => config,
|
||||
),
|
||||
ChangeNotifierProvider<AppState>(
|
||||
ChangeNotifierProxyProvider2<Config, ClashConfig, AppState>(
|
||||
create: (_) => appState,
|
||||
update: (_, config, clashConfig, appState) {
|
||||
appState?.mode = clashConfig.mode;
|
||||
appState?.currentProxyName = config.currentProxyName;
|
||||
return appState!;
|
||||
},
|
||||
)
|
||||
],
|
||||
child: child,
|
||||
@@ -112,7 +119,6 @@ class ApplicationState extends State<Application> {
|
||||
primaryColor: config.primaryColor,
|
||||
),
|
||||
builder: (_, state, child) {
|
||||
debugPrint("[Application] update===>");
|
||||
return DynamicColorBuilder(
|
||||
builder: (lightDynamic, darkDynamic) {
|
||||
_updateSystemColorSchemes(lightDynamic, darkDynamic);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
@@ -16,19 +17,22 @@ class ClashCore {
|
||||
late final ClashFFI clashFFI;
|
||||
late final DynamicLibrary lib;
|
||||
|
||||
ClashCore._internal() {
|
||||
DynamicLibrary _getClashLib() {
|
||||
if (Platform.isWindows) {
|
||||
lib = DynamicLibrary.open("libclash.dll");
|
||||
clashFFI = ClashFFI(lib);
|
||||
return DynamicLibrary.open("libclash.dll");
|
||||
}
|
||||
if (Platform.isMacOS) {
|
||||
lib = DynamicLibrary.open("libclash.dylib");
|
||||
clashFFI = ClashFFI(lib);
|
||||
return DynamicLibrary.open("libclash.dylib");
|
||||
}
|
||||
if (Platform.isAndroid || Platform.isLinux) {
|
||||
lib = DynamicLibrary.open("libclash.so");
|
||||
clashFFI = ClashFFI(lib);
|
||||
return DynamicLibrary.open("libclash.so");
|
||||
}
|
||||
throw "Platform is not supported";
|
||||
}
|
||||
|
||||
ClashCore._internal() {
|
||||
lib = _getClashLib();
|
||||
clashFFI = ClashFFI(lib);
|
||||
clashFFI.initNativeApiBridge(
|
||||
NativeApi.initializeApiDLData,
|
||||
receiver.sendPort.nativePort,
|
||||
@@ -61,12 +65,21 @@ class ClashCore {
|
||||
1;
|
||||
}
|
||||
|
||||
bool updateConfig(UpdateConfigParams updateConfigParams) {
|
||||
Future<String> updateConfig(UpdateConfigParams updateConfigParams) {
|
||||
final completer = Completer<String>();
|
||||
final receiver = ReceivePort();
|
||||
receiver.listen((message) {
|
||||
if (!completer.isCompleted) {
|
||||
completer.complete(message);
|
||||
receiver.close();
|
||||
}
|
||||
});
|
||||
final params = json.encode(updateConfigParams);
|
||||
return clashFFI.updateConfig(
|
||||
params.toNativeUtf8().cast(),
|
||||
) ==
|
||||
1;
|
||||
clashFFI.updateConfig(
|
||||
params.toNativeUtf8().cast(),
|
||||
receiver.sendPort.nativePort,
|
||||
);
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
Future<List<Group>> getProxiesGroups() {
|
||||
@@ -74,15 +87,14 @@ class ClashCore {
|
||||
final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString();
|
||||
return Isolate.run<List<Group>>(() {
|
||||
final proxies = json.decode(proxiesRawString);
|
||||
final groupsRaw = (proxies[UsedProxy.GLOBAL.name]["all"] as List)
|
||||
.where((e) {
|
||||
final proxy = proxies[e];
|
||||
final excludeName = !UsedProxyExtension.valueList
|
||||
.where((element) => element != UsedProxy.GLOBAL.name)
|
||||
.contains(proxy['name']);
|
||||
final validType = GroupTypeExtension.valueList.contains(proxy['type']);
|
||||
return excludeName && validType;
|
||||
}).map((groupName) {
|
||||
final groupNames = [
|
||||
UsedProxy.GLOBAL.name,
|
||||
...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) {
|
||||
final proxy = proxies[e];
|
||||
return GroupTypeExtension.valueList.contains(proxy['type']);
|
||||
})
|
||||
];
|
||||
final groupsRaw = groupNames.map((groupName) {
|
||||
final group = proxies[groupName];
|
||||
group["all"] = ((group["all"] ?? []) as List)
|
||||
.map(
|
||||
@@ -100,13 +112,42 @@ class ClashCore {
|
||||
return clashFFI.changeProxy(params.toNativeUtf8().cast()) == 1;
|
||||
}
|
||||
|
||||
bool delay(String proxyName) {
|
||||
Future<Delay> delay(String proxyName) {
|
||||
final completer = Completer<Delay>();
|
||||
final receiver = ReceivePort();
|
||||
receiver.listen((message) {
|
||||
if (!completer.isCompleted) {
|
||||
final m = Message.fromJson(json.decode(message));
|
||||
final delay = Delay.fromJson(m.data);
|
||||
completer.complete(delay);
|
||||
receiver.close();
|
||||
}
|
||||
});
|
||||
final delayParams = {
|
||||
"proxy-name": proxyName,
|
||||
"timeout": appConstant.httpTimeoutDuration.inMilliseconds,
|
||||
};
|
||||
clashFFI.asyncTestDelay(json.encode(delayParams).toNativeUtf8().cast());
|
||||
return true;
|
||||
clashFFI.asyncTestDelay(
|
||||
json.encode(delayParams).toNativeUtf8().cast(),
|
||||
receiver.sendPort.nativePort,
|
||||
);
|
||||
Future.delayed(appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
||||
() {
|
||||
if (!completer.isCompleted) {
|
||||
receiver.close();
|
||||
completer.complete(
|
||||
Delay(
|
||||
name: proxyName,
|
||||
value: -1,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
healthcheck() {
|
||||
clashFFI.healthcheck();
|
||||
}
|
||||
|
||||
VersionInfo getVersionInfo() {
|
||||
|
||||
@@ -907,19 +907,22 @@ class ClashFFI {
|
||||
late final _validateConfig =
|
||||
_validateConfigPtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
int updateConfig(
|
||||
void updateConfig(
|
||||
ffi.Pointer<ffi.Char> s,
|
||||
int port,
|
||||
) {
|
||||
return _updateConfig(
|
||||
s,
|
||||
port,
|
||||
);
|
||||
}
|
||||
|
||||
late final _updateConfigPtr =
|
||||
_lookup<ffi.NativeFunction<GoUint8 Function(ffi.Pointer<ffi.Char>)>>(
|
||||
'updateConfig');
|
||||
late final _updateConfigPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Char>, ffi.LongLong)>>('updateConfig');
|
||||
late final _updateConfig =
|
||||
_updateConfigPtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
|
||||
_updateConfigPtr.asFunction<void Function(ffi.Pointer<ffi.Char>, int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> getProxies() {
|
||||
return _getProxies();
|
||||
@@ -957,17 +960,20 @@ class ClashFFI {
|
||||
|
||||
void asyncTestDelay(
|
||||
ffi.Pointer<ffi.Char> s,
|
||||
int port,
|
||||
) {
|
||||
return _asyncTestDelay(
|
||||
s,
|
||||
port,
|
||||
);
|
||||
}
|
||||
|
||||
late final _asyncTestDelayPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Char>)>>(
|
||||
'asyncTestDelay');
|
||||
late final _asyncTestDelay =
|
||||
_asyncTestDelayPtr.asFunction<void Function(ffi.Pointer<ffi.Char>)>();
|
||||
late final _asyncTestDelayPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Char>, ffi.LongLong)>>('asyncTestDelay');
|
||||
late final _asyncTestDelay = _asyncTestDelayPtr
|
||||
.asFunction<void Function(ffi.Pointer<ffi.Char>, int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> getVersionInfo() {
|
||||
return _getVersionInfo();
|
||||
@@ -1037,6 +1043,14 @@ class ClashFFI {
|
||||
late final _getProvider = _getProviderPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
void healthcheck() {
|
||||
return _healthcheck();
|
||||
}
|
||||
|
||||
late final _healthcheckPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function()>>('healthcheck');
|
||||
late final _healthcheck = _healthcheckPtr.asFunction<void Function()>();
|
||||
|
||||
void initNativeApiBridge(
|
||||
ffi.Pointer<ffi.Void> api,
|
||||
int port,
|
||||
|
||||
@@ -15,6 +15,8 @@ abstract mixin class ClashMessageListener {
|
||||
void onDelay(Delay delay) {}
|
||||
|
||||
void onProcess(Metadata metadata) {}
|
||||
|
||||
void onNow(Now now) {}
|
||||
}
|
||||
|
||||
class ClashMessage {
|
||||
@@ -41,6 +43,9 @@ class ClashMessage {
|
||||
case MessageType.process:
|
||||
listener.onProcess(Metadata.fromJson(m.data));
|
||||
break;
|
||||
case MessageType.now:
|
||||
listener.onNow(Now.fromJson(m.data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,8 +19,8 @@ Function debounce<F extends Function>(F func,{int milliseconds = 600}) {
|
||||
if (timer != null) {
|
||||
timer!.cancel();
|
||||
}
|
||||
timer = Timer(Duration(milliseconds: milliseconds), () {
|
||||
Function.apply(func, args ?? [], namedArgs);
|
||||
timer = Timer(Duration(milliseconds: milliseconds), () async {
|
||||
await Function.apply(func, args ?? [], namedArgs);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -35,7 +35,6 @@ class AppController {
|
||||
config: config,
|
||||
clashConfig: clashConfig,
|
||||
);
|
||||
|
||||
updateRunTime();
|
||||
updateTraffic();
|
||||
globalState.updateFunctionLists = [
|
||||
@@ -115,7 +114,7 @@ class AppController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> updateClashConfig({bool isPatch = true}) async {
|
||||
Future<String> updateClashConfig({bool isPatch = true}) async {
|
||||
return await globalState.updateClashConfig(
|
||||
clashConfig: clashConfig,
|
||||
config: config,
|
||||
@@ -123,12 +122,31 @@ class AppController {
|
||||
);
|
||||
}
|
||||
|
||||
applyProfile() async {
|
||||
await globalState.applyProfile(
|
||||
appState: appState,
|
||||
config: config,
|
||||
clashConfig: clashConfig,
|
||||
);
|
||||
}
|
||||
|
||||
Function? _changeProfileDebounce;
|
||||
|
||||
changeProfileDebounce(String? profileId) {
|
||||
if (profileId == config.currentProfileId) return;
|
||||
config.currentProfileId = profileId;
|
||||
_changeProfileDebounce ??= debounce<Function(String?)>((profileId) async {
|
||||
await applyProfile();
|
||||
appState.delayMap = {};
|
||||
saveConfigPreferences();
|
||||
});
|
||||
_changeProfileDebounce!([profileId]);
|
||||
}
|
||||
|
||||
changeProfile(String? value) async {
|
||||
if (value == config.currentProfileId) return;
|
||||
config.currentProfileId = value;
|
||||
await updateClashConfig(isPatch: false);
|
||||
await updateGroups();
|
||||
changeProxy();
|
||||
await applyProfile();
|
||||
appState.delayMap = {};
|
||||
saveConfigPreferences();
|
||||
}
|
||||
@@ -142,10 +160,7 @@ class AppController {
|
||||
)
|
||||
.isBeforeNow();
|
||||
if (isNotNeedUpdate == false) continue;
|
||||
final result = await profile.update();
|
||||
if (result.type == ResultType.error) continue;
|
||||
await updateGroups();
|
||||
changeProxy();
|
||||
await profile.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,13 +172,6 @@ class AppController {
|
||||
appState.systemColorSchemes = systemColorSchemes;
|
||||
}
|
||||
|
||||
clearCurrentDelay() {
|
||||
final currentProxyName =
|
||||
appState.getCurrentProxyName(config.currentProxyName, clashConfig.mode);
|
||||
if (currentProxyName == null) return;
|
||||
appState.setDelay(Delay(name: currentProxyName, value: null));
|
||||
}
|
||||
|
||||
savePreferences() async {
|
||||
await saveConfigPreferences();
|
||||
await saveClashConfigPreferences();
|
||||
@@ -207,19 +215,30 @@ class AppController {
|
||||
}
|
||||
|
||||
afterInit() async {
|
||||
if (appState.isInit) {
|
||||
if (config.autoRun) {
|
||||
await updateSystemProxy(true);
|
||||
} else {
|
||||
await proxyManager.updateStartTime();
|
||||
await updateSystemProxy(proxyManager.isStart);
|
||||
}
|
||||
autoUpdateProfiles();
|
||||
updateLogStatus();
|
||||
if (!config.silentLaunch) {
|
||||
window?.show();
|
||||
}
|
||||
if (config.autoRun) {
|
||||
await updateSystemProxy(true);
|
||||
} else {
|
||||
await proxyManager.updateStartTime();
|
||||
await updateSystemProxy(proxyManager.isStart);
|
||||
}
|
||||
autoUpdateProfiles();
|
||||
updateLogStatus();
|
||||
if (!config.silentLaunch) {
|
||||
window?.show();
|
||||
}
|
||||
}
|
||||
|
||||
healthcheck() {
|
||||
if (globalState.healthcheckLock) return;
|
||||
for (final delay in appState.delayMap.entries) {
|
||||
setDelay(
|
||||
Delay(
|
||||
name: delay.key,
|
||||
value: 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
clashCore.healthcheck();
|
||||
}
|
||||
|
||||
setDelay(Delay delay) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
enum GroupType { Selector, URLTest, Fallback }
|
||||
|
||||
enum GroupName { GLOBAL, Proxy, Auto, Fallback }
|
||||
|
||||
extension GroupTypeExtension on GroupType {
|
||||
static List<String> get valueList => GroupType.values
|
||||
.map(
|
||||
@@ -52,4 +54,4 @@ enum ProfileType { file, url }
|
||||
|
||||
enum ResultType { success, error }
|
||||
|
||||
enum MessageType { log, tun, delay, process }
|
||||
enum MessageType { log, tun, delay, process, now }
|
||||
|
||||
@@ -80,6 +80,15 @@ class AboutFragment extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: const Text("Telegram"),
|
||||
onTap: () {
|
||||
launchUrl(
|
||||
Uri.parse("https://t.me/+G-veVtwBOl4wODc1"),
|
||||
);
|
||||
},
|
||||
trailing: const Icon(Icons.launch),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(appLocalizations.project),
|
||||
onTap: () {
|
||||
|
||||
@@ -12,7 +12,6 @@ class CoreInfo extends StatelessWidget {
|
||||
return Selector<AppState, VersionInfo?>(
|
||||
selector: (_, appState) => appState.versionInfo,
|
||||
builder: (_, versionInfo, __) {
|
||||
debugPrint("[CoreInfo] update===>");
|
||||
return CommonCard(
|
||||
info: Info(
|
||||
label: appLocalizations.coreInfo,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:fl_clash/enum/enum.dart';
|
||||
import 'package:fl_clash/models/models.dart';
|
||||
import 'package:fl_clash/state.dart';
|
||||
import 'package:fl_clash/widgets/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -25,6 +25,11 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (currentProxyName == UsedProxy.DIRECT.name) {
|
||||
return const Icon(
|
||||
Icons.offline_bolt_outlined,
|
||||
);
|
||||
}
|
||||
if (delay == 0 || delay == null) {
|
||||
return const AspectRatio(
|
||||
aspectRatio: 1,
|
||||
@@ -73,57 +78,6 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
);
|
||||
}
|
||||
|
||||
_updateCurrentDelay(
|
||||
String? currentProxyName,
|
||||
int? delay,
|
||||
bool isCurrent,
|
||||
bool isInit,
|
||||
) {
|
||||
if (!isCurrent || currentProxyName == null || !isInit) return;
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
if (delay == null) {
|
||||
context.appController.setDelay(
|
||||
Delay(
|
||||
name: currentProxyName,
|
||||
value: 0,
|
||||
),
|
||||
);
|
||||
globalState.updateCurrentDelay(
|
||||
currentProxyName,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_updateCurrentDelayContainer(Widget child) {
|
||||
return Selector3<AppState, Config, ClashConfig,
|
||||
UpdateCurrentDelaySelectorState>(
|
||||
selector: (_, appState, config, clashConfig) {
|
||||
final proxyName = appState.getCurrentProxyName(
|
||||
config.currentProxyName,
|
||||
clashConfig.mode,
|
||||
);
|
||||
return UpdateCurrentDelaySelectorState(
|
||||
isInit: appState.isInit,
|
||||
currentProxyName: proxyName,
|
||||
delay: appState.delayMap[proxyName],
|
||||
isCurrent: appState.currentLabel == 'dashboard',
|
||||
);
|
||||
},
|
||||
builder: (_, state, __) {
|
||||
debugPrint("[UpdateCurrentDelay] update===>");
|
||||
_updateCurrentDelay(
|
||||
state.currentProxyName,
|
||||
state.delay,
|
||||
state.isCurrent,
|
||||
state.isInit,
|
||||
);
|
||||
return child;
|
||||
},
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CommonCard(
|
||||
@@ -131,59 +85,55 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
iconData: Icons.network_check,
|
||||
label: appLocalizations.networkDetection,
|
||||
),
|
||||
child: _updateCurrentDelayContainer(
|
||||
Selector3<AppState, Config, ClashConfig, NetworkDetectionSelectorState>(
|
||||
selector: (_, appState, config, clashConfig) {
|
||||
final proxyName = appState.getCurrentProxyName(
|
||||
config.currentProxyName,
|
||||
clashConfig.mode,
|
||||
);
|
||||
return NetworkDetectionSelectorState(
|
||||
isInit: appState.isInit,
|
||||
currentProxyName: proxyName,
|
||||
delay: appState.delayMap[proxyName],
|
||||
);
|
||||
},
|
||||
builder: (_, state, __) {
|
||||
debugPrint("[NetworkDetection] update===>");
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16).copyWith(top: 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 0,
|
||||
child: TooltipText(
|
||||
text: Text(
|
||||
state.currentProxyName ?? appLocalizations.noProxy,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
||||
child: Selector3<AppState, Config, ClashConfig,
|
||||
NetworkDetectionSelectorState>(
|
||||
selector: (_, appState, config, clashConfig) {
|
||||
final proxyName = appState.currentProxyName;
|
||||
return NetworkDetectionSelectorState(
|
||||
currentProxyName: proxyName,
|
||||
delay: appState.getDelay(
|
||||
proxyName,
|
||||
),
|
||||
);
|
||||
},
|
||||
builder: (_, state, __) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16).copyWith(top: 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 0,
|
||||
child: TooltipText(
|
||||
text: Text(
|
||||
state.currentProxyName ?? appLocalizations.noProxy,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: context.appController.measure.titleLargeHeight,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: FadeBox(
|
||||
child: _buildDescription(
|
||||
state.currentProxyName,
|
||||
state.delay,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: context.appController.measure.titleLargeHeight,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: FadeBox(
|
||||
child: _buildDescription(
|
||||
state.currentProxyName,
|
||||
state.delay,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:fl_clash/clash/clash.dart';
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:fl_clash/models/models.dart';
|
||||
import 'package:fl_clash/state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -50,9 +52,6 @@ class _StartButtonState extends State<StartButton>
|
||||
updateSystemProxy() async {
|
||||
final appController = context.appController;
|
||||
await appController.updateSystemProxy(isStart);
|
||||
if (isStart && mounted) {
|
||||
appController.clearCurrentDelay();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -63,18 +62,20 @@ class _StartButtonState extends State<StartButton>
|
||||
hasProfile: config.profiles.isNotEmpty,
|
||||
),
|
||||
builder: (_, state, child) {
|
||||
debugPrint("[StartButton] update===>");
|
||||
if (!state.isInit || !state.hasProfile) {
|
||||
return Container();
|
||||
}
|
||||
final textWidth = context.appController.measure.computeTextSize(
|
||||
Text(
|
||||
Other.getTimeDifference(
|
||||
DateTime.now(),
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
||||
),
|
||||
).width +
|
||||
final textWidth = context.appController.measure
|
||||
.computeTextSize(
|
||||
Text(
|
||||
Other.getTimeDifference(
|
||||
DateTime.now(),
|
||||
),
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
||||
),
|
||||
)
|
||||
.width +
|
||||
16;
|
||||
return AnimatedBuilder(
|
||||
animation: _controller.view,
|
||||
|
||||
@@ -24,6 +24,7 @@ class ProfilesFragment extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfilesFragmentState extends State<ProfilesFragment> {
|
||||
|
||||
String _getLastUpdateTimeDifference(DateTime lastDateTime) {
|
||||
final currentDateTime = DateTime.now();
|
||||
final difference = currentDateTime.difference(lastDateTime);
|
||||
@@ -209,7 +210,7 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
||||
child: _profileItem(
|
||||
profile: profile,
|
||||
groupValue: state.currentProfileId,
|
||||
onChanged: context.appController.changeProfile,
|
||||
onChanged: context.appController.changeProfileDebounce,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -234,7 +235,6 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
||||
currentProfileId: config.currentProfileId,
|
||||
),
|
||||
builder: (context, state, child) {
|
||||
debugPrint("[Profiles] update===>");
|
||||
if (state.profiles.isEmpty) {
|
||||
return NullStatus(
|
||||
label: appLocalizations.nullProfileDesc,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:fl_clash/clash/clash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -17,8 +16,6 @@ class ProxiesFragment extends StatefulWidget {
|
||||
|
||||
class _ProxiesFragmentState extends State<ProxiesFragment>
|
||||
with TickerProviderStateMixin {
|
||||
TabController? _tabController;
|
||||
|
||||
_initActions() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
final commonScaffoldState =
|
||||
@@ -56,148 +53,6 @@ class _ProxiesFragmentState extends State<ProxiesFragment>
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Selector<AppState, bool>(
|
||||
selector: (_, appState) => appState.currentLabel == 'proxies',
|
||||
builder: (_, isCurrent, child) {
|
||||
if (isCurrent) {
|
||||
_initActions();
|
||||
}
|
||||
return child!;
|
||||
},
|
||||
child: Selector3<AppState, Config, ClashConfig, ProxiesSelectorState>(
|
||||
selector: (_, appState, config, clashConfig) {
|
||||
final currentGroups = appState.getCurrentGroups(clashConfig.mode);
|
||||
final currentProxyName = appState.getCurrentGroupNameWithGroups(
|
||||
currentGroups,
|
||||
config.currentGroupName,
|
||||
clashConfig.mode,
|
||||
);
|
||||
final currentIndex = currentGroups
|
||||
.indexWhere((element) => element.name == currentProxyName);
|
||||
return ProxiesSelectorState(
|
||||
currentIndex: currentIndex != -1 ? currentIndex : 0,
|
||||
groups: currentGroups,
|
||||
);
|
||||
},
|
||||
builder: (_, state, __) {
|
||||
if (_tabController != null) {
|
||||
_tabController!.dispose();
|
||||
_tabController = null;
|
||||
}
|
||||
_tabController = TabController(
|
||||
length: state.groups.length,
|
||||
vsync: this,
|
||||
initialIndex: state.currentIndex,
|
||||
);
|
||||
debugPrint("[Proxies] update===>");
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TabBar(
|
||||
controller: _tabController,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
dividerColor: Colors.transparent,
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
overlayColor:
|
||||
const MaterialStatePropertyAll(Colors.transparent),
|
||||
tabs: [
|
||||
for (final group in state.groups)
|
||||
Tab(
|
||||
text: group.name,
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
for (final group in state.groups)
|
||||
KeepContainer(
|
||||
child: ProxiesTabView(
|
||||
group: group,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ProxiesTabView extends StatefulWidget {
|
||||
final Group group;
|
||||
|
||||
const ProxiesTabView({
|
||||
super.key,
|
||||
required this.group,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ProxiesTabView> createState() => _ProxiesTabViewState();
|
||||
}
|
||||
|
||||
class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
with SingleTickerProviderStateMixin {
|
||||
var lock = false;
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _scale;
|
||||
late Animation<double> _opacity;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(
|
||||
milliseconds: 200,
|
||||
),
|
||||
);
|
||||
_scale = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: 0.8,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(
|
||||
0.0,
|
||||
0.3,
|
||||
curve: Curves.easeIn,
|
||||
),
|
||||
),
|
||||
);
|
||||
_opacity = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: 0.0,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(
|
||||
0,
|
||||
1,
|
||||
curve: Curves.easeIn,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
get group => widget.group;
|
||||
|
||||
get measure => context.appController.measure;
|
||||
|
||||
List<Proxy> _sortOfName(List<Proxy> proxies) {
|
||||
return List.of(proxies)
|
||||
..sort(
|
||||
@@ -205,7 +60,7 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
);
|
||||
}
|
||||
|
||||
List<Proxy> _sortOfDelay(List<Proxy> proxies) {
|
||||
List<Proxy> _sortOfDelay(BuildContext context, List<Proxy> proxies) {
|
||||
final appState = context.read<AppState>();
|
||||
final delayMap = appState.delayMap;
|
||||
return proxies = List.of(proxies)
|
||||
@@ -231,35 +86,15 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
List<Proxy> proxies,
|
||||
ProxiesSortType proxiesSortType,
|
||||
) {
|
||||
if (proxiesSortType == ProxiesSortType.delay) return _sortOfDelay(proxies);
|
||||
if (proxiesSortType == ProxiesSortType.delay) {
|
||||
return _sortOfDelay(context, proxies);
|
||||
}
|
||||
if (proxiesSortType == ProxiesSortType.name) return _sortOfName(proxies);
|
||||
return proxies;
|
||||
}
|
||||
|
||||
_getDelayMap() async {
|
||||
if (lock == true) return;
|
||||
lock = true;
|
||||
_controller.forward();
|
||||
for (final proxy in group.all) {
|
||||
context.appController.setDelay(
|
||||
Delay(
|
||||
name: proxy.name,
|
||||
value: 0,
|
||||
),
|
||||
);
|
||||
clashCore.delay(
|
||||
proxy.name,
|
||||
);
|
||||
}
|
||||
await Future.delayed(
|
||||
appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
||||
);
|
||||
lock = false;
|
||||
_controller.reverse();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
double _getItemHeight() {
|
||||
double _getItemHeight(BuildContext context) {
|
||||
final measure = context.appController.measure;
|
||||
return 12 * 2 +
|
||||
measure.bodyMediumHeight * 2 +
|
||||
measure.bodySmallHeight +
|
||||
@@ -272,6 +107,7 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
required bool isSelected,
|
||||
required Proxy proxy,
|
||||
}) {
|
||||
final measure = context.appController.measure;
|
||||
return CommonCard(
|
||||
isSelected: isSelected,
|
||||
onPressed: onPressed,
|
||||
@@ -308,12 +144,22 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
),
|
||||
SizedBox(
|
||||
height: measure.bodySmallHeight,
|
||||
child: Text(
|
||||
proxy.type,
|
||||
style: context.textTheme.bodySmall?.copyWith(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
color: context.textTheme.bodySmall?.color?.toLight(),
|
||||
child: Selector<AppState, String>(
|
||||
selector: (context, appState) => appState.getDesc(
|
||||
proxy.type,
|
||||
proxy.name,
|
||||
),
|
||||
builder: (_, desc, __) {
|
||||
return TooltipText(
|
||||
text: Text(
|
||||
desc,
|
||||
style: context.textTheme.bodySmall?.copyWith(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
color: context.textTheme.bodySmall?.color?.toLight(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
@@ -322,7 +168,7 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
SizedBox(
|
||||
height: measure.labelSmallHeight,
|
||||
child: Selector<AppState, int?>(
|
||||
selector: (context, appState) => appState.delayMap[proxy.name],
|
||||
selector: (context, appState) => appState.getDelay(proxy.name),
|
||||
builder: (_, delay, __) {
|
||||
return FadeBox(
|
||||
child: Builder(
|
||||
@@ -360,107 +206,200 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
||||
);
|
||||
}
|
||||
|
||||
_buildGrid({
|
||||
required ProxiesSortType proxiesSortType,
|
||||
Widget _buildGrid(
|
||||
BuildContext context, {
|
||||
required List<Proxy> proxies,
|
||||
required int columns,
|
||||
}) {
|
||||
return SingleChildScrollView(
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: AnimateGrid<Proxy>(
|
||||
items: _getProxies(group.all, proxiesSortType),
|
||||
columns: columns,
|
||||
itemHeight: _getItemHeight(),
|
||||
keyBuilder: (item) {
|
||||
return ObjectKey(item);
|
||||
},
|
||||
builder: (_, proxy) {
|
||||
return Selector3<AppState, Config, ClashConfig, String?>(
|
||||
selector: (_, appState, config, clashConfig) =>
|
||||
appState.getCurrentProxyName(
|
||||
config.currentProxyName,
|
||||
clashConfig.mode,
|
||||
),
|
||||
builder: (_, value, __) {
|
||||
final currentProxyName =
|
||||
group.type == GroupType.Selector ? value : group.now;
|
||||
return _card(
|
||||
isSelected: proxy.name == currentProxyName,
|
||||
onPressed: () {
|
||||
if (group.type == GroupType.Selector) {
|
||||
final config = context.read<Config>();
|
||||
config.currentProfile?.groupName = group.name;
|
||||
config.currentProfile?.proxyName = proxy.name;
|
||||
config.update();
|
||||
context.appController.changeProxy();
|
||||
}
|
||||
},
|
||||
proxy: proxy,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: columns,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisExtent: _getItemHeight(context),
|
||||
),
|
||||
itemCount: proxies.length,
|
||||
itemBuilder: (_, index) {
|
||||
final proxy = proxies[index];
|
||||
return Selector<AppState, bool>(
|
||||
selector: (_, appState) => proxy.name == appState.currentProxyName,
|
||||
builder: (_, isSelected, __) {
|
||||
return _card(
|
||||
isSelected: isSelected,
|
||||
onPressed: () {
|
||||
context.appController.config.currentProxyName = proxy.name;
|
||||
context.appController.changeProxy();
|
||||
},
|
||||
proxy: proxy,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Selector<Config, ProxiesSortType>(
|
||||
selector: (_, config) => config.proxiesSortType,
|
||||
builder: (_, proxiesSortType, __) {
|
||||
return FloatLayout(
|
||||
floatingWidget: FloatWrapper(
|
||||
child: AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (_, __) {
|
||||
return Transform.scale(
|
||||
scale: _scale.value,
|
||||
child: SizedBox(
|
||||
width: 56,
|
||||
height: 56,
|
||||
child: Opacity(
|
||||
opacity: _opacity.value,
|
||||
child: FloatingActionButton(
|
||||
heroTag: null,
|
||||
onPressed: _getDelayMap,
|
||||
child: const Icon(Icons.network_ping),
|
||||
),
|
||||
return DelayTestButtonContainer(
|
||||
child: Selector<AppState, bool>(
|
||||
selector: (_, appState) => appState.currentLabel == 'proxies',
|
||||
builder: (_, isCurrent, child) {
|
||||
if (isCurrent) {
|
||||
_initActions();
|
||||
}
|
||||
return child!;
|
||||
},
|
||||
child: Selector2<AppState, Config, ProxiesSelectorState>(
|
||||
selector: (_, appState, config) {
|
||||
return ProxiesSelectorState(
|
||||
proxiesSortType: config.proxiesSortType,
|
||||
sortNum: appState.sortNum,
|
||||
group: appState.currentGroup,
|
||||
);
|
||||
},
|
||||
builder: (_, state, __) {
|
||||
if (state.group == null) return Container();
|
||||
final proxies = _getProxies(
|
||||
state.group!.all,
|
||||
state.proxiesSortType,
|
||||
);
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SlotLayout(
|
||||
config: {
|
||||
Breakpoints.small: SlotLayout.from(
|
||||
key: const Key('proxies_grid_small'),
|
||||
builder: (_) => _buildGrid(
|
||||
context,
|
||||
proxies: proxies,
|
||||
columns: 2,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SlotLayout(
|
||||
config: {
|
||||
Breakpoints.small: SlotLayout.from(
|
||||
key: const Key('proxies_grid_small'),
|
||||
builder: (_) => _buildGrid(
|
||||
proxiesSortType: proxiesSortType,
|
||||
columns: 2,
|
||||
Breakpoints.medium: SlotLayout.from(
|
||||
key: const Key('proxies_grid_medium'),
|
||||
builder: (_) => _buildGrid(
|
||||
context,
|
||||
proxies: proxies,
|
||||
columns: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Breakpoints.medium: SlotLayout.from(
|
||||
key: const Key('proxies_grid_medium'),
|
||||
builder: (_) => _buildGrid(
|
||||
proxiesSortType: proxiesSortType,
|
||||
columns: 3,
|
||||
Breakpoints.large: SlotLayout.from(
|
||||
key: const Key('proxies_grid_large'),
|
||||
builder: (_) => _buildGrid(
|
||||
context,
|
||||
proxies: proxies,
|
||||
columns: 4,
|
||||
),
|
||||
),
|
||||
),
|
||||
Breakpoints.large: SlotLayout.from(
|
||||
key: const Key('proxies_grid_large'),
|
||||
builder: (_) => _buildGrid(
|
||||
proxiesSortType: proxiesSortType,
|
||||
columns: 4,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DelayTestButtonContainer extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
const DelayTestButtonContainer({
|
||||
super.key,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@override
|
||||
State<DelayTestButtonContainer> createState() =>
|
||||
_DelayTestButtonContainerState();
|
||||
}
|
||||
|
||||
class _DelayTestButtonContainerState extends State<DelayTestButtonContainer>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _scale;
|
||||
late Animation<double> _opacity;
|
||||
|
||||
_healthcheck() async {
|
||||
_controller.forward();
|
||||
context.appController.healthcheck();
|
||||
await Future.delayed(
|
||||
appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
||||
);
|
||||
_controller.reverse();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(
|
||||
milliseconds: 300,
|
||||
),
|
||||
);
|
||||
_scale = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: 0.0,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(
|
||||
0,
|
||||
1,
|
||||
curve: Curves.easeIn,
|
||||
),
|
||||
),
|
||||
);
|
||||
_opacity = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: 0.0,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(
|
||||
0,
|
||||
1,
|
||||
curve: Curves.easeIn,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FloatLayout(
|
||||
floatingWidget: FloatWrapper(
|
||||
child: AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (_, child) {
|
||||
return SizedBox(
|
||||
width: 56,
|
||||
height: 56,
|
||||
child: Transform.scale(
|
||||
scale: _scale.value,
|
||||
child: Opacity(
|
||||
opacity: _opacity.value,
|
||||
child: child!,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: FloatingActionButton(
|
||||
heroTag: null,
|
||||
onPressed: _healthcheck,
|
||||
child: const Icon(Icons.network_ping),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@ Future<void> main() async {
|
||||
await window?.init();
|
||||
final config = await preferences.getConfig() ?? Config();
|
||||
final clashConfig = await preferences.getClashConfig() ?? ClashConfig();
|
||||
final appState = AppState();
|
||||
final appState = AppState(
|
||||
mode: clashConfig.mode,
|
||||
currentProxyName: config.currentProxyName,
|
||||
);
|
||||
await globalState.init(
|
||||
appState: appState,
|
||||
config: config,
|
||||
@@ -41,7 +44,10 @@ Future<void> vpnService() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final config = await preferences.getConfig() ?? Config();
|
||||
final clashConfig = await preferences.getClashConfig() ?? ClashConfig();
|
||||
final appState = AppState();
|
||||
final appState = AppState(
|
||||
mode: clashConfig.mode,
|
||||
currentProxyName: config.currentProxyName,
|
||||
);
|
||||
clashMessage.addListener(ClashMessageListenerWithVpn(onTun: (String fd) {
|
||||
proxyManager.setProtect(
|
||||
int.parse(fd),
|
||||
|
||||
@@ -22,8 +22,11 @@ class AppState with ChangeNotifier {
|
||||
String _currentLabel;
|
||||
SystemColorSchemes _systemColorSchemes;
|
||||
List<Group> _groups;
|
||||
num _sortNum;
|
||||
Mode _mode;
|
||||
String? _currentProxyName;
|
||||
|
||||
AppState()
|
||||
AppState({required Mode mode, required currentProxyName})
|
||||
: _navigationItems = [],
|
||||
_delayMap = {},
|
||||
_isInit = false,
|
||||
@@ -32,6 +35,9 @@ class AppState with ChangeNotifier {
|
||||
_logs = [],
|
||||
_groups = [],
|
||||
_packages = [],
|
||||
_sortNum = 0,
|
||||
_mode = mode,
|
||||
_currentProxyName = currentProxyName,
|
||||
_systemColorSchemes = SystemColorSchemes();
|
||||
|
||||
String get currentLabel => _currentLabel;
|
||||
@@ -79,6 +85,35 @@ class AppState with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
String getDesc(String type, String? proxyName) {
|
||||
final groupTypeNamesList = GroupType.values.map((e) => e.name).toList();
|
||||
if (!groupTypeNamesList.contains(type)) {
|
||||
return type;
|
||||
}else{
|
||||
final index = groups.indexWhere((element) => element.name == proxyName);
|
||||
if(index == -1) return type;
|
||||
return "$type(${groups[index].now})";
|
||||
}
|
||||
}
|
||||
|
||||
int? getDelay(String? proxyName) {
|
||||
if (proxyName == null) return null;
|
||||
final index = groups.indexWhere((element) => element.name == proxyName);
|
||||
if (index == -1) return _delayMap[proxyName];
|
||||
final group = groups[index];
|
||||
if (group.now == null) return null;
|
||||
return _delayMap[group.now];
|
||||
}
|
||||
|
||||
String? get realCurrentProxyName {
|
||||
if (currentProxyName == null) return null;
|
||||
final index = groups.indexWhere((element) => element.name == currentProxyName);
|
||||
if (index == -1) return currentProxyName;
|
||||
final group = groups[index];
|
||||
if (group.now == null) return null;
|
||||
return group.now;
|
||||
}
|
||||
|
||||
setDelay(Delay delay) {
|
||||
if (_delayMap[delay.name] != delay.value) {
|
||||
_delayMap = Map.from(_delayMap)..[delay.name] = delay.value;
|
||||
@@ -144,55 +179,63 @@ class AppState with ChangeNotifier {
|
||||
List<Group> get groups => _groups;
|
||||
|
||||
set groups(List<Group> value) {
|
||||
if (_groups != value) {
|
||||
if (!const ListEquality<Group>().equals(_groups, value)) {
|
||||
_groups = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
List<Group> getCurrentGroups(Mode mode) {
|
||||
switch (mode) {
|
||||
case Mode.direct:
|
||||
return [];
|
||||
case Mode.global:
|
||||
return groups
|
||||
.where((element) => element.name == UsedProxy.GLOBAL.name)
|
||||
.toList();
|
||||
case Mode.rule:
|
||||
return groups
|
||||
.where((element) => element.name != UsedProxy.GLOBAL.name)
|
||||
.toList();
|
||||
num get sortNum => _sortNum;
|
||||
|
||||
set sortNum(num value) {
|
||||
if (_sortNum != value) {
|
||||
_sortNum = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
String? getCurrentGroupNameWithGroups(
|
||||
List<Group> groups,
|
||||
String? groupName,
|
||||
Mode mode,
|
||||
) {
|
||||
Mode get mode => _mode;
|
||||
|
||||
set mode(Mode value) {
|
||||
if (_mode != value) {
|
||||
_mode = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
String? get currentProxyName {
|
||||
if (mode == Mode.direct) return UsedProxy.DIRECT.name;
|
||||
if (_currentProxyName != null) return _currentProxyName!;
|
||||
return currentGroup?.now;
|
||||
}
|
||||
|
||||
set currentProxyName(String? value) {
|
||||
if (_currentProxyName != value) {
|
||||
_currentProxyName = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Group? get currentGroup {
|
||||
switch (mode) {
|
||||
case Mode.direct:
|
||||
return null;
|
||||
case Mode.global:
|
||||
return UsedProxy.GLOBAL.name;
|
||||
return globalGroup;
|
||||
case Mode.rule:
|
||||
return groupName ?? (groups.isNotEmpty ? groups.first.name : null);
|
||||
return ruleGroup;
|
||||
}
|
||||
}
|
||||
|
||||
String? getCurrentGroupName(String? groupName, Mode mode) {
|
||||
final currentGroups = getCurrentGroups(mode);
|
||||
return getCurrentGroupNameWithGroups(currentGroups, groupName, mode);
|
||||
Group? get globalGroup {
|
||||
final index =
|
||||
groups.indexWhere((element) => element.name == GroupName.GLOBAL.name);
|
||||
return index != -1 ? groups[index] : null;
|
||||
}
|
||||
|
||||
String? getCurrentProxyName(String? proxyName, Mode mode) {
|
||||
final currentGroups = getCurrentGroups(mode);
|
||||
switch (mode) {
|
||||
case Mode.direct:
|
||||
return UsedProxy.DIRECT.name;
|
||||
case Mode.global || Mode.rule:
|
||||
return proxyName ??
|
||||
(currentGroups.isNotEmpty ? currentGroups.first.now : null);
|
||||
}
|
||||
Group? get ruleGroup {
|
||||
final index =
|
||||
groups.indexWhere((element) => element.name == GroupName.Proxy.name);
|
||||
return index != -1 ? groups[index] : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,12 @@ class Config extends ChangeNotifier {
|
||||
|
||||
String? get currentProxyName => currentProfile?.proxyName;
|
||||
|
||||
String? get currentGroupName => currentProfile?.groupName;
|
||||
set currentProxyName(String? value){
|
||||
if (currentProfile?.proxyName != value) {
|
||||
currentProfile?.proxyName = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@JsonKey(defaultValue: false)
|
||||
bool get autoLaunch {
|
||||
|
||||
@@ -52,6 +52,16 @@ class Delay with _$Delay {
|
||||
factory Delay.fromJson(Map<String, Object?> json) => _$DelayFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Now with _$Now {
|
||||
const factory Now({
|
||||
required String name,
|
||||
required String value,
|
||||
}) = _Now;
|
||||
|
||||
factory Now.fromJson(Map<String, Object?> json) => _$NowFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Process with _$Process {
|
||||
const factory Process({
|
||||
|
||||
@@ -672,6 +672,151 @@ abstract class _Delay implements Delay {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
Now _$NowFromJson(Map<String, dynamic> json) {
|
||||
return _Now.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Now {
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get value => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$NowCopyWith<Now> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $NowCopyWith<$Res> {
|
||||
factory $NowCopyWith(Now value, $Res Function(Now) then) =
|
||||
_$NowCopyWithImpl<$Res, Now>;
|
||||
@useResult
|
||||
$Res call({String name, String value});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$NowCopyWithImpl<$Res, $Val extends Now> implements $NowCopyWith<$Res> {
|
||||
_$NowCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? value = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
value: null == value
|
||||
? _value.value
|
||||
: value // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$NowImplCopyWith<$Res> implements $NowCopyWith<$Res> {
|
||||
factory _$$NowImplCopyWith(_$NowImpl value, $Res Function(_$NowImpl) then) =
|
||||
__$$NowImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String name, String value});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$NowImplCopyWithImpl<$Res> extends _$NowCopyWithImpl<$Res, _$NowImpl>
|
||||
implements _$$NowImplCopyWith<$Res> {
|
||||
__$$NowImplCopyWithImpl(_$NowImpl _value, $Res Function(_$NowImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? value = null,
|
||||
}) {
|
||||
return _then(_$NowImpl(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
value: null == value
|
||||
? _value.value
|
||||
: value // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$NowImpl implements _Now {
|
||||
const _$NowImpl({required this.name, required this.value});
|
||||
|
||||
factory _$NowImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$NowImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Now(name: $name, value: $value)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$NowImpl &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.value, value) || other.value == value));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, name, value);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$NowImplCopyWith<_$NowImpl> get copyWith =>
|
||||
__$$NowImplCopyWithImpl<_$NowImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$NowImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Now implements Now {
|
||||
const factory _Now(
|
||||
{required final String name, required final String value}) = _$NowImpl;
|
||||
|
||||
factory _Now.fromJson(Map<String, dynamic> json) = _$NowImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String get value;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$NowImplCopyWith<_$NowImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
Process _$ProcessFromJson(Map<String, dynamic> json) {
|
||||
return _Process.fromJson(json);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ const _$MessageTypeEnumMap = {
|
||||
MessageType.tun: 'tun',
|
||||
MessageType.delay: 'delay',
|
||||
MessageType.process: 'process',
|
||||
MessageType.now: 'now',
|
||||
};
|
||||
|
||||
_$DelayImpl _$$DelayImplFromJson(Map<String, dynamic> json) => _$DelayImpl(
|
||||
@@ -66,6 +67,16 @@ Map<String, dynamic> _$$DelayImplToJson(_$DelayImpl instance) =>
|
||||
'value': instance.value,
|
||||
};
|
||||
|
||||
_$NowImpl _$$NowImplFromJson(Map<String, dynamic> json) => _$NowImpl(
|
||||
name: json['name'] as String,
|
||||
value: json['value'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$NowImplToJson(_$NowImpl instance) => <String, dynamic>{
|
||||
'name': instance.name,
|
||||
'value': instance.value,
|
||||
};
|
||||
|
||||
_$ProcessImpl _$$ProcessImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ProcessImpl(
|
||||
uid: (json['uid'] as num).toInt(),
|
||||
|
||||
@@ -27,7 +27,6 @@ Profile _$ProfileFromJson(Map<String, dynamic> json) => Profile(
|
||||
userInfo: json['userInfo'] == null
|
||||
? null
|
||||
: UserInfo.fromJson(json['userInfo'] as Map<String, dynamic>),
|
||||
groupName: json['groupName'] as String?,
|
||||
proxyName: json['proxyName'] as String?,
|
||||
lastUpdateDate: json['lastUpdateDate'] == null
|
||||
? null
|
||||
@@ -41,7 +40,6 @@ Profile _$ProfileFromJson(Map<String, dynamic> json) => Profile(
|
||||
Map<String, dynamic> _$ProfileToJson(Profile instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'label': instance.label,
|
||||
'groupName': instance.groupName,
|
||||
'proxyName': instance.proxyName,
|
||||
'url': instance.url,
|
||||
'lastUpdateDate': instance.lastUpdateDate?.toIso8601String(),
|
||||
|
||||
@@ -349,7 +349,6 @@ abstract class _UpdateCurrentDelaySelectorState
|
||||
mixin _$NetworkDetectionSelectorState {
|
||||
String? get currentProxyName => throw _privateConstructorUsedError;
|
||||
int? get delay => throw _privateConstructorUsedError;
|
||||
bool get isInit => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$NetworkDetectionSelectorStateCopyWith<NetworkDetectionSelectorState>
|
||||
@@ -364,7 +363,7 @@ abstract class $NetworkDetectionSelectorStateCopyWith<$Res> {
|
||||
_$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
||||
NetworkDetectionSelectorState>;
|
||||
@useResult
|
||||
$Res call({String? currentProxyName, int? delay, bool isInit});
|
||||
$Res call({String? currentProxyName, int? delay});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -383,7 +382,6 @@ class _$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
||||
$Res call({
|
||||
Object? currentProxyName = freezed,
|
||||
Object? delay = freezed,
|
||||
Object? isInit = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
currentProxyName: freezed == currentProxyName
|
||||
@@ -394,10 +392,6 @@ class _$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
||||
? _value.delay
|
||||
: delay // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
isInit: null == isInit
|
||||
? _value.isInit
|
||||
: isInit // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
@@ -411,7 +405,7 @@ abstract class _$$NetworkDetectionSelectorStateImplCopyWith<$Res>
|
||||
__$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String? currentProxyName, int? delay, bool isInit});
|
||||
$Res call({String? currentProxyName, int? delay});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -429,7 +423,6 @@ class __$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>
|
||||
$Res call({
|
||||
Object? currentProxyName = freezed,
|
||||
Object? delay = freezed,
|
||||
Object? isInit = null,
|
||||
}) {
|
||||
return _then(_$NetworkDetectionSelectorStateImpl(
|
||||
currentProxyName: freezed == currentProxyName
|
||||
@@ -440,10 +433,6 @@ class __$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>
|
||||
? _value.delay
|
||||
: delay // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
isInit: null == isInit
|
||||
? _value.isInit
|
||||
: isInit // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -453,20 +442,16 @@ class __$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>
|
||||
class _$NetworkDetectionSelectorStateImpl
|
||||
implements _NetworkDetectionSelectorState {
|
||||
const _$NetworkDetectionSelectorStateImpl(
|
||||
{required this.currentProxyName,
|
||||
required this.delay,
|
||||
required this.isInit});
|
||||
{required this.currentProxyName, required this.delay});
|
||||
|
||||
@override
|
||||
final String? currentProxyName;
|
||||
@override
|
||||
final int? delay;
|
||||
@override
|
||||
final bool isInit;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NetworkDetectionSelectorState(currentProxyName: $currentProxyName, delay: $delay, isInit: $isInit)';
|
||||
return 'NetworkDetectionSelectorState(currentProxyName: $currentProxyName, delay: $delay)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -476,12 +461,11 @@ class _$NetworkDetectionSelectorStateImpl
|
||||
other is _$NetworkDetectionSelectorStateImpl &&
|
||||
(identical(other.currentProxyName, currentProxyName) ||
|
||||
other.currentProxyName == currentProxyName) &&
|
||||
(identical(other.delay, delay) || other.delay == delay) &&
|
||||
(identical(other.isInit, isInit) || other.isInit == isInit));
|
||||
(identical(other.delay, delay) || other.delay == delay));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, currentProxyName, delay, isInit);
|
||||
int get hashCode => Object.hash(runtimeType, currentProxyName, delay);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@@ -496,16 +480,13 @@ abstract class _NetworkDetectionSelectorState
|
||||
implements NetworkDetectionSelectorState {
|
||||
const factory _NetworkDetectionSelectorState(
|
||||
{required final String? currentProxyName,
|
||||
required final int? delay,
|
||||
required final bool isInit}) = _$NetworkDetectionSelectorStateImpl;
|
||||
required final int? delay}) = _$NetworkDetectionSelectorStateImpl;
|
||||
|
||||
@override
|
||||
String? get currentProxyName;
|
||||
@override
|
||||
int? get delay;
|
||||
@override
|
||||
bool get isInit;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$NetworkDetectionSelectorStateImplCopyWith<
|
||||
_$NetworkDetectionSelectorStateImpl>
|
||||
@@ -1741,10 +1722,154 @@ abstract class _HomeNavigationSelectorState
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProxiesCardSelectorState {
|
||||
String? get currentProxyName => throw _privateConstructorUsedError;
|
||||
bool get isSelected => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$ProxiesCardSelectorStateCopyWith<ProxiesCardSelectorState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||
factory $ProxiesCardSelectorStateCopyWith(ProxiesCardSelectorState value,
|
||||
$Res Function(ProxiesCardSelectorState) then) =
|
||||
_$ProxiesCardSelectorStateCopyWithImpl<$Res, ProxiesCardSelectorState>;
|
||||
@useResult
|
||||
$Res call({String? currentProxyName, bool isSelected});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProxiesCardSelectorStateCopyWithImpl<$Res,
|
||||
$Val extends ProxiesCardSelectorState>
|
||||
implements $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||
_$ProxiesCardSelectorStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? currentProxyName = freezed,
|
||||
Object? isSelected = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
currentProxyName: freezed == currentProxyName
|
||||
? _value.currentProxyName
|
||||
: currentProxyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
isSelected: null == isSelected
|
||||
? _value.isSelected
|
||||
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProxiesCardSelectorStateImplCopyWith<$Res>
|
||||
implements $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||
factory _$$ProxiesCardSelectorStateImplCopyWith(
|
||||
_$ProxiesCardSelectorStateImpl value,
|
||||
$Res Function(_$ProxiesCardSelectorStateImpl) then) =
|
||||
__$$ProxiesCardSelectorStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String? currentProxyName, bool isSelected});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProxiesCardSelectorStateImplCopyWithImpl<$Res>
|
||||
extends _$ProxiesCardSelectorStateCopyWithImpl<$Res,
|
||||
_$ProxiesCardSelectorStateImpl>
|
||||
implements _$$ProxiesCardSelectorStateImplCopyWith<$Res> {
|
||||
__$$ProxiesCardSelectorStateImplCopyWithImpl(
|
||||
_$ProxiesCardSelectorStateImpl _value,
|
||||
$Res Function(_$ProxiesCardSelectorStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? currentProxyName = freezed,
|
||||
Object? isSelected = null,
|
||||
}) {
|
||||
return _then(_$ProxiesCardSelectorStateImpl(
|
||||
currentProxyName: freezed == currentProxyName
|
||||
? _value.currentProxyName
|
||||
: currentProxyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
isSelected: null == isSelected
|
||||
? _value.isSelected
|
||||
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProxiesCardSelectorStateImpl implements _ProxiesCardSelectorState {
|
||||
const _$ProxiesCardSelectorStateImpl(
|
||||
{required this.currentProxyName, required this.isSelected});
|
||||
|
||||
@override
|
||||
final String? currentProxyName;
|
||||
@override
|
||||
final bool isSelected;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProxiesCardSelectorState(currentProxyName: $currentProxyName, isSelected: $isSelected)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProxiesCardSelectorStateImpl &&
|
||||
(identical(other.currentProxyName, currentProxyName) ||
|
||||
other.currentProxyName == currentProxyName) &&
|
||||
(identical(other.isSelected, isSelected) ||
|
||||
other.isSelected == isSelected));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, currentProxyName, isSelected);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProxiesCardSelectorStateImplCopyWith<_$ProxiesCardSelectorStateImpl>
|
||||
get copyWith => __$$ProxiesCardSelectorStateImplCopyWithImpl<
|
||||
_$ProxiesCardSelectorStateImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _ProxiesCardSelectorState implements ProxiesCardSelectorState {
|
||||
const factory _ProxiesCardSelectorState(
|
||||
{required final String? currentProxyName,
|
||||
required final bool isSelected}) = _$ProxiesCardSelectorStateImpl;
|
||||
|
||||
@override
|
||||
String? get currentProxyName;
|
||||
@override
|
||||
bool get isSelected;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$ProxiesCardSelectorStateImplCopyWith<_$ProxiesCardSelectorStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProxiesSelectorState {
|
||||
int get currentIndex => throw _privateConstructorUsedError;
|
||||
List<Group> get groups => throw _privateConstructorUsedError;
|
||||
ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError;
|
||||
num get sortNum => throw _privateConstructorUsedError;
|
||||
Group? get group => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$ProxiesSelectorStateCopyWith<ProxiesSelectorState> get copyWith =>
|
||||
@@ -1757,7 +1882,9 @@ abstract class $ProxiesSelectorStateCopyWith<$Res> {
|
||||
$Res Function(ProxiesSelectorState) then) =
|
||||
_$ProxiesSelectorStateCopyWithImpl<$Res, ProxiesSelectorState>;
|
||||
@useResult
|
||||
$Res call({int currentIndex, List<Group> groups});
|
||||
$Res call({ProxiesSortType proxiesSortType, num sortNum, Group? group});
|
||||
|
||||
$GroupCopyWith<$Res>? get group;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -1774,20 +1901,37 @@ class _$ProxiesSelectorStateCopyWithImpl<$Res,
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? currentIndex = null,
|
||||
Object? groups = null,
|
||||
Object? proxiesSortType = null,
|
||||
Object? sortNum = null,
|
||||
Object? group = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
currentIndex: null == currentIndex
|
||||
? _value.currentIndex
|
||||
: currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
groups: null == groups
|
||||
? _value.groups
|
||||
: groups // ignore: cast_nullable_to_non_nullable
|
||||
as List<Group>,
|
||||
proxiesSortType: null == proxiesSortType
|
||||
? _value.proxiesSortType
|
||||
: proxiesSortType // ignore: cast_nullable_to_non_nullable
|
||||
as ProxiesSortType,
|
||||
sortNum: null == sortNum
|
||||
? _value.sortNum
|
||||
: sortNum // ignore: cast_nullable_to_non_nullable
|
||||
as num,
|
||||
group: freezed == group
|
||||
? _value.group
|
||||
: group // ignore: cast_nullable_to_non_nullable
|
||||
as Group?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$GroupCopyWith<$Res>? get group {
|
||||
if (_value.group == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $GroupCopyWith<$Res>(_value.group!, (value) {
|
||||
return _then(_value.copyWith(group: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -1798,7 +1942,10 @@ abstract class _$$ProxiesSelectorStateImplCopyWith<$Res>
|
||||
__$$ProxiesSelectorStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({int currentIndex, List<Group> groups});
|
||||
$Res call({ProxiesSortType proxiesSortType, num sortNum, Group? group});
|
||||
|
||||
@override
|
||||
$GroupCopyWith<$Res>? get group;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -1812,18 +1959,23 @@ class __$$ProxiesSelectorStateImplCopyWithImpl<$Res>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? currentIndex = null,
|
||||
Object? groups = null,
|
||||
Object? proxiesSortType = null,
|
||||
Object? sortNum = null,
|
||||
Object? group = freezed,
|
||||
}) {
|
||||
return _then(_$ProxiesSelectorStateImpl(
|
||||
currentIndex: null == currentIndex
|
||||
? _value.currentIndex
|
||||
: currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
groups: null == groups
|
||||
? _value._groups
|
||||
: groups // ignore: cast_nullable_to_non_nullable
|
||||
as List<Group>,
|
||||
proxiesSortType: null == proxiesSortType
|
||||
? _value.proxiesSortType
|
||||
: proxiesSortType // ignore: cast_nullable_to_non_nullable
|
||||
as ProxiesSortType,
|
||||
sortNum: null == sortNum
|
||||
? _value.sortNum
|
||||
: sortNum // ignore: cast_nullable_to_non_nullable
|
||||
as num,
|
||||
group: freezed == group
|
||||
? _value.group
|
||||
: group // ignore: cast_nullable_to_non_nullable
|
||||
as Group?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1832,22 +1984,20 @@ class __$$ProxiesSelectorStateImplCopyWithImpl<$Res>
|
||||
|
||||
class _$ProxiesSelectorStateImpl implements _ProxiesSelectorState {
|
||||
const _$ProxiesSelectorStateImpl(
|
||||
{required this.currentIndex, required final List<Group> groups})
|
||||
: _groups = groups;
|
||||
{required this.proxiesSortType,
|
||||
required this.sortNum,
|
||||
required this.group});
|
||||
|
||||
@override
|
||||
final int currentIndex;
|
||||
final List<Group> _groups;
|
||||
final ProxiesSortType proxiesSortType;
|
||||
@override
|
||||
List<Group> get groups {
|
||||
if (_groups is EqualUnmodifiableListView) return _groups;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_groups);
|
||||
}
|
||||
final num sortNum;
|
||||
@override
|
||||
final Group? group;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProxiesSelectorState(currentIndex: $currentIndex, groups: $groups)';
|
||||
return 'ProxiesSelectorState(proxiesSortType: $proxiesSortType, sortNum: $sortNum, group: $group)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1855,14 +2005,14 @@ class _$ProxiesSelectorStateImpl implements _ProxiesSelectorState {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProxiesSelectorStateImpl &&
|
||||
(identical(other.currentIndex, currentIndex) ||
|
||||
other.currentIndex == currentIndex) &&
|
||||
const DeepCollectionEquality().equals(other._groups, _groups));
|
||||
(identical(other.proxiesSortType, proxiesSortType) ||
|
||||
other.proxiesSortType == proxiesSortType) &&
|
||||
(identical(other.sortNum, sortNum) || other.sortNum == sortNum) &&
|
||||
(identical(other.group, group) || other.group == group));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, currentIndex, const DeepCollectionEquality().hash(_groups));
|
||||
int get hashCode => Object.hash(runtimeType, proxiesSortType, sortNum, group);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@@ -1875,13 +2025,16 @@ class _$ProxiesSelectorStateImpl implements _ProxiesSelectorState {
|
||||
|
||||
abstract class _ProxiesSelectorState implements ProxiesSelectorState {
|
||||
const factory _ProxiesSelectorState(
|
||||
{required final int currentIndex,
|
||||
required final List<Group> groups}) = _$ProxiesSelectorStateImpl;
|
||||
{required final ProxiesSortType proxiesSortType,
|
||||
required final num sortNum,
|
||||
required final Group? group}) = _$ProxiesSelectorStateImpl;
|
||||
|
||||
@override
|
||||
int get currentIndex;
|
||||
ProxiesSortType get proxiesSortType;
|
||||
@override
|
||||
List<Group> get groups;
|
||||
num get sortNum;
|
||||
@override
|
||||
Group? get group;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl>
|
||||
|
||||
@@ -62,7 +62,6 @@ class UserInfo {
|
||||
class Profile {
|
||||
String id;
|
||||
String? label;
|
||||
String? groupName;
|
||||
String? proxyName;
|
||||
String? url;
|
||||
DateTime? lastUpdateDate;
|
||||
@@ -75,7 +74,6 @@ class Profile {
|
||||
this.label,
|
||||
this.url,
|
||||
this.userInfo,
|
||||
this.groupName,
|
||||
this.proxyName,
|
||||
this.lastUpdateDate,
|
||||
Duration? autoUpdateDuration,
|
||||
@@ -158,7 +156,6 @@ class Profile {
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
label == other.label &&
|
||||
groupName == other.groupName &&
|
||||
proxyName == other.proxyName &&
|
||||
url == other.url &&
|
||||
lastUpdateDate == other.lastUpdateDate &&
|
||||
@@ -170,7 +167,6 @@ class Profile {
|
||||
int get hashCode =>
|
||||
id.hashCode ^
|
||||
label.hashCode ^
|
||||
groupName.hashCode ^
|
||||
proxyName.hashCode ^
|
||||
url.hashCode ^
|
||||
lastUpdateDate.hashCode ^
|
||||
@@ -180,7 +176,7 @@ class Profile {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Profile{id: $id, label: $label, groupName: $groupName, proxyName: $proxyName, url: $url, lastUpdateDate: $lastUpdateDate, autoUpdateDuration: $autoUpdateDuration, userInfo: $userInfo, autoUpdate: $autoUpdate}';
|
||||
return 'Profile{id: $id, label: $label, proxyName: $proxyName, url: $url, lastUpdateDate: $lastUpdateDate, autoUpdateDuration: $autoUpdateDuration, userInfo: $userInfo, autoUpdate: $autoUpdate}';
|
||||
}
|
||||
|
||||
Profile copyWith({
|
||||
@@ -197,7 +193,6 @@ class Profile {
|
||||
id: id,
|
||||
label: label ?? this.label,
|
||||
url: url ?? this.url,
|
||||
groupName: groupName ?? this.groupName,
|
||||
proxyName: proxyName ?? this.proxyName,
|
||||
userInfo: userInfo ?? this.userInfo,
|
||||
lastUpdateDate: lastUpdateDate ?? this.lastUpdateDate,
|
||||
|
||||
@@ -32,7 +32,6 @@ class NetworkDetectionSelectorState with _$NetworkDetectionSelectorState {
|
||||
const factory NetworkDetectionSelectorState({
|
||||
required String? currentProxyName,
|
||||
required int? delay,
|
||||
required bool isInit,
|
||||
}) = _NetworkDetectionSelectorState;
|
||||
}
|
||||
|
||||
@@ -104,10 +103,18 @@ class HomeNavigationSelectorState with _$HomeNavigationSelectorState{
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProxiesSelectorState with _$ProxiesSelectorState{
|
||||
const factory ProxiesSelectorState({
|
||||
required int currentIndex,
|
||||
required List<Group> groups,
|
||||
}) = _ProxiesSelectorState;
|
||||
class ProxiesCardSelectorState with _$ProxiesCardSelectorState{
|
||||
const factory ProxiesCardSelectorState({
|
||||
required String? currentProxyName,
|
||||
required bool isSelected,
|
||||
}) = _ProxiesCardSelectorState;
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProxiesSelectorState with _$ProxiesSelectorState{
|
||||
const factory ProxiesSelectorState({
|
||||
required ProxiesSortType proxiesSortType,
|
||||
required num sortNum,
|
||||
required Group? group,
|
||||
}) = _ProxiesSelectorState;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,6 @@ class HomePage extends StatelessWidget {
|
||||
child: Selector<AppState, List<NavigationItem>>(
|
||||
selector: (_, appState) => appState.navigationItems,
|
||||
builder: (_, navigationItems, __) {
|
||||
debugPrint("[Home] update===>");
|
||||
final desktopNavigationItems = navigationItems
|
||||
.where(
|
||||
(element) =>
|
||||
|
||||
105
lib/state.dart
105
lib/state.dart
@@ -5,7 +5,6 @@ import 'dart:io';
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:fl_clash/clash/clash.dart';
|
||||
import 'package:fl_clash/enum/enum.dart';
|
||||
import 'package:fl_clash/models/clash_config.dart';
|
||||
import 'package:fl_clash/plugins/app.dart';
|
||||
import 'package:fl_clash/widgets/scaffold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -15,8 +14,7 @@ import 'common/common.dart';
|
||||
|
||||
class GlobalState {
|
||||
Timer? timer;
|
||||
Timer? currentDelayTimer;
|
||||
Function? updateCurrentDelayDebounce;
|
||||
Function? updateSortNumDebounce;
|
||||
PageController? pageController;
|
||||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
final Map<int, String?> packageNameMap = {};
|
||||
@@ -24,6 +22,7 @@ class GlobalState {
|
||||
List<Function> updateFunctionLists = [];
|
||||
List<NavigationItem> currentNavigationItems = [];
|
||||
bool updatePackagesLock = false;
|
||||
bool healthcheckLock = false;
|
||||
|
||||
startListenUpdate() {
|
||||
if (timer != null && timer!.isActive == true) return;
|
||||
@@ -39,7 +38,7 @@ class GlobalState {
|
||||
timer?.cancel();
|
||||
}
|
||||
|
||||
Future<bool> updateClashConfig({
|
||||
Future<String> updateClashConfig({
|
||||
required ClashConfig clashConfig,
|
||||
required Config config,
|
||||
bool isPatch = true,
|
||||
@@ -75,17 +74,24 @@ class GlobalState {
|
||||
stopListenUpdate();
|
||||
}
|
||||
|
||||
void updateCurrentDelay(
|
||||
String? proxyName,
|
||||
) {
|
||||
updateCurrentDelayDebounce ??= debounce<Function(String?)>((proxyName) {
|
||||
if (proxyName != null) {
|
||||
clashCore.delay(
|
||||
proxyName,
|
||||
);
|
||||
}
|
||||
});
|
||||
updateCurrentDelayDebounce!([proxyName]);
|
||||
|
||||
applyProfile({
|
||||
required AppState appState,
|
||||
required Config config,
|
||||
required ClashConfig clashConfig,
|
||||
}) async {
|
||||
final res = await updateClashConfig(
|
||||
clashConfig: clashConfig,
|
||||
config: config,
|
||||
isPatch: false,
|
||||
);
|
||||
if (res.isNotEmpty) return Result.error(message: res);
|
||||
await updateGroups(appState);
|
||||
changeProxy(
|
||||
appState: appState,
|
||||
config: config,
|
||||
clashConfig: clashConfig,
|
||||
);
|
||||
}
|
||||
|
||||
init({
|
||||
@@ -101,18 +107,12 @@ class GlobalState {
|
||||
);
|
||||
}
|
||||
if (!appState.isInit) return;
|
||||
await updateClashConfig(
|
||||
clashConfig: clashConfig,
|
||||
config: config,
|
||||
isPatch: false,
|
||||
);
|
||||
updateGroups(appState);
|
||||
updateCoreVersionInfo(appState);
|
||||
changeProxy(
|
||||
await applyProfile(
|
||||
appState: appState,
|
||||
config: config,
|
||||
clashConfig: clashConfig,
|
||||
);
|
||||
updateCoreVersionInfo(appState);
|
||||
}
|
||||
|
||||
changeProxy({
|
||||
@@ -120,29 +120,36 @@ class GlobalState {
|
||||
required Config config,
|
||||
required ClashConfig clashConfig,
|
||||
}) {
|
||||
final currentGroupName =
|
||||
appState.getCurrentGroupName(config.currentGroupName, clashConfig.mode);
|
||||
final currentProxyName =
|
||||
appState.getCurrentProxyName(config.currentProxyName, clashConfig.mode);
|
||||
if (config.profiles.isEmpty || currentProxyName == null) {
|
||||
stopSystemProxy();
|
||||
return;
|
||||
}
|
||||
if (currentGroupName == null) return;
|
||||
final groupIndex = appState.groups.indexWhere(
|
||||
(element) => element.name == currentGroupName,
|
||||
);
|
||||
if (groupIndex == -1) return;
|
||||
final proxyIndex = appState.groups[groupIndex].all.indexWhere(
|
||||
(element) => element.name == currentProxyName,
|
||||
);
|
||||
if (proxyIndex == -1) return;
|
||||
clashCore.changeProxy(
|
||||
ChangeProxyParams(
|
||||
groupName: currentGroupName,
|
||||
proxyName: currentProxyName,
|
||||
),
|
||||
);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (config.profiles.isEmpty) {
|
||||
stopSystemProxy();
|
||||
return;
|
||||
}
|
||||
final currentProxyName = appState.currentProxyName;
|
||||
if (currentProxyName == null) return;
|
||||
final index1 = appState.globalGroup?.all.indexWhere(
|
||||
(element) => element.name == currentProxyName,
|
||||
);
|
||||
if (index1 != null && index1 != -1) {
|
||||
clashCore.changeProxy(
|
||||
ChangeProxyParams(
|
||||
groupName: GroupName.GLOBAL.name,
|
||||
proxyName: currentProxyName,
|
||||
),
|
||||
);
|
||||
}
|
||||
final index2 = appState.ruleGroup?.all.indexWhere(
|
||||
(element) => element.name == currentProxyName,
|
||||
);
|
||||
if (index2 != null && index2 != -1) {
|
||||
clashCore.changeProxy(
|
||||
ChangeProxyParams(
|
||||
groupName: GroupName.Proxy.name,
|
||||
proxyName: currentProxyName,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updatePackages(AppState appState) async {
|
||||
@@ -158,16 +165,16 @@ class GlobalState {
|
||||
required Config config,
|
||||
required ClashConfig clashConfig,
|
||||
}) {
|
||||
final hasGroups = appState.getCurrentGroups(clashConfig.mode).isNotEmpty;
|
||||
final group = appState.currentGroup;
|
||||
final hasProfile = config.profiles.isNotEmpty;
|
||||
appState.navigationItems = navigation.getItems(
|
||||
openLogs: config.openLogs,
|
||||
hasProxies: hasGroups && hasProfile,
|
||||
hasProxies: group != null && hasProfile,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateGroups(AppState appState) async {
|
||||
appState.groups = await clashCore.getProxiesGroups();
|
||||
appState.groups = await clashCore.getProxiesGroups();
|
||||
}
|
||||
|
||||
showMessage({
|
||||
|
||||
@@ -15,7 +15,6 @@ class AppStateContainer extends StatelessWidget {
|
||||
return Selector<Config, bool>(
|
||||
selector: (_, config) => config.autoLaunch,
|
||||
builder: (_, isAutoLaunch, child) {
|
||||
debugPrint("[autoLaunchContainer] update===>");
|
||||
autoLaunch?.updateStatus(isAutoLaunch);
|
||||
return child!;
|
||||
},
|
||||
@@ -24,18 +23,16 @@ class AppStateContainer extends StatelessWidget {
|
||||
}
|
||||
|
||||
_updateNavigationsContainer(Widget child) {
|
||||
return Selector3<AppState, Config, ClashConfig, UpdateNavigationsSelector>(
|
||||
selector: (_, appState, config, clashConfig) {
|
||||
final hasGroups =
|
||||
appState.getCurrentGroups(clashConfig.mode).isNotEmpty;
|
||||
return Selector2<AppState, Config, UpdateNavigationsSelector>(
|
||||
selector: (_, appState, config) {
|
||||
final group = appState.currentGroup;
|
||||
final hasProfile = config.profiles.isNotEmpty;
|
||||
return UpdateNavigationsSelector(
|
||||
openLogs: config.openLogs,
|
||||
hasProxies: hasGroups && hasProfile,
|
||||
hasProxies: group != null && hasProfile,
|
||||
);
|
||||
},
|
||||
builder: (context, state, child) {
|
||||
debugPrint("[NavigationsContainer] update===>");
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) {
|
||||
context.appController.appState.navigationItems =
|
||||
|
||||
@@ -38,13 +38,26 @@ class _ClashMessageContainerState extends State<ClashMessageContainer>
|
||||
|
||||
@override
|
||||
void onDelay(Delay delay) {
|
||||
context.appController.setDelay(delay);
|
||||
final appController = context.appController;
|
||||
appController.setDelay(delay);
|
||||
globalState.healthcheckLock = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
globalState.updateSortNumDebounce ??= debounce<Function()>(
|
||||
() async {
|
||||
await appController.updateGroups();
|
||||
appController.appState.sortNum++;
|
||||
globalState.healthcheckLock = false;
|
||||
},
|
||||
milliseconds: 5000,
|
||||
);
|
||||
globalState.updateSortNumDebounce!();
|
||||
});
|
||||
super.onDelay(delay);
|
||||
}
|
||||
|
||||
@override
|
||||
void onLog(Log log) {
|
||||
debugPrint("$log");
|
||||
print("$log");
|
||||
context.appController.appState.addLog(log);
|
||||
super.onLog(log);
|
||||
}
|
||||
|
||||
@@ -446,7 +446,6 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
|
||||
return Selector<Config, ThemeMode>(
|
||||
selector: (_, config) => config.themeMode,
|
||||
builder: (_, __, ___) {
|
||||
debugPrint("[OpenContainerTheme] update===>");
|
||||
_colorTween = _getColorTween(
|
||||
transitionType: transitionType,
|
||||
closedColor: Theme.of(context).colorScheme.background,
|
||||
|
||||
@@ -144,7 +144,6 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
||||
locale: config.locale,
|
||||
),
|
||||
builder: (_, state, child) {
|
||||
debugPrint("[TrayContainer] update===>");
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
updateMenu(state);
|
||||
});
|
||||
|
||||
12
pubspec.lock
12
pubspec.lock
@@ -279,10 +279,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_plugin_android_lifecycle
|
||||
sha256: "592dc01a18961a51c24ae5d963b724b2b7fa4a95c100fe8eb6ca8a5a4732cadf"
|
||||
sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.18"
|
||||
version: "2.0.19"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -957,10 +957,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: win32_registry
|
||||
sha256: "10589e0d7f4e053f2c61023a31c9ce01146656a70b7b7f0828c0b46d7da2a9bb"
|
||||
sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
version: "1.1.2"
|
||||
window_manager:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -997,10 +997,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml_edit
|
||||
sha256: c566f4f804215d84a7a2c377667f546c6033d5b34b4f9e60dfb09d17c4e97826
|
||||
sha256: e9c1a3543d2da0db3e90270dbb1e4eebc985ee5e3ffe468d83224472b2194a5f
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=3.3.0 <4.0.0"
|
||||
flutter: ">=3.19.0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: fl_clash
|
||||
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
|
||||
publish_to: 'none'
|
||||
version: 0.7.4
|
||||
version: 0.7.14
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user