Compare commits
1 Commits
v0.8.83-pr
...
v0.8.83-pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
094857e0d6 |
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
os: windows-latest
|
||||
arch: amd64
|
||||
- platform: linux
|
||||
os: ubuntu-latest
|
||||
os: ubuntu-22.04
|
||||
arch: amd64
|
||||
- platform: macos
|
||||
os: macos-13
|
||||
|
||||
@@ -41,8 +41,8 @@ on Mobile:
|
||||
⚠️ Make sure to install the following dependencies before using them
|
||||
|
||||
```bash
|
||||
sudo apt-get install appindicator3-0.1 libappindicator3-dev
|
||||
sudo apt-get install keybinder-3.0
|
||||
sudo apt-get install libayatana-appindicator3-dev
|
||||
sudo apt-get install libkeybinder-3.0-dev
|
||||
```
|
||||
|
||||
### Android
|
||||
|
||||
@@ -41,8 +41,8 @@ on Mobile:
|
||||
⚠️ 使用前请确保安装以下依赖
|
||||
|
||||
```bash
|
||||
sudo apt-get install appindicator3-0.1 libappindicator3-dev
|
||||
sudo apt-get install keybinder-3.0
|
||||
sudo apt-get install libayatana-appindicator3-dev
|
||||
sudo apt-get install libkeybinder-3.0-dev
|
||||
```
|
||||
|
||||
### Android
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.follow.clash.services
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.PendingIntent
|
||||
import android.content.Intent
|
||||
import android.net.ProxyInfo
|
||||
import android.net.VpnService
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import com.android.build.gradle.tasks.MergeSourceSetFolders
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
@@ -37,13 +35,17 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation("androidx.annotation:annotation-jvm:1.9.1")
|
||||
}
|
||||
|
||||
val copyNativeLibs by tasks.register<Copy>("copyNativeLibs") {
|
||||
@@ -58,8 +60,4 @@ afterEvaluate {
|
||||
tasks.named("preBuild") {
|
||||
dependsOn(copyNativeLibs)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.16.0")
|
||||
}
|
||||
@@ -21,6 +21,8 @@ if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
-Wl,--strip-all
|
||||
-Wl,--exclude-libs=ALL
|
||||
)
|
||||
|
||||
add_compile_options(-fvisibility=hidden -fvisibility-inlines-hidden)
|
||||
endif ()
|
||||
|
||||
set(LIB_CLASH_PATH "${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libclash.so")
|
||||
|
||||
@@ -395,5 +395,10 @@
|
||||
"textScale": "Text Scaling",
|
||||
"internet": "Internet",
|
||||
"systemApp": "System APP",
|
||||
"noNetworkApp": "No network App"
|
||||
"noNetworkApp": "No network APP",
|
||||
"contactMe": "Contact me",
|
||||
"recoveryStrategy": "Recovery strategy",
|
||||
"recoveryStrategy_override": "Override",
|
||||
"recoveryStrategy_compatible": "Compatible",
|
||||
"logsTest": "Logs test"
|
||||
}
|
||||
@@ -396,5 +396,10 @@
|
||||
"textScale": "テキストスケーリング",
|
||||
"internet": "インターネット",
|
||||
"systemApp": "システムアプリ",
|
||||
"noNetworkApp": "ネットワークなしアプリ"
|
||||
"noNetworkApp": "ネットワークなしアプリ",
|
||||
"contactMe": "連絡する",
|
||||
"recoveryStrategy": "リカバリー戦略",
|
||||
"recoveryStrategy_override": "オーバーライド",
|
||||
"recoveryStrategy_compatible": "互換性",
|
||||
"logsTest": "ログテスト"
|
||||
}
|
||||
@@ -396,5 +396,10 @@
|
||||
"textScale": "Масштабирование текста",
|
||||
"internet": "Интернет",
|
||||
"systemApp": "Системное приложение",
|
||||
"noNetworkApp": "Приложение без сети"
|
||||
"noNetworkApp": "Приложение без сети",
|
||||
"contactMe": "Свяжитесь со мной",
|
||||
"recoveryStrategy": "Стратегия восстановления",
|
||||
"recoveryStrategy_override": "Переопределение",
|
||||
"recoveryStrategy_compatible": "Совместимый",
|
||||
"logsTest": "Тест журналов"
|
||||
}
|
||||
@@ -396,5 +396,10 @@
|
||||
"textScale": "文本缩放",
|
||||
"internet": "互联网",
|
||||
"systemApp": "系统应用",
|
||||
"noNetworkApp": "无网络应用"
|
||||
"noNetworkApp": "无网络应用",
|
||||
"contactMe": "联系我",
|
||||
"recoveryStrategy": "恢复策略",
|
||||
"recoveryStrategy_override": "覆盖",
|
||||
"recoveryStrategy_compatible": "兼容",
|
||||
"logsTest": "日志测试"
|
||||
}
|
||||
|
||||
@@ -92,12 +92,11 @@ class ClashService extends ClashHandlerInterface {
|
||||
final arg = Platform.isWindows
|
||||
? "${serverSocket.port}"
|
||||
: serverSocket.address.address;
|
||||
bool isSuccess = false;
|
||||
if (Platform.isWindows && await system.checkIsAdmin()) {
|
||||
isSuccess = await request.startCoreByHelper(arg);
|
||||
}
|
||||
if (isSuccess) {
|
||||
return;
|
||||
final isSuccess = await request.startCoreByHelper(arg);
|
||||
if (isSuccess) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
process = await Process.start(
|
||||
appPath.corePath,
|
||||
|
||||
@@ -43,6 +43,18 @@ class Measure {
|
||||
);
|
||||
}
|
||||
|
||||
double get bodyLargeHeight {
|
||||
return _measureMap.getCacheValue(
|
||||
"bodyLargeHeight",
|
||||
computeTextSize(
|
||||
Text(
|
||||
"X",
|
||||
style: context.textTheme.bodyLarge,
|
||||
),
|
||||
).height,
|
||||
);
|
||||
}
|
||||
|
||||
double get bodySmallHeight {
|
||||
return _measureMap.getCacheValue(
|
||||
"bodySmallHeight",
|
||||
|
||||
@@ -130,7 +130,7 @@ class Request {
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
return false;
|
||||
}
|
||||
return (response.data as String) == globalState.helperToken;
|
||||
return (response.data as String) == globalState.coreSHA256;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,18 +55,24 @@ class System {
|
||||
}
|
||||
|
||||
Future<AuthorizeCode> authorizeCore() async {
|
||||
if (Platform.isAndroid) {
|
||||
return AuthorizeCode.none;
|
||||
}
|
||||
final corePath = appPath.corePath.replaceAll(' ', '\\\\ ');
|
||||
final isAdmin = await checkIsAdmin();
|
||||
if (isAdmin) {
|
||||
return AuthorizeCode.none;
|
||||
}
|
||||
|
||||
if (Platform.isWindows) {
|
||||
final result = await windows?.registerService();
|
||||
if (result == true) {
|
||||
return AuthorizeCode.success;
|
||||
}
|
||||
return AuthorizeCode.error;
|
||||
} else if (Platform.isMacOS) {
|
||||
}
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
final shell = 'chown root:admin $corePath; chmod +sx $corePath';
|
||||
final arguments = [
|
||||
"-e",
|
||||
|
||||
@@ -260,9 +260,7 @@ class AppController {
|
||||
final patchConfig = _ref.read(patchClashConfigProvider);
|
||||
final appSetting = _ref.read(appSettingProvider);
|
||||
bool enableTun = patchConfig.tun.enable;
|
||||
if (enableTun != lastTunEnable &&
|
||||
lastTunEnable == false &&
|
||||
!Platform.isAndroid) {
|
||||
if (enableTun != lastTunEnable && lastTunEnable == false) {
|
||||
final code = await system.authorizeCore();
|
||||
switch (code) {
|
||||
case AuthorizeCode.none:
|
||||
@@ -487,7 +485,7 @@ class AppController {
|
||||
Future<void> _initCore() async {
|
||||
final isInit = await clashCore.isInit;
|
||||
if (!isInit) {
|
||||
await clashCore.init();
|
||||
await clashCore.init();
|
||||
await clashCore.setState(
|
||||
globalState.getCoreState(),
|
||||
);
|
||||
@@ -940,14 +938,18 @@ class AppController {
|
||||
}
|
||||
|
||||
_recovery(Config config, RecoveryOption recoveryOption) {
|
||||
final recoveryStrategy = _ref.read(appSettingProvider.select(
|
||||
(state) => state.recoveryStrategy,
|
||||
));
|
||||
final profiles = config.profiles;
|
||||
final oldProfiles = List.from(globalState.config.profiles);
|
||||
_ref.read(profilesProvider.notifier).value = profiles;
|
||||
for (final profile in oldProfiles) {
|
||||
_ref.read(profilesProvider.notifier).setProfile(
|
||||
profile,
|
||||
force: false,
|
||||
);
|
||||
if (recoveryStrategy == RecoveryStrategy.override) {
|
||||
_ref.read(profilesProvider.notifier).value = profiles;
|
||||
} else {
|
||||
for (final profile in profiles) {
|
||||
_ref.read(profilesProvider.notifier).setProfile(
|
||||
profile,
|
||||
);
|
||||
}
|
||||
}
|
||||
final onlyProfiles = recoveryOption == RecoveryOption.onlyProfiles;
|
||||
if (!onlyProfiles) {
|
||||
|
||||
@@ -471,3 +471,9 @@ enum RuleTarget {
|
||||
DIRECT,
|
||||
REJECT,
|
||||
}
|
||||
|
||||
|
||||
enum RecoveryStrategy {
|
||||
compatible,
|
||||
override,
|
||||
}
|
||||
|
||||
@@ -47,6 +47,14 @@ class AboutFragment extends StatelessWidget {
|
||||
_checkUpdate(context);
|
||||
},
|
||||
),
|
||||
ListItem(
|
||||
title: Text(appLocalizations.contactMe),
|
||||
onTap: () {
|
||||
globalState.showMessage(
|
||||
message: TextSpan(text: "chen08209@gmail.com"),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListItem(
|
||||
title: const Text("Telegram"),
|
||||
onTap: () {
|
||||
|
||||
@@ -8,10 +8,12 @@ import 'package:fl_clash/providers/config.dart';
|
||||
import 'package:fl_clash/state.dart';
|
||||
import 'package:fl_clash/widgets/dialog.dart';
|
||||
import 'package:fl_clash/widgets/fade_box.dart';
|
||||
import 'package:fl_clash/widgets/input.dart';
|
||||
import 'package:fl_clash/widgets/list.dart';
|
||||
import 'package:fl_clash/widgets/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class BackupAndRecovery extends ConsumerWidget {
|
||||
const BackupAndRecovery({super.key});
|
||||
@@ -134,6 +136,30 @@ class BackupAndRecovery extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_handleUpdateRecoveryStrategy(WidgetRef ref) async {
|
||||
final recoveryStrategy = ref.read(appSettingProvider.select(
|
||||
(state) => state.recoveryStrategy,
|
||||
));
|
||||
final res = await globalState.showCommonDialog(
|
||||
child: OptionsDialog<RecoveryStrategy>(
|
||||
title: appLocalizations.recoveryStrategy,
|
||||
options: RecoveryStrategy.values,
|
||||
textBuilder: (mode) => Intl.message(
|
||||
"recoveryStrategy_${mode.name}",
|
||||
),
|
||||
value: recoveryStrategy,
|
||||
),
|
||||
);
|
||||
if (res == null) {
|
||||
return;
|
||||
}
|
||||
ref.read(appSettingProvider.notifier).updateState(
|
||||
(state) => state.copyWith(
|
||||
recoveryStrategy: res,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, ref) {
|
||||
final dav = ref.watch(appDAVSettingProvider);
|
||||
@@ -256,6 +282,26 @@ class BackupAndRecovery extends ConsumerWidget {
|
||||
title: Text(appLocalizations.recovery),
|
||||
subtitle: Text(appLocalizations.localRecoveryDesc),
|
||||
),
|
||||
ListHeader(title: appLocalizations.options),
|
||||
Consumer(builder: (_, ref, __) {
|
||||
final recoveryStrategy = ref.watch(appSettingProvider.select(
|
||||
(state) => state.recoveryStrategy,
|
||||
));
|
||||
return ListItem(
|
||||
onTap: () {
|
||||
_handleUpdateRecoveryStrategy(ref);
|
||||
},
|
||||
title: Text(appLocalizations.recoveryStrategy),
|
||||
trailing: FilledButton(
|
||||
onPressed: () {
|
||||
_handleUpdateRecoveryStrategy(ref);
|
||||
},
|
||||
child: Text(
|
||||
Intl.message("recoveryStrategy_${recoveryStrategy.name}"),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +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/providers/providers.dart';
|
||||
import 'package:fl_clash/state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:fl_clash/clash/core.dart';
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:fl_clash/enum/enum.dart';
|
||||
import 'package:fl_clash/models/common.dart';
|
||||
import 'package:fl_clash/providers/config.dart';
|
||||
import 'package:fl_clash/state.dart';
|
||||
import 'package:fl_clash/widgets/widgets.dart';
|
||||
@@ -15,7 +16,6 @@ class DeveloperView extends ConsumerWidget {
|
||||
title: appLocalizations.options,
|
||||
items: [
|
||||
ListItem(
|
||||
leading: Icon(Icons.ac_unit),
|
||||
title: Text(appLocalizations.messageTest),
|
||||
onTap: () {
|
||||
context.showNotifier(
|
||||
@@ -24,14 +24,27 @@ class DeveloperView extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
ListItem(
|
||||
leading: Icon(Icons.heart_broken),
|
||||
title: Text(appLocalizations.logsTest),
|
||||
onTap: () {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
globalState.appController.addLog(
|
||||
Log.app(
|
||||
utils.generateRandomString(
|
||||
maxLength: 1000,
|
||||
minLength: 20,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListItem(
|
||||
title: Text(appLocalizations.crashTest),
|
||||
onTap: () {
|
||||
clashCore.clashInterface.crash();
|
||||
},
|
||||
),
|
||||
ListItem(
|
||||
leading: Icon(Icons.delete_forever),
|
||||
title: Text(appLocalizations.clearData),
|
||||
onTap: () async {
|
||||
await globalState.appController.handleClear();
|
||||
|
||||
@@ -29,7 +29,9 @@ class _LogsFragmentState extends ConsumerState<LogsFragment> with PageMixin {
|
||||
super.initState();
|
||||
final preOffset = globalState.cacheScrollPosition[_cacheKey] ?? -1;
|
||||
_scrollController = ScrollController(
|
||||
initialScrollOffset: preOffset > 0 ? preOffset : double.maxFinite,
|
||||
initialScrollOffset: preOffset > 0
|
||||
? preOffset
|
||||
: double.maxFinite,
|
||||
);
|
||||
_logsStateNotifier.value = _logsStateNotifier.value.copyWith(
|
||||
logs: globalState.appState.logs.list,
|
||||
|
||||
@@ -164,6 +164,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"View current connections data",
|
||||
),
|
||||
"connectivity": MessageLookupByLibrary.simpleMessage("Connectivity:"),
|
||||
"contactMe": MessageLookupByLibrary.simpleMessage("Contact me"),
|
||||
"content": MessageLookupByLibrary.simpleMessage("Content"),
|
||||
"contentEmptyTip": MessageLookupByLibrary.simpleMessage(
|
||||
"Content cannot be empty",
|
||||
@@ -363,6 +364,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
),
|
||||
"logs": MessageLookupByLibrary.simpleMessage("Logs"),
|
||||
"logsDesc": MessageLookupByLibrary.simpleMessage("Log capture records"),
|
||||
"logsTest": MessageLookupByLibrary.simpleMessage("Logs test"),
|
||||
"loopback": MessageLookupByLibrary.simpleMessage("Loopback unlock tool"),
|
||||
"loopbackDesc": MessageLookupByLibrary.simpleMessage(
|
||||
"Used for UWP loopback unlocking",
|
||||
@@ -410,7 +412,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"noInfo": MessageLookupByLibrary.simpleMessage("No info"),
|
||||
"noMoreInfoDesc": MessageLookupByLibrary.simpleMessage("No more info"),
|
||||
"noNetwork": MessageLookupByLibrary.simpleMessage("No network"),
|
||||
"noNetworkApp": MessageLookupByLibrary.simpleMessage("No network App"),
|
||||
"noNetworkApp": MessageLookupByLibrary.simpleMessage("No network APP"),
|
||||
"noProxy": MessageLookupByLibrary.simpleMessage("No proxy"),
|
||||
"noProxyDesc": MessageLookupByLibrary.simpleMessage(
|
||||
"Please create a profile or add a valid profile",
|
||||
@@ -538,6 +540,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"recoveryProfiles": MessageLookupByLibrary.simpleMessage(
|
||||
"Only recovery profiles",
|
||||
),
|
||||
"recoveryStrategy": MessageLookupByLibrary.simpleMessage(
|
||||
"Recovery strategy",
|
||||
),
|
||||
"recoveryStrategy_compatible": MessageLookupByLibrary.simpleMessage(
|
||||
"Compatible",
|
||||
),
|
||||
"recoveryStrategy_override": MessageLookupByLibrary.simpleMessage(
|
||||
"Override",
|
||||
),
|
||||
"recoverySuccess": MessageLookupByLibrary.simpleMessage("Recovery success"),
|
||||
"redo": MessageLookupByLibrary.simpleMessage("redo"),
|
||||
"regExp": MessageLookupByLibrary.simpleMessage("RegExp"),
|
||||
|
||||
@@ -118,6 +118,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"connections": MessageLookupByLibrary.simpleMessage("接続"),
|
||||
"connectionsDesc": MessageLookupByLibrary.simpleMessage("現在の接続データを表示"),
|
||||
"connectivity": MessageLookupByLibrary.simpleMessage("接続性:"),
|
||||
"contactMe": MessageLookupByLibrary.simpleMessage("連絡する"),
|
||||
"content": MessageLookupByLibrary.simpleMessage("内容"),
|
||||
"contentEmptyTip": MessageLookupByLibrary.simpleMessage("内容は必須です"),
|
||||
"contentScheme": MessageLookupByLibrary.simpleMessage("コンテンツテーマ"),
|
||||
@@ -261,6 +262,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"logcatDesc": MessageLookupByLibrary.simpleMessage("無効化するとログエントリを非表示"),
|
||||
"logs": MessageLookupByLibrary.simpleMessage("ログ"),
|
||||
"logsDesc": MessageLookupByLibrary.simpleMessage("ログキャプチャ記録"),
|
||||
"logsTest": MessageLookupByLibrary.simpleMessage("ログテスト"),
|
||||
"loopback": MessageLookupByLibrary.simpleMessage("ループバック解除ツール"),
|
||||
"loopbackDesc": MessageLookupByLibrary.simpleMessage("UWPループバック解除用"),
|
||||
"loose": MessageLookupByLibrary.simpleMessage("疎"),
|
||||
@@ -394,6 +396,11 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"recovery": MessageLookupByLibrary.simpleMessage("復元"),
|
||||
"recoveryAll": MessageLookupByLibrary.simpleMessage("全データ復元"),
|
||||
"recoveryProfiles": MessageLookupByLibrary.simpleMessage("プロファイルのみ復元"),
|
||||
"recoveryStrategy": MessageLookupByLibrary.simpleMessage("リカバリー戦略"),
|
||||
"recoveryStrategy_compatible": MessageLookupByLibrary.simpleMessage("互換性"),
|
||||
"recoveryStrategy_override": MessageLookupByLibrary.simpleMessage(
|
||||
"オーバーライド",
|
||||
),
|
||||
"recoverySuccess": MessageLookupByLibrary.simpleMessage("復元成功"),
|
||||
"redo": MessageLookupByLibrary.simpleMessage("やり直す"),
|
||||
"regExp": MessageLookupByLibrary.simpleMessage("正規表現"),
|
||||
|
||||
@@ -170,6 +170,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"Просмотр текущих данных о соединениях",
|
||||
),
|
||||
"connectivity": MessageLookupByLibrary.simpleMessage("Связь:"),
|
||||
"contactMe": MessageLookupByLibrary.simpleMessage("Свяжитесь со мной"),
|
||||
"content": MessageLookupByLibrary.simpleMessage("Содержание"),
|
||||
"contentEmptyTip": MessageLookupByLibrary.simpleMessage(
|
||||
"Содержание не может быть пустым",
|
||||
@@ -385,6 +386,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
),
|
||||
"logs": MessageLookupByLibrary.simpleMessage("Логи"),
|
||||
"logsDesc": MessageLookupByLibrary.simpleMessage("Записи захвата логов"),
|
||||
"logsTest": MessageLookupByLibrary.simpleMessage("Тест журналов"),
|
||||
"loopback": MessageLookupByLibrary.simpleMessage(
|
||||
"Инструмент разблокировки Loopback",
|
||||
),
|
||||
@@ -572,6 +574,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"recoveryProfiles": MessageLookupByLibrary.simpleMessage(
|
||||
"Только восстановление профилей",
|
||||
),
|
||||
"recoveryStrategy": MessageLookupByLibrary.simpleMessage(
|
||||
"Стратегия восстановления",
|
||||
),
|
||||
"recoveryStrategy_compatible": MessageLookupByLibrary.simpleMessage(
|
||||
"Совместимый",
|
||||
),
|
||||
"recoveryStrategy_override": MessageLookupByLibrary.simpleMessage(
|
||||
"Переопределение",
|
||||
),
|
||||
"recoverySuccess": MessageLookupByLibrary.simpleMessage(
|
||||
"Восстановление успешно",
|
||||
),
|
||||
|
||||
@@ -108,6 +108,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"connections": MessageLookupByLibrary.simpleMessage("连接"),
|
||||
"connectionsDesc": MessageLookupByLibrary.simpleMessage("查看当前连接数据"),
|
||||
"connectivity": MessageLookupByLibrary.simpleMessage("连通性:"),
|
||||
"contactMe": MessageLookupByLibrary.simpleMessage("联系我"),
|
||||
"content": MessageLookupByLibrary.simpleMessage("内容"),
|
||||
"contentEmptyTip": MessageLookupByLibrary.simpleMessage("内容不能为空"),
|
||||
"contentScheme": MessageLookupByLibrary.simpleMessage("内容主题"),
|
||||
@@ -233,6 +234,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"logcatDesc": MessageLookupByLibrary.simpleMessage("禁用将会隐藏日志入口"),
|
||||
"logs": MessageLookupByLibrary.simpleMessage("日志"),
|
||||
"logsDesc": MessageLookupByLibrary.simpleMessage("日志捕获记录"),
|
||||
"logsTest": MessageLookupByLibrary.simpleMessage("日志测试"),
|
||||
"loopback": MessageLookupByLibrary.simpleMessage("回环解锁工具"),
|
||||
"loopbackDesc": MessageLookupByLibrary.simpleMessage("用于UWP回环解锁"),
|
||||
"loose": MessageLookupByLibrary.simpleMessage("宽松"),
|
||||
@@ -346,6 +348,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"recovery": MessageLookupByLibrary.simpleMessage("恢复"),
|
||||
"recoveryAll": MessageLookupByLibrary.simpleMessage("恢复所有数据"),
|
||||
"recoveryProfiles": MessageLookupByLibrary.simpleMessage("仅恢复配置文件"),
|
||||
"recoveryStrategy": MessageLookupByLibrary.simpleMessage("恢复策略"),
|
||||
"recoveryStrategy_compatible": MessageLookupByLibrary.simpleMessage("兼容"),
|
||||
"recoveryStrategy_override": MessageLookupByLibrary.simpleMessage("覆盖"),
|
||||
"recoverySuccess": MessageLookupByLibrary.simpleMessage("恢复成功"),
|
||||
"redo": MessageLookupByLibrary.simpleMessage("重做"),
|
||||
"regExp": MessageLookupByLibrary.simpleMessage("正则"),
|
||||
|
||||
@@ -3070,15 +3070,55 @@ class AppLocalizations {
|
||||
return Intl.message('System APP', name: 'systemApp', desc: '', args: []);
|
||||
}
|
||||
|
||||
/// `No network App`
|
||||
/// `No network APP`
|
||||
String get noNetworkApp {
|
||||
return Intl.message(
|
||||
'No network App',
|
||||
'No network APP',
|
||||
name: 'noNetworkApp',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Contact me`
|
||||
String get contactMe {
|
||||
return Intl.message('Contact me', name: 'contactMe', desc: '', args: []);
|
||||
}
|
||||
|
||||
/// `Recovery strategy`
|
||||
String get recoveryStrategy {
|
||||
return Intl.message(
|
||||
'Recovery strategy',
|
||||
name: 'recoveryStrategy',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Override`
|
||||
String get recoveryStrategy_override {
|
||||
return Intl.message(
|
||||
'Override',
|
||||
name: 'recoveryStrategy_override',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Compatible`
|
||||
String get recoveryStrategy_compatible {
|
||||
return Intl.message(
|
||||
'Compatible',
|
||||
name: 'recoveryStrategy_compatible',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Logs test`
|
||||
String get logsTest {
|
||||
return Intl.message('Logs test', name: 'logsTest', desc: '', args: []);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||
|
||||
@@ -27,7 +27,7 @@ Future<void> main() async {
|
||||
await android?.init();
|
||||
await window?.init(version);
|
||||
globalState.isPre = const String.fromEnvironment("APP_ENV") != 'stable';
|
||||
globalState.helperToken = const String.fromEnvironment("HELPER_TOKEN");
|
||||
globalState.coreSHA256 = const String.fromEnvironment("CORE_SHA256");
|
||||
HttpOverrides.global = FlClashHttpOverrides();
|
||||
runApp(ProviderScope(
|
||||
child: const Application(),
|
||||
|
||||
@@ -85,6 +85,7 @@ class AppSettingProps with _$AppSettingProps {
|
||||
@Default(true) bool minimizeOnExit,
|
||||
@Default(false) bool hidden,
|
||||
@Default(false) bool developerMode,
|
||||
@Default(RecoveryStrategy.compatible) RecoveryStrategy recoveryStrategy,
|
||||
}) = _AppSettingProps;
|
||||
|
||||
factory AppSettingProps.fromJson(Map<String, Object?> json) =>
|
||||
|
||||
@@ -38,6 +38,7 @@ mixin _$AppSettingProps {
|
||||
bool get minimizeOnExit => throw _privateConstructorUsedError;
|
||||
bool get hidden => throw _privateConstructorUsedError;
|
||||
bool get developerMode => throw _privateConstructorUsedError;
|
||||
RecoveryStrategy get recoveryStrategy => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this AppSettingProps to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@@ -72,7 +73,8 @@ abstract class $AppSettingPropsCopyWith<$Res> {
|
||||
bool disclaimerAccepted,
|
||||
bool minimizeOnExit,
|
||||
bool hidden,
|
||||
bool developerMode});
|
||||
bool developerMode,
|
||||
RecoveryStrategy recoveryStrategy});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -106,6 +108,7 @@ class _$AppSettingPropsCopyWithImpl<$Res, $Val extends AppSettingProps>
|
||||
Object? minimizeOnExit = null,
|
||||
Object? hidden = null,
|
||||
Object? developerMode = null,
|
||||
Object? recoveryStrategy = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
locale: freezed == locale
|
||||
@@ -172,6 +175,10 @@ class _$AppSettingPropsCopyWithImpl<$Res, $Val extends AppSettingProps>
|
||||
? _value.developerMode
|
||||
: developerMode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
recoveryStrategy: null == recoveryStrategy
|
||||
? _value.recoveryStrategy
|
||||
: recoveryStrategy // ignore: cast_nullable_to_non_nullable
|
||||
as RecoveryStrategy,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +208,8 @@ abstract class _$$AppSettingPropsImplCopyWith<$Res>
|
||||
bool disclaimerAccepted,
|
||||
bool minimizeOnExit,
|
||||
bool hidden,
|
||||
bool developerMode});
|
||||
bool developerMode,
|
||||
RecoveryStrategy recoveryStrategy});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -233,6 +241,7 @@ class __$$AppSettingPropsImplCopyWithImpl<$Res>
|
||||
Object? minimizeOnExit = null,
|
||||
Object? hidden = null,
|
||||
Object? developerMode = null,
|
||||
Object? recoveryStrategy = null,
|
||||
}) {
|
||||
return _then(_$AppSettingPropsImpl(
|
||||
locale: freezed == locale
|
||||
@@ -299,6 +308,10 @@ class __$$AppSettingPropsImplCopyWithImpl<$Res>
|
||||
? _value.developerMode
|
||||
: developerMode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
recoveryStrategy: null == recoveryStrategy
|
||||
? _value.recoveryStrategy
|
||||
: recoveryStrategy // ignore: cast_nullable_to_non_nullable
|
||||
as RecoveryStrategy,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -323,7 +336,8 @@ class _$AppSettingPropsImpl implements _AppSettingProps {
|
||||
this.disclaimerAccepted = false,
|
||||
this.minimizeOnExit = true,
|
||||
this.hidden = false,
|
||||
this.developerMode = false})
|
||||
this.developerMode = false,
|
||||
this.recoveryStrategy = RecoveryStrategy.compatible})
|
||||
: _dashboardWidgets = dashboardWidgets;
|
||||
|
||||
factory _$AppSettingPropsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -383,10 +397,13 @@ class _$AppSettingPropsImpl implements _AppSettingProps {
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool developerMode;
|
||||
@override
|
||||
@JsonKey()
|
||||
final RecoveryStrategy recoveryStrategy;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AppSettingProps(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyStatisticsProxy: $onlyStatisticsProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, minimizeOnExit: $minimizeOnExit, hidden: $hidden, developerMode: $developerMode)';
|
||||
return 'AppSettingProps(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyStatisticsProxy: $onlyStatisticsProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, minimizeOnExit: $minimizeOnExit, hidden: $hidden, developerMode: $developerMode, recoveryStrategy: $recoveryStrategy)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -421,7 +438,9 @@ class _$AppSettingPropsImpl implements _AppSettingProps {
|
||||
other.minimizeOnExit == minimizeOnExit) &&
|
||||
(identical(other.hidden, hidden) || other.hidden == hidden) &&
|
||||
(identical(other.developerMode, developerMode) ||
|
||||
other.developerMode == developerMode));
|
||||
other.developerMode == developerMode) &&
|
||||
(identical(other.recoveryStrategy, recoveryStrategy) ||
|
||||
other.recoveryStrategy == recoveryStrategy));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -443,7 +462,8 @@ class _$AppSettingPropsImpl implements _AppSettingProps {
|
||||
disclaimerAccepted,
|
||||
minimizeOnExit,
|
||||
hidden,
|
||||
developerMode);
|
||||
developerMode,
|
||||
recoveryStrategy);
|
||||
|
||||
/// Create a copy of AppSettingProps
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -480,7 +500,8 @@ abstract class _AppSettingProps implements AppSettingProps {
|
||||
final bool disclaimerAccepted,
|
||||
final bool minimizeOnExit,
|
||||
final bool hidden,
|
||||
final bool developerMode}) = _$AppSettingPropsImpl;
|
||||
final bool developerMode,
|
||||
final RecoveryStrategy recoveryStrategy}) = _$AppSettingPropsImpl;
|
||||
|
||||
factory _AppSettingProps.fromJson(Map<String, dynamic> json) =
|
||||
_$AppSettingPropsImpl.fromJson;
|
||||
@@ -518,6 +539,8 @@ abstract class _AppSettingProps implements AppSettingProps {
|
||||
bool get hidden;
|
||||
@override
|
||||
bool get developerMode;
|
||||
@override
|
||||
RecoveryStrategy get recoveryStrategy;
|
||||
|
||||
/// Create a copy of AppSettingProps
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@@ -27,6 +27,9 @@ _$AppSettingPropsImpl _$$AppSettingPropsImplFromJson(
|
||||
minimizeOnExit: json['minimizeOnExit'] as bool? ?? true,
|
||||
hidden: json['hidden'] as bool? ?? false,
|
||||
developerMode: json['developerMode'] as bool? ?? false,
|
||||
recoveryStrategy: $enumDecodeNullable(
|
||||
_$RecoveryStrategyEnumMap, json['recoveryStrategy']) ??
|
||||
RecoveryStrategy.compatible,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AppSettingPropsImplToJson(
|
||||
@@ -50,8 +53,14 @@ Map<String, dynamic> _$$AppSettingPropsImplToJson(
|
||||
'minimizeOnExit': instance.minimizeOnExit,
|
||||
'hidden': instance.hidden,
|
||||
'developerMode': instance.developerMode,
|
||||
'recoveryStrategy': _$RecoveryStrategyEnumMap[instance.recoveryStrategy]!,
|
||||
};
|
||||
|
||||
const _$RecoveryStrategyEnumMap = {
|
||||
RecoveryStrategy.compatible: 'compatible',
|
||||
RecoveryStrategy.override: 'override',
|
||||
};
|
||||
|
||||
const _$DashboardWidgetEnumMap = {
|
||||
DashboardWidget.networkSpeed: 'networkSpeed',
|
||||
DashboardWidget.outboundModeV2: 'outboundModeV2',
|
||||
|
||||
@@ -126,7 +126,7 @@ class Profiles extends _$Profiles with AutoDisposeNotifierMixin {
|
||||
}
|
||||
}
|
||||
|
||||
setProfile(Profile profile, {bool force = true}) {
|
||||
setProfile(Profile profile) {
|
||||
final List<Profile> profilesTemp = List.from(state);
|
||||
final index =
|
||||
profilesTemp.indexWhere((element) => element.id == profile.id);
|
||||
@@ -135,7 +135,7 @@ class Profiles extends _$Profiles with AutoDisposeNotifierMixin {
|
||||
);
|
||||
if (index == -1) {
|
||||
profilesTemp.add(updateProfile);
|
||||
} else if (force == true) {
|
||||
} else {
|
||||
profilesTemp[index] = updateProfile;
|
||||
}
|
||||
state = profilesTemp;
|
||||
|
||||
@@ -83,7 +83,7 @@ final themeSettingProvider =
|
||||
);
|
||||
|
||||
typedef _$ThemeSetting = AutoDisposeNotifier<ThemeProps>;
|
||||
String _$profilesHash() => r'c416fda0f8deded24a715a8234efa0bcd0445449';
|
||||
String _$profilesHash() => r'a6514c89064e4f42fc31fe7d525088fd26c51016';
|
||||
|
||||
/// See also [Profiles].
|
||||
@ProviderFor(Profiles)
|
||||
|
||||
@@ -30,7 +30,7 @@ class GlobalState {
|
||||
late Config config;
|
||||
late AppState appState;
|
||||
bool isPre = true;
|
||||
String? helperToken;
|
||||
String? coreSHA256;
|
||||
late PackageInfo packageInfo;
|
||||
Function? updateCurrentDelayDebounce;
|
||||
late Measure measure;
|
||||
@@ -56,8 +56,8 @@ class GlobalState {
|
||||
appState = AppState(
|
||||
version: version,
|
||||
viewSize: Size.zero,
|
||||
requests: FixedList(1000),
|
||||
logs: FixedList(1000),
|
||||
requests: FixedList(500),
|
||||
logs: FixedList(500),
|
||||
traffics: FixedList(30),
|
||||
totalTraffic: Traffic(),
|
||||
);
|
||||
|
||||
@@ -257,6 +257,7 @@ class ListItem<T> extends StatelessWidget {
|
||||
leading: leading ?? this.leading,
|
||||
horizontalTitleGap: horizontalTitleGap,
|
||||
title: title,
|
||||
minTileHeight: 52,
|
||||
subtitle: subtitle,
|
||||
titleAlignment: tileTitleAlignment,
|
||||
onTap: onTap,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:fl_clash/common/list.dart';
|
||||
import 'package:fl_clash/state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -85,12 +84,6 @@ class _ScrollToEndBoxState<T> extends State<ScrollToEndBox<T>> {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
globalState.cacheScrollPosition[widget.cacheKey] = -1;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(ScrollToEndBox<T> oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
@@ -10,7 +10,6 @@ keywords:
|
||||
|
||||
generic_name: FlClash
|
||||
|
||||
|
||||
categories:
|
||||
- Network
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ installed_size: 6604
|
||||
essential: false
|
||||
icon: ./assets/images/icon.png
|
||||
|
||||
dependencies:
|
||||
- libayatana-appindicator3-dev
|
||||
- libkeybinder-3.0-dev
|
||||
|
||||
keywords:
|
||||
- FlClash
|
||||
|
||||
Submodule plugins/flutter_distributor updated: c5c06ee67d...9daab581b0
@@ -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.83+202504254
|
||||
version: 0.8.83+202504281
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
|
||||
|
||||
34
setup.dart
34
setup.dart
@@ -196,10 +196,10 @@ class Build {
|
||||
if (exitCode != 0 && name != null) throw "$name error";
|
||||
}
|
||||
|
||||
static Future<String?> calcSha256(String filePath) async {
|
||||
static Future<String> calcSha256(String filePath) async {
|
||||
final file = File(filePath);
|
||||
if (!await file.exists()) {
|
||||
return null;
|
||||
throw "File not exists";
|
||||
}
|
||||
final stream = file.openRead();
|
||||
return sha256.convert(await stream.reduce((a, b) => a + b)).toString();
|
||||
@@ -422,7 +422,8 @@ class BuildCommand extends Command {
|
||||
await Build.exec(
|
||||
Build.getExecutable("sudo apt install -y libfuse2"),
|
||||
);
|
||||
final downloadName = arch == Arch.amd64 ? "x86_64" : "aarch_64";
|
||||
|
||||
final downloadName = arch == Arch.amd64 ? "x86_64" : "aarch64";
|
||||
await Build.exec(
|
||||
Build.getExecutable(
|
||||
"wget -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$downloadName.AppImage",
|
||||
@@ -433,12 +434,12 @@ class BuildCommand extends Command {
|
||||
"chmod +x appimagetool",
|
||||
),
|
||||
);
|
||||
await Build.exec(
|
||||
Build.getExecutable(
|
||||
"sudo mv appimagetool /usr/local/bin/",
|
||||
),
|
||||
);
|
||||
}
|
||||
await Build.exec(
|
||||
Build.getExecutable(
|
||||
"sudo mv appimagetool /usr/local/bin/",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_getMacosDependencies() async {
|
||||
@@ -498,16 +499,15 @@ class BuildCommand extends Command {
|
||||
|
||||
switch (target) {
|
||||
case Target.windows:
|
||||
final token = await Build.calcSha256(corePaths.first);
|
||||
if (token == null) {
|
||||
throw "Core not exists";
|
||||
}
|
||||
Build.buildHelper(target, token);
|
||||
final token = target != Target.android
|
||||
? await Build.calcSha256(corePaths.first)
|
||||
: null;
|
||||
Build.buildHelper(target, token!);
|
||||
_buildDistributor(
|
||||
target: target,
|
||||
targets: "exe,zip",
|
||||
args:
|
||||
" --description $archName --build-dart-define=HELPER_TOKEN=$token",
|
||||
" --description $archName --build-dart-define=CORE_SHA256=$token",
|
||||
env: env,
|
||||
);
|
||||
return;
|
||||
@@ -518,10 +518,8 @@ class BuildCommand extends Command {
|
||||
};
|
||||
final targets = [
|
||||
"deb",
|
||||
if (arch == Arch.amd64) ...[
|
||||
"appimage",
|
||||
"rpm",
|
||||
],
|
||||
if (arch == Arch.amd64) "appimage",
|
||||
if (arch == Arch.amd64) "rpm",
|
||||
].join(",");
|
||||
final defaultTarget = targetMap[arch];
|
||||
await _getLinuxDependencies(arch!);
|
||||
|
||||
Reference in New Issue
Block a user