diff --git a/README.md b/README.md index 212f6814..57920c7a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- + diff --git a/assets/linux/armbian.png b/assets/linux/armbian.png new file mode 100644 index 00000000..7108b27d Binary files /dev/null and b/assets/linux/armbian.png differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0fdf60d5..7d32cfcd 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 153; + CURRENT_PROJECT_VERSION = 155; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -362,7 +362,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.153; + MARKETING_VERSION = 1.0.155; 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 = 153; + CURRENT_PROJECT_VERSION = 155; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -492,7 +492,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.153; + MARKETING_VERSION = 1.0.155; 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 = 153; + CURRENT_PROJECT_VERSION = 155; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -516,7 +516,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.153; + MARKETING_VERSION = 1.0.155; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/core/update.dart b/lib/core/update.dart index 027e3313..5d6d5f4e 100644 --- a/lib/core/update.dart +++ b/lib/core/update.dart @@ -11,14 +11,14 @@ import 'package:toolbox/data/service/app.dart'; import 'package:toolbox/generated/l10n.dart'; import 'package:toolbox/locator.dart'; -final logger = Logger('UPDATE'); +final _logger = Logger('UPDATE'); Future isFileAvailable(String url) async { try { final resp = await Dio().head(url); return resp.statusCode == 200; } catch (e) { - logger.warning('update file not available: $e'); + _logger.warning('update file not available: $e'); return false; } } @@ -40,11 +40,11 @@ Future doUpdate(BuildContext context, {bool force = false}) async { }(); if (!force && newest <= BuildData.build) { - logger.info('Update ignored due to current: ${BuildData.build}, ' + _logger.info('Update ignored due to current: ${BuildData.build}, ' 'update: $newest'); return; } - logger.info('Update available: $newest'); + _logger.info('Update available: $newest'); if (Platform.isAndroid && !await isFileAvailable(update.android)) { return; diff --git a/lib/data/model/distribution.dart b/lib/data/model/distribution.dart index c86045d1..61e18443 100644 --- a/lib/data/model/distribution.dart +++ b/lib/data/model/distribution.dart @@ -9,8 +9,10 @@ const debianDistList = [ 'ubuntu', 'linuxmint', 'elementary', - 'raspbian' + 'raspbian', + 'armbian' ]; + const rehlDistList = [ 'redhat', 'fedora', diff --git a/lib/data/model/server/cpu_2_status.dart b/lib/data/model/server/cpu_2_status.dart index 4888822b..c3107ca2 100644 --- a/lib/data/model/server/cpu_2_status.dart +++ b/lib/data/model/server/cpu_2_status.dart @@ -1,53 +1,53 @@ import 'package:toolbox/data/model/server/cpu_status.dart'; class Cpu2Status { - List pre; - List now; + List _pre; + List _now; String temp; - Cpu2Status(this.pre, this.now, this.temp); + Cpu2Status(this._pre, this._now, this.temp); double usedPercent({int coreIdx = 0}) { - if (now.length != pre.length) return 0; - final idleDelta = now[coreIdx].idle - pre[coreIdx].idle; - final totalDelta = now[coreIdx].total - pre[coreIdx].total; + if (_now.length != _pre.length) return 0; + final idleDelta = _now[coreIdx].idle - _pre[coreIdx].idle; + final totalDelta = _now[coreIdx].total - _pre[coreIdx].total; final used = idleDelta / totalDelta; return used.isNaN ? 0 : 100 - used * 100; } void update(List newStatus, String newTemp) { - pre = now; - now = newStatus; + _pre = _now; + _now = newStatus; temp = newTemp; } - int get coresCount => now.length; + int get coresCount => _now.length; - int get totalDelta => now[0].total - pre[0].total; + int get totalDelta => _now[0].total - _pre[0].total; double get user { - if (now.length != pre.length) return 0; - final delta = now[0].user - pre[0].user; + if (_now.length != _pre.length) return 0; + final delta = _now[0].user - _pre[0].user; final used = delta / totalDelta; return used.isNaN ? 0 : used * 100; } double get sys { - if (now.length != pre.length) return 0; - final delta = now[0].sys - pre[0].sys; + if (_now.length != _pre.length) return 0; + final delta = _now[0].sys - _pre[0].sys; final used = delta / totalDelta; return used.isNaN ? 0 : used * 100; } double get nice { - if (now.length != pre.length) return 0; - final delta = now[0].nice - pre[0].nice; + if (_now.length != _pre.length) return 0; + final delta = _now[0].nice - _pre[0].nice; final used = delta / totalDelta; return used.isNaN ? 0 : used * 100; } double get iowait { - if (now.length != pre.length) return 0; - final delta = now[0].iowait - pre[0].iowait; + if (_now.length != _pre.length) return 0; + final delta = _now[0].iowait - _pre[0].iowait; final used = delta / totalDelta; return used.isNaN ? 0 : used * 100; } diff --git a/lib/data/model/server/linux_icon.dart b/lib/data/model/server/linux_icon.dart deleted file mode 100644 index 522cffcb..00000000 --- a/lib/data/model/server/linux_icon.dart +++ /dev/null @@ -1,14 +0,0 @@ -class LinuxIcons { - List db; - - LinuxIcons(this.db); - - String? search(String sysVer) { - for (var item in db) { - if (sysVer.toLowerCase().contains(item)) { - return 'assets/linux/$item.png'; - } - } - return null; - } -} diff --git a/lib/data/model/server/net_speed.dart b/lib/data/model/server/net_speed.dart index fb79a2a2..66596aaa 100644 --- a/lib/data/model/server/net_speed.dart +++ b/lib/data/model/server/net_speed.dart @@ -9,46 +9,46 @@ class NetSpeedPart { } class NetSpeed { - List old; - List now; - NetSpeed(this.old, this.now); + List _old; + List _now; + NetSpeed(this._old, this._now); List get devices { final devices = []; - for (var item in now) { + for (var item in _now) { devices.add(item.device); } return devices; } void update(List newOne) { - old = now; - now = newOne; + _old = _now; + _now = newOne; } - int get timeDiff => now[0].time - old[0].time; + int get timeDiff => _now[0].time - _old[0].time; String speedIn({String? device}) { - if (old[0].device == '' || now[0].device == '') return '0kb/s'; + if (_old[0].device == '' || _now[0].device == '') return '0kb/s'; final idx = deviceIdx(device); final speedInBytesPerSecond = - (now[idx].bytesIn - old[idx].bytesIn) / timeDiff; + (_now[idx].bytesIn - _old[idx].bytesIn) / timeDiff; return buildStandardOutput(speedInBytesPerSecond); } String speedOut({String? device}) { - if (old[0].device == '' || now[0].device == '') return '0kb/s'; + if (_old[0].device == '' || _now[0].device == '') return '0kb/s'; final idx = deviceIdx(device); final speedOutBytesPerSecond = - (now[idx].bytesOut - old[idx].bytesOut) / timeDiff; + (_now[idx].bytesOut - _old[idx].bytesOut) / timeDiff; return buildStandardOutput(speedOutBytesPerSecond); } int deviceIdx(String? device) { if (device != null) { - for (var item in now) { + for (var item in _now) { if (item.device == device) { - return now.indexOf(item); + return _now.indexOf(item); } } } diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 7a92a31e..e191bb17 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,9 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 154; + static const int build = 155; static const String engine = - "Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision eb6d86ee27 (2 weeks ago) • 2022-10-04 22:31:45 -0700\nEngine • revision c08d7d5efc\nTools • Dart 2.18.2 • DevTools 2.15.0\n"; - static const String buildAt = "2022-10-21 17:29:42.809139"; - static const int modifications = 9; + "Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision eb6d86ee27 (4 weeks ago) • 2022-10-04 22:31:45 -0700\nEngine • revision c08d7d5efc\nTools • Dart 2.18.2 • DevTools 2.15.0\n"; + static const String buildAt = "2022-11-05 21:49:47.105329"; + static const int modifications = 0; } diff --git a/lib/data/res/icon/linux_icons.dart b/lib/data/res/icon/linux_icons.dart index 1dbe6a87..17b8ae5c 100644 --- a/lib/data/res/icon/linux_icons.dart +++ b/lib/data/res/icon/linux_icons.dart @@ -1,5 +1,3 @@ -import 'package:toolbox/data/model/server/linux_icon.dart'; - final linuxIcons = LinuxIcons([ 'ubuntu', 'arch', @@ -8,5 +6,21 @@ final linuxIcons = LinuxIcons([ 'fedora', 'opensuse', 'kali', - 'wrt' + 'wrt', + 'armbian' ]); + +class LinuxIcons { + List db; + + LinuxIcons(this.db); + + String? search(String sysVer) { + for (var item in db) { + if (sysVer.toLowerCase().contains(item)) { + return 'assets/linux/$item.png'; + } + } + return null; + } +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index c6f5ce2b..80b7216b 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -420,14 +420,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 153; + CURRENT_PROJECT_VERSION = 155; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.153; + MARKETING_VERSION = 1.0.155; 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 = 153; + CURRENT_PROJECT_VERSION = 155; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.153; + MARKETING_VERSION = 1.0.155; 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 = 153; + CURRENT_PROJECT_VERSION = 155; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.153; + MARKETING_VERSION = 1.0.155; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; diff --git a/pubspec.yaml b/pubspec.yaml index ceed9251..9e1e6aaa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -94,6 +94,7 @@ flutter: - assets/linux/fedora.png - assets/linux/opensuse.png - assets/linux/wrt.png + - assets/linux/armbian.png # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see