Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
526ccdf3ad | ||
|
|
8282a9a474 |
37
.github/workflows/build.yaml
vendored
37
.github/workflows/build.yaml
vendored
@@ -86,7 +86,7 @@ jobs:
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.22.x
|
||||
flutter-version: '3.x'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
|
||||
@@ -108,6 +108,14 @@ jobs:
|
||||
permissions: write-all
|
||||
needs: [ build ]
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
telegram-bot-api:
|
||||
image: aiogram/telegram-bot-api:latest
|
||||
env:
|
||||
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }}
|
||||
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
|
||||
ports:
|
||||
- 8081:8081
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -121,12 +129,10 @@ jobs:
|
||||
pattern: artifact-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate release
|
||||
- name: Generate release.md
|
||||
run: |
|
||||
tags=($(git tag --merged $(git rev-parse HEAD) --sort=-creatordate))
|
||||
preTag=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
|
||||
version=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
sed "s|VERSION|$version|g" ./.github/release_template.md > release.md
|
||||
currentTag=""
|
||||
for ((i = 0; i <= ${#tags[@]}; i++)); do
|
||||
if (( i < ${#tags[@]} )); then
|
||||
@@ -140,8 +146,6 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
if [ -n "$currentTag" ]; then
|
||||
echo "## $currentTag" >> release.md
|
||||
echo "" >> release.md
|
||||
if [ -n "$tag" ]; then
|
||||
git log --pretty=format:"%B" "$tag..$currentTag" | awk 'NF {print "- " $0} !NF {print ""}' >> release.md
|
||||
else
|
||||
@@ -152,14 +156,19 @@ jobs:
|
||||
currentTag=$tag
|
||||
done
|
||||
|
||||
- name: Upload
|
||||
if: ${{ contains(github.ref, '+') }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifact
|
||||
path: ./dist
|
||||
retention-days: 7
|
||||
overwrite: true
|
||||
- name: Push to telegram
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install requests
|
||||
python release.py
|
||||
|
||||
- name: Patch release.md
|
||||
run: |
|
||||
version=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
sed "s|VERSION|$version|g" ./.github/release_template.md >> release.md
|
||||
|
||||
- name: Release
|
||||
if: ${{ !contains(github.ref, '+') }}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.follow.clash
|
||||
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.follow.clash.plugins.AppPlugin
|
||||
import com.follow.clash.plugins.ServicePlugin
|
||||
import com.follow.clash.plugins.VpnPlugin
|
||||
|
||||
BIN
assets/fonts/MiSans-Regular.ttf
Normal file
BIN
assets/fonts/MiSans-Regular.ttf
Normal file
Binary file not shown.
Submodule core/Clash.Meta updated: e89569916a...8472840f47
106
core/common.go
106
core/common.go
@@ -5,13 +5,15 @@ import (
|
||||
"context"
|
||||
"core/state"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/metacubex/mihomo/constant/features"
|
||||
"github.com/metacubex/mihomo/hub/route"
|
||||
"math"
|
||||
"github.com/samber/lo"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -155,6 +157,16 @@ func getRawConfigWithId(id string) *config.RawConfig {
|
||||
continue
|
||||
}
|
||||
mapping["path"] = filepath.Join(getProfileProvidersPath(id), value)
|
||||
if configParams.TestURL != nil {
|
||||
if mapping["health-check"] != nil {
|
||||
hc := mapping["health-check"].(map[string]any)
|
||||
if hc != nil {
|
||||
if hc["url"] != nil {
|
||||
hc["url"] = *configParams.TestURL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, mapping := range prof.RuleProvider {
|
||||
value, exist := mapping["path"].(string)
|
||||
@@ -212,16 +224,16 @@ func sideUpdateExternalProvider(p cp.Provider, bytes []byte) error {
|
||||
switch p.(type) {
|
||||
case *provider.ProxySetProvider:
|
||||
psp := p.(*provider.ProxySetProvider)
|
||||
elm, same, err := psp.SideUpdate(bytes)
|
||||
if err == nil && !same {
|
||||
psp.OnUpdate(elm)
|
||||
_, _, err := psp.SideUpdate(bytes)
|
||||
if err == nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case rp.RuleSetProvider:
|
||||
rsp := p.(*rp.RuleSetProvider)
|
||||
elm, same, err := rsp.SideUpdate(bytes)
|
||||
if err == nil && !same {
|
||||
rsp.OnUpdate(elm)
|
||||
_, _, err := rsp.SideUpdate(bytes)
|
||||
if err == nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
@@ -387,6 +399,37 @@ func genHosts(hosts, patchHosts map[string]any) {
|
||||
}
|
||||
}
|
||||
|
||||
func trimArr(arr []string) (r []string) {
|
||||
for _, e := range arr {
|
||||
r = append(r, strings.Trim(e, " "))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var ips = []string{"ipinfo.io", "ipapi.co", "api.ip.sb", "ipwho.is"}
|
||||
|
||||
func overrideRules(rules *[]string) {
|
||||
var target = ""
|
||||
for _, line := range *rules {
|
||||
rule := trimArr(strings.Split(line, ","))
|
||||
l := len(rule)
|
||||
if l != 2 {
|
||||
return
|
||||
}
|
||||
if strings.ToUpper(rule[0]) == "MATCH" {
|
||||
target = rule[1]
|
||||
break
|
||||
}
|
||||
}
|
||||
if target == "" {
|
||||
return
|
||||
}
|
||||
var rulesExt = lo.Map(ips, func(ip string, index int) string {
|
||||
return fmt.Sprintf("DOMAIN %s %s", ip, target)
|
||||
})
|
||||
*rules = append(rulesExt, *rules...)
|
||||
}
|
||||
|
||||
func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfig) {
|
||||
targetConfig.ExternalController = patchConfig.ExternalController
|
||||
targetConfig.ExternalUI = ""
|
||||
@@ -425,6 +468,7 @@ func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfi
|
||||
targetConfig.DNS.Enable = true
|
||||
}
|
||||
}
|
||||
overrideRules(&targetConfig.Rule)
|
||||
//if runtime.GOOS == "android" {
|
||||
// targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, "dhcp://"+dns.SystemDNSPlaceholder)
|
||||
//} else if runtime.GOOS == "windows" {
|
||||
@@ -437,9 +481,8 @@ func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfi
|
||||
//}
|
||||
}
|
||||
|
||||
func patchConfig(general *config.General, controller *config.Controller) {
|
||||
func patchConfig(general *config.General, controller *config.Controller, tls *config.TLS) {
|
||||
log.Infoln("[Apply] patch")
|
||||
route.ReStartServer(controller.ExternalController)
|
||||
tunnel.SetSniffing(general.Sniffing)
|
||||
tunnel.SetFindProcessMode(general.FindProcessMode)
|
||||
dialer.SetTcpConcurrent(general.TCPConcurrent)
|
||||
@@ -448,6 +491,22 @@ func patchConfig(general *config.General, controller *config.Controller) {
|
||||
tunnel.SetMode(general.Mode)
|
||||
log.SetLevel(general.LogLevel)
|
||||
resolver.DisableIPv6 = !general.IPv6
|
||||
|
||||
route.ReCreateServer(&route.Config{
|
||||
Addr: controller.ExternalController,
|
||||
TLSAddr: controller.ExternalControllerTLS,
|
||||
UnixAddr: controller.ExternalControllerUnix,
|
||||
PipeAddr: controller.ExternalControllerPipe,
|
||||
Secret: controller.Secret,
|
||||
Certificate: tls.Certificate,
|
||||
PrivateKey: tls.PrivateKey,
|
||||
DohServer: controller.ExternalDohServer,
|
||||
IsDebug: false,
|
||||
Cors: route.Cors{
|
||||
AllowOrigins: controller.Cors.AllowOrigins,
|
||||
AllowPrivateNetwork: controller.Cors.AllowPrivateNetwork,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
var isRunning = false
|
||||
@@ -460,6 +519,7 @@ func updateListeners(general *config.General, listeners map[string]constant.Inbo
|
||||
}
|
||||
runLock.Lock()
|
||||
defer runLock.Unlock()
|
||||
stopListeners()
|
||||
listener.PatchInboundListeners(listeners, tunnel.Tunnel, true)
|
||||
listener.SetAllowLan(general.AllowLan)
|
||||
inbound.SetSkipAuthPrefixes(general.SkipAuthPrefixes)
|
||||
@@ -483,27 +543,6 @@ func stopListeners() {
|
||||
listener.StopListener()
|
||||
}
|
||||
|
||||
func hcCompatibleProvider(proxyProviders map[string]cp.ProxyProvider) {
|
||||
wg := sync.WaitGroup{}
|
||||
ch := make(chan struct{}, math.MaxInt)
|
||||
for _, proxyProvider := range proxyProviders {
|
||||
proxyProvider := proxyProvider
|
||||
if proxyProvider.VehicleType() == cp.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 patchSelectGroup() {
|
||||
mapping := configParams.SelectedMap
|
||||
if mapping == nil {
|
||||
@@ -535,17 +574,14 @@ func applyConfig() error {
|
||||
cfg, _ = config.ParseRawConfig(config.DefaultRawConfig())
|
||||
}
|
||||
if configParams.IsPatch {
|
||||
patchConfig(cfg.General, cfg.Controller)
|
||||
patchConfig(cfg.General, cfg.Controller, cfg.TLS)
|
||||
} else {
|
||||
closeConnections()
|
||||
runtime.GC()
|
||||
hub.UltraApplyConfig(cfg)
|
||||
hub.ApplyConfig(cfg)
|
||||
patchSelectGroup()
|
||||
}
|
||||
updateListeners(cfg.General, cfg.Listeners)
|
||||
if isRunning {
|
||||
hcCompatibleProvider(cfg.Providers)
|
||||
}
|
||||
externalProviders = getExternalProvidersRaw()
|
||||
return err
|
||||
}
|
||||
|
||||
30
core/go.mod
30
core/go.mod
@@ -6,6 +6,14 @@ replace github.com/metacubex/mihomo => ./Clash.Meta
|
||||
|
||||
require github.com/metacubex/mihomo v1.17.1
|
||||
|
||||
require (
|
||||
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab // indirect
|
||||
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 // indirect
|
||||
github.com/sagernet/cors v1.2.1 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/sagernet/sing => github.com/metacubex/sing v0.0.0-20240724044459-6f3cf5896297
|
||||
|
||||
require (
|
||||
@@ -17,7 +25,7 @@ require (
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cloudflare/circl v1.3.7 // indirect
|
||||
github.com/coreos/go-iptables v0.7.0 // indirect
|
||||
github.com/coreos/go-iptables v0.8.0 // indirect
|
||||
github.com/dlclark/regexp2 v1.11.4 // indirect
|
||||
github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 // indirect
|
||||
github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 // indirect
|
||||
@@ -26,7 +34,6 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/gaukas/godicttls v0.0.4 // indirect
|
||||
github.com/go-chi/chi/v5 v5.1.0 // indirect
|
||||
github.com/go-chi/cors v1.2.1 // indirect
|
||||
github.com/go-chi/render v1.0.3 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
@@ -38,7 +45,7 @@ require (
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||
github.com/insomniacslk/dhcp v0.0.0-20240812123929-b105c29bd1b5 // indirect
|
||||
github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 // indirect
|
||||
github.com/josharian/native v1.1.0 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
|
||||
@@ -58,8 +65,8 @@ require (
|
||||
github.com/metacubex/sing-shadowsocks2 v0.2.2 // indirect
|
||||
github.com/metacubex/sing-tun v0.2.7-0.20240729131039-ed03f557dee1 // indirect
|
||||
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9 // indirect
|
||||
github.com/metacubex/sing-wireguard v0.0.0-20240826061955-1e4e67afe5cd // indirect
|
||||
github.com/metacubex/tfo-go v0.0.0-20240830120620-c5e019b67785 // indirect
|
||||
github.com/metacubex/sing-wireguard v0.0.0-20240924052438-b0976fc59ea3 // indirect
|
||||
github.com/metacubex/tfo-go v0.0.0-20241006021335-daedaf0ca7aa // indirect
|
||||
github.com/metacubex/utls v1.6.6 // indirect
|
||||
github.com/miekg/dns v1.1.62 // indirect
|
||||
github.com/mroth/weightedrand/v2 v2.1.0 // indirect
|
||||
@@ -79,8 +86,7 @@ require (
|
||||
github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 // indirect
|
||||
github.com/sagernet/sing-shadowtls v0.1.4 // indirect
|
||||
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect
|
||||
github.com/sagernet/wireguard-go v0.0.0-20231209092712-9a439356a62e // indirect
|
||||
github.com/samber/lo v1.47.0 // indirect
|
||||
github.com/samber/lo v1.47.0
|
||||
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b // indirect
|
||||
@@ -97,13 +103,13 @@ require (
|
||||
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect
|
||||
go.uber.org/mock v0.4.0 // indirect
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||
golang.org/x/crypto v0.26.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
|
||||
golang.org/x/crypto v0.28.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
|
||||
golang.org/x/mod v0.20.0 // indirect
|
||||
golang.org/x/net v0.28.0 // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.24.0 // indirect
|
||||
golang.org/x/text v0.17.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.24.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
|
||||
54
core/go.sum
54
core/go.sum
@@ -19,8 +19,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||
github.com/coreos/go-iptables v0.7.0 h1:XWM3V+MPRr5/q51NuWSgU0fqMad64Zyxs8ZUoMsamr8=
|
||||
github.com/coreos/go-iptables v0.7.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
|
||||
github.com/coreos/go-iptables v0.8.0 h1:MPc2P89IhuVpLI7ETL/2tx3XZ61VeICZjYqDEgNsPRc=
|
||||
github.com/coreos/go-iptables v0.8.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -42,8 +42,6 @@ github.com/gaukas/godicttls v0.0.4 h1:NlRaXb3J6hAnTmWdsEKb9bcSBD6BvcIjdGdeb0zfXb
|
||||
github.com/gaukas/godicttls v0.0.4/go.mod h1:l6EenT4TLWgTdwslVb4sEMOCf7Bv0JAK67deKr9/NCI=
|
||||
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
|
||||
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
||||
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
|
||||
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
|
||||
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
||||
@@ -76,8 +74,8 @@ github.com/google/tink/go v1.6.1/go.mod h1:IGW53kTgag+st5yPhKKwJ6u2l+SSp5/v9XF7s
|
||||
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
|
||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20240812123929-b105c29bd1b5 h1:GkMacU5ftc+IEg1449N3UEy2XLDz58W4fkrRu2fibb8=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20240812123929-b105c29bd1b5/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 h1:hxST5pwMBEOWmxpkX20w9oZG+hXdhKmAIPQ3NGGAxas=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
|
||||
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
|
||||
@@ -96,6 +94,8 @@ github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/
|
||||
github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw=
|
||||
github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
|
||||
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
|
||||
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab h1:Chbw+/31UC14YFNr78pESt5Vowlc62zziw05JCUqoL4=
|
||||
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab/go.mod h1:xVKK8jC5Sd3hfh7WjmCq+HorehIbrBijaUWmcuKjPcI=
|
||||
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 h1:oBowHVKZycNtAFbZ6avaCSZJYeme2Nrj+4RpV2cNJig=
|
||||
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399/go.mod h1:4xcieuIK+M4bGQmQYZVqEaIYqjS1ahO4kXG7EmDgEro=
|
||||
github.com/metacubex/chacha v0.1.0 h1:tg9RSJ18NvL38cCWNyYH1eiG6qDCyyXIaTLQthon0sc=
|
||||
@@ -120,12 +120,14 @@ github.com/metacubex/sing-tun v0.2.7-0.20240729131039-ed03f557dee1 h1:ypfofGDZbP
|
||||
github.com/metacubex/sing-tun v0.2.7-0.20240729131039-ed03f557dee1/go.mod h1:olbEx9yVcaw5tHTNlRamRoxmMKcvDvcVS1YLnQGzvWE=
|
||||
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9 h1:OAXiCosqY8xKDp3pqTW3qbrCprZ1l6WkrXSFSCwyY4I=
|
||||
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9/go.mod h1:olVkD4FChQ5gKMHG4ZzuD7+fMkJY1G8vwOKpRehjrmY=
|
||||
github.com/metacubex/sing-wireguard v0.0.0-20240826061955-1e4e67afe5cd h1:r7alry8u4qlUFLNMwGvG1A8ZcfPM6AMSmrm6E2yKdB4=
|
||||
github.com/metacubex/sing-wireguard v0.0.0-20240826061955-1e4e67afe5cd/go.mod h1:uY+BYb0UEknLrqvbGcwi9i++KgrKxsurysgI6G1Pveo=
|
||||
github.com/metacubex/tfo-go v0.0.0-20240830120620-c5e019b67785 h1:NNmI+ZV0DzNuqaAInRQuZFLHlWVuyHeow8jYpdKjHjo=
|
||||
github.com/metacubex/tfo-go v0.0.0-20240830120620-c5e019b67785/go.mod h1:c7bVFM9f5+VzeZ/6Kg77T/jrg1Xp8QpqlSHvG/aXVts=
|
||||
github.com/metacubex/sing-wireguard v0.0.0-20240924052438-b0976fc59ea3 h1:xg71VmzLS6ByAzi/57phwDvjE+dLLs+ozH00k4DnOns=
|
||||
github.com/metacubex/sing-wireguard v0.0.0-20240924052438-b0976fc59ea3/go.mod h1:6nitcmzPDL3MXnLdhu6Hm126Zk4S1fBbX3P7jxUxSFw=
|
||||
github.com/metacubex/tfo-go v0.0.0-20241006021335-daedaf0ca7aa h1:9mcjV+RGZVC3reJBNDjjNPyS8PmFG97zq56X7WNaFO4=
|
||||
github.com/metacubex/tfo-go v0.0.0-20241006021335-daedaf0ca7aa/go.mod h1:4tLB5c8U0CxpkFM+AJJB77jEaVDbLH5XQvy42vAGsWw=
|
||||
github.com/metacubex/utls v1.6.6 h1:3D12YKHTf2Z41UPhQU2dWerNWJ5TVQD9gKoQ+H+iLC8=
|
||||
github.com/metacubex/utls v1.6.6/go.mod h1:+WLFUnXjcpdxXCnyX25nggw8C6YonZ8zOK2Zm/oRvdo=
|
||||
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 h1:hJLQviGySBuaynlCwf/oYgIxbVbGRUIKZCxdya9YrbQ=
|
||||
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181/go.mod h1:phewKljNYiTVT31Gcif8RiCKnTUOgVWFJjccqYM8s+Y=
|
||||
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
|
||||
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
|
||||
github.com/mroth/weightedrand/v2 v2.1.0 h1:o1ascnB1CIVzsqlfArQQjeMy1U0NcIbBO5rfd5E/OeU=
|
||||
@@ -156,6 +158,8 @@ github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
|
||||
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
|
||||
github.com/quic-go/qtls-go1-20 v0.4.1 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs=
|
||||
github.com/quic-go/qtls-go1-20 v0.4.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
|
||||
github.com/sagernet/cors v1.2.1 h1:Cv5Z8y9YSD6Gm+qSpNrL3LO4lD3eQVvbFYJSG7JCMHQ=
|
||||
github.com/sagernet/cors v1.2.1/go.mod h1:O64VyOjjhrkLmQIjF4KGRrJO/5dVXFdpEmCW/eISRAI=
|
||||
github.com/sagernet/fswatch v0.1.1 h1:YqID+93B7VRfqIH3PArW/XpJv5H4OLEVWDfProGoRQs=
|
||||
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
|
||||
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZNjr6sGeT00J8uU7JF4cNUdb44/Duis=
|
||||
@@ -168,8 +172,6 @@ github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnV
|
||||
github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4=
|
||||
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ=
|
||||
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7/go.mod h1:FP9X2xjT/Az1EsG/orYYoC+5MojWnuI7hrffz8fGwwo=
|
||||
github.com/sagernet/wireguard-go v0.0.0-20231209092712-9a439356a62e h1:iGH0RMv2FzELOFNFQtvsxH7NPmlo7X5JizEK51UCojo=
|
||||
github.com/sagernet/wireguard-go v0.0.0-20231209092712-9a439356a62e/go.mod h1:YbL4TKHRR6APYQv3U2RGfwLDpPYSyWz6oUlpISBEzBE=
|
||||
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
|
||||
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
|
||||
github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
|
||||
@@ -209,6 +211,10 @@ github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17
|
||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
|
||||
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
@@ -223,18 +229,18 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBs
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
||||
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
|
||||
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
|
||||
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
@@ -254,13 +260,13 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
|
||||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
|
||||
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
|
||||
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
|
||||
@@ -163,9 +163,10 @@ class ApplicationState extends State<Application> {
|
||||
child: Selector2<AppState, Config, ApplicationSelectorState>(
|
||||
selector: (_, appState, config) => ApplicationSelectorState(
|
||||
locale: config.appSetting.locale,
|
||||
themeMode: config.themeMode,
|
||||
primaryColor: config.primaryColor,
|
||||
prueBlack: config.prueBlack,
|
||||
themeMode: config.themeProps.themeMode,
|
||||
primaryColor: config.themeProps.primaryColor,
|
||||
prueBlack: config.themeProps.prueBlack,
|
||||
fontFamily: config.themeProps.fontFamily,
|
||||
),
|
||||
builder: (_, state, child) {
|
||||
return DynamicColorBuilder(
|
||||
@@ -199,6 +200,7 @@ class ApplicationState extends State<Application> {
|
||||
themeMode: state.themeMode,
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
fontFamily: state.fontFamily.value,
|
||||
pageTransitionsTheme: _pageTransitionsTheme,
|
||||
colorScheme: _getAppColorScheme(
|
||||
brightness: Brightness.light,
|
||||
@@ -208,6 +210,7 @@ class ApplicationState extends State<Application> {
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
useMaterial3: true,
|
||||
fontFamily: state.fontFamily.value,
|
||||
pageTransitionsTheme: _pageTransitionsTheme,
|
||||
colorScheme: _getAppColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
|
||||
@@ -8,7 +8,8 @@ class Measure {
|
||||
|
||||
Measure.of(this.context)
|
||||
: _textScale = TextScaler.linear(
|
||||
WidgetsBinding.instance.platformDispatcher.textScaleFactor);
|
||||
WidgetsBinding.instance.platformDispatcher.textScaleFactor,
|
||||
);
|
||||
|
||||
Size computeTextSize(Text text) {
|
||||
final textPainter = TextPainter(
|
||||
@@ -38,7 +39,6 @@ class Measure {
|
||||
return _bodyMediumHeight!;
|
||||
}
|
||||
|
||||
|
||||
Size get bodyLargeSize {
|
||||
_bodyLargeSize ??= computeTextSize(
|
||||
Text(
|
||||
|
||||
@@ -104,14 +104,17 @@ class Other {
|
||||
required bool isStart,
|
||||
required Brightness brightness,
|
||||
}) {
|
||||
final suffix = Platform.isWindows ? "ico" : "png";
|
||||
if (!isStart && Platform.isWindows) {
|
||||
return switch (brightness) {
|
||||
Brightness.dark => "assets/images/icon_white.$suffix",
|
||||
Brightness.light => "assets/images/icon_black.$suffix",
|
||||
};
|
||||
if(Platform.isMacOS){
|
||||
return "assets/images/icon_white.png";
|
||||
}
|
||||
return "assets/images/icon.$suffix";
|
||||
final suffix = Platform.isWindows ? "ico" : "png";
|
||||
if (isStart && Platform.isWindows) {
|
||||
return "assets/images/icon.$suffix";
|
||||
}
|
||||
return switch (brightness) {
|
||||
Brightness.dark => "assets/images/icon_white.$suffix",
|
||||
Brightness.light => "assets/images/icon_black.$suffix",
|
||||
};
|
||||
}
|
||||
|
||||
int compareVersions(String version1, String version2) {
|
||||
@@ -193,7 +196,7 @@ class Other {
|
||||
|
||||
List<String> parseReleaseBody(String? body) {
|
||||
if (body == null) return [];
|
||||
const pattern = r'- (.+?)\. \[.+?\]';
|
||||
const pattern = r'- \s*(.*)';
|
||||
final regex = RegExp(pattern);
|
||||
return regex
|
||||
.allMatches(body)
|
||||
|
||||
@@ -610,14 +610,18 @@ class AppController {
|
||||
Future _updateSystemTray({
|
||||
required bool isStart,
|
||||
required Brightness? brightness,
|
||||
bool force = false,
|
||||
}) async {
|
||||
await trayManager.destroy();
|
||||
if (Platform.isLinux || force) {
|
||||
await trayManager.destroy();
|
||||
}
|
||||
await trayManager.setIcon(
|
||||
other.getTrayIconPath(
|
||||
isStart: isStart,
|
||||
brightness: brightness ??
|
||||
WidgetsBinding.instance.platformDispatcher.platformBrightness,
|
||||
),
|
||||
isTemplate: true,
|
||||
);
|
||||
if (!Platform.isLinux) {
|
||||
await trayManager.setToolTip(
|
||||
@@ -626,11 +630,12 @@ class AppController {
|
||||
}
|
||||
}
|
||||
|
||||
updateTray() async {
|
||||
updateTray([bool focus = false]) async {
|
||||
if (!Platform.isLinux) {
|
||||
await _updateSystemTray(
|
||||
isStart: appFlowingState.isStart,
|
||||
brightness: appState.brightness,
|
||||
force: focus,
|
||||
);
|
||||
}
|
||||
List<MenuItem> menuItems = [];
|
||||
@@ -642,8 +647,9 @@ class AppController {
|
||||
);
|
||||
menuItems.add(showMenuItem);
|
||||
final startMenuItem = MenuItem.checkbox(
|
||||
label:
|
||||
appFlowingState.isStart ? appLocalizations.stop : appLocalizations.start,
|
||||
label: appFlowingState.isStart
|
||||
? appLocalizations.stop
|
||||
: appLocalizations.start,
|
||||
onClick: (_) async {
|
||||
globalState.appController.updateStart();
|
||||
},
|
||||
@@ -714,6 +720,7 @@ class AppController {
|
||||
await _updateSystemTray(
|
||||
isStart: appFlowingState.isStart,
|
||||
brightness: appState.brightness,
|
||||
force: focus,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,3 +162,14 @@ enum ProxiesIconStyle {
|
||||
none,
|
||||
icon,
|
||||
}
|
||||
|
||||
enum FontFamily {
|
||||
system(),
|
||||
miSans("MiSans"),
|
||||
twEmoji("Twemoji"),
|
||||
icon("Icons");
|
||||
|
||||
final String? value;
|
||||
|
||||
const FontFamily([this.value]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
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';
|
||||
@@ -69,7 +70,7 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
}
|
||||
|
||||
_clearSetTimeoutTimer() {
|
||||
if(_setTimeoutTimer != null){
|
||||
if (_setTimeoutTimer != null) {
|
||||
_setTimeoutTimer?.cancel();
|
||||
_setTimeoutTimer = null;
|
||||
}
|
||||
@@ -155,7 +156,7 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
.textTheme
|
||||
.titleLarge
|
||||
?.copyWith(
|
||||
fontFamily: "Twemoji",
|
||||
fontFamily: FontFamily.twEmoji.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
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:flutter/material.dart';
|
||||
@@ -18,6 +19,16 @@ class ThemeModeItem {
|
||||
});
|
||||
}
|
||||
|
||||
class FontFamilyItem {
|
||||
final FontFamily fontFamily;
|
||||
final String label;
|
||||
|
||||
const FontFamilyItem({
|
||||
required this.fontFamily,
|
||||
required this.label,
|
||||
});
|
||||
}
|
||||
|
||||
class ThemeFragment extends StatelessWidget {
|
||||
const ThemeFragment({super.key});
|
||||
|
||||
@@ -92,7 +103,11 @@ class _ThemeColorsBoxState extends State<ThemeColorsBox> {
|
||||
return CommonCard(
|
||||
isSelected: isSelected,
|
||||
onPressed: () {
|
||||
globalState.appController.config.themeMode = themeModeItem.themeMode;
|
||||
final appController = globalState.appController;
|
||||
appController.config.themeProps =
|
||||
appController.config.themeProps.copyWith(
|
||||
themeMode: themeModeItem.themeMode,
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
@@ -125,11 +140,45 @@ class _ThemeColorsBoxState extends State<ThemeColorsBox> {
|
||||
isSelected: isSelected,
|
||||
primaryColor: color,
|
||||
onPressed: () {
|
||||
globalState.appController.config.primaryColor = color?.value;
|
||||
final appController = globalState.appController;
|
||||
appController.config.themeProps =
|
||||
appController.config.themeProps.copyWith(
|
||||
primaryColor: color?.value,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _fontFamilyCheckBox({
|
||||
bool? isSelected,
|
||||
required FontFamilyItem fontFamilyItem,
|
||||
}) {
|
||||
return CommonCard(
|
||||
isSelected: isSelected,
|
||||
onPressed: () {
|
||||
final appController = globalState.appController;
|
||||
appController.config.themeProps =
|
||||
appController.config.themeProps.copyWith(
|
||||
fontFamily: fontFamilyItem.fontFamily,
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
fontFamilyItem.label,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<ThemeModeItem> themeModeItems = [
|
||||
@@ -158,15 +207,59 @@ class _ThemeColorsBoxState extends State<ThemeColorsBox> {
|
||||
Colors.yellowAccent,
|
||||
Colors.purple,
|
||||
];
|
||||
List<FontFamilyItem> fontFamilyItems = [
|
||||
FontFamilyItem(
|
||||
label: appLocalizations.systemFont,
|
||||
fontFamily: FontFamily.system,
|
||||
),
|
||||
const FontFamilyItem(
|
||||
label: "MiSans",
|
||||
fontFamily: FontFamily.miSans,
|
||||
),
|
||||
];
|
||||
return Column(
|
||||
children: [
|
||||
ItemCard(
|
||||
info: Info(
|
||||
label: appLocalizations.fontFamily,
|
||||
iconData: Icons.text_fields,
|
||||
),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
),
|
||||
height: 48,
|
||||
child: Selector<Config, FontFamily>(
|
||||
selector: (_, config) => config.themeProps.fontFamily,
|
||||
builder: (_, fontFamily, __) {
|
||||
return ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (_, index) {
|
||||
final fontFamilyItem = fontFamilyItems[index];
|
||||
return _fontFamilyCheckBox(
|
||||
isSelected: fontFamily == fontFamilyItem.fontFamily,
|
||||
fontFamilyItem: fontFamilyItem,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) {
|
||||
return const SizedBox(
|
||||
width: 16,
|
||||
);
|
||||
},
|
||||
itemCount: fontFamilyItems.length,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
ItemCard(
|
||||
info: Info(
|
||||
label: appLocalizations.themeMode,
|
||||
iconData: Icons.brightness_high,
|
||||
),
|
||||
child: Selector<Config, ThemeMode>(
|
||||
selector: (_, config) => config.themeMode,
|
||||
selector: (_, config) => config.themeProps.themeMode,
|
||||
builder: (_, themeMode, __) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
@@ -204,7 +297,7 @@ class _ThemeColorsBoxState extends State<ThemeColorsBox> {
|
||||
),
|
||||
height: 88,
|
||||
child: Selector<Config, int?>(
|
||||
selector: (_, config) => config.primaryColor,
|
||||
selector: (_, config) => config.themeProps.primaryColor,
|
||||
builder: (_, currentPrimaryColor, __) {
|
||||
return ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
@@ -229,7 +322,7 @@ class _ThemeColorsBoxState extends State<ThemeColorsBox> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Selector<Config, bool>(
|
||||
selector: (_, config) => config.prueBlack,
|
||||
selector: (_, config) => config.themeProps.prueBlack,
|
||||
builder: (_, value, ___) {
|
||||
return ListItem.switchItem(
|
||||
leading: Icon(
|
||||
@@ -238,63 +331,19 @@ class _ThemeColorsBoxState extends State<ThemeColorsBox> {
|
||||
),
|
||||
title: Text(appLocalizations.prueBlackMode),
|
||||
delegate: SwitchDelegate(
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
globalState.appController.config.prueBlack = value;
|
||||
}),
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
final appController = globalState.appController;
|
||||
appController.config.themeProps =
|
||||
appController.config.themeProps.copyWith(
|
||||
prueBlack: value,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
// child: Selector<Config, bool>(
|
||||
// selector: (_, config) => config.scaleProps.custom,
|
||||
// builder: (_, value, ___) {
|
||||
// return ListItem.switchItem(
|
||||
// leading: Icon(
|
||||
// Icons.format_size_sharp,
|
||||
// color: context.colorScheme.primary,
|
||||
// ),
|
||||
// title: const Text("自定义字体大小"),
|
||||
// delegate: SwitchDelegate(
|
||||
// value: value,
|
||||
// onChanged: (value) {
|
||||
// globalState.appController.config.scaleProps =
|
||||
// globalState.appController.config.scaleProps.copyWith(
|
||||
// custom: value,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// child: Selector<Config, ScaleProps>(
|
||||
// selector: (_, config) => config.scaleProps,
|
||||
// builder: (_, props, ___) {
|
||||
// return AbsorbPointer(
|
||||
// absorbing: !props.custom,
|
||||
// child: DisabledMask(
|
||||
// status: !props.custom,
|
||||
// child: Slider(
|
||||
// value: props.scale,
|
||||
// min: 0.8,
|
||||
// max: 1.2,
|
||||
// onChanged: (value) {
|
||||
// globalState.appController.config.scaleProps =
|
||||
// globalState.appController.config.scaleProps.copyWith(
|
||||
// scale: value,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(
|
||||
height: 64,
|
||||
),
|
||||
|
||||
@@ -320,5 +320,7 @@
|
||||
"iconConfiguration": "Icon configuration",
|
||||
"noData": "No data",
|
||||
"adminAutoLaunch": "Admin auto launch",
|
||||
"adminAutoLaunchDesc": "Boot up by using admin mode"
|
||||
"adminAutoLaunchDesc": "Boot up by using admin mode",
|
||||
"fontFamily": "FontFamily",
|
||||
"systemFont": "System font"
|
||||
}
|
||||
@@ -320,5 +320,7 @@
|
||||
"iconConfiguration": "图片配置",
|
||||
"noData": "暂无数据",
|
||||
"adminAutoLaunch": "管理员自启动",
|
||||
"adminAutoLaunchDesc": "使用管理员模式开机自启动"
|
||||
"adminAutoLaunchDesc": "使用管理员模式开机自启动",
|
||||
"fontFamily": "字体",
|
||||
"systemFont": "系统字体"
|
||||
}
|
||||
@@ -192,6 +192,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"findProcessMode": MessageLookupByLibrary.simpleMessage("Find process"),
|
||||
"findProcessModeDesc": MessageLookupByLibrary.simpleMessage(
|
||||
"There is a risk of flashback after opening"),
|
||||
"fontFamily": MessageLookupByLibrary.simpleMessage("FontFamily"),
|
||||
"fourColumns": MessageLookupByLibrary.simpleMessage("Four columns"),
|
||||
"general": MessageLookupByLibrary.simpleMessage("General"),
|
||||
"generalDesc":
|
||||
@@ -425,6 +426,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"style": MessageLookupByLibrary.simpleMessage("Style"),
|
||||
"submit": MessageLookupByLibrary.simpleMessage("Submit"),
|
||||
"sync": MessageLookupByLibrary.simpleMessage("Sync"),
|
||||
"systemFont": MessageLookupByLibrary.simpleMessage("System font"),
|
||||
"systemProxy": MessageLookupByLibrary.simpleMessage("System proxy"),
|
||||
"systemProxyDesc": MessageLookupByLibrary.simpleMessage(
|
||||
"Attach HTTP proxy to VpnService"),
|
||||
|
||||
@@ -155,6 +155,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"findProcessMode": MessageLookupByLibrary.simpleMessage("查找进程"),
|
||||
"findProcessModeDesc":
|
||||
MessageLookupByLibrary.simpleMessage("开启后存在闪退风险"),
|
||||
"fontFamily": MessageLookupByLibrary.simpleMessage("字体"),
|
||||
"fourColumns": MessageLookupByLibrary.simpleMessage("四列"),
|
||||
"general": MessageLookupByLibrary.simpleMessage("基础"),
|
||||
"generalDesc": MessageLookupByLibrary.simpleMessage("覆写基础设置"),
|
||||
@@ -339,6 +340,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"style": MessageLookupByLibrary.simpleMessage("风格"),
|
||||
"submit": MessageLookupByLibrary.simpleMessage("提交"),
|
||||
"sync": MessageLookupByLibrary.simpleMessage("同步"),
|
||||
"systemFont": MessageLookupByLibrary.simpleMessage("系统字体"),
|
||||
"systemProxy": MessageLookupByLibrary.simpleMessage("系统代理"),
|
||||
"systemProxyDesc":
|
||||
MessageLookupByLibrary.simpleMessage("为VpnService附加HTTP代理"),
|
||||
|
||||
@@ -3269,6 +3269,26 @@ class AppLocalizations {
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `FontFamily`
|
||||
String get fontFamily {
|
||||
return Intl.message(
|
||||
'FontFamily',
|
||||
name: 'fontFamily',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `System font`
|
||||
String get systemFont {
|
||||
return Intl.message(
|
||||
'System font',
|
||||
name: 'systemFont',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||
|
||||
@@ -142,7 +142,6 @@ class _ClashContainerState extends State<ClashManager> with AppMessageListener {
|
||||
if (log.logLevel == LogLevel.error) {
|
||||
globalState.appController.showSnackBar(log.payload ?? '');
|
||||
}
|
||||
// debugPrint("$log");
|
||||
super.onLog(log);
|
||||
}
|
||||
|
||||
@@ -159,14 +158,14 @@ class _ClashContainerState extends State<ClashManager> with AppMessageListener {
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoaded(String providerName) {
|
||||
Future<void> onLoaded(String providerName) async {
|
||||
final appController = globalState.appController;
|
||||
appController.appState.setProvider(
|
||||
clashCore.getExternalProvider(
|
||||
providerName,
|
||||
),
|
||||
);
|
||||
// appController.addCheckIpNumDebounce();
|
||||
await appController.updateGroupDebounce();
|
||||
super.onLoaded(providerName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class _WindowContainerState extends State<WindowManager> with WindowListener, Wi
|
||||
|
||||
@override
|
||||
void onTaskbarCreated() {
|
||||
globalState.appController.updateTray();
|
||||
globalState.appController.updateTray(true);
|
||||
super.onTaskbarCreated();
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,35 @@ class ProxiesStyle with _$ProxiesStyle {
|
||||
json == null ? defaultProxiesStyle : _$ProxiesStyleFromJson(json);
|
||||
}
|
||||
|
||||
const defaultThemeProps = ThemeProps();
|
||||
|
||||
@freezed
|
||||
class ThemeProps with _$ThemeProps {
|
||||
const factory ThemeProps({
|
||||
@Default(0xFF795548) int? primaryColor,
|
||||
@Default(ThemeMode.system) ThemeMode themeMode,
|
||||
@Default(false) bool prueBlack,
|
||||
@Default(FontFamily.system) FontFamily fontFamily,
|
||||
}) = _ThemeProps;
|
||||
|
||||
factory ThemeProps.fromJson(Map<String, Object?> json) => _$ThemePropsFromJson(json);
|
||||
|
||||
factory ThemeProps.realFromJson(Map<String, Object?>? json) {
|
||||
if (json == null) {
|
||||
return Platform.isWindows
|
||||
? defaultThemeProps.copyWith(fontFamily: FontFamily.miSans)
|
||||
: defaultThemeProps;
|
||||
}
|
||||
try {
|
||||
return ThemeProps.fromJson(json);
|
||||
} catch (_) {
|
||||
return Platform.isWindows
|
||||
? defaultThemeProps.copyWith(fontFamily: FontFamily.miSans)
|
||||
: defaultThemeProps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const defaultCustomFontSizeScale = 1.0;
|
||||
|
||||
@JsonSerializable()
|
||||
@@ -148,13 +177,11 @@ class Config extends ChangeNotifier {
|
||||
AppSetting _appSetting;
|
||||
List<Profile> _profiles;
|
||||
String? _currentProfileId;
|
||||
ThemeMode _themeMode;
|
||||
int? _primaryColor;
|
||||
bool _isAccessControl;
|
||||
AccessControl _accessControl;
|
||||
DAV? _dav;
|
||||
WindowProps _windowProps;
|
||||
bool _prueBlack;
|
||||
ThemeProps _themeProps;
|
||||
VpnProps _vpnProps;
|
||||
DesktopProps _desktopProps;
|
||||
bool _overrideDns;
|
||||
@@ -163,18 +190,16 @@ class Config extends ChangeNotifier {
|
||||
|
||||
Config()
|
||||
: _profiles = [],
|
||||
_themeMode = ThemeMode.system,
|
||||
_primaryColor = defaultPrimaryColor.value,
|
||||
_isAccessControl = false,
|
||||
_accessControl = const AccessControl(),
|
||||
_windowProps = const WindowProps(),
|
||||
_prueBlack = false,
|
||||
_vpnProps = defaultVpnProps,
|
||||
_desktopProps = const DesktopProps(),
|
||||
_overrideDns = false,
|
||||
_appSetting = defaultAppSetting,
|
||||
_hotKeyActions = [],
|
||||
_proxiesStyle = defaultProxiesStyle;
|
||||
_proxiesStyle = defaultProxiesStyle,
|
||||
_themeProps = defaultThemeProps;
|
||||
|
||||
@JsonKey(fromJson: AppSetting.realFromJson)
|
||||
AppSetting get appSetting => _appSetting;
|
||||
@@ -305,25 +330,6 @@ class Config extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonKey(defaultValue: ThemeMode.system)
|
||||
ThemeMode get themeMode => _themeMode;
|
||||
|
||||
set themeMode(ThemeMode value) {
|
||||
if (_themeMode != value) {
|
||||
_themeMode = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
int? get primaryColor => _primaryColor;
|
||||
|
||||
set primaryColor(int? value) {
|
||||
if (_primaryColor != value) {
|
||||
_primaryColor = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@JsonKey(defaultValue: false)
|
||||
bool get isAccessControl {
|
||||
if (!Platform.isAndroid) return false;
|
||||
@@ -355,18 +361,6 @@ class Config extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonKey(defaultValue: false)
|
||||
bool get prueBlack {
|
||||
return _prueBlack;
|
||||
}
|
||||
|
||||
set prueBlack(bool value) {
|
||||
if (_prueBlack != value) {
|
||||
_prueBlack = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
WindowProps get windowProps => _windowProps;
|
||||
|
||||
set windowProps(WindowProps value) {
|
||||
@@ -427,6 +421,16 @@ class Config extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonKey(fromJson: ThemeProps.realFromJson)
|
||||
ThemeProps get themeProps => _themeProps;
|
||||
|
||||
set themeProps(ThemeProps value) {
|
||||
if (_themeProps != value) {
|
||||
_themeProps = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
updateOrAddHotKeyAction(HotKeyAction hotKeyAction) {
|
||||
final index =
|
||||
_hotKeyActions.indexWhere((item) => item.action == hotKeyAction.action);
|
||||
@@ -455,11 +459,9 @@ class Config extends ChangeNotifier {
|
||||
_appSetting = config._appSetting;
|
||||
_currentProfileId = config._currentProfileId;
|
||||
_dav = config._dav;
|
||||
_themeMode = config._themeMode;
|
||||
_primaryColor = config._primaryColor;
|
||||
_isAccessControl = config._isAccessControl;
|
||||
_accessControl = config._accessControl;
|
||||
_prueBlack = config._prueBlack;
|
||||
_themeProps = config._themeProps;
|
||||
_windowProps = config._windowProps;
|
||||
_proxiesStyle = config._proxiesStyle;
|
||||
_vpnProps = config._vpnProps;
|
||||
|
||||
@@ -1541,3 +1541,212 @@ abstract class _ProxiesStyle implements ProxiesStyle {
|
||||
_$$ProxiesStyleImplCopyWith<_$ProxiesStyleImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
ThemeProps _$ThemePropsFromJson(Map<String, dynamic> json) {
|
||||
return _ThemeProps.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ThemeProps {
|
||||
int? get primaryColor => throw _privateConstructorUsedError;
|
||||
ThemeMode get themeMode => throw _privateConstructorUsedError;
|
||||
bool get prueBlack => throw _privateConstructorUsedError;
|
||||
FontFamily get fontFamily => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$ThemePropsCopyWith<ThemeProps> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ThemePropsCopyWith<$Res> {
|
||||
factory $ThemePropsCopyWith(
|
||||
ThemeProps value, $Res Function(ThemeProps) then) =
|
||||
_$ThemePropsCopyWithImpl<$Res, ThemeProps>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int? primaryColor,
|
||||
ThemeMode themeMode,
|
||||
bool prueBlack,
|
||||
FontFamily fontFamily});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ThemePropsCopyWithImpl<$Res, $Val extends ThemeProps>
|
||||
implements $ThemePropsCopyWith<$Res> {
|
||||
_$ThemePropsCopyWithImpl(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? primaryColor = freezed,
|
||||
Object? themeMode = null,
|
||||
Object? prueBlack = null,
|
||||
Object? fontFamily = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
primaryColor: freezed == primaryColor
|
||||
? _value.primaryColor
|
||||
: primaryColor // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
themeMode: null == themeMode
|
||||
? _value.themeMode
|
||||
: themeMode // ignore: cast_nullable_to_non_nullable
|
||||
as ThemeMode,
|
||||
prueBlack: null == prueBlack
|
||||
? _value.prueBlack
|
||||
: prueBlack // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
fontFamily: null == fontFamily
|
||||
? _value.fontFamily
|
||||
: fontFamily // ignore: cast_nullable_to_non_nullable
|
||||
as FontFamily,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ThemePropsImplCopyWith<$Res>
|
||||
implements $ThemePropsCopyWith<$Res> {
|
||||
factory _$$ThemePropsImplCopyWith(
|
||||
_$ThemePropsImpl value, $Res Function(_$ThemePropsImpl) then) =
|
||||
__$$ThemePropsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int? primaryColor,
|
||||
ThemeMode themeMode,
|
||||
bool prueBlack,
|
||||
FontFamily fontFamily});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ThemePropsImplCopyWithImpl<$Res>
|
||||
extends _$ThemePropsCopyWithImpl<$Res, _$ThemePropsImpl>
|
||||
implements _$$ThemePropsImplCopyWith<$Res> {
|
||||
__$$ThemePropsImplCopyWithImpl(
|
||||
_$ThemePropsImpl _value, $Res Function(_$ThemePropsImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? primaryColor = freezed,
|
||||
Object? themeMode = null,
|
||||
Object? prueBlack = null,
|
||||
Object? fontFamily = null,
|
||||
}) {
|
||||
return _then(_$ThemePropsImpl(
|
||||
primaryColor: freezed == primaryColor
|
||||
? _value.primaryColor
|
||||
: primaryColor // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
themeMode: null == themeMode
|
||||
? _value.themeMode
|
||||
: themeMode // ignore: cast_nullable_to_non_nullable
|
||||
as ThemeMode,
|
||||
prueBlack: null == prueBlack
|
||||
? _value.prueBlack
|
||||
: prueBlack // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
fontFamily: null == fontFamily
|
||||
? _value.fontFamily
|
||||
: fontFamily // ignore: cast_nullable_to_non_nullable
|
||||
as FontFamily,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ThemePropsImpl implements _ThemeProps {
|
||||
const _$ThemePropsImpl(
|
||||
{this.primaryColor = 0xFF795548,
|
||||
this.themeMode = ThemeMode.system,
|
||||
this.prueBlack = false,
|
||||
this.fontFamily = FontFamily.system});
|
||||
|
||||
factory _$ThemePropsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ThemePropsImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final int? primaryColor;
|
||||
@override
|
||||
@JsonKey()
|
||||
final ThemeMode themeMode;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool prueBlack;
|
||||
@override
|
||||
@JsonKey()
|
||||
final FontFamily fontFamily;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ThemeProps(primaryColor: $primaryColor, themeMode: $themeMode, prueBlack: $prueBlack, fontFamily: $fontFamily)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ThemePropsImpl &&
|
||||
(identical(other.primaryColor, primaryColor) ||
|
||||
other.primaryColor == primaryColor) &&
|
||||
(identical(other.themeMode, themeMode) ||
|
||||
other.themeMode == themeMode) &&
|
||||
(identical(other.prueBlack, prueBlack) ||
|
||||
other.prueBlack == prueBlack) &&
|
||||
(identical(other.fontFamily, fontFamily) ||
|
||||
other.fontFamily == fontFamily));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, primaryColor, themeMode, prueBlack, fontFamily);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ThemePropsImplCopyWith<_$ThemePropsImpl> get copyWith =>
|
||||
__$$ThemePropsImplCopyWithImpl<_$ThemePropsImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ThemePropsImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ThemeProps implements ThemeProps {
|
||||
const factory _ThemeProps(
|
||||
{final int? primaryColor,
|
||||
final ThemeMode themeMode,
|
||||
final bool prueBlack,
|
||||
final FontFamily fontFamily}) = _$ThemePropsImpl;
|
||||
|
||||
factory _ThemeProps.fromJson(Map<String, dynamic> json) =
|
||||
_$ThemePropsImpl.fromJson;
|
||||
|
||||
@override
|
||||
int? get primaryColor;
|
||||
@override
|
||||
ThemeMode get themeMode;
|
||||
@override
|
||||
bool get prueBlack;
|
||||
@override
|
||||
FontFamily get fontFamily;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$ThemePropsImplCopyWith<_$ThemePropsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -14,16 +14,12 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config()
|
||||
.toList() ??
|
||||
[]
|
||||
..currentProfileId = json['currentProfileId'] as String?
|
||||
..themeMode = $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']) ??
|
||||
ThemeMode.system
|
||||
..primaryColor = (json['primaryColor'] as num?)?.toInt()
|
||||
..isAccessControl = json['isAccessControl'] as bool? ?? false
|
||||
..accessControl =
|
||||
AccessControl.fromJson(json['accessControl'] as Map<String, dynamic>)
|
||||
..dav = json['dav'] == null
|
||||
? null
|
||||
: DAV.fromJson(json['dav'] as Map<String, dynamic>)
|
||||
..prueBlack = json['prueBlack'] as bool? ?? false
|
||||
..windowProps =
|
||||
WindowProps.fromJson(json['windowProps'] as Map<String, dynamic>?)
|
||||
..vpnProps = VpnProps.fromJson(json['vpnProps'] as Map<String, dynamic>?)
|
||||
@@ -35,32 +31,26 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config()
|
||||
.toList() ??
|
||||
[]
|
||||
..proxiesStyle =
|
||||
ProxiesStyle.fromJson(json['proxiesStyle'] as Map<String, dynamic>?);
|
||||
ProxiesStyle.fromJson(json['proxiesStyle'] as Map<String, dynamic>?)
|
||||
..themeProps =
|
||||
ThemeProps.realFromJson(json['themeProps'] as Map<String, Object?>?);
|
||||
|
||||
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||
'appSetting': instance.appSetting,
|
||||
'profiles': instance.profiles,
|
||||
'currentProfileId': instance.currentProfileId,
|
||||
'themeMode': _$ThemeModeEnumMap[instance.themeMode]!,
|
||||
'primaryColor': instance.primaryColor,
|
||||
'isAccessControl': instance.isAccessControl,
|
||||
'accessControl': instance.accessControl,
|
||||
'dav': instance.dav,
|
||||
'prueBlack': instance.prueBlack,
|
||||
'windowProps': instance.windowProps,
|
||||
'vpnProps': instance.vpnProps,
|
||||
'desktopProps': instance.desktopProps,
|
||||
'overrideDns': instance.overrideDns,
|
||||
'hotKeyActions': instance.hotKeyActions,
|
||||
'proxiesStyle': instance.proxiesStyle,
|
||||
'themeProps': instance.themeProps,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
ThemeMode.system: 'system',
|
||||
ThemeMode.light: 'light',
|
||||
ThemeMode.dark: 'dark',
|
||||
};
|
||||
|
||||
_$AppSettingImpl _$$AppSettingImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AppSettingImpl(
|
||||
locale: json['locale'] as String?,
|
||||
@@ -241,3 +231,35 @@ const _$ProxyCardTypeEnumMap = {
|
||||
ProxyCardType.shrink: 'shrink',
|
||||
ProxyCardType.min: 'min',
|
||||
};
|
||||
|
||||
_$ThemePropsImpl _$$ThemePropsImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ThemePropsImpl(
|
||||
primaryColor: (json['primaryColor'] as num?)?.toInt() ?? 0xFF795548,
|
||||
themeMode: $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']) ??
|
||||
ThemeMode.system,
|
||||
prueBlack: json['prueBlack'] as bool? ?? false,
|
||||
fontFamily:
|
||||
$enumDecodeNullable(_$FontFamilyEnumMap, json['fontFamily']) ??
|
||||
FontFamily.system,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ThemePropsImplToJson(_$ThemePropsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'primaryColor': instance.primaryColor,
|
||||
'themeMode': _$ThemeModeEnumMap[instance.themeMode]!,
|
||||
'prueBlack': instance.prueBlack,
|
||||
'fontFamily': _$FontFamilyEnumMap[instance.fontFamily]!,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
ThemeMode.system: 'system',
|
||||
ThemeMode.light: 'light',
|
||||
ThemeMode.dark: 'dark',
|
||||
};
|
||||
|
||||
const _$FontFamilyEnumMap = {
|
||||
FontFamily.system: 'system',
|
||||
FontFamily.miSans: 'miSans',
|
||||
FontFamily.twEmoji: 'twEmoji',
|
||||
FontFamily.icon: 'icon',
|
||||
};
|
||||
|
||||
@@ -772,6 +772,7 @@ mixin _$ApplicationSelectorState {
|
||||
ThemeMode? get themeMode => throw _privateConstructorUsedError;
|
||||
int? get primaryColor => throw _privateConstructorUsedError;
|
||||
bool get prueBlack => throw _privateConstructorUsedError;
|
||||
FontFamily get fontFamily => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$ApplicationSelectorStateCopyWith<ApplicationSelectorState> get copyWith =>
|
||||
@@ -788,7 +789,8 @@ abstract class $ApplicationSelectorStateCopyWith<$Res> {
|
||||
{String? locale,
|
||||
ThemeMode? themeMode,
|
||||
int? primaryColor,
|
||||
bool prueBlack});
|
||||
bool prueBlack,
|
||||
FontFamily fontFamily});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -809,6 +811,7 @@ class _$ApplicationSelectorStateCopyWithImpl<$Res,
|
||||
Object? themeMode = freezed,
|
||||
Object? primaryColor = freezed,
|
||||
Object? prueBlack = null,
|
||||
Object? fontFamily = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
locale: freezed == locale
|
||||
@@ -827,6 +830,10 @@ class _$ApplicationSelectorStateCopyWithImpl<$Res,
|
||||
? _value.prueBlack
|
||||
: prueBlack // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
fontFamily: null == fontFamily
|
||||
? _value.fontFamily
|
||||
: fontFamily // ignore: cast_nullable_to_non_nullable
|
||||
as FontFamily,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
@@ -844,7 +851,8 @@ abstract class _$$ApplicationSelectorStateImplCopyWith<$Res>
|
||||
{String? locale,
|
||||
ThemeMode? themeMode,
|
||||
int? primaryColor,
|
||||
bool prueBlack});
|
||||
bool prueBlack,
|
||||
FontFamily fontFamily});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -864,6 +872,7 @@ class __$$ApplicationSelectorStateImplCopyWithImpl<$Res>
|
||||
Object? themeMode = freezed,
|
||||
Object? primaryColor = freezed,
|
||||
Object? prueBlack = null,
|
||||
Object? fontFamily = null,
|
||||
}) {
|
||||
return _then(_$ApplicationSelectorStateImpl(
|
||||
locale: freezed == locale
|
||||
@@ -882,6 +891,10 @@ class __$$ApplicationSelectorStateImplCopyWithImpl<$Res>
|
||||
? _value.prueBlack
|
||||
: prueBlack // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
fontFamily: null == fontFamily
|
||||
? _value.fontFamily
|
||||
: fontFamily // ignore: cast_nullable_to_non_nullable
|
||||
as FontFamily,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -893,7 +906,8 @@ class _$ApplicationSelectorStateImpl implements _ApplicationSelectorState {
|
||||
{required this.locale,
|
||||
required this.themeMode,
|
||||
required this.primaryColor,
|
||||
required this.prueBlack});
|
||||
required this.prueBlack,
|
||||
required this.fontFamily});
|
||||
|
||||
@override
|
||||
final String? locale;
|
||||
@@ -903,10 +917,12 @@ class _$ApplicationSelectorStateImpl implements _ApplicationSelectorState {
|
||||
final int? primaryColor;
|
||||
@override
|
||||
final bool prueBlack;
|
||||
@override
|
||||
final FontFamily fontFamily;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ApplicationSelectorState(locale: $locale, themeMode: $themeMode, primaryColor: $primaryColor, prueBlack: $prueBlack)';
|
||||
return 'ApplicationSelectorState(locale: $locale, themeMode: $themeMode, primaryColor: $primaryColor, prueBlack: $prueBlack, fontFamily: $fontFamily)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -920,12 +936,14 @@ class _$ApplicationSelectorStateImpl implements _ApplicationSelectorState {
|
||||
(identical(other.primaryColor, primaryColor) ||
|
||||
other.primaryColor == primaryColor) &&
|
||||
(identical(other.prueBlack, prueBlack) ||
|
||||
other.prueBlack == prueBlack));
|
||||
other.prueBlack == prueBlack) &&
|
||||
(identical(other.fontFamily, fontFamily) ||
|
||||
other.fontFamily == fontFamily));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, locale, themeMode, primaryColor, prueBlack);
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, locale, themeMode, primaryColor, prueBlack, fontFamily);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@@ -940,7 +958,8 @@ abstract class _ApplicationSelectorState implements ApplicationSelectorState {
|
||||
{required final String? locale,
|
||||
required final ThemeMode? themeMode,
|
||||
required final int? primaryColor,
|
||||
required final bool prueBlack}) = _$ApplicationSelectorStateImpl;
|
||||
required final bool prueBlack,
|
||||
required final FontFamily fontFamily}) = _$ApplicationSelectorStateImpl;
|
||||
|
||||
@override
|
||||
String? get locale;
|
||||
@@ -951,6 +970,8 @@ abstract class _ApplicationSelectorState implements ApplicationSelectorState {
|
||||
@override
|
||||
bool get prueBlack;
|
||||
@override
|
||||
FontFamily get fontFamily;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$ApplicationSelectorStateImplCopyWith<_$ApplicationSelectorStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
|
||||
@@ -55,6 +55,7 @@ class ApplicationSelectorState with _$ApplicationSelectorState {
|
||||
required ThemeMode? themeMode,
|
||||
required int? primaryColor,
|
||||
required bool prueBlack,
|
||||
required FontFamily fontFamily,
|
||||
}) = _ApplicationSelectorState;
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
|
||||
Animation<double> secondaryAnimation,
|
||||
) {
|
||||
return Selector<Config, ThemeMode>(
|
||||
selector: (_, config) => config.themeMode,
|
||||
selector: (_, config) => config.themeProps.themeMode,
|
||||
builder: (_, __, ___) {
|
||||
_colorTween = _getColorTween(
|
||||
transitionType: transitionType,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fl_clash/enum/enum.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:emoji_regex/emoji_regex.dart';
|
||||
|
||||
@@ -62,7 +63,7 @@ class EmojiText extends StatelessWidget {
|
||||
TextSpan(
|
||||
text:match.group(0),
|
||||
style: style?.copyWith(
|
||||
fontFamily: "Twemoji",
|
||||
fontFamily: FontFamily.twEmoji.value,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -665,18 +665,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.4"
|
||||
version: "10.0.5"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
version: "3.0.5"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -721,10 +721,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
version: "0.11.1"
|
||||
menu_base:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -737,10 +737,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.0"
|
||||
version: "1.15.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1149,10 +1149,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
version: "0.7.2"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1269,10 +1269,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.1"
|
||||
version: "14.2.5"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -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.8.64+202410121
|
||||
version: 0.8.66+202410262
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
|
||||
@@ -72,6 +72,9 @@ flutter:
|
||||
- family: Twemoji
|
||||
fonts:
|
||||
- asset: assets/fonts/Twemoji.Mozilla.ttf
|
||||
- family: MiSans
|
||||
fonts:
|
||||
- asset: assets/fonts/MiSans-Regular.ttf
|
||||
- family: Icons
|
||||
fonts:
|
||||
- asset: assets/fonts/Icons.ttf
|
||||
|
||||
59
release.py
Normal file
59
release.py
Normal file
@@ -0,0 +1,59 @@
|
||||
import os
|
||||
import json
|
||||
import requests
|
||||
|
||||
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
|
||||
TAG = os.getenv("TAG")
|
||||
|
||||
IS_RELEASE = "+" not in TAG
|
||||
|
||||
CHAT_ID = "@FlClash"
|
||||
API_URL = f"http://localhost:8081/bot{TELEGRAM_BOT_TOKEN}/sendMediaGroup"
|
||||
|
||||
DIST_DIR = os.path.join(os.getcwd(), "dist")
|
||||
release = os.path.join(os.getcwd(), "release.md")
|
||||
|
||||
text = ""
|
||||
|
||||
media = []
|
||||
files = {}
|
||||
|
||||
i = 1
|
||||
for file in os.listdir(DIST_DIR):
|
||||
file_path = os.path.join(DIST_DIR, file)
|
||||
if os.path.isfile(file_path):
|
||||
file_key = f"file{i}"
|
||||
media.append({
|
||||
"type": "document",
|
||||
"media": f"attach://{file_key}"
|
||||
})
|
||||
files[file_key] = open(file_path, 'rb')
|
||||
i += 1
|
||||
|
||||
if TAG:
|
||||
text += f"\n**{TAG}**\n"
|
||||
|
||||
if IS_RELEASE:
|
||||
text += f"\nhttps://github.com/chen08209/FlClash/releases/tag/{TAG}\n"
|
||||
|
||||
|
||||
if os.path.exists(release):
|
||||
text += "\n"
|
||||
with open(release, 'r') as f:
|
||||
text += f.read()
|
||||
text += "\n"
|
||||
|
||||
if media:
|
||||
media[-1]["caption"] = text
|
||||
media[-1]["parse_mode"] = "Markdown"
|
||||
|
||||
response = requests.post(
|
||||
API_URL,
|
||||
data={
|
||||
"chat_id": CHAT_ID,
|
||||
"media": json.dumps(media)
|
||||
},
|
||||
files=files
|
||||
)
|
||||
|
||||
print("Response JSON:", response.json())
|
||||
30
setup.dart
30
setup.dart
@@ -55,8 +55,7 @@ class BuildLibItem {
|
||||
}
|
||||
|
||||
class Build {
|
||||
static List<BuildLibItem> get buildItems =>
|
||||
[
|
||||
static List<BuildLibItem> get buildItems => [
|
||||
BuildLibItem(
|
||||
platform: PlatformType.macos,
|
||||
arch: Arch.amd64,
|
||||
@@ -115,7 +114,7 @@ class Build {
|
||||
final ndk = environment["ANDROID_NDK"];
|
||||
assert(ndk != null);
|
||||
final prebuiltDir =
|
||||
Directory(join(ndk!, "toolchains", "llvm", "prebuilt"));
|
||||
Directory(join(ndk!, "toolchains", "llvm", "prebuilt"));
|
||||
final prebuiltDirList = prebuiltDir.listSync();
|
||||
final map = {
|
||||
"armeabi-v7a": "armv7a-linux-androideabi21-clang",
|
||||
@@ -134,7 +133,8 @@ class Build {
|
||||
|
||||
static get tags => "with_gvisor";
|
||||
|
||||
static Future<void> exec(List<String> executable, {
|
||||
static Future<void> exec(
|
||||
List<String> executable, {
|
||||
String? name,
|
||||
Map<String, String>? environment,
|
||||
String? workingDirectory,
|
||||
@@ -163,7 +163,7 @@ class Build {
|
||||
Arch? arch,
|
||||
}) async {
|
||||
final items = buildItems.where(
|
||||
(element) {
|
||||
(element) {
|
||||
return element.platform == platform &&
|
||||
(arch == null ? true : element.arch == arch);
|
||||
},
|
||||
@@ -276,11 +276,10 @@ class BuildCommand extends Command {
|
||||
@override
|
||||
String get name => platform.name;
|
||||
|
||||
List<Arch> get arches =>
|
||||
Build.buildItems
|
||||
.where((element) => element.platform == platform)
|
||||
.map((e) => e.arch)
|
||||
.toList();
|
||||
List<Arch> get arches => Build.buildItems
|
||||
.where((element) => element.platform == platform)
|
||||
.map((e) => e.arch)
|
||||
.toList();
|
||||
|
||||
Future<void> _buildLib(Arch? arch) async {
|
||||
await Build.buildLib(platform: platform, arch: arch);
|
||||
@@ -337,11 +336,13 @@ class BuildCommand extends Command {
|
||||
String args = '',
|
||||
}) async {
|
||||
await Build.getDistributor();
|
||||
/* final tag = Platform.environment["TAG"] ?? "+";
|
||||
final isDev = tag.contains("+");
|
||||
final channelArgs = isDev && platform == PlatformType.android ? "--build-flavor dev" : "";*/
|
||||
await Build.exec(
|
||||
name: name,
|
||||
Build.getExecutable(
|
||||
"flutter_distributor package --skip-clean --platform ${platform
|
||||
.name} --targets $targets --flutter-build-args=verbose $args",
|
||||
"flutter_distributor package --skip-clean --platform ${platform.name} --targets $targets --flutter-build-args=verbose $args",
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -351,7 +352,7 @@ class BuildCommand extends Command {
|
||||
final String build = argResults?['build'] ?? 'all';
|
||||
final archName = argResults?['arch'];
|
||||
final currentArches =
|
||||
arches.where((element) => element.name == archName).toList();
|
||||
arches.where((element) => element.name == archName).toList();
|
||||
final arch = currentArches.isEmpty ? null : currentArches.first;
|
||||
if (arch == null && platform == PlatformType.windows) {
|
||||
throw "Invalid arch";
|
||||
@@ -389,8 +390,7 @@ class BuildCommand extends Command {
|
||||
platform: platform,
|
||||
targets: "apk",
|
||||
args:
|
||||
"--flutter-build-args split-per-abi --build-target-platform ${defaultTargets
|
||||
.join(",")}",
|
||||
"--flutter-build-args split-per-abi --build-target-platform ${defaultTargets.join(",")}",
|
||||
);
|
||||
case PlatformType.macos:
|
||||
await _getMacosDependencies();
|
||||
|
||||
Reference in New Issue
Block a user