set LANG in shell

This commit is contained in:
Junyuan Feng
2022-05-05 16:53:35 +08:00
parent 29e3ee0156
commit 74a933eb6e
12 changed files with 65 additions and 66 deletions

View File

@@ -354,7 +354,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 123;
CURRENT_PROJECT_VERSION = 125;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -362,7 +362,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.123;
MARKETING_VERSION = 1.0.125;
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 = 123;
CURRENT_PROJECT_VERSION = 125;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.123;
MARKETING_VERSION = 1.0.125;
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 = 123;
CURRENT_PROJECT_VERSION = 125;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.123;
MARKETING_VERSION = 1.0.125;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -41,5 +41,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>zh</string>
</array>
</dict>
</plist>

View File

@@ -30,7 +30,8 @@ List<SSHKeyPair> loadIndentity(String key) {
}
const seperator = 'A====A';
const shellCmd = "cat /proc/net/dev && date +%s \necho $seperator \n "
const shellCmd = "export LANG=en_US.utf-8 \necho '$seperator' \n"
"cat /proc/net/dev && date +%s \necho $seperator \n "
"cat /etc/os-release | grep PRETTY_NAME \necho $seperator \n"
"cat /proc/stat | grep cpu \necho $seperator \n"
"uptime \necho $seperator \n"
@@ -40,6 +41,7 @@ const shellCmd = "cat /proc/net/dev && date +%s \necho $seperator \n "
"cat /sys/class/thermal/thermal_zone*/type \necho $seperator \n"
"cat /sys/class/thermal/thermal_zone*/temp";
const shellPath = '.serverbox.sh';
const memPrefix = 'Mem:';
final cpuTempReg = RegExp('(x86_pkg_temp|cpu_thermal)');
class ServerProvider extends BusyProvider {
@@ -192,6 +194,7 @@ class ServerProvider extends BusyProvider {
if (si.client == null) return;
final raw = await si.client!.run("sh $shellPath").string;
final lines = raw.split(seperator).map((e) => e.trim()).toList();
lines.removeAt(0);
try {
_getCPU(spi, lines[2], lines[7], lines[8]);
@@ -322,11 +325,9 @@ class ServerProvider extends BusyProvider {
}
void _getMem(ServerPrivateInfo spi, String raw) {
const memPrefixies = ['Mem:', '内存:'];
final info = _servers.firstWhere((e) => e.info == spi);
for (var item in raw.split('\n')) {
var found = false;
for (var memPrefix in memPrefixies) {
if (item.contains(memPrefix)) {
found = true;
final split = item.replaceFirst(memPrefix, '').split(' ');
@@ -341,7 +342,6 @@ class ServerProvider extends BusyProvider {
avail: memList[5]);
break;
}
}
if (found) break;
}
}

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 123;
static const int build = 125;
static const String engine =
"Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5464c5bac7 (2 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-04 21:08:15.263486";
static const int modifications = 0;
static const String buildAt = "2022-05-05 16:11:07.575227";
static const int modifications = 2;
}

View File

@@ -247,8 +247,7 @@ class _MyHomePageState extends State<MyHomePage>
applicationIcon: _buildIcon(),
aboutBoxChildren: [
UrlText(
text: s.madeWithLove(myGithub),
replace: 'LollipopKit'),
text: s.madeWithLove(myGithub), replace: 'LollipopKit'),
UrlText(
text: s.aboutThanks(rainSunMeGithub),
replace: 'RainSunMe',

View File

@@ -75,7 +75,10 @@ class _PingPageState extends State<PingPage>
title: Text(result.serverName,
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold, color: primaryColor)),
subtitle: Text(_buildPingSummary(result, unknown, ms), style: summaryTextStyle,),
subtitle: Text(
_buildPingSummary(result, unknown, ms),
style: summaryTextStyle,
),
trailing: Text(
s.pingAvg +
(result.statistic?.avg?.toStringAsFixed(2) ?? s.unknown) +

View File

@@ -92,8 +92,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
final key = keyController.text;
final pwd = pwdController.text;
if (name.isEmpty || key.isEmpty) {
showSnackBar(
context, Text(s.fieldMustNotEmpty));
showSnackBar(context, Text(s.fieldMustNotEmpty));
return;
}
FocusScope.of(context).unfocus();

View File

@@ -60,12 +60,8 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
widget.spi != null
? IconButton(
onPressed: () {
showRoundDialog(
context,
'Attention',
Text(
s.sureToDeleteServer(widget.spi!.name)),
[
showRoundDialog(context, 'Attention',
Text(s.sureToDeleteServer(widget.spi!.name)), [
TextButton(
onPressed: () {
_serverProvider.delServer(widget.spi!);
@@ -93,8 +89,8 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
TextField(
controller: nameController,
keyboardType: TextInputType.text,
decoration:
buildDecoration(s.name, icon: Icons.info, hint: s.exampleName),
decoration: buildDecoration(s.name,
icon: Icons.info, hint: s.exampleName),
),
TextField(
controller: ipController,

View File

@@ -122,7 +122,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
TextButton(
onPressed: () async =>
await _import(_importFieldController.text.trim()),
child: Text('GO'),
child: const Text('GO'),
)
]);
}
@@ -246,11 +246,9 @@ class _SnippetListPageState extends State<SnippetListPage> {
]));
}), [
TextButton(
onPressed: () async => run(context, snippet),
child: Text(s.run)),
onPressed: () async => run(context, snippet), child: Text(s.run)),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(s.cancel)),
onPressed: () => Navigator.of(context).pop(), child: Text(s.cancel)),
]);
}
@@ -261,8 +259,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
showRoundDialog(context, s.result,
Text(result, style: const TextStyle(fontSize: 13)), [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(s.close))
onPressed: () => Navigator.of(context).pop(), child: Text(s.close))
]);
}
}