mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
#112 new: check hash during upgrade
This commit is contained in:
@@ -75,12 +75,14 @@ esac''');
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CmdType {
|
||||
extension EnumX on Enum {
|
||||
/// Find out the required segment from [segments]
|
||||
String find(List<String> segments);
|
||||
String find(List<String> segments) {
|
||||
return segments[index];
|
||||
}
|
||||
}
|
||||
|
||||
enum StatusCmdType implements _CmdType {
|
||||
enum StatusCmdType {
|
||||
net,
|
||||
sys,
|
||||
cpu,
|
||||
@@ -92,21 +94,11 @@ enum StatusCmdType implements _CmdType {
|
||||
tempVal,
|
||||
host,
|
||||
sysRhel;
|
||||
|
||||
@override
|
||||
String find(List<String> segments) {
|
||||
return segments[index];
|
||||
}
|
||||
}
|
||||
|
||||
enum DockerCmdType implements _CmdType {
|
||||
enum DockerCmdType {
|
||||
version,
|
||||
ps,
|
||||
stats,
|
||||
images;
|
||||
|
||||
@override
|
||||
String find(List<String> segments) {
|
||||
return segments[index];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,13 @@ class AppUpdate {
|
||||
required this.changelog,
|
||||
required this.build,
|
||||
required this.url,
|
||||
required this.sha256,
|
||||
});
|
||||
|
||||
final AppUpdatePlatformSpecific<String> changelog;
|
||||
final Build build;
|
||||
final AppUpdatePlatformSpecific<String> url;
|
||||
final AppUpdatePlatformSpecific<String?> sha256;
|
||||
|
||||
factory AppUpdate.fromRawJson(String str) =>
|
||||
AppUpdate.fromJson(json.decode(str));
|
||||
@@ -49,12 +51,14 @@ class AppUpdate {
|
||||
changelog: AppUpdatePlatformSpecific.fromJson(json["changelog"]),
|
||||
build: Build.fromJson(json["build"]),
|
||||
url: AppUpdatePlatformSpecific.fromJson(json["url"]),
|
||||
sha256: AppUpdatePlatformSpecific.fromJson(json["sha256"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"changelog": changelog.toJson(),
|
||||
"build": build.toJson(),
|
||||
"url": url.toJson(),
|
||||
"sha256": sha256.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user