mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
fix & opt
- fix docker not found regexp - use en_US in docker cmd -
This commit is contained in:
@@ -4,6 +4,7 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:toolbox/core/extension/stringx.dart';
|
||||
import 'package:toolbox/core/extension/uint8list.dart';
|
||||
import 'package:toolbox/core/provider_base.dart';
|
||||
import 'package:toolbox/data/model/apt/upgrade_pkg_info.dart';
|
||||
@@ -101,7 +102,7 @@ class AptProvider extends BusyProvider {
|
||||
onUpdate!();
|
||||
});
|
||||
await session.done;
|
||||
return await client!.run('apt list --upgradeable').string;
|
||||
return await client!.run('apt list --upgradeable'.withLangExport).string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:toolbox/core/extension/stringx.dart';
|
||||
import 'package:toolbox/core/extension/uint8list.dart';
|
||||
import 'package:toolbox/core/provider_base.dart';
|
||||
import 'package:toolbox/data/model/docker/ps.dart';
|
||||
|
||||
final dockerNotFound = RegExp('(command not found | Unknown command)');
|
||||
final dockerNotFound = RegExp(r'command not found|Unknown command');
|
||||
|
||||
class DockerProvider extends BusyProvider {
|
||||
SSHClient? client;
|
||||
@@ -29,7 +30,8 @@ class DockerProvider extends BusyProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
final verRaw = await client!.run('docker version').string;
|
||||
final verRaw = await client!.run('docker version'.withLangExport).string;
|
||||
print(verRaw);
|
||||
if (verRaw.contains(dockerNotFound)) {
|
||||
error = 'docker not found';
|
||||
notifyListeners();
|
||||
@@ -39,16 +41,18 @@ class DockerProvider extends BusyProvider {
|
||||
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').string;
|
||||
final raw = await client!.run('docker ps -a'.withLangExport).string;
|
||||
final lines = raw.split('\n');
|
||||
lines.removeAt(0);
|
||||
lines.removeWhere((element) => element.isEmpty);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 129;
|
||||
static const int build = 133;
|
||||
static const String engine =
|
||||
"Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5464c5bac7 (3 weeks ago) • 2022-04-18 09:55:37 -0700\nEngine • revision 57d3bac3dd\nTools • Dart 2.16.2 • DevTools 2.9.2\n";
|
||||
static const String buildAt = "2022-05-08 08:37:10.208726";
|
||||
static const int modifications = 14;
|
||||
static const String buildAt = "2022-05-10 21:49:33.780998";
|
||||
static const int modifications = 1;
|
||||
}
|
||||
|
||||
@@ -3,3 +3,4 @@ const baseUrl = backendUrl + '/toolbox';
|
||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||
const myGithub = 'https://github.com/LollipopKit';
|
||||
const rainSunMeGithub = 'https://github.com/RainSunMe';
|
||||
const issueUrl = 'https://github.com/LollipopKit/flutter_server_box/issues';
|
||||
|
||||
Reference in New Issue
Block a user