mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
Fix update server info failed. Display temp&uptime
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 90;
|
static const int build = 91;
|
||||||
static const String engine = "Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5f105a6ca7 (6 days ago) • 2022-02-01 14:15:42 -0800\nEngine • revision 776efd2034\nTools • Dart 2.16.0 • DevTools 2.9.2\n";
|
static const String engine = "Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5f105a6ca7 (7 days ago) • 2022-02-01 14:15:42 -0800\nEngine • revision 776efd2034\nTools • Dart 2.16.0 • DevTools 2.9.2\n";
|
||||||
static const String buildAt = "2022-02-08 16:48:52.440919";
|
static const String buildAt = "2022-02-08 19:01:55.450937";
|
||||||
static const int modifications = 5;
|
static const int modifications = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:toolbox/data/model/server/server_private_info.dart';
|
|||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/data/store/private_key.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||||
import 'package:toolbox/view/widget/input_decoration.dart';
|
import 'package:toolbox/view/widget/input_decoration.dart';
|
||||||
@@ -34,7 +35,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
bool usePublicKey = false;
|
bool usePublicKey = false;
|
||||||
|
|
||||||
int _pubKeyIndex = -1;
|
int _pubKeyIndex = -1;
|
||||||
late PrivateKeyInfo _keyInfo;
|
PrivateKeyInfo? _keyInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -188,10 +189,15 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
if (portController.text == '') {
|
if (portController.text == '') {
|
||||||
portController.text = '22';
|
portController.text = '22';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (widget.spi != null && widget.spi!.pubKeyId != null) {
|
||||||
|
_keyInfo ??= locator<PrivateKeyStore>().get(widget.spi!.pubKeyId!);
|
||||||
|
}
|
||||||
|
|
||||||
final authorization = usePublicKey
|
final authorization = usePublicKey
|
||||||
? {
|
? {
|
||||||
"privateKey": _keyInfo.privateKey,
|
"privateKey": _keyInfo!.privateKey,
|
||||||
"passphrase": _keyInfo.password
|
"passphrase": _keyInfo!.password
|
||||||
}
|
}
|
||||||
: passwordController.text;
|
: passwordController.text;
|
||||||
final spi = ServerPrivateInfo(
|
final spi = ServerPrivateInfo(
|
||||||
@@ -200,7 +206,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
port: int.parse(portController.text),
|
port: int.parse(portController.text),
|
||||||
user: usernameController.text,
|
user: usernameController.text,
|
||||||
authorization: authorization,
|
authorization: authorization,
|
||||||
pubKeyId: usePublicKey ? _keyInfo.id : null);
|
pubKeyId: usePublicKey ? _keyInfo!.id : null);
|
||||||
|
|
||||||
if (widget.spi == null) {
|
if (widget.spi == null) {
|
||||||
_serverProvider.addServer(spi);
|
_serverProvider.addServer(spi);
|
||||||
|
|||||||
@@ -293,7 +293,19 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
case ServerConnectionState.disconnected:
|
case ServerConnectionState.disconnected:
|
||||||
return 'Disconnected';
|
return 'Disconnected';
|
||||||
case ServerConnectionState.connected:
|
case ServerConnectionState.connected:
|
||||||
return temp == '' ? (upTime == '' ? 'Loading...' : upTime) : temp;
|
if (temp == '') {
|
||||||
|
if (upTime == '') {
|
||||||
|
return 'Loading...';
|
||||||
|
} else {
|
||||||
|
return upTime;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (upTime == '') {
|
||||||
|
return temp;
|
||||||
|
} else {
|
||||||
|
return '$temp | $upTime';
|
||||||
|
}
|
||||||
|
}
|
||||||
case ServerConnectionState.connecting:
|
case ServerConnectionState.connecting:
|
||||||
return 'Connecting...';
|
return 'Connecting...';
|
||||||
case ServerConnectionState.failed:
|
case ServerConnectionState.failed:
|
||||||
|
|||||||
Reference in New Issue
Block a user