Compare commits
9 Commits
v0.8.17-de
...
v0.8.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a2ad63f38 | ||
|
|
2ec12c9363 | ||
|
|
a3c2dc786c | ||
|
|
7acf9c6db3 | ||
|
|
8074547fb4 | ||
|
|
8a01e04871 | ||
|
|
7ddcdd9828 | ||
|
|
d89ed076fd | ||
|
|
f4c3b06cd5 |
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
@@ -3,7 +3,7 @@ name: build
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -17,10 +17,16 @@ jobs:
|
||||
os: windows-latest
|
||||
- platform: linux
|
||||
os: ubuntu-latest
|
||||
# - platform: macos
|
||||
# os: macos-13
|
||||
- platform: macos
|
||||
os: macos-13
|
||||
|
||||
steps:
|
||||
- name: Check Matrix
|
||||
run: |
|
||||
echo "Running on ${{ matrix.os }}"
|
||||
echo "Arch: ${{ runner.arch }}"
|
||||
gcc --version
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -82,7 +88,7 @@ jobs:
|
||||
|
||||
|
||||
upload-release:
|
||||
if: ${{ !endsWith(github.ref, '-debug') }}
|
||||
if: ${{ !contains(github.ref, '+') }}
|
||||
permissions: write-all
|
||||
needs: [ build ]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -5,4 +5,4 @@
|
||||
[submodule "plugins/flutter_distributor"]
|
||||
path = plugins/flutter_distributor
|
||||
url = git@github.com:chen08209/flutter_distributor.git
|
||||
branch = main
|
||||
branch = FlClash
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<application
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:extractNativeLibs="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:label="FlClash">
|
||||
<activity
|
||||
|
||||
@@ -10,3 +10,8 @@ data class AccessControl(
|
||||
val acceptList: List<String>,
|
||||
val rejectList: List<String>,
|
||||
)
|
||||
|
||||
data class Props (
|
||||
val accessControl: AccessControl?,
|
||||
val allowBypass: Boolean?,
|
||||
)
|
||||
@@ -17,6 +17,7 @@ import androidx.core.content.ContextCompat
|
||||
import com.follow.clash.GlobalState
|
||||
import com.follow.clash.RunState
|
||||
import com.follow.clash.models.AccessControl
|
||||
import com.follow.clash.models.Props
|
||||
import com.follow.clash.services.FlClashVpnService
|
||||
import com.google.gson.Gson
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
@@ -41,7 +42,7 @@ class ProxyPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAwar
|
||||
private var flClashVpnService: FlClashVpnService? = null
|
||||
private var isBound = false
|
||||
private var port: Int? = null
|
||||
private var accessControl: AccessControl? = null
|
||||
private var props: Props? = null
|
||||
private lateinit var title: String
|
||||
private lateinit var content: String
|
||||
|
||||
@@ -73,8 +74,8 @@ class ProxyPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAwar
|
||||
"StartProxy" -> {
|
||||
port = call.argument<Int>("port")
|
||||
val args = call.argument<String>("args")
|
||||
accessControl =
|
||||
if (args != null) Gson().fromJson(args, AccessControl::class.java) else null
|
||||
props =
|
||||
if (args != null) Gson().fromJson(args, Props::class.java) else null
|
||||
handleStartVpn()
|
||||
result.success(true)
|
||||
}
|
||||
@@ -121,7 +122,7 @@ class ProxyPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAwar
|
||||
|
||||
private fun startVpn(port: Int) {
|
||||
if (GlobalState.runState.value == RunState.START) return;
|
||||
flClashVpnService?.start(port, accessControl)
|
||||
flClashVpnService?.start(port, props)
|
||||
GlobalState.runState.value = RunState.START
|
||||
GlobalState.runTime = Date()
|
||||
startAfter()
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.follow.clash.MainActivity
|
||||
import com.follow.clash.R
|
||||
import com.follow.clash.models.AccessControl
|
||||
import com.follow.clash.models.AccessControlMode
|
||||
import com.follow.clash.models.Props
|
||||
|
||||
|
||||
class FlClashVpnService : VpnService() {
|
||||
@@ -51,12 +52,12 @@ class FlClashVpnService : VpnService() {
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
fun start(port: Int, accessControl: AccessControl?) {
|
||||
fun start(port: Int, props: Props?) {
|
||||
fd = with(Builder()) {
|
||||
addAddress("172.16.0.1", 30)
|
||||
setMtu(9000)
|
||||
addRoute("0.0.0.0", 0)
|
||||
if (accessControl != null) {
|
||||
props?.accessControl?.let { accessControl ->
|
||||
when (accessControl.mode) {
|
||||
AccessControlMode.acceptSelected -> {
|
||||
(accessControl.acceptList + packageName).forEach {
|
||||
@@ -77,7 +78,9 @@ class FlClashVpnService : VpnService() {
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
setMetered(false)
|
||||
}
|
||||
allowBypass()
|
||||
if (props?.allowBypass == true) {
|
||||
allowBypass()
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
setHttpProxy(
|
||||
ProxyInfo.buildDirectProxy(
|
||||
@@ -144,8 +147,8 @@ class FlClashVpnService : VpnService() {
|
||||
val notification =
|
||||
notificationBuilder.setContentTitle(title).setContentText(content).build()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(notificationId, notification, FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
|
||||
}else{
|
||||
startForeground(notificationId, notification, FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
|
||||
} else {
|
||||
startForeground(notificationId, notification)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,8 +336,8 @@ func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfi
|
||||
targetConfig.Mode = patchConfig.Mode
|
||||
targetConfig.Tun.Enable = patchConfig.Tun.Enable
|
||||
targetConfig.Tun.Device = patchConfig.Tun.Device
|
||||
targetConfig.Tun.DNSHijack = patchConfig.Tun.DNSHijack
|
||||
targetConfig.Tun.Stack = patchConfig.Tun.Stack
|
||||
//targetConfig.Tun.DNSHijack = patchConfig.Tun.DNSHijack
|
||||
//targetConfig.Tun.Stack = patchConfig.Tun.Stack
|
||||
targetConfig.GeodataLoader = "standard"
|
||||
targetConfig.Profile.StoreSelected = false
|
||||
if targetConfig.DNS.Enable == false {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module core
|
||||
|
||||
go 1.20
|
||||
go 1.21.0
|
||||
|
||||
replace github.com/metacubex/mihomo => ./Clash.Meta
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ class Picker {
|
||||
if (Platform.isAndroid) {
|
||||
filePickerResult = await FilePicker.platform.pickFiles(
|
||||
withData: true,
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['txt', 'conf'],
|
||||
allowMultiple: false,
|
||||
);
|
||||
} else {
|
||||
filePickerResult = await FilePicker.platform.pickFiles(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum GroupType { Selector, URLTest, Fallback }
|
||||
enum GroupType { Selector, URLTest, Fallback, LoadBalance, Relay }
|
||||
|
||||
enum GroupName { GLOBAL, Proxy, Auto, Fallback }
|
||||
|
||||
@@ -61,4 +61,4 @@ enum MessageType { log, tun, delay, process, now }
|
||||
enum RecoveryOption {
|
||||
all,
|
||||
onlyProfiles,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,13 @@ import 'package:fl_clash/widgets/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
extension AccessControlExtension on AccessControl {
|
||||
List<String> get currentList => switch (mode) {
|
||||
AccessControlMode.acceptSelected => acceptList,
|
||||
AccessControlMode.rejectSelected => rejectList,
|
||||
};
|
||||
}
|
||||
|
||||
class AccessFragment extends StatefulWidget {
|
||||
const AccessFragment({super.key});
|
||||
|
||||
@@ -83,137 +90,64 @@ class _AccessFragmentState extends State<AccessFragment> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSelectedAllButton({
|
||||
required bool isSelectedAll,
|
||||
required List<String> allValueList,
|
||||
}) {
|
||||
return Builder(
|
||||
builder: (context) {
|
||||
final tooltip = isSelectedAll
|
||||
? appLocalizations.cancelSelectAll
|
||||
: appLocalizations.selectAll;
|
||||
return IconButton(
|
||||
tooltip: tooltip,
|
||||
onPressed: () {
|
||||
final config = globalState.appController.config;
|
||||
final isAccept =
|
||||
config.accessControl.mode == AccessControlMode.acceptSelected;
|
||||
|
||||
if (isSelectedAll) {
|
||||
config.accessControl = switch (isAccept) {
|
||||
true => config.accessControl.copyWith(
|
||||
acceptList: [],
|
||||
),
|
||||
false => config.accessControl.copyWith(
|
||||
rejectList: [],
|
||||
),
|
||||
};
|
||||
} else {
|
||||
config.accessControl = switch (isAccept) {
|
||||
true => config.accessControl.copyWith(
|
||||
acceptList: allValueList,
|
||||
),
|
||||
false => config.accessControl.copyWith(
|
||||
rejectList: allValueList,
|
||||
),
|
||||
};
|
||||
}
|
||||
},
|
||||
icon: isSelectedAll
|
||||
? const Icon(Icons.deselect)
|
||||
: const Icon(Icons.select_all),
|
||||
);
|
||||
Widget _buildSearchButton(List<Package> packages) {
|
||||
return IconButton(
|
||||
tooltip: appLocalizations.search,
|
||||
onPressed: () {
|
||||
showSearch(
|
||||
context: context,
|
||||
delegate: AccessControlSearchDelegate(
|
||||
packages: packages,
|
||||
),
|
||||
).then((_) => {setState(() {})});
|
||||
},
|
||||
icon: const Icon(Icons.search),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _actionHeader({
|
||||
required bool isAccessControl,
|
||||
required List<String> valueList,
|
||||
required String describe,
|
||||
required List<String> packageNameList,
|
||||
}) {
|
||||
return AbsorbPointer(
|
||||
absorbing: !isAccessControl,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4,
|
||||
bottom: 4,
|
||||
left: 16,
|
||||
right: 8,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
appLocalizations.selected,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge
|
||||
?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Flexible(
|
||||
child: SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
"${valueList.length}",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge
|
||||
?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(describe),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Flexible(
|
||||
child: _buildSelectedAllButton(
|
||||
isSelectedAll: const ListEquality<String>()
|
||||
.equals(valueList, packageNameList),
|
||||
allValueList: packageNameList,
|
||||
),
|
||||
),
|
||||
Flexible(child: _buildFilterSystemAppButton()),
|
||||
Flexible(child: _buildAppProxyModePopup()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
// Widget _buildSelectedAllButton({
|
||||
// required bool isSelectedAll,
|
||||
// required List<String> allValueList,
|
||||
// }) {
|
||||
// return Builder(
|
||||
// builder: (context) {
|
||||
// final tooltip = isSelectedAll
|
||||
// ? appLocalizations.cancelSelectAll
|
||||
// : appLocalizations.selectAll;
|
||||
// return IconButton(
|
||||
// tooltip: tooltip,
|
||||
// onPressed: () {
|
||||
// final config = globalState.appController.config;
|
||||
// final isAccept =
|
||||
// config.accessControl.mode == AccessControlMode.acceptSelected;
|
||||
//
|
||||
// if (isSelectedAll) {
|
||||
// config.accessControl = switch (isAccept) {
|
||||
// true => config.accessControl.copyWith(
|
||||
// acceptList: [],
|
||||
// ),
|
||||
// false => config.accessControl.copyWith(
|
||||
// rejectList: [],
|
||||
// ),
|
||||
// };
|
||||
// } else {
|
||||
// config.accessControl = switch (isAccept) {
|
||||
// true => config.accessControl.copyWith(
|
||||
// acceptList: allValueList,
|
||||
// ),
|
||||
// false => config.accessControl.copyWith(
|
||||
// rejectList: allValueList,
|
||||
// ),
|
||||
// };
|
||||
// }
|
||||
// },
|
||||
// icon: isSelectedAll
|
||||
// ? const Icon(Icons.deselect)
|
||||
// : const Icon(Icons.select_all),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget _buildPackageList() {
|
||||
return ValueListenableBuilder(
|
||||
@@ -252,14 +186,11 @@ class _AccessFragmentState extends State<AccessFragment> {
|
||||
accessControlMode == AccessControlMode.acceptSelected
|
||||
? acceptPackages
|
||||
: rejectPackages;
|
||||
final currentList =
|
||||
accessControlMode == AccessControlMode.acceptSelected
|
||||
? accessControl.acceptList
|
||||
: accessControl.rejectList;
|
||||
final currentList = accessControl.currentList;
|
||||
final currentPackages = isFilterSystemApp
|
||||
? packages
|
||||
.where((element) => element.isSystem == false)
|
||||
.toList()
|
||||
.where((element) => element.isSystem == false)
|
||||
.toList()
|
||||
: packages;
|
||||
final packageNameList =
|
||||
currentPackages.map((e) => e.packageName).toList();
|
||||
@@ -272,11 +203,82 @@ class _AccessFragmentState extends State<AccessFragment> {
|
||||
status: !isAccessControl,
|
||||
child: Column(
|
||||
children: [
|
||||
_actionHeader(
|
||||
isAccessControl: isAccessControl,
|
||||
valueList: valueList,
|
||||
describe: describe,
|
||||
packageNameList: packageNameList,
|
||||
AbsorbPointer(
|
||||
absorbing: !isAccessControl,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4,
|
||||
bottom: 4,
|
||||
left: 16,
|
||||
right: 8,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
appLocalizations.selected,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge
|
||||
?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Flexible(
|
||||
child: SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
"${valueList.length}",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge
|
||||
?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(describe),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Flexible(
|
||||
child: _buildSearchButton(currentPackages)),
|
||||
Flexible(child: _buildFilterSystemAppButton()),
|
||||
Flexible(child: _buildAppProxyModePopup()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
@@ -429,3 +431,110 @@ class PackageListItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AccessControlSearchDelegate extends SearchDelegate {
|
||||
final List<Package> packages;
|
||||
|
||||
AccessControlSearchDelegate({
|
||||
required this.packages,
|
||||
});
|
||||
|
||||
List<Package> get _results {
|
||||
final lowQuery = query.toLowerCase();
|
||||
return packages
|
||||
.where(
|
||||
(package) =>
|
||||
package.label.toLowerCase().contains(lowQuery) ||
|
||||
package.packageName.contains(lowQuery),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Widget>? buildActions(BuildContext context) {
|
||||
return [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (query.isEmpty) {
|
||||
close(context, null);
|
||||
return;
|
||||
}
|
||||
query = '';
|
||||
},
|
||||
icon: const Icon(Icons.clear),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget? buildLeading(BuildContext context) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
close(context, null);
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _packageList(List<Package> packages) {
|
||||
return Selector<Config, PackageListSelectorState>(
|
||||
selector: (_, config) => PackageListSelectorState(
|
||||
accessControl: config.accessControl,
|
||||
isAccessControl: config.isAccessControl,
|
||||
),
|
||||
builder: (context, state, __) {
|
||||
final accessControl = state.accessControl;
|
||||
final isAccessControl = state.isAccessControl;
|
||||
final accessControlMode = accessControl.mode;
|
||||
final currentList = accessControl.currentList;
|
||||
final packageNameList = this.packages.map((e) => e.packageName).toList();
|
||||
final valueList = currentList.intersection(packageNameList);
|
||||
return DisabledMask(
|
||||
status: !isAccessControl,
|
||||
child: ListView.builder(
|
||||
itemCount: packages.length,
|
||||
itemBuilder: (_, index) {
|
||||
final package = packages[index];
|
||||
return PackageListItem(
|
||||
key: Key(package.packageName),
|
||||
package: package,
|
||||
value: valueList.contains(package.packageName),
|
||||
isActive: isAccessControl,
|
||||
onChanged: (value) {
|
||||
if (value == true) {
|
||||
valueList.add(package.packageName);
|
||||
} else {
|
||||
valueList.remove(package.packageName);
|
||||
}
|
||||
final config = globalState.appController.config;
|
||||
if (accessControlMode == AccessControlMode.acceptSelected) {
|
||||
config.accessControl = config.accessControl.copyWith(
|
||||
acceptList: valueList,
|
||||
);
|
||||
} else {
|
||||
config.accessControl = config.accessControl.copyWith(
|
||||
rejectList: valueList,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildResults(BuildContext context) {
|
||||
return buildSuggestions(context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildSuggestions(BuildContext context) {
|
||||
return _packageList(_results);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:fl_clash/enum/enum.dart';
|
||||
import 'package:fl_clash/models/models.dart';
|
||||
@@ -54,7 +56,7 @@ class _ConfigFragmentState extends State<ConfigFragment> {
|
||||
onTab: () {
|
||||
_modifyMixedPort(mixedPort);
|
||||
},
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
leading: const Icon(Icons.adjust),
|
||||
title: Text(appLocalizations.proxyPort),
|
||||
trailing: FilledButton.tonal(
|
||||
@@ -105,6 +107,24 @@ class _ConfigFragmentState extends State<ConfigFragment> {
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
if (Platform.isAndroid)
|
||||
Selector<Config, bool>(
|
||||
selector: (_, config) => config.allowBypass,
|
||||
builder: (_, allowBypass, __) {
|
||||
return ListItem.switchItem(
|
||||
leading: const Icon(Icons.double_arrow),
|
||||
title: Text(appLocalizations.allowBypass),
|
||||
subtitle: Text(appLocalizations.allowBypassDesc),
|
||||
delegate: SwitchDelegate(
|
||||
value: allowBypass,
|
||||
onChanged: (bool value) async {
|
||||
final appController = globalState.appController;
|
||||
appController.config.allowBypass = value;
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Selector<Config, bool>(
|
||||
selector: (_, config) => config.isCompatible,
|
||||
builder: (_, isCompatible, __) {
|
||||
|
||||
@@ -17,9 +17,16 @@ enum ProfileActions {
|
||||
delete,
|
||||
}
|
||||
|
||||
class ProfilesFragment extends StatelessWidget {
|
||||
class ProfilesFragment extends StatefulWidget {
|
||||
const ProfilesFragment({super.key});
|
||||
|
||||
@override
|
||||
State<ProfilesFragment> createState() => _ProfilesFragmentState();
|
||||
}
|
||||
|
||||
class _ProfilesFragmentState extends State<ProfilesFragment> {
|
||||
final hasPadding = ValueNotifier<bool>(false);
|
||||
|
||||
_handleShowAddExtendPage() {
|
||||
showExtendPage(
|
||||
globalState.navigatorKey.currentState!.context,
|
||||
@@ -41,7 +48,7 @@ class ProfilesFragment extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
_initScaffoldState(BuildContext context) {
|
||||
_initScaffoldState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) {
|
||||
final commonScaffoldState =
|
||||
@@ -55,7 +62,7 @@ class ProfilesFragment extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.download),
|
||||
icon: const Icon(Icons.sync),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
@@ -78,7 +85,7 @@ class ProfilesFragment extends StatelessWidget {
|
||||
selector: (_, appState) => appState.currentLabel == 'profiles',
|
||||
builder: (_, isCurrent, child) {
|
||||
if (isCurrent) {
|
||||
_initScaffoldState(context);
|
||||
_initScaffoldState();
|
||||
}
|
||||
return child!;
|
||||
},
|
||||
@@ -98,27 +105,46 @@ class ProfilesFragment extends StatelessWidget {
|
||||
final isMobile = state.viewMode == ViewMode.mobile;
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SingleChildScrollView(
|
||||
padding: !isMobile
|
||||
? const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 16,
|
||||
)
|
||||
: EdgeInsets.zero,
|
||||
child: Grid(
|
||||
mainAxisSpacing: isMobile ? 8 : 16,
|
||||
crossAxisSpacing: 16,
|
||||
crossAxisCount: columns,
|
||||
children: [
|
||||
for (final profile in state.profiles)
|
||||
GridItem(
|
||||
child: ProfileItem(
|
||||
profile: profile,
|
||||
groupValue: state.currentProfileId,
|
||||
onChanged: globalState.appController.changeProfile,
|
||||
),
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (scrollNotification) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
hasPadding.value =
|
||||
scrollNotification.metrics.maxScrollExtent > 0;
|
||||
});
|
||||
return true;
|
||||
},
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: hasPadding,
|
||||
builder: (_, hasPadding, __) {
|
||||
return SingleChildScrollView(
|
||||
padding: !isMobile
|
||||
? EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 16,
|
||||
bottom: 16 + (hasPadding ? 56 : 0),
|
||||
)
|
||||
: EdgeInsets.only(
|
||||
bottom: 0 + (hasPadding ? 56 : 0),
|
||||
),
|
||||
child: Grid(
|
||||
mainAxisSpacing: isMobile ? 8 : 16,
|
||||
crossAxisSpacing: 16,
|
||||
crossAxisCount: columns,
|
||||
children: [
|
||||
for (final profile in state.profiles)
|
||||
GridItem(
|
||||
child: ProfileItem(
|
||||
profile: profile,
|
||||
groupValue: state.currentProfileId,
|
||||
onChanged:
|
||||
globalState.appController.changeProfile,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -199,10 +199,15 @@ class ProxiesTabView extends StatelessWidget {
|
||||
|
||||
_delayTest(List<Proxy> proxies) async {
|
||||
for (final proxy in proxies) {
|
||||
final appController = globalState.appController;
|
||||
final proxyName = appController.appState.getRealProxyName(proxy.name) ?? proxy.name;
|
||||
globalState.appController.setDelay(
|
||||
Delay(name: proxy.name, value: 0),
|
||||
Delay(
|
||||
name: proxyName,
|
||||
value: 0,
|
||||
),
|
||||
);
|
||||
clashCore.getDelay(proxy.name).then((delay) {
|
||||
clashCore.getDelay(proxyName).then((delay) {
|
||||
globalState.appController.setDelay(delay);
|
||||
});
|
||||
}
|
||||
@@ -434,7 +439,7 @@ class _DelayTestButtonContainerState extends State<DelayTestButtonContainer>
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(
|
||||
milliseconds: 600,
|
||||
milliseconds: 200,
|
||||
),
|
||||
);
|
||||
_scale = Tween<double>(
|
||||
|
||||
@@ -160,5 +160,8 @@
|
||||
"checking": "Checking...",
|
||||
"country": "Country",
|
||||
"checkError": "Check error",
|
||||
"ipCheckTimeout": "Ip check timeout"
|
||||
"ipCheckTimeout": "Ip check timeout",
|
||||
"search": "Search",
|
||||
"allowBypass": "Allow applications to bypass VPN",
|
||||
"allowBypassDesc": "After opening, some applications can bypass VPN"
|
||||
}
|
||||
@@ -160,5 +160,8 @@
|
||||
"checking": "检测中...",
|
||||
"country": "区域",
|
||||
"checkError": "检测失败",
|
||||
"ipCheckTimeout": "Ip检测超时"
|
||||
"ipCheckTimeout": "Ip检测超时",
|
||||
"search": "搜索",
|
||||
"allowBypass": "允许应用绕过vpn",
|
||||
"allowBypassDesc": "开启后部分应用可绕过VPN"
|
||||
}
|
||||
@@ -40,6 +40,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"addressTip": MessageLookupByLibrary.simpleMessage(
|
||||
"Please enter a valid WebDAV address"),
|
||||
"ago": MessageLookupByLibrary.simpleMessage(" Ago"),
|
||||
"allowBypass": MessageLookupByLibrary.simpleMessage(
|
||||
"Allow applications to bypass VPN"),
|
||||
"allowBypassDesc": MessageLookupByLibrary.simpleMessage(
|
||||
"After opening, some applications can bypass VPN"),
|
||||
"allowLan": MessageLookupByLibrary.simpleMessage("AllowLan"),
|
||||
"allowLanDesc": MessageLookupByLibrary.simpleMessage(
|
||||
"Allow access proxy through the LAN"),
|
||||
@@ -212,6 +216,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"External resource related info"),
|
||||
"rule": MessageLookupByLibrary.simpleMessage("Rule"),
|
||||
"save": MessageLookupByLibrary.simpleMessage("Save"),
|
||||
"search": MessageLookupByLibrary.simpleMessage("Search"),
|
||||
"selectAll": MessageLookupByLibrary.simpleMessage("Select all"),
|
||||
"selected": MessageLookupByLibrary.simpleMessage("Selected"),
|
||||
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
|
||||
|
||||
@@ -36,6 +36,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"addressHelp": MessageLookupByLibrary.simpleMessage("WebDAV服务器地址"),
|
||||
"addressTip": MessageLookupByLibrary.simpleMessage("请输入有效的WebDAV地址"),
|
||||
"ago": MessageLookupByLibrary.simpleMessage("前"),
|
||||
"allowBypass": MessageLookupByLibrary.simpleMessage("允许应用绕过vpn"),
|
||||
"allowBypassDesc":
|
||||
MessageLookupByLibrary.simpleMessage("开启后部分应用可绕过VPN"),
|
||||
"allowLan": MessageLookupByLibrary.simpleMessage("局域网代理"),
|
||||
"allowLanDesc": MessageLookupByLibrary.simpleMessage("允许通过局域网访问代理"),
|
||||
"appAccessControl": MessageLookupByLibrary.simpleMessage("应用访问控制"),
|
||||
@@ -171,6 +174,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"resourcesDesc": MessageLookupByLibrary.simpleMessage("外部资源相关信息"),
|
||||
"rule": MessageLookupByLibrary.simpleMessage("规则"),
|
||||
"save": MessageLookupByLibrary.simpleMessage("保存"),
|
||||
"search": MessageLookupByLibrary.simpleMessage("搜索"),
|
||||
"selectAll": MessageLookupByLibrary.simpleMessage("全选"),
|
||||
"selected": MessageLookupByLibrary.simpleMessage("已选择"),
|
||||
"settings": MessageLookupByLibrary.simpleMessage("设置"),
|
||||
|
||||
@@ -1669,6 +1669,36 @@ class AppLocalizations {
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Search`
|
||||
String get search {
|
||||
return Intl.message(
|
||||
'Search',
|
||||
name: 'search',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Allow applications to bypass VPN`
|
||||
String get allowBypass {
|
||||
return Intl.message(
|
||||
'Allow applications to bypass VPN',
|
||||
name: 'allowBypass',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `After opening, some applications can bypass VPN`
|
||||
String get allowBypassDesc {
|
||||
return Intl.message(
|
||||
'After opening, some applications can bypass VPN',
|
||||
name: 'allowBypassDesc',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||
|
||||
@@ -107,7 +107,7 @@ class AppState with ChangeNotifier {
|
||||
} else {
|
||||
final index = groups.indexWhere((element) => element.name == proxyName);
|
||||
if (index == -1) return type;
|
||||
return "$type(${groups[index].now})";
|
||||
return "$type(${groups[index].now ?? '*'})";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class Tun with _$Tun {
|
||||
const factory Tun({
|
||||
@Default(false) bool enable,
|
||||
@Default(appName) String device,
|
||||
@Default(TunStack.mixed) TunStack stack,
|
||||
@Default(TunStack.gvisor) TunStack stack,
|
||||
@JsonKey(name: "dns-hijack") @Default(["any:53"]) List<String> dnsHijack,
|
||||
}) = _Tun;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../common/common.dart';
|
||||
import 'models.dart';
|
||||
|
||||
part 'generated/config.g.dart';
|
||||
|
||||
part 'generated/config.freezed.dart';
|
||||
|
||||
@freezed
|
||||
@@ -23,6 +24,17 @@ class AccessControl with _$AccessControl {
|
||||
_$AccessControlFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Props with _$Props {
|
||||
const factory Props({
|
||||
AccessControl? accessControl,
|
||||
bool? allowBypass,
|
||||
}) = _Props;
|
||||
|
||||
factory Props.fromJson(Map<String, Object?> json) =>
|
||||
_$PropsFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class Config extends ChangeNotifier {
|
||||
List<Profile> _profiles;
|
||||
@@ -41,6 +53,7 @@ class Config extends ChangeNotifier {
|
||||
AccessControl _accessControl;
|
||||
bool _isAnimateToPage;
|
||||
bool _autoCheckUpdate;
|
||||
bool _allowBypass;
|
||||
DAV? _dav;
|
||||
|
||||
Config()
|
||||
@@ -57,7 +70,8 @@ class Config extends ChangeNotifier {
|
||||
_isAccessControl = false,
|
||||
_autoCheckUpdate = true,
|
||||
_accessControl = const AccessControl(),
|
||||
_isAnimateToPage = true;
|
||||
_isAnimateToPage = true,
|
||||
_allowBypass = true;
|
||||
|
||||
deleteProfileById(String id) {
|
||||
_profiles = profiles.where((element) => element.id != id).toList();
|
||||
@@ -305,8 +319,22 @@ class Config extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
update(
|
||||
[Config? config, RecoveryOption recoveryOptions = RecoveryOption.all]) {
|
||||
@JsonKey(defaultValue: true)
|
||||
bool get allowBypass {
|
||||
return _allowBypass;
|
||||
}
|
||||
|
||||
set allowBypass(bool value) {
|
||||
if (_allowBypass != value) {
|
||||
_allowBypass = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
update([
|
||||
Config? config,
|
||||
RecoveryOption recoveryOptions = RecoveryOption.all,
|
||||
]) {
|
||||
if (config != null) {
|
||||
_profiles = config._profiles;
|
||||
for (final profile in config._profiles) {
|
||||
@@ -325,6 +353,7 @@ class Config extends ChangeNotifier {
|
||||
_openLog = config._openLog;
|
||||
_themeMode = config._themeMode;
|
||||
_locale = config._locale;
|
||||
_allowBypass = config._allowBypass;
|
||||
_primaryColor = config._primaryColor;
|
||||
_proxiesSortType = config._proxiesSortType;
|
||||
_isMinimizeOnExit = config._isMinimizeOnExit;
|
||||
|
||||
@@ -135,7 +135,7 @@ class _$TunImpl implements _Tun {
|
||||
const _$TunImpl(
|
||||
{this.enable = false,
|
||||
this.device = appName,
|
||||
this.stack = TunStack.mixed,
|
||||
this.stack = TunStack.gvisor,
|
||||
@JsonKey(name: "dns-hijack")
|
||||
final List<String> dnsHijack = const ["any:53"]})
|
||||
: _dnsHijack = dnsHijack;
|
||||
|
||||
@@ -79,7 +79,7 @@ _$TunImpl _$$TunImplFromJson(Map<String, dynamic> json) => _$TunImpl(
|
||||
enable: json['enable'] as bool? ?? false,
|
||||
device: json['device'] as String? ?? appName,
|
||||
stack: $enumDecodeNullable(_$TunStackEnumMap, json['stack']) ??
|
||||
TunStack.mixed,
|
||||
TunStack.gvisor,
|
||||
dnsHijack: (json['dns-hijack'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
|
||||
@@ -239,3 +239,172 @@ abstract class _AccessControl implements AccessControl {
|
||||
_$$AccessControlImplCopyWith<_$AccessControlImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
Props _$PropsFromJson(Map<String, dynamic> json) {
|
||||
return _Props.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Props {
|
||||
AccessControl? get accessControl => throw _privateConstructorUsedError;
|
||||
bool? get allowBypass => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$PropsCopyWith<Props> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $PropsCopyWith<$Res> {
|
||||
factory $PropsCopyWith(Props value, $Res Function(Props) then) =
|
||||
_$PropsCopyWithImpl<$Res, Props>;
|
||||
@useResult
|
||||
$Res call({AccessControl? accessControl, bool? allowBypass});
|
||||
|
||||
$AccessControlCopyWith<$Res>? get accessControl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PropsCopyWithImpl<$Res, $Val extends Props>
|
||||
implements $PropsCopyWith<$Res> {
|
||||
_$PropsCopyWithImpl(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? accessControl = freezed,
|
||||
Object? allowBypass = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
accessControl: freezed == accessControl
|
||||
? _value.accessControl
|
||||
: accessControl // ignore: cast_nullable_to_non_nullable
|
||||
as AccessControl?,
|
||||
allowBypass: freezed == allowBypass
|
||||
? _value.allowBypass
|
||||
: allowBypass // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AccessControlCopyWith<$Res>? get accessControl {
|
||||
if (_value.accessControl == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $AccessControlCopyWith<$Res>(_value.accessControl!, (value) {
|
||||
return _then(_value.copyWith(accessControl: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PropsImplCopyWith<$Res> implements $PropsCopyWith<$Res> {
|
||||
factory _$$PropsImplCopyWith(
|
||||
_$PropsImpl value, $Res Function(_$PropsImpl) then) =
|
||||
__$$PropsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({AccessControl? accessControl, bool? allowBypass});
|
||||
|
||||
@override
|
||||
$AccessControlCopyWith<$Res>? get accessControl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PropsImplCopyWithImpl<$Res>
|
||||
extends _$PropsCopyWithImpl<$Res, _$PropsImpl>
|
||||
implements _$$PropsImplCopyWith<$Res> {
|
||||
__$$PropsImplCopyWithImpl(
|
||||
_$PropsImpl _value, $Res Function(_$PropsImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessControl = freezed,
|
||||
Object? allowBypass = freezed,
|
||||
}) {
|
||||
return _then(_$PropsImpl(
|
||||
accessControl: freezed == accessControl
|
||||
? _value.accessControl
|
||||
: accessControl // ignore: cast_nullable_to_non_nullable
|
||||
as AccessControl?,
|
||||
allowBypass: freezed == allowBypass
|
||||
? _value.allowBypass
|
||||
: allowBypass // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$PropsImpl implements _Props {
|
||||
const _$PropsImpl({this.accessControl, this.allowBypass});
|
||||
|
||||
factory _$PropsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$PropsImplFromJson(json);
|
||||
|
||||
@override
|
||||
final AccessControl? accessControl;
|
||||
@override
|
||||
final bool? allowBypass;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Props(accessControl: $accessControl, allowBypass: $allowBypass)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PropsImpl &&
|
||||
(identical(other.accessControl, accessControl) ||
|
||||
other.accessControl == accessControl) &&
|
||||
(identical(other.allowBypass, allowBypass) ||
|
||||
other.allowBypass == allowBypass));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, accessControl, allowBypass);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PropsImplCopyWith<_$PropsImpl> get copyWith =>
|
||||
__$$PropsImplCopyWithImpl<_$PropsImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$PropsImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Props implements Props {
|
||||
const factory _Props(
|
||||
{final AccessControl? accessControl,
|
||||
final bool? allowBypass}) = _$PropsImpl;
|
||||
|
||||
factory _Props.fromJson(Map<String, dynamic> json) = _$PropsImpl.fromJson;
|
||||
|
||||
@override
|
||||
AccessControl? get accessControl;
|
||||
@override
|
||||
bool? get allowBypass;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$PropsImplCopyWith<_$PropsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config()
|
||||
: DAV.fromJson(json['dav'] as Map<String, dynamic>)
|
||||
..isAnimateToPage = json['isAnimateToPage'] as bool? ?? true
|
||||
..isCompatible = json['isCompatible'] as bool? ?? true
|
||||
..autoCheckUpdate = json['autoCheckUpdate'] as bool? ?? true;
|
||||
..autoCheckUpdate = json['autoCheckUpdate'] as bool? ?? true
|
||||
..allowBypass = json['allowBypass'] as bool? ?? true;
|
||||
|
||||
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||
'profiles': instance.profiles,
|
||||
@@ -52,6 +53,7 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||
'isAnimateToPage': instance.isAnimateToPage,
|
||||
'isCompatible': instance.isCompatible,
|
||||
'autoCheckUpdate': instance.autoCheckUpdate,
|
||||
'allowBypass': instance.allowBypass,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
@@ -93,3 +95,17 @@ const _$AccessControlModeEnumMap = {
|
||||
AccessControlMode.acceptSelected: 'acceptSelected',
|
||||
AccessControlMode.rejectSelected: 'rejectSelected',
|
||||
};
|
||||
|
||||
_$PropsImpl _$$PropsImplFromJson(Map<String, dynamic> json) => _$PropsImpl(
|
||||
accessControl: json['accessControl'] == null
|
||||
? null
|
||||
: AccessControl.fromJson(
|
||||
json['accessControl'] as Map<String, dynamic>),
|
||||
allowBypass: json['allowBypass'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$PropsImplToJson(_$PropsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'accessControl': instance.accessControl,
|
||||
'allowBypass': instance.allowBypass,
|
||||
};
|
||||
|
||||
@@ -28,6 +28,8 @@ const _$GroupTypeEnumMap = {
|
||||
GroupType.Selector: 'Selector',
|
||||
GroupType.URLTest: 'URLTest',
|
||||
GroupType.Fallback: 'Fallback',
|
||||
GroupType.LoadBalance: 'LoadBalance',
|
||||
GroupType.Relay: 'Relay',
|
||||
};
|
||||
|
||||
_$ProxyImpl _$$ProxyImplFromJson(Map<String, dynamic> json) => _$ProxyImpl(
|
||||
|
||||
@@ -107,6 +107,9 @@ class _ScanPageState extends State<ScanPage> with WidgetsBindingObserver {
|
||||
case TorchState.unavailable:
|
||||
icon = const Icon(Icons.flash_off);
|
||||
backgroundColor = Colors.transparent;
|
||||
case TorchState.auto:
|
||||
icon = const Icon(Icons.flash_auto);
|
||||
backgroundColor = Colors.orange;
|
||||
}
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||
|
||||
@@ -61,8 +61,14 @@ class GlobalState {
|
||||
required Config config,
|
||||
required ClashConfig clashConfig,
|
||||
}) async {
|
||||
final args =
|
||||
config.isAccessControl ? json.encode(config.accessControl) : null;
|
||||
final args = config.isAccessControl
|
||||
? json.encode(
|
||||
Props(
|
||||
accessControl: config.accessControl,
|
||||
allowBypass: config.allowBypass,
|
||||
),
|
||||
)
|
||||
: null;
|
||||
await proxyManager.startProxy(
|
||||
port: clashConfig.mixedPort,
|
||||
args: args,
|
||||
|
||||
@@ -122,7 +122,6 @@ class CommonScaffoldState extends State<CommonScaffold> {
|
||||
return floatingActionButton ?? Container();
|
||||
},
|
||||
),
|
||||
floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling,
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(kToolbarHeight),
|
||||
child: Stack(
|
||||
|
||||
Submodule plugins/flutter_distributor updated: e31c994e67...64122ab7e1
300
pubspec.lock
300
pubspec.lock
File diff suppressed because it is too large
Load Diff
@@ -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.16
|
||||
version: 0.8.19
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
|
||||
@@ -24,7 +24,7 @@ dependencies:
|
||||
windows_single_instance: ^1.0.1
|
||||
json_annotation: ^4.9.0
|
||||
file_picker: ^8.0.3
|
||||
mobile_scanner: 5.0.1
|
||||
mobile_scanner: ^5.1.1
|
||||
app_links: ^3.5.0
|
||||
win32_registry: ^1.1.2
|
||||
tray_manager: ^0.2.1
|
||||
|
||||
17
setup.dart
17
setup.dart
@@ -12,10 +12,7 @@ enum PlatformType {
|
||||
macos,
|
||||
}
|
||||
|
||||
enum Arch {
|
||||
amd64,
|
||||
arm64,
|
||||
}
|
||||
enum Arch { amd64, arm64, arm }
|
||||
|
||||
class BuildLibItem {
|
||||
PlatformType platform;
|
||||
@@ -64,6 +61,11 @@ class Build {
|
||||
arch: Arch.amd64,
|
||||
archName: 'amd64',
|
||||
),
|
||||
BuildLibItem(
|
||||
platform: PlatformType.android,
|
||||
arch: Arch.arm,
|
||||
archName: 'armeabi-v7a',
|
||||
),
|
||||
BuildLibItem(
|
||||
platform: PlatformType.android,
|
||||
arch: Arch.arm64,
|
||||
@@ -334,7 +336,7 @@ class BuildCommand extends Command {
|
||||
final archName = argResults?['arch'];
|
||||
final currentArches =
|
||||
arches.where((element) => element.name == archName).toList();
|
||||
final arch = currentArches.isEmpty ? null : arches.first;
|
||||
final arch = currentArches.isEmpty ? null : currentArches.first;
|
||||
await _buildLib(arch);
|
||||
if (build != "all") {
|
||||
return;
|
||||
@@ -357,10 +359,11 @@ class BuildCommand extends Command {
|
||||
break;
|
||||
case PlatformType.android:
|
||||
final targetMap = {
|
||||
Arch.arm: "android-arm",
|
||||
Arch.arm64: "android-arm64",
|
||||
Arch.amd64: "android-x64",
|
||||
Arch.arm64: "android-arm64"
|
||||
};
|
||||
final defaultArches = [Arch.amd64, Arch.arm64];
|
||||
final defaultArches = [Arch.arm, Arch.arm64, Arch.amd64];
|
||||
final defaultTargets = defaultArches
|
||||
.where((element) => arch == null ? true : element == arch)
|
||||
.map((e) => targetMap[e])
|
||||
|
||||
Reference in New Issue
Block a user