mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new & opt
new: support set maxRetryCount of server reconnection opt: server detail UI opt: server provider opt: `ssh` page on Android
This commit is contained in:
@@ -6,9 +6,17 @@ class Server {
|
||||
ServerPrivateInfo spi;
|
||||
ServerStatus status;
|
||||
SSHClient? client;
|
||||
ServerConnectionState cs;
|
||||
ServerState cs;
|
||||
|
||||
Server(this.spi, this.status, this.client, this.cs);
|
||||
}
|
||||
|
||||
enum ServerConnectionState { disconnected, connecting, connected, failed }
|
||||
enum ServerState {
|
||||
disconnected,
|
||||
connecting,
|
||||
connected,
|
||||
failed;
|
||||
|
||||
bool get shouldConnect =>
|
||||
this == ServerState.disconnected || this == ServerState.failed;
|
||||
}
|
||||
|
||||
@@ -31,15 +31,17 @@ class ServerPrivateInfo {
|
||||
@HiveField(5)
|
||||
String? pubKeyId;
|
||||
|
||||
String get id => '$user@$ip:$port';
|
||||
late String id;
|
||||
|
||||
ServerPrivateInfo({
|
||||
required this.name,
|
||||
required this.ip,
|
||||
required this.port,
|
||||
required this.user,
|
||||
required this.pwd,
|
||||
this.pubKeyId,
|
||||
}) : id = '$user@$ip:$port';
|
||||
|
||||
ServerPrivateInfo(
|
||||
{required this.name,
|
||||
required this.ip,
|
||||
required this.port,
|
||||
required this.user,
|
||||
required this.pwd,
|
||||
this.pubKeyId});
|
||||
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
||||
name = json["name"].toString();
|
||||
ip = json["ip"].toString();
|
||||
@@ -47,7 +49,9 @@ class ServerPrivateInfo {
|
||||
user = json["user"].toString();
|
||||
pwd = json["authorization"].toString();
|
||||
pubKeyId = json["pubKeyId"]?.toString();
|
||||
id = '$user@$ip:$port';
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data["name"] = name;
|
||||
|
||||
Reference in New Issue
Block a user