fix: ssh alter url (#554)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-08-27 15:22:26 +08:00
committed by GitHub
parent 329fd33b69
commit eb83d05c81
17 changed files with 79 additions and 84 deletions

View File

@@ -19,7 +19,7 @@ jobs:
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
channel: 'stable' channel: 'stable'
flutter-version: '3.24.0' flutter-version: '3.24.1'
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4
with: with:
distribution: 'zulu' distribution: 'zulu'

View File

@@ -690,7 +690,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -700,7 +700,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -826,7 +826,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -836,7 +836,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -854,7 +854,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -864,7 +864,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -885,7 +885,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -898,7 +898,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
@@ -924,7 +924,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -937,7 +937,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -960,7 +960,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -973,7 +973,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -996,7 +996,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1008,7 +1008,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
@@ -1037,7 +1037,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1049,7 +1049,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox; PRODUCT_NAME = ServerBox;
@@ -1075,7 +1075,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1087,7 +1087,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox; PRODUCT_NAME = ServerBox;

View File

@@ -23,7 +23,6 @@ import 'package:server_box/view/page/storage/local.dart';
import 'package:server_box/data/model/server/snippet.dart'; import 'package:server_box/data/model/server/snippet.dart';
import 'package:server_box/view/page/editor.dart'; import 'package:server_box/view/page/editor.dart';
import 'package:server_box/view/page/process.dart'; import 'package:server_box/view/page/process.dart';
import 'package:server_box/view/page/server/edit.dart';
import 'package:server_box/view/page/server/tab.dart'; import 'package:server_box/view/page/server/tab.dart';
import 'package:server_box/view/page/setting/entry.dart'; import 'package:server_box/view/page/setting/entry.dart';
import 'package:server_box/view/page/setting/seq/srv_detail_seq.dart'; import 'package:server_box/view/page/setting/seq/srv_detail_seq.dart';
@@ -66,13 +65,6 @@ class AppRoutes {
return AppRoutes(ServerPage(key: key), 'server_tab'); return AppRoutes(ServerPage(key: key), 'server_tab');
} }
static AppRoutes serverEdit({Key? key, Spi? spi}) {
return AppRoutes(
ServerEditPage(spi: spi),
'server_${spi == null ? 'add' : 'edit'}',
);
}
static AppRoutes keyEdit({Key? key, PrivateKeyInfo? pki}) { static AppRoutes keyEdit({Key? key, PrivateKeyInfo? pki}) {
return AppRoutes( return AppRoutes(
PrivateKeyEditPage(pki: pki), PrivateKeyEditPage(pki: pki),

View File

@@ -93,8 +93,8 @@ Future<SSHClient> genClient(
spi.port, spi.port,
timeout: timeout, timeout: timeout,
); );
} catch (e, s) { } catch (e) {
Loggers.app.warning('genClient', e, s); Loggers.app.warning('genClient', e);
if (spi.alterUrl == null) rethrow; if (spi.alterUrl == null) rethrow;
try { try {
final res = spi.fromStringUrl(); final res = spi.fromStringUrl();
@@ -104,8 +104,8 @@ Future<SSHClient> genClient(
res.$3, res.$3,
timeout: timeout, timeout: timeout,
); );
} catch (e, s) { } catch (e) {
Loggers.app.warning('genClient alterUrl', e, s); Loggers.app.warning('genClient alterUrl', e);
rethrow; rethrow;
} }
} }

View File

@@ -107,13 +107,13 @@ extension Spix on Spi {
throw SSHErr(type: SSHErrType.connect, message: 'alterUrl no @'); throw SSHErr(type: SSHErrType.connect, message: 'alterUrl no @');
} }
final usr = splited[0]; final usr = splited[0];
final splited2 = splited[1].split(':'); final idx = splited[1].lastIndexOf(':');
if (splited2.length != 2) { if (idx == -1) {
throw SSHErr(type: SSHErrType.connect, message: 'alterUrl no :'); throw SSHErr(type: SSHErrType.connect, message: 'alterUrl no :');
} }
final ip_ = splited2[0]; final ip_ = splited[1].substring(0, idx);
final port_ = int.tryParse(splited2[1]) ?? 22; final port_ = int.tryParse(splited[1].substring(idx + 1));
if (port <= 0 || port > 65535) { if (port_ == null || port_ <= 0 || port_ > 65535) {
throw SSHErr(type: SSHErrType.connect, message: 'alterUrl port error'); throw SSHErr(type: SSHErrType.connect, message: 'alterUrl port error');
} }
return (ip_, usr, port_); return (ip_, usr, port_);

View File

@@ -3,6 +3,6 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 1070; static const int build = 1076;
static const int script = 58; static const int script = 58;
} }

