mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
set LANG in shell
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -41,5 +41,10 @@
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>CFBundleLocalizations</key>
|
||||
<array>
|
||||
<string>en</string>
|
||||
<string>zh</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -33,10 +33,10 @@ class MyApp extends StatelessWidget {
|
||||
final textStyle = TextStyle(color: primaryColor);
|
||||
return MaterialApp(
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
title: BuildData.name,
|
||||
|
||||
@@ -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,25 +325,22 @@ 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(' ');
|
||||
split.removeWhere((e) => e == '');
|
||||
final memList = split.map((e) => int.parse(e)).toList();
|
||||
info.status.memory = Memory(
|
||||
total: memList[0],
|
||||
used: memList[1],
|
||||
free: memList[2],
|
||||
shared: memList[3],
|
||||
cache: memList[4],
|
||||
avail: memList[5]);
|
||||
break;
|
||||
}
|
||||
if (item.contains(memPrefix)) {
|
||||
found = true;
|
||||
final split = item.replaceFirst(memPrefix, '').split(' ');
|
||||
split.removeWhere((e) => e == '');
|
||||
final memList = split.map((e) => int.parse(e)).toList();
|
||||
info.status.memory = Memory(
|
||||
total: memList[0],
|
||||
used: memList[1],
|
||||
free: memList[2],
|
||||
shared: memList[3],
|
||||
cache: memList[4],
|
||||
avail: memList[5]);
|
||||
break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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) +
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -60,26 +60,22 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
widget.spi != null
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
showRoundDialog(
|
||||
context,
|
||||
'Attention',
|
||||
Text(
|
||||
s.sureToDeleteServer(widget.spi!.name)),
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_serverProvider.delServer(widget.spi!);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
s.ok,
|
||||
style: const TextStyle(color: Colors.red),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(s.cancel))
|
||||
]);
|
||||
showRoundDialog(context, 'Attention',
|
||||
Text(s.sureToDeleteServer(widget.spi!.name)), [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_serverProvider.delServer(widget.spi!);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
s.ok,
|
||||
style: const TextStyle(color: Colors.red),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(s.cancel))
|
||||
]);
|
||||
},
|
||||
icon: const Icon(Icons.delete))
|
||||
: const SizedBox()
|
||||
@@ -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,
|
||||
|
||||
@@ -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))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user