Skip to content

Commit 1154e7b

Browse files
committed
Optimize desktop view
Optimize logs, requests, connection pages Optimize windows tray auto hide Optimize some details Update core
1 parent adb890d commit 1154e7b

File tree

169 files changed

+6473
-5219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+6473
-5219
lines changed

analysis_options.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
include: package:flutter_lints/flutter.yaml
2+
analyzer:
3+
exclude:
4+
- lib/l10n/intl/**
5+
6+
linter:
7+
rules:
8+
prefer_single_quotes: true

arb/intl_en.arb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,5 +406,20 @@
406406
"import": "Import",
407407
"importFile": "Import from file",
408408
"importUrl": "Import from URL",
409-
"autoSetSystemDns": "Auto set system DNS"
409+
"autoSetSystemDns": "Auto set system DNS",
410+
"details": "{label} details",
411+
"creationTime": "Creation time",
412+
"progress": "Progress",
413+
"host": "Host",
414+
"destination": "Destination",
415+
"destinationGeoIP": "Destination GeoIP",
416+
"destinationIPASN": "Destination IPASN",
417+
"specialProxy": "Special proxy",
418+
"specialRules": "special rules",
419+
"remoteDestination": "Remote destination",
420+
"networkType": "Network type",
421+
"proxyChains": "Proxy chains",
422+
"log": "Log",
423+
"connection": "Connection",
424+
"request": "Request"
410425
}

arb/intl_ja.arb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,5 +407,20 @@
407407
"import": "インポート",
408408
"importFile": "ファイルからインポート",
409409
"importUrl": "URLからインポート",
410-
"autoSetSystemDns": "オートセットシステムDNS"
410+
"autoSetSystemDns": "オートセットシステムDNS",
411+
"details": "{label}詳細",
412+
"creationTime": "作成時間",
413+
"progress": "進捗",
414+
"host": "ホスト",
415+
"destination": "宛先",
416+
"destinationGeoIP": "宛先地理情報",
417+
"destinationIPASN": "宛先IP ASN",
418+
"specialProxy": "特殊プロキシ",
419+
"specialRules": "特殊ルール",
420+
"remoteDestination": "リモート宛先",
421+
"networkType": "ネットワーク種別",
422+
"proxyChains": "プロキシチェーン",
423+
"log": "ログ",
424+
"connection": "接続",
425+
"request": "リクエスト"
411426
}

arb/intl_ru.arb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,5 +407,20 @@
407407
"import": "Импорт",
408408
"importFile": "Импорт из файла",
409409
"importUrl": "Импорт по URL",
410-
"autoSetSystemDns": "Автоматическая настройка системного DNS"
410+
"autoSetSystemDns": "Автоматическая настройка системного DNS",
411+
"details": "Детали {}",
412+
"creationTime": "Время создания",
413+
"progress": "Прогресс",
414+
"host": "Хост",
415+
"destination": "Назначение",
416+
"destinationGeoIP": "Геолокация назначения",
417+
"destinationIPASN": "ASN назначения",
418+
"specialProxy": "Специальный прокси",
419+
"specialRules": "Специальные правила",
420+
"remoteDestination": "Удалённое назначение",
421+
"networkType": "Тип сети",
422+
"proxyChains": "Цепочки прокси",
423+
"log": "Журнал",
424+
"connection": "Соединение",
425+
"request": "Запрос"
411426
}

arb/intl_zh_CN.arb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,5 +407,20 @@
407407
"import": "导入",
408408
"importFile": "通过文件导入",
409409
"importUrl": "通过URL导入",
410-
"autoSetSystemDns": "自动设置系统DNS"
410+
"autoSetSystemDns": "自动设置系统DNS",
411+
"details": "{label}详情",
412+
"creationTime": "创建时间",
413+
"progress": "进度",
414+
"host": "主机",
415+
"destination": "目标地址",
416+
"destinationGeoIP": "目标地理定位",
417+
"destinationIPASN": "目标IP ASN",
418+
"specialProxy": "特殊代理",
419+
"specialRules": "特殊规则",
420+
"remoteDestination": "远程目标",
421+
"networkType": "网络类型",
422+
"proxyChains": "代理链",
423+
"log": "日志",
424+
"connection": "连接",
425+
"request": "请求"
411426
}

core/Clash.Meta

Submodule Clash.Meta updated 78 files

core/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ require (
5252
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab // indirect
5353
github.com/metacubex/bart v0.20.5 // indirect
5454
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 // indirect
55-
github.com/metacubex/chacha v0.1.2 // indirect
55+
github.com/metacubex/chacha v0.1.5 // indirect
5656
github.com/metacubex/fswatch v0.1.1 // indirect
5757
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 // indirect
5858
github.com/metacubex/gvisor v0.0.0-20250324165734-5857f47bd43b // indirect
5959
github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 // indirect
6060
github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639 // indirect
6161
github.com/metacubex/randv2 v0.2.0 // indirect
62-
github.com/metacubex/sing v0.5.3 // indirect
62+
github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29 // indirect
6363
github.com/metacubex/sing-mux v0.3.2 // indirect
6464
github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f // indirect
65-
github.com/metacubex/sing-shadowsocks v0.2.10 // indirect
66-
github.com/metacubex/sing-shadowsocks2 v0.2.4 // indirect
65+
github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92 // indirect
66+
github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d // indirect
6767
github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 // indirect
68-
github.com/metacubex/sing-tun v0.4.6-0.20250524142129-9d110c0af70c // indirect
68+
github.com/metacubex/sing-tun v0.4.7-0.20250611091011-60774779fdd8 // indirect
6969
github.com/metacubex/sing-vmess v0.2.2 // indirect
7070
github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f // indirect
7171
github.com/metacubex/smux v0.0.0-20250503055512-501391591dee // indirect
7272
github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4 // indirect
73-
github.com/metacubex/utls v1.7.3 // indirect
73+
github.com/metacubex/utls v1.7.4-0.20250610022031-808d767c8c73 // indirect
7474
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 // indirect
7575
github.com/miekg/dns v1.1.63 // indirect
7676
github.com/mroth/weightedrand/v2 v2.1.0 // indirect

core/go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ github.com/metacubex/bart v0.20.5 h1:XkgLZ17QxfxkqKdGsojoM2Zu01mmHyyQSFzt2/calTM
101101
github.com/metacubex/bart v0.20.5/go.mod h1:DCcyfP4MC+Zy7sLK7XeGuMw+P5K9mIRsYOBgiE8icsI=
102102
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 h1:oBowHVKZycNtAFbZ6avaCSZJYeme2Nrj+4RpV2cNJig=
103103
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399/go.mod h1:4xcieuIK+M4bGQmQYZVqEaIYqjS1ahO4kXG7EmDgEro=
104-
github.com/metacubex/chacha v0.1.2 h1:QulCq3eVm3TO6+4nVIWJtmSe7BT2GMrgVHuAoqRQnlc=
105-
github.com/metacubex/chacha v0.1.2/go.mod h1:Djn9bPZxLTXbJFSeyo0/qzEzQI+gUSSzttuzZM75GH8=
104+
github.com/metacubex/chacha v0.1.5 h1:fKWMb/5c7ZrY8Uoqi79PPFxl+qwR7X/q0OrsAubyX2M=
105+
github.com/metacubex/chacha v0.1.5/go.mod h1:Djn9bPZxLTXbJFSeyo0/qzEzQI+gUSSzttuzZM75GH8=
106106
github.com/metacubex/fswatch v0.1.1 h1:jqU7C/v+g0qc2RUFgmAOPoVvfl2BXXUXEumn6oQuxhU=
107107
github.com/metacubex/fswatch v0.1.1/go.mod h1:czrTT7Zlbz7vWft8RQu9Qqh+JoX+Nnb+UabuyN1YsgI=
108108
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvOzK9ubNCCkQ+ldc4YSH/rILn53l/xGBFHHI=
@@ -116,20 +116,20 @@ github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639/go.mod h1:Kc6
116116
github.com/metacubex/randv2 v0.2.0 h1:uP38uBvV2SxYfLj53kuvAjbND4RUDfFJjwr4UigMiLs=
117117
github.com/metacubex/randv2 v0.2.0/go.mod h1:kFi2SzrQ5WuneuoLLCMkABtiBu6VRrMrWFqSPyj2cxY=
118118
github.com/metacubex/sing v0.5.2/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w=
119-
github.com/metacubex/sing v0.5.3 h1:QWdN16WFKMk06x4nzkc8SvZ7y2x+TLQrpkPoHs+WSVM=
120-
github.com/metacubex/sing v0.5.3/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w=
119+
github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29 h1:SD9q025FNTaepuFXFOKDhnGLVu6PQYChBvw2ZYPXeLo=
120+
github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w=
121121
github.com/metacubex/sing-mux v0.3.2 h1:nJv52pyRivHcaZJKk2JgxpaVvj1GAXG81scSa9N7ncw=
122122
github.com/metacubex/sing-mux v0.3.2/go.mod h1:3rt1soewn0O6j89GCLmwAQFsq257u0jf2zQSPhTL3Bw=
123123
github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f h1:mP3vIm+9hRFI0C0Vl3pE0NESF/L85FDbuB0tGgUii6I=
124124
github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f/go.mod h1:JPTpf7fpnojsSuwRJExhSZSy63pVbp3VM39+zj+sAJM=
125-
github.com/metacubex/sing-shadowsocks v0.2.10 h1:Pr7LDbjMANIQHl07zWgl1vDuhpsfDQUpZ8cX6DPabfg=
126-
github.com/metacubex/sing-shadowsocks v0.2.10/go.mod h1:MtRM0ZZjR0kaDOzy9zWSt6/4/UlrnsNBq+1FNAF4vBk=
127-
github.com/metacubex/sing-shadowsocks2 v0.2.4 h1:Ec0x3hHR7xkld5Z09IGh16wtUUpBb2HgqZ9DExd8Q7s=
128-
github.com/metacubex/sing-shadowsocks2 v0.2.4/go.mod h1:WP8+S0kqtnSbX1vlIpo5i8Irm/ijZITEPBcZ26B5unY=
125+
github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92 h1:Y9ebcKya6ow7VHoESCN5+l4zZvg5eaL2IhI5LLCQxQA=
126+
github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92/go.mod h1:/squZ38pXrYjqtg8qn+joVvwbpGNYQNp8yxKsMVbCto=
127+
github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d h1:Ey3A1tA8lVkRbK1FDmwuWj/57Nr8JMdpoVqe45mFzJg=
128+
github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d/go.mod h1:+ukTd0OPFglT3bnKAYTJWYPbuox6HYNXE235r5tHdUk=
129129
github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 h1:gXU+MYPm7Wme3/OAY2FFzVq9d9GxPHOqu5AQfg/ddhI=
130130
github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2/go.mod h1:mbfboaXauKJNIHJYxQRa+NJs4JU9NZfkA+I33dS2+9E=
131-
github.com/metacubex/sing-tun v0.4.6-0.20250524142129-9d110c0af70c h1:Y6jk7AH5BEg9Dsvczrf/KokYsvxeKSZZlCLHg+hC4ro=
132-
github.com/metacubex/sing-tun v0.4.6-0.20250524142129-9d110c0af70c/go.mod h1:HDaHDL6onAX2ZGbAGUXKp++PohRdNb7Nzt6zxzhox+U=
131+
github.com/metacubex/sing-tun v0.4.7-0.20250611091011-60774779fdd8 h1:4zWKqxTx75TbfW2EmlQ3hxM6RTRg2PYOAVMCnU4I61I=
132+
github.com/metacubex/sing-tun v0.4.7-0.20250611091011-60774779fdd8/go.mod h1:2YywXPWW8Z97kTH7RffOeykKzU+l0aiKlglWV1PAS64=
133133
github.com/metacubex/sing-vmess v0.2.2 h1:nG6GIKF1UOGmlzs+BIetdGHkFZ20YqFVIYp5Htqzp+4=
134134
github.com/metacubex/sing-vmess v0.2.2/go.mod h1:CVDNcdSLVYFgTHQlubr88d8CdqupAUDqLjROos+H9xk=
135135
github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU=
@@ -138,8 +138,8 @@ github.com/metacubex/smux v0.0.0-20250503055512-501391591dee h1:lp6hJ+4wCLZu113a
138138
github.com/metacubex/smux v0.0.0-20250503055512-501391591dee/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE=
139139
github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4 h1:j1VRTiC9JLR4nUbSikx9OGdu/3AgFDqgcLj4GoqyQkc=
140140
github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw=
141-
github.com/metacubex/utls v1.7.3 h1:yDcMEWojFh+t8rU9X0HPcZDPAoFze/rIIyssqivzj8A=
142-
github.com/metacubex/utls v1.7.3/go.mod h1:oknYT0qTOwE4hjPmZOEpzVdefnW7bAdGLvZcqmk4TLU=
141+
github.com/metacubex/utls v1.7.4-0.20250610022031-808d767c8c73 h1:HWKsf92BqLYqugATFIJ3hYiEBZ7JF6AoqyvqF39afuI=
142+
github.com/metacubex/utls v1.7.4-0.20250610022031-808d767c8c73/go.mod h1:oknYT0qTOwE4hjPmZOEpzVdefnW7bAdGLvZcqmk4TLU=
143143
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 h1:hJLQviGySBuaynlCwf/oYgIxbVbGRUIKZCxdya9YrbQ=
144144
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181/go.mod h1:phewKljNYiTVT31Gcif8RiCKnTUOgVWFJjccqYM8s+Y=
145145
github.com/miekg/dns v1.1.63 h1:8M5aAw6OMZfFXTT7K5V0Eu5YiiL8l7nUAkyN6C9YwaY=

lib/application.dart

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ApplicationState extends ConsumerState<Application> {
6262
});
6363
}
6464

65-
_autoUpdateGroupTask() {
65+
void _autoUpdateGroupTask() {
6666
_autoUpdateGroupTaskTimer = Timer(const Duration(milliseconds: 20000), () {
6767
WidgetsBinding.instance.addPostFrameCallback((_) {
6868
globalState.appController.updateGroupsDebounce();
@@ -71,14 +71,14 @@ class ApplicationState extends ConsumerState<Application> {
7171
});
7272
}
7373

74-
_autoUpdateProfilesTask() {
74+
void _autoUpdateProfilesTask() {
7575
_autoUpdateProfilesTaskTimer = Timer(const Duration(minutes: 20), () async {
7676
await globalState.appController.autoUpdateProfiles();
7777
_autoUpdateProfilesTask();
7878
});
7979
}
8080

81-
_buildPlatformState(Widget child) {
81+
Widget _buildPlatformState(Widget child) {
8282
if (system.isDesktop) {
8383
return WindowManager(
8484
child: TrayManager(
@@ -97,13 +97,13 @@ class ApplicationState extends ConsumerState<Application> {
9797
);
9898
}
9999

100-
_buildState(Widget child) {
100+
Widget _buildState(Widget child) {
101101
return AppStateManager(
102102
child: ClashManager(
103103
child: ConnectivityManager(
104104
onConnectivityChanged: (results) async {
105105
if (!results.contains(ConnectivityResult.vpn)) {
106-
await clashCore.closeConnections();
106+
clashCore.closeConnections();
107107
}
108108
globalState.appController.updateLocalIp();
109109
globalState.appController.addCheckIpNumDebounce();
@@ -114,7 +114,7 @@ class ApplicationState extends ConsumerState<Application> {
114114
);
115115
}
116116

117-
_buildPlatformApp(Widget child) {
117+
Widget _buildPlatformApp(Widget child) {
118118
if (system.isDesktop) {
119119
return WindowHeaderContainer(
120120
child: child,
@@ -125,7 +125,7 @@ class ApplicationState extends ConsumerState<Application> {
125125
);
126126
}
127127

128-
_buildApp(Widget child) {
128+
Widget _buildApp(Widget child) {
129129
return MessageManager(
130130
child: ThemeManager(
131131
child: child,
@@ -153,8 +153,12 @@ class ApplicationState extends ConsumerState<Application> {
153153
],
154154
builder: (_, child) {
155155
return AppEnvManager(
156-
child: _buildPlatformApp(
157-
_buildApp(child!),
156+
child: _buildApp(
157+
AppSidebarContainer(
158+
child: _buildPlatformApp(
159+
child!,
160+
),
161+
),
158162
),
159163
);
160164
},
@@ -179,7 +183,7 @@ class ApplicationState extends ConsumerState<Application> {
179183
primaryColor: themeProps.primaryColor,
180184
).toPureBlack(themeProps.pureBlack),
181185
),
182-
home: child,
186+
home: child!,
183187
);
184188
},
185189
child: const HomePage(),

lib/clash/core.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ClashCore {
1717
late ClashHandlerInterface clashInterface;
1818

1919
ClashCore._internal() {
20-
if (Platform.isAndroid) {
20+
if (system.isAndroid) {
2121
clashInterface = clashLib!;
2222
} else {
2323
clashInterface = clashService!;
@@ -84,7 +84,7 @@ class ClashCore {
8484
return await clashInterface.setState(state);
8585
}
8686

87-
shutdown() async {
87+
Future<void> shutdown() async {
8888
await clashInterface.shutdown();
8989
}
9090

@@ -107,14 +107,14 @@ class ClashCore {
107107
if (proxies.isEmpty) return [];
108108
final groupNames = [
109109
UsedProxy.GLOBAL.name,
110-
...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) {
110+
...(proxies[UsedProxy.GLOBAL.name]['all'] as List).where((e) {
111111
final proxy = proxies[e] ?? {};
112112
return GroupTypeExtension.valueList.contains(proxy['type']);
113113
})
114114
];
115115
final groupsRaw = groupNames.map((groupName) {
116116
final group = proxies[groupName];
117-
group["all"] = ((group["all"] ?? []) as List)
117+
group['all'] = ((group['all'] ?? []) as List)
118118
.map(
119119
(name) => proxies[name],
120120
)
@@ -133,22 +133,22 @@ class ClashCore {
133133
return await clashInterface.changeProxy(changeProxyParams);
134134
}
135135

136-
Future<List<Connection>> getConnections() async {
136+
Future<List<TrackerInfo>> getConnections() async {
137137
final res = await clashInterface.getConnections();
138138
final connectionsData = json.decode(res) as Map;
139139
final connectionsRaw = connectionsData['connections'] as List? ?? [];
140-
return connectionsRaw.map((e) => Connection.fromJson(e)).toList();
140+
return connectionsRaw.map((e) => TrackerInfo.fromJson(e)).toList();
141141
}
142142

143-
closeConnection(String id) {
143+
void closeConnection(String id) {
144144
clashInterface.closeConnection(id);
145145
}
146146

147-
closeConnections() {
147+
void closeConnections() {
148148
clashInterface.closeConnections();
149149
}
150150

151-
resetConnections() {
151+
void resetConnections() {
152152
clashInterface.resetConnections();
153153
}
154154

@@ -202,11 +202,11 @@ class ClashCore {
202202
return clashInterface.updateExternalProvider(providerName);
203203
}
204204

205-
startListener() async {
205+
Future<void> startListener() async {
206206
await clashInterface.startListener();
207207
}
208208

209-
stopListener() async {
209+
Future<void> stopListener() async {
210210
await clashInterface.stopListener();
211211
}
212212

@@ -260,23 +260,23 @@ class ClashCore {
260260
return int.parse(value);
261261
}
262262

263-
resetTraffic() {
263+
void resetTraffic() {
264264
clashInterface.resetTraffic();
265265
}
266266

267-
startLog() {
267+
void startLog() {
268268
clashInterface.startLog();
269269
}
270270

271-
stopLog() {
271+
void stopLog() {
272272
clashInterface.stopLog();
273273
}
274274

275-
requestGc() {
276-
clashInterface.forceGc();
275+
Future<void> requestGc() async {
276+
await clashInterface.forceGc();
277277
}
278278

279-
destroy() async {
279+
Future<void> destroy() async {
280280
await clashInterface.destroy();
281281
}
282282
}

0 commit comments

Comments
 (0)