View File

@@ -17,6 +17,7 @@ import 'package:server_box/data/model/server/sensors.dart';
import 'package:server_box/data/model/server/server_private_info.dart'; import 'package:server_box/data/model/server/server_private_info.dart';
import 'package:server_box/data/model/server/system.dart'; import 'package:server_box/data/model/server/system.dart';
import 'package:server_box/data/res/store.dart'; import 'package:server_box/data/res/store.dart';
import 'package:server_box/view/page/server/edit.dart';
import 'package:server_box/view/widget/server_func_btns.dart'; import 'package:server_box/view/widget/server_func_btns.dart';
import 'package:server_box/core/route.dart'; import 'package:server_box/core/route.dart';
@@ -125,7 +126,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
IconButton( IconButton(
icon: const Icon(Icons.edit), icon: const Icon(Icons.edit),
onPressed: () async { onPressed: () async {
final delete = await AppRoutes.serverEdit(spi: si.spi).go(context); final delete = await ServerEditPage.route.go(context, args: si.spi);
if (delete == true) { if (delete == true) {
context.pop(); context.pop();
} }

View File

@@ -15,15 +15,21 @@ import 'package:server_box/data/model/server/server_private_info.dart';
import 'package:server_box/data/provider/private_key.dart'; import 'package:server_box/data/provider/private_key.dart';
class ServerEditPage extends StatefulWidget { class ServerEditPage extends StatefulWidget {
const ServerEditPage({super.key, this.spi}); final Spi? args;
final Spi? spi; const ServerEditPage({super.key, this.args});
static const route = AppRoute<bool, Spi>(
page: ServerEditPage.new,
path: '/server_edit',
);
@override @override
State<ServerEditPage> createState() => _ServerEditPageState(); State<ServerEditPage> createState() => _ServerEditPageState();
} }
class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin { class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
late final spi = widget.args;
final _nameController = TextEditingController(); final _nameController = TextEditingController();
final _ipController = TextEditingController(); final _ipController = TextEditingController();
final _altUrlController = TextEditingController(); final _altUrlController = TextEditingController();
@@ -47,6 +53,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
late FocusScopeNode _focusScope; late FocusScopeNode _focusScope;
/// -1: non selected, null: password, others: index of private key
final _keyIdx = ValueNotifier<int?>(null); final _keyIdx = ValueNotifier<int?>(null);
final _autoConnect = ValueNotifier(true); final _autoConnect = ValueNotifier(true);
final _jumpServer = nvn<String?>(); final _jumpServer = nvn<String?>();
@@ -88,7 +95,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final actions = <Widget>[]; final actions = <Widget>[];
if (widget.spi != null) actions.add(_buildDelBtn()); if (spi != null) actions.add(_buildDelBtn());
return GestureDetector( return GestureDetector(
onTap: () => _focusScope.unfocus(), onTap: () => _focusScope.unfocus(),
@@ -277,7 +284,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
onTap: () async { onTap: () async {
final res = await KvEditor.route.go( final res = await KvEditor.route.go(
context, context,
args: KvEditorArgs(data: widget.spi?.envs ?? {}), KvEditorArgs(data: spi?.envs ?? {}),
); );
if (res == null) return; if (res == null) return;
_env.value = res; _env.value = res;
@@ -409,7 +416,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
onTap: () async { onTap: () async {
final res = await KvEditor.route.go( final res = await KvEditor.route.go(
context, context,
args: KvEditorArgs(data: _customCmds.value), KvEditorArgs(data: _customCmds.value),
); );
if (res == null) return; if (res == null) return;
_customCmds.value = res; _customCmds.value = res;
@@ -477,7 +484,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
final srvs = ServerProvider.servers.values final srvs = ServerProvider.servers.values
.map((e) => e.value) .map((e) => e.value)
.where((e) => e.spi.jumpId == null) .where((e) => e.spi.jumpId == null)
.where((e) => e.spi.id != widget.spi?.id) .where((e) => e.spi.id != spi?.id)
.toList(); .toList();
final choice = _jumpServer.listenVal( final choice = _jumpServer.listenVal(
(val) { (val) {
@@ -602,10 +609,10 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
envs: _env.value.isEmpty ? null : _env.value, envs: _env.value.isEmpty ? null : _env.value,
); );
if (widget.spi == null) { if (this.spi == null) {
ServerProvider.addServer(spi); ServerProvider.addServer(spi);
} else { } else {
ServerProvider.updateServer(widget.spi!, spi); ServerProvider.updateServer(this.spi!, spi);
} }
context.pop(); context.pop();
@@ -613,9 +620,8 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
@override @override
void afterFirstLayout(BuildContext context) { void afterFirstLayout(BuildContext context) {
final spi = widget.spi;
if (spi != null) { if (spi != null) {
_initWithSpi(spi); _initWithSpi(spi!);
} }
} }
@@ -628,7 +634,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
_passwordController.text = spi.pwd ?? ''; _passwordController.text = spi.pwd ?? '';
} else { } else {
_keyIdx.value = PrivateKeyProvider.pkis.value.indexWhere( _keyIdx.value = PrivateKeyProvider.pkis.value.indexWhere(
(e) => e.id == widget.spi!.keyId, (e) => e.id == spi.keyId,
); );
} }
@@ -705,15 +711,13 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
onPressed: () { onPressed: () {
context.showRoundDialog( context.showRoundDialog(
title: libL10n.attention, title: libL10n.attention,
child: StatefulBuilder(builder: (ctx, setState) { child: Text(libL10n.askContinue(
return Text(libL10n.askContinue( '${libL10n.delete} ${l10n.server}(${spi!.name})',
'${libL10n.delete} ${l10n.server}(${widget.spi!.name})', )),
));
}),
actions: Btn.ok( actions: Btn.ok(
onTap: () async { onTap: () async {
context.pop(); context.pop();
ServerProvider.delServer(widget.spi!.id); ServerProvider.delServer(spi!.id);
context.pop(true); context.pop(true);
}, },
red: true, red: true,

View File

@@ -9,6 +9,7 @@ import 'package:server_box/core/extension/ssh_client.dart';
import 'package:server_box/data/model/app/shell_func.dart'; import 'package:server_box/data/model/app/shell_func.dart';
import 'package:server_box/data/model/server/try_limiter.dart'; import 'package:server_box/data/model/server/try_limiter.dart';
import 'package:server_box/data/res/store.dart'; import 'package:server_box/data/res/store.dart';
import 'package:server_box/view/page/server/edit.dart';
import 'package:server_box/view/widget/percent_circle.dart'; import 'package:server_box/view/widget/percent_circle.dart';
import 'package:server_box/core/route.dart'; import 'package:server_box/core/route.dart';
@@ -107,7 +108,7 @@ class _ServerPageState extends State<ServerPage>
controller: _scrollController, controller: _scrollController,
child: FloatingActionButton( child: FloatingActionButton(
heroTag: 'addServer', heroTag: 'addServer',
onPressed: () => AppRoutes.serverEdit().go(context), onPressed: () => ServerEditPage.route.go(context),
tooltip: libL10n.add, tooltip: libL10n.add,
child: const Icon(Icons.add), child: const Icon(Icons.add),
), ),
@@ -259,7 +260,7 @@ class _ServerPageState extends State<ServerPage>
if (srv.canViewDetails) { if (srv.canViewDetails) {
AppRoutes.serverDetail(spi: srv.spi).go(context); AppRoutes.serverDetail(spi: srv.spi).go(context);
} else { } else {
AppRoutes.serverEdit(spi: srv.spi).go(context); ServerEditPage.route.go(context, args: srv.spi);
} }
}, },
onLongPress: () { onLongPress: () {
@@ -270,7 +271,7 @@ class _ServerPageState extends State<ServerPage>
flip: !cardStatus.value.flip, flip: !cardStatus.value.flip,
); );
} else { } else {
AppRoutes.serverEdit(spi: srv.spi).go(context); ServerEditPage.route.go(context, args: srv.spi);
} }
}, },
child: Padding( child: Padding(
@@ -384,7 +385,7 @@ class _ServerPageState extends State<ServerPage>
textStyle: textStyle, textStyle: textStyle,
), ),
Btn.column( Btn.column(
onTap: () => AppRoutes.serverEdit(spi: srv.spi).go(context), onTap: () => ServerEditPage.route.go(context, args: srv.spi),
icon: const Icon(Icons.edit, color: Colors.grey), icon: const Icon(Icons.edit, color: Colors.grey),
text: libL10n.edit, text: libL10n.edit,
textStyle: textStyle, textStyle: textStyle,

View File

@@ -64,7 +64,7 @@ class _AndroidSettingsPageState extends State<AndroidSettingsPage> {
} }
final result = await KvEditor.route.go( final result = await KvEditor.route.go(
context, context,
args: KvEditorArgs(data: data, prefix: 'widget_'), KvEditorArgs(data: data, prefix: 'widget_'),
); );
if (result != null) { if (result != null) {
_saveWidgetSP(result, data); _saveWidgetSP(result, data);

View File

@@ -111,7 +111,7 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
final urls = Map<String, String>.from(map['urls'] as Map? ?? {}); final urls = Map<String, String>.from(map['urls'] as Map? ?? {});
final result = await KvEditor.route.go( final result = await KvEditor.route.go(
context, context,
args: KvEditorArgs(data: urls), KvEditorArgs(data: urls),
); );
if (result == null) return; if (result == null) return;

View File

@@ -3,9 +3,9 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:icons_plus/icons_plus.dart'; import 'package:icons_plus/icons_plus.dart';
import 'package:server_box/core/extension/context/locale.dart'; import 'package:server_box/core/extension/context/locale.dart';
import 'package:server_box/core/route.dart';
import 'package:server_box/data/model/server/server_private_info.dart'; import 'package:server_box/data/model/server/server_private_info.dart';
import 'package:server_box/data/provider/server.dart'; import 'package:server_box/data/provider/server.dart';
import 'package:server_box/view/page/server/edit.dart';
import 'package:server_box/view/page/ssh/page.dart'; import 'package:server_box/view/page/ssh/page.dart';
class SSHTabPage extends StatefulWidget { class SSHTabPage extends StatefulWidget {
@@ -48,7 +48,7 @@ class _SSHTabPageState extends State<SSHTabPage>
if (idx != 0) return const SizedBox(); if (idx != 0) return const SizedBox();
return FloatingActionButton( return FloatingActionButton(
heroTag: 'sshAddServer', heroTag: 'sshAddServer',
onPressed: () => AppRoutes.serverEdit().go(context), onPressed: () => ServerEditPage.route.go(context),
tooltip: libL10n.add, tooltip: libL10n.add,
child: const Icon(Icons.add), child: const Icon(Icons.add),
); );

View File

@@ -21,7 +21,7 @@ final class SystemdPage extends StatefulWidget {
required this.args, required this.args,
}); });
static const route = AppRoute<void, SystemdPageArgs>( static const route = AppRouteArg<void, SystemdPageArgs>(
page: SystemdPage.new, page: SystemdPage.new,
path: '/systemd', path: '/systemd',
); );

View File

@@ -165,10 +165,7 @@ void _onTapMoreBtns(
); );
break; break;
case ServerFuncBtn.systemd: case ServerFuncBtn.systemd:
SystemdPage.route.go( SystemdPage.route.go(context, SystemdPageArgs(spi: spi));
context,
args: SystemdPageArgs(spi: spi),
);
break; break;
} }
} }

View File

@@ -471,7 +471,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -481,7 +481,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -608,7 +608,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -618,7 +618,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -638,7 +638,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1070; CURRENT_PROJECT_VERSION = 1076;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -649,7 +649,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.1070; MARKETING_VERSION = 1.0.1076;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -421,8 +421,8 @@ packages:
dependency: "direct dev" dependency: "direct dev"
description: description:
path: "." path: "."
ref: "v1.0.42" ref: "v1.0.43"
resolved-ref: "2cae3388a66581169638c3b3f5fc73dd7b5b4bfd" resolved-ref: df503ed1598f4fc6a3d3904491d54a1738d4be98
url: "https://github.com/lppcg/fl_build.git" url: "https://github.com/lppcg/fl_build.git"
source: git source: git
version: "1.0.0" version: "1.0.0"
@@ -438,8 +438,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "v1.0.143" ref: "v1.0.145"
resolved-ref: "241ab972985a97abcba032cba96229bdff61a759" resolved-ref: "9f37be2b15c9d87887d704599f8fcc17263b8335"
url: "https://github.com/lppcg/fl_lib" url: "https://github.com/lppcg/fl_lib"
source: git source: git
version: "0.0.1" version: "0.0.1"
@@ -1425,10 +1425,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.4" version: "14.2.5"
wake_on_lan: wake_on_lan:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -1,7 +1,7 @@
name: server_box name: server_box
description: server status & toolbox app. description: server status & toolbox app.
publish_to: 'none' publish_to: 'none'
version: 1.0.1070+1070 version: 1.0.1076+1076
environment: environment:
sdk: ">=3.0.0" sdk: ">=3.0.0"
@@ -60,7 +60,7 @@ dependencies:
fl_lib: fl_lib:
git: git:
url: https://github.com/lppcg/fl_lib url: https://github.com/lppcg/fl_lib
ref: v1.0.143 ref: v1.0.145
dependency_overrides: dependency_overrides:
# dartssh2: # dartssh2:
@@ -83,7 +83,7 @@ dev_dependencies:
fl_build: fl_build:
git: git:
url: https://github.com/lppcg/fl_build.git url: https://github.com/lppcg/fl_build.git
ref: v1.0.42 ref: v1.0.43
flutter: flutter:
generate: true generate: true