mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
fix docker parse error
- rootless docker socket host - version & edition
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Server Monitor & Toolbox
|
# Server Monitor & Toolbox
|
||||||
A new Flutter project which provide a chart view to display server status data and a manager toolbox.
|
A new Flutter project which provide a chart view to display server status data and a manager toolbox.
|
||||||
|
|
||||||
## Milestone
|
## Milestone
|
||||||
- [x] Status chart view
|
- [x] Status chart view
|
||||||
@@ -71,3 +71,6 @@ Please use `make.dart` to build.
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
`LGPL License. LollipopKit 2021`
|
`LGPL License. LollipopKit 2021`
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
Especially thanks to [xuty](https://github.com/xtyxtyx) and dartssh2.
|
||||||
|
|||||||
@@ -354,7 +354,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 149;
|
CURRENT_PROJECT_VERSION = 151;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -362,7 +362,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.149;
|
MARKETING_VERSION = 1.0.151;
|
||||||
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";
|
||||||
@@ -484,7 +484,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 149;
|
CURRENT_PROJECT_VERSION = 151;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -492,7 +492,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.149;
|
MARKETING_VERSION = 1.0.151;
|
||||||
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";
|
||||||
@@ -508,7 +508,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 149;
|
CURRENT_PROJECT_VERSION = 151;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.149;
|
MARKETING_VERSION = 1.0.151;
|
||||||
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";
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import 'package:toolbox/core/extension/uint8list.dart';
|
|||||||
import 'package:toolbox/core/provider_base.dart';
|
import 'package:toolbox/core/provider_base.dart';
|
||||||
import 'package:toolbox/data/model/docker/ps.dart';
|
import 'package:toolbox/data/model/docker/ps.dart';
|
||||||
|
|
||||||
final dockerNotFound = RegExp(r'command not found|Unknown command');
|
final _dockerNotFound = RegExp(r'command not found|Unknown command');
|
||||||
|
final _versionReg = RegExp(r'(Version:)\s+([0-9]+\.[0-9]+\.[0-9]+)');
|
||||||
|
final _editionReg = RegExp(r'(Client:)\s+(.+-.+)');
|
||||||
|
|
||||||
class DockerProvider extends BusyProvider {
|
class DockerProvider extends BusyProvider {
|
||||||
SSHClient? client;
|
SSHClient? client;
|
||||||
@@ -31,32 +33,30 @@ class DockerProvider extends BusyProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final verRaw = await client!.run('docker version'.withLangExport).string;
|
final verRaw = await client!.run('docker version'.withLangExport).string;
|
||||||
if (verRaw.contains(dockerNotFound)) {
|
if (verRaw.contains(_dockerNotFound)) {
|
||||||
error = 'docker not found';
|
error = 'docker not found';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final verSplit = verRaw.split('\n');
|
|
||||||
if (verSplit.length < 3) {
|
|
||||||
error = 'invalid version';
|
|
||||||
notifyListeners();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
version = verSplit[1].split(' ').last;
|
|
||||||
edition = verSplit[0].split(': ')[1];
|
|
||||||
} catch (e) {
|
|
||||||
error = e.toString();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final raw = await client!.run('docker ps -a'.withLangExport).string;
|
version = _versionReg.firstMatch(verRaw)?.group(2);
|
||||||
final lines = raw.split('\n');
|
edition = _editionReg.firstMatch(verRaw)?.group(2);
|
||||||
lines.removeAt(0);
|
|
||||||
lines.removeWhere((element) => element.isEmpty);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
final cmd = 'docker ps -a'.withLangExport;
|
||||||
|
final raw = await () async {
|
||||||
|
final raw = await client!.run(cmd).string;
|
||||||
|
if (raw.contains('permission denied')) {
|
||||||
|
return await client!
|
||||||
|
.run(
|
||||||
|
'export DOCKER_HOST=unix:///run/user/1000/docker.sock && $cmd')
|
||||||
|
.string;
|
||||||
|
}
|
||||||
|
return raw;
|
||||||
|
}();
|
||||||
|
final lines = raw.split('\n');
|
||||||
|
lines.removeAt(0);
|
||||||
|
lines.removeWhere((element) => element.isEmpty);
|
||||||
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e.toString();
|
error = e.toString();
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ const shellCmd = "export LANG=en_US.utf-8 \necho '$seperator' \n"
|
|||||||
"cat /sys/class/thermal/thermal_zone*/type \necho $seperator \n"
|
"cat /sys/class/thermal/thermal_zone*/type \necho $seperator \n"
|
||||||
"cat /sys/class/thermal/thermal_zone*/temp";
|
"cat /sys/class/thermal/thermal_zone*/temp";
|
||||||
const shellPath = '.serverbox.sh';
|
const shellPath = '.serverbox.sh';
|
||||||
const memPrefix = 'Mem:';
|
final cpuTempReg = RegExp(r'(x86_pkg_temp|cpu_thermal)');
|
||||||
final cpuTempReg = RegExp('(x86_pkg_temp|cpu_thermal)');
|
|
||||||
final numReg = RegExp(r'\s{1,}');
|
final numReg = RegExp(r'\s{1,}');
|
||||||
final memItemReg = RegExp(r'([A-Z].+:)\s+([0-9]+) kB');
|
final memItemReg = RegExp(r'([A-Z].+:)\s+([0-9]+) kB');
|
||||||
|
|
||||||
@@ -274,7 +273,11 @@ class ServerProvider extends BusyProvider {
|
|||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
return '${(int.parse(value.split('\n')[idx].trim()) / 1000).toStringAsFixed(1)}°C';
|
final valueSplited = value.split('\n');
|
||||||
|
if (idx >= valueSplited.length) return '';
|
||||||
|
final temp = int.tryParse(valueSplited[idx].trim());
|
||||||
|
if (temp == null) return '';
|
||||||
|
return '${(temp / 1000).toStringAsFixed(1)}°C';
|
||||||
}
|
}
|
||||||
|
|
||||||
void _getCPU(
|
void _getCPU(
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 149;
|
static const int build = 151;
|
||||||
static const String engine =
|
static const String engine =
|
||||||
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (5 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
|
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (10 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-25 13:35:39.361656";
|
static const String buildAt = "2022-05-30 15:20:12.101899";
|
||||||
static const int modifications = 4;
|
static const int modifications = 6;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -420,14 +420,14 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 149;
|
CURRENT_PROJECT_VERSION = 151;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.149;
|
MARKETING_VERSION = 1.0.151;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -550,14 +550,14 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 149;
|
CURRENT_PROJECT_VERSION = 151;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.149;
|
MARKETING_VERSION = 1.0.151;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@@ -574,14 +574,14 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 149;
|
CURRENT_PROJECT_VERSION = 151;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.149;
|
MARKETING_VERSION = 1.0.151;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ packages:
|
|||||||
name: dartssh2
|
name: dartssh2
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.7.0"
|
version: "2.7.1"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ dependencies:
|
|||||||
git:
|
git:
|
||||||
url: https://github.com/Countly/countly-sdk-flutter-bridge.git
|
url: https://github.com/Countly/countly-sdk-flutter-bridge.git
|
||||||
ref: master
|
ref: master
|
||||||
dartssh2: ^2.7.0
|
dartssh2: ^2.7.1
|
||||||
logging: ^1.0.2
|
logging: ^1.0.2
|
||||||
flutter_material_color_picker: ^1.1.0+2
|
flutter_material_color_picker: ^1.1.0+2
|
||||||
circle_chart:
|
circle_chart:
|
||||||
|
|||||||
Reference in New Issue
Block a user