diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index dda89ee9..ea6a2f7c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -356,7 +356,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 224; + CURRENT_PROJECT_VERSION = 225; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -364,7 +364,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.224; + MARKETING_VERSION = 1.0.225; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -486,7 +486,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 224; + CURRENT_PROJECT_VERSION = 225; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -494,7 +494,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.224; + MARKETING_VERSION = 1.0.225; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -510,7 +510,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 224; + CURRENT_PROJECT_VERSION = 225; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -518,7 +518,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.224; + MARKETING_VERSION = 1.0.225; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/core/utils/server.dart b/lib/core/utils/server.dart index 79ffb615..8ba5578b 100644 --- a/lib/core/utils/server.dart +++ b/lib/core/utils/server.dart @@ -8,12 +8,22 @@ import '../../data/store/private_key.dart'; import '../../locator.dart'; /// Must put this func out of any Class. +/// /// Because of this function is called by [compute] in [ServerProvider.genClient]. +/// /// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure List loadIndentity(String key) { return SSHKeyPair.fromPem(key); } +/// [args] : [key, pwd] +String decyptPem(List args) { + /// skip when the key is not encrypted, or will throw exception + if (!SSHKeyPair.isEncryptedPem(args[0])) return args[0]; + final sshKey = SSHKeyPair.fromPem(args[0], args[1]); + return sshKey.first.toPem(); +} + Future genClient(ServerPrivateInfo spi) async { final socket = await SSHSocket.connect( spi.ip, diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index f4bda050..014f212e 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,8 +2,8 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 224; + static const int build = 225; static const String engine = "Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (9 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n"; - static const String buildAt = "2023-02-18 13:16:46.172437"; - static const int modifications = 1; + static const String buildAt = "2023-02-18 13:22:17.786805"; + static const int modifications = 3; } diff --git a/lib/main.dart b/lib/main.dart index 0af3c285..78bb96ec 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -72,8 +72,8 @@ void onError(Object obj, StackTrace stack) { } Future main() async { + await initApp(); runInZone(() async { - await initApp(); runApp( MultiProvider( providers: [ diff --git a/lib/view/page/private_key/edit.dart b/lib/view/page/private_key/edit.dart index 6ec416ce..1b1dd48d 100644 --- a/lib/view/page/private_key/edit.dart +++ b/lib/view/page/private_key/edit.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:after_layout/after_layout.dart'; -import 'package:dartssh2/dartssh2.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -9,6 +8,7 @@ import 'package:toolbox/core/extension/numx.dart'; import 'package:toolbox/core/utils/misc.dart'; import 'package:toolbox/data/res/misc.dart'; +import '../../../core/utils/server.dart'; import '../../../core/utils/ui.dart'; import '../../../data/model/server/private_key_info.dart'; import '../../../data/provider/private_key.dart'; @@ -158,7 +158,7 @@ class _PrivateKeyEditPageState extends State ), ); }); - final info = PrivateKeyInfo(name, key, pwd); + final info = PrivateKeyInfo(name, key, ''); bool haveErr = false; try { info.privateKey = await compute(decyptPem, [key, pwd]); @@ -197,11 +197,3 @@ class _PrivateKeyEditPageState extends State } } } - -/// [args] : [key, pwd] -String decyptPem(List args) { - /// skip when the key is not encrypted, or will throw exception - if (!SSHKeyPair.isEncryptedPem(args[0])) return args[0]; - final sshKey = SSHKeyPair.fromPem(args[0], args[1]); - return sshKey.first.toPem(); -} diff --git a/make.dart b/make.dart index fb49d14c..30f9ccf6 100755 --- a/make.dart +++ b/make.dart @@ -28,9 +28,9 @@ Future fvmRun(List args) async { return await Process.run('fvm', args, runInShell: true); } -Future getGitCommitCount() async { +Future getGitCommitCount() async { final result = await Process.run('git', ['log', '--oneline']); - return (result.stdout as String) + build = (result.stdout as String) .split('\n') .where((line) => line.isNotEmpty) .length; @@ -184,9 +184,9 @@ void main(List args) async { case 'build': final stopwatch = Stopwatch()..start(); await dartFormat(); - build = await getGitCommitCount(); - await updateBuildData(); + await getGitCommitCount(); await changeAppleVersion(); + await updateBuildData(); if (args.length > 1) { final platforms = args[1]; for (final platform in platforms.split(',')) {