mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix #3
- server edit page display bugs, include userPubKey and pubKeyIdx
This commit is contained in:
@@ -354,7 +354,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 145;
|
||||
CURRENT_PROJECT_VERSION = 146;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -362,7 +362,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.145;
|
||||
MARKETING_VERSION = 1.0.146;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -484,7 +484,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 145;
|
||||
CURRENT_PROJECT_VERSION = 146;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -492,7 +492,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.145;
|
||||
MARKETING_VERSION = 1.0.146;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -508,7 +508,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 145;
|
||||
CURRENT_PROJECT_VERSION = 146;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -516,7 +516,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.145;
|
||||
MARKETING_VERSION = 1.0.146;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
||||
@@ -6,7 +6,7 @@ enum _BuildMode {
|
||||
profile,
|
||||
}
|
||||
|
||||
_BuildMode _buildMode = (() {
|
||||
final _buildMode = (() {
|
||||
if (const bool.fromEnvironment('dart.vm.product')) {
|
||||
return _BuildMode.release;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,6 @@ class ProviderBase with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
enum ProviderState {
|
||||
idle,
|
||||
busy,
|
||||
}
|
||||
|
||||
class BusyProvider extends ProviderBase {
|
||||
bool _isBusy = false;
|
||||
bool get isBusy => _isBusy;
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
import 'package:toolbox/core/provider_base.dart';
|
||||
import 'package:toolbox/data/service/app.dart';
|
||||
|
||||
class AppProvider extends BusyProvider {
|
||||
Map? _notify;
|
||||
Map? get notify => _notify;
|
||||
int? _newestBuild;
|
||||
int? get newestBuild => _newestBuild;
|
||||
|
||||
Future<void> loadData() async {
|
||||
setBusyState(true);
|
||||
final service = AppService();
|
||||
_notify = await service.getNotify();
|
||||
setBusyState(false);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setNewestBuild(int build) {
|
||||
_newestBuild = build;
|
||||
notifyListeners();
|
||||
|
||||
@@ -66,42 +66,22 @@ class DockerProvider extends BusyProvider {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> stop(String id) async {
|
||||
Future<bool> _do(String id, String cmd) async {
|
||||
setBusyState();
|
||||
if (client == null) {
|
||||
error = 'no client';
|
||||
setBusyState(false);
|
||||
return false;
|
||||
}
|
||||
final result = await client!.run('docker stop $id').string;
|
||||
final result = await client!.run(cmd).string;
|
||||
await refresh();
|
||||
setBusyState(false);
|
||||
return result.contains(id);
|
||||
}
|
||||
|
||||
Future<bool> start(String id) async {
|
||||
setBusyState();
|
||||
if (client == null) {
|
||||
error = 'no client';
|
||||
setBusyState(false);
|
||||
return false;
|
||||
}
|
||||
final result = await client!.run('docker start $id').string;
|
||||
await refresh();
|
||||
setBusyState(false);
|
||||
return result.contains(id);
|
||||
}
|
||||
Future<bool> stop(String id) async => await _do(id, 'docker stop $id');
|
||||
|
||||
Future<bool> delete(String id) async {
|
||||
setBusyState();
|
||||
if (client == null) {
|
||||
error = 'no client';
|
||||
setBusyState(false);
|
||||
return false;
|
||||
}
|
||||
final result = await client!.run('docker rm $id').string;
|
||||
await refresh();
|
||||
setBusyState(false);
|
||||
return result.contains(id);
|
||||
}
|
||||
Future<bool> start(String id) async => await _do(id, 'docker start $id');
|
||||
|
||||
Future<bool> delete(String id) async => await _do(id, 'docker rm $id');
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 145;
|
||||
static const int build = 146;
|
||||
static const String engine =
|
||||
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (4 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
|
||||
static const String buildAt = "2022-05-24 13:29:00.556031";
|
||||
static const int modifications = 4;
|
||||
static const String buildAt = "2022-05-24 13:44:07.002192";
|
||||
static const int modifications = 0;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,6 @@ import 'package:toolbox/data/model/app/update.dart';
|
||||
import 'package:toolbox/data/res/url.dart';
|
||||
|
||||
class AppService {
|
||||
Future<Map> getNotify() async {
|
||||
final resp = await Dio().get('$baseUrl/notify.json');
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
Future<AppUpdate> getUpdate() async {
|
||||
final resp = await Dio().get('$baseUrl/update.json');
|
||||
return AppUpdate.fromJson(resp.data);
|
||||
|
||||
@@ -44,7 +44,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
|
||||
bool usePublicKey = false;
|
||||
|
||||
int _pubKeyIndex = -1;
|
||||
int? _pubKeyIndex;
|
||||
PrivateKeyInfo? _keyInfo;
|
||||
|
||||
@override
|
||||
@@ -151,7 +151,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
? Consumer<PrivateKeyProvider>(builder: (_, key, __) {
|
||||
for (var item in key.infos) {
|
||||
if (item.id == widget.spi?.pubKeyId) {
|
||||
_pubKeyIndex = key.infos.indexOf(item);
|
||||
_pubKeyIndex ??= key.infos.indexOf(item);
|
||||
}
|
||||
}
|
||||
final tiles = key.infos
|
||||
@@ -255,12 +255,9 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
ipController.text = widget.spi?.ip ?? '';
|
||||
portController.text = (widget.spi?.port ?? 22).toString();
|
||||
usernameController.text = widget.spi?.user ?? '';
|
||||
if (widget.spi?.pwd is String) {
|
||||
if (widget.spi?.pubKeyId == null) {
|
||||
passwordController.text = widget.spi?.pwd ?? '';
|
||||
} else {
|
||||
final auth = widget.spi?.pwd as Map;
|
||||
passwordController.text = auth['passphrase'];
|
||||
keyController.text = auth['privateKey'];
|
||||
usePublicKey = true;
|
||||
}
|
||||
setState(() {});
|
||||
|
||||
@@ -420,14 +420,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 145;
|
||||
CURRENT_PROJECT_VERSION = 146;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.145;
|
||||
MARKETING_VERSION = 1.0.146;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -550,14 +550,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 145;
|
||||
CURRENT_PROJECT_VERSION = 146;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.145;
|
||||
MARKETING_VERSION = 1.0.146;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -574,14 +574,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 145;
|
||||
CURRENT_PROJECT_VERSION = 146;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.145;
|
||||
MARKETING_VERSION = 1.0.146;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
Reference in New Issue
Block a user