new: shutdown | reboot on rootless user
This commit is contained in:
@@ -2,19 +2,24 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
import 'package:toolbox/core/extension/uint8list.dart';
|
import 'package:toolbox/core/extension/uint8list.dart';
|
||||||
|
import 'package:toolbox/core/utils/ui.dart';
|
||||||
|
|
||||||
typedef OnStd = void Function(String data, StreamSink<Uint8List> sink);
|
import '../../data/res/misc.dart';
|
||||||
typedef OnStdin = void Function(StreamSink<Uint8List> sink);
|
|
||||||
|
typedef _OnStdout = void Function(String data, StreamSink<Uint8List> sink);
|
||||||
|
typedef _OnStdin = void Function(StreamSink<Uint8List> sink);
|
||||||
|
|
||||||
typedef PwdRequestFunc = Future<String?> Function(String? user);
|
typedef PwdRequestFunc = Future<String?> Function(String? user);
|
||||||
|
|
||||||
extension SSHClientX on SSHClient {
|
extension SSHClientX on SSHClient {
|
||||||
Future<int?> exec(
|
Future<int?> exec(
|
||||||
String cmd, {
|
String cmd, {
|
||||||
OnStd? onStderr,
|
_OnStdout? onStderr,
|
||||||
OnStd? onStdout,
|
_OnStdout? onStdout,
|
||||||
OnStdin? stdin,
|
_OnStdin? stdin,
|
||||||
}) async {
|
}) async {
|
||||||
final session = await execute(cmd);
|
final session = await execute(cmd);
|
||||||
|
|
||||||
@@ -49,4 +54,33 @@ extension SSHClientX on SSHClient {
|
|||||||
session.close();
|
session.close();
|
||||||
return session.exitCode;
|
return session.exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<int?> execWithPwd(
|
||||||
|
String cmd, {
|
||||||
|
BuildContext? context,
|
||||||
|
_OnStdout? onStdout,
|
||||||
|
_OnStdout? onStderr,
|
||||||
|
_OnStdin? stdin,
|
||||||
|
}) async {
|
||||||
|
var isRequestingPwd = false;
|
||||||
|
return await exec(
|
||||||
|
cmd,
|
||||||
|
onStderr: (data, sink) async {
|
||||||
|
onStderr?.call(data, sink);
|
||||||
|
if (isRequestingPwd) return;
|
||||||
|
isRequestingPwd = true;
|
||||||
|
if (data.contains('[sudo] password for ')) {
|
||||||
|
final user = pwdRequestWithUserReg.firstMatch(data)?.group(1);
|
||||||
|
if (context == null) return;
|
||||||
|
final pwd = await showPwdDialog(context, user);
|
||||||
|
if (pwd == null || pwd.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sink.add('$pwd\n'.uint8List);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onStdout: onStdout,
|
||||||
|
stdin: stdin,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:toolbox/core/extension/context.dart';
|
import 'package:toolbox/core/extension/context.dart';
|
||||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
|
||||||
import 'package:toolbox/data/model/app/tab.dart';
|
import 'package:toolbox/data/model/app/tab.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import '../../data/model/server/snippet.dart';
|
import '../../data/model/server/snippet.dart';
|
||||||
import '../../data/provider/snippet.dart';
|
import '../../data/provider/snippet.dart';
|
||||||
import '../../data/res/misc.dart';
|
|
||||||
import '../../data/res/ui.dart';
|
import '../../data/res/ui.dart';
|
||||||
import '../../locator.dart';
|
import '../../locator.dart';
|
||||||
import '../../view/widget/input_field.dart';
|
import '../../view/widget/input_field.dart';
|
||||||
@@ -97,21 +95,6 @@ Future<String?> showPwdDialog(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> onPwd(
|
|
||||||
String event,
|
|
||||||
StreamSink<Uint8List> stdin,
|
|
||||||
PwdRequestFunc? onPwdReq,
|
|
||||||
) async {
|
|
||||||
if (event.contains('[sudo] password for ')) {
|
|
||||||
final user = pwdRequestWithUserReg.firstMatch(event)?.group(1);
|
|
||||||
final pwd = await onPwdReq?.call(user);
|
|
||||||
if (pwd == null || pwd.isEmpty) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
stdin.add('$pwd\n'.uint8List);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildSwitch(
|
Widget buildSwitch(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
StorePropertyBase<bool> prop, {
|
StorePropertyBase<bool> prop, {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ enum AppShellFuncType {
|
|||||||
status,
|
status,
|
||||||
docker,
|
docker,
|
||||||
process,
|
process,
|
||||||
|
shutdown,
|
||||||
|
reboot,
|
||||||
;
|
;
|
||||||
|
|
||||||
String get flag {
|
String get flag {
|
||||||
@@ -21,6 +23,10 @@ enum AppShellFuncType {
|
|||||||
return 'd';
|
return 'd';
|
||||||
case AppShellFuncType.process:
|
case AppShellFuncType.process:
|
||||||
return 'p';
|
return 'p';
|
||||||
|
case AppShellFuncType.shutdown:
|
||||||
|
return 'sd';
|
||||||
|
case AppShellFuncType.reboot:
|
||||||
|
return 'r';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +42,10 @@ enum AppShellFuncType {
|
|||||||
return 'dockeR';
|
return 'dockeR';
|
||||||
case AppShellFuncType.process:
|
case AppShellFuncType.process:
|
||||||
return 'process';
|
return 'process';
|
||||||
|
case AppShellFuncType.shutdown:
|
||||||
|
return 'ShutDown';
|
||||||
|
case AppShellFuncType.reboot:
|
||||||
|
return 'Reboot';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,10 +78,24 @@ else
|
|||||||
\tps -ax
|
\tps -ax
|
||||||
fi
|
fi
|
||||||
''';
|
''';
|
||||||
|
case AppShellFuncType.shutdown:
|
||||||
|
return '''
|
||||||
|
if [ "\$userId" = "0" ]; then
|
||||||
|
\tshutdown -h now
|
||||||
|
else
|
||||||
|
\tsudo -S shutdown -h now
|
||||||
|
fi''';
|
||||||
|
case AppShellFuncType.reboot:
|
||||||
|
return '''
|
||||||
|
if [ "\$userId" = "0" ]; then
|
||||||
|
\treboot
|
||||||
|
else
|
||||||
|
\tsudo -S reboot
|
||||||
|
fi''';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String get shellScript {
|
static final String shellScript = () {
|
||||||
final sb = StringBuffer();
|
final sb = StringBuffer();
|
||||||
// Write each func
|
// Write each func
|
||||||
for (final func in values) {
|
for (final func in values) {
|
||||||
@@ -98,7 +122,7 @@ ${func.cmd}
|
|||||||
;;
|
;;
|
||||||
esac''');
|
esac''');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
extension EnumX on Enum {
|
extension EnumX on Enum {
|
||||||
@@ -196,6 +220,7 @@ export LANG=en_US.UTF-8
|
|||||||
isLinux=\$(uname 2>&1 | grep "Linux")
|
isLinux=\$(uname 2>&1 | grep "Linux")
|
||||||
# Link /bin/sh to busybox?
|
# Link /bin/sh to busybox?
|
||||||
isBusybox=\$(ls -l /bin/sh | grep "busybox")
|
isBusybox=\$(ls -l /bin/sh | grep "busybox")
|
||||||
|
userId=\$(id -u)
|
||||||
|
|
||||||
${AppShellFuncType.shellScript}
|
${AppShellFuncType.shellScript}
|
||||||
""";
|
""";
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
import 'package:toolbox/core/utils/ui.dart';
|
|
||||||
import 'package:toolbox/data/model/app/shell_func.dart';
|
import 'package:toolbox/data/model/app/shell_func.dart';
|
||||||
import 'package:toolbox/data/model/docker/image.dart';
|
import 'package:toolbox/data/model/docker/image.dart';
|
||||||
import 'package:toolbox/data/model/docker/ps.dart';
|
import 'package:toolbox/data/model/docker/ps.dart';
|
||||||
@@ -34,34 +32,33 @@ class DockerProvider extends ChangeNotifier {
|
|||||||
String? version;
|
String? version;
|
||||||
String? edition;
|
String? edition;
|
||||||
DockerErr? error;
|
DockerErr? error;
|
||||||
PwdRequestFunc? onPwdReq;
|
|
||||||
String? hostId;
|
String? hostId;
|
||||||
String? runLog;
|
String? runLog;
|
||||||
bool isRequestingPwd = false;
|
BuildContext? context;
|
||||||
|
|
||||||
void init(
|
void init(
|
||||||
SSHClient client,
|
SSHClient client,
|
||||||
String userName,
|
String userName,
|
||||||
PwdRequestFunc onPwdReq,
|
PwdRequestFunc onPwdReq,
|
||||||
String hostId,
|
String hostId,
|
||||||
|
BuildContext context,
|
||||||
) {
|
) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.onPwdReq = onPwdReq;
|
this.context = context;
|
||||||
this.hostId = hostId;
|
this.hostId = hostId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
client = userName = error = items = version = edition = onPwdReq = null;
|
client = userName = error = items = version = edition = context = null;
|
||||||
isRequestingPwd = false;
|
|
||||||
hostId = runLog = images = null;
|
hostId = runLog = images = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
var raw = '';
|
var raw = '';
|
||||||
await client!.exec(
|
await client!.execWithPwd(
|
||||||
AppShellFuncType.docker.exec,
|
AppShellFuncType.docker.exec,
|
||||||
onStderr: _onPwd,
|
context: context,
|
||||||
onStdout: (data, _) => raw = '$raw$data',
|
onStdout: (data, _) => raw = '$raw$data',
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -145,13 +142,6 @@ class DockerProvider extends ChangeNotifier {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onPwd(String event, StreamSink<Uint8List> stdin) async {
|
|
||||||
if (isRequestingPwd) return;
|
|
||||||
isRequestingPwd = true;
|
|
||||||
await onPwd(event, stdin, onPwdReq);
|
|
||||||
isRequestingPwd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<DockerErr?> stop(String id) async => await run('docker stop $id');
|
Future<DockerErr?> stop(String id) async => await run('docker stop $id');
|
||||||
|
|
||||||
Future<DockerErr?> start(String id) async => await run('docker start $id');
|
Future<DockerErr?> start(String id) async => await run('docker start $id');
|
||||||
@@ -168,16 +158,14 @@ class DockerProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
runLog = '';
|
runLog = '';
|
||||||
final errs = <String>[];
|
final errs = <String>[];
|
||||||
final code = await client!.exec(
|
final code = await client!.execWithPwd(
|
||||||
_wrap(cmd),
|
_wrap(cmd),
|
||||||
onStderr: (data, sink) {
|
context: context,
|
||||||
_onPwd(data, sink);
|
|
||||||
errs.add(data);
|
|
||||||
},
|
|
||||||
onStdout: (data, _) {
|
onStdout: (data, _) {
|
||||||
runLog = '$runLog$data';
|
runLog = '$runLog$data';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
},
|
},
|
||||||
|
onStderr: (data, _) => errs.add(data),
|
||||||
);
|
);
|
||||||
runLog = null;
|
runLog = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
import 'package:toolbox/core/extension/uint8list.dart';
|
import 'package:toolbox/core/extension/uint8list.dart';
|
||||||
import 'package:toolbox/core/utils/ui.dart';
|
|
||||||
import 'package:toolbox/data/model/pkg/manager.dart';
|
import 'package:toolbox/data/model/pkg/manager.dart';
|
||||||
import 'package:toolbox/data/model/pkg/upgrade_info.dart';
|
import 'package:toolbox/data/model/pkg/upgrade_info.dart';
|
||||||
import 'package:toolbox/data/model/server/dist.dart';
|
import 'package:toolbox/data/model/server/dist.dart';
|
||||||
@@ -19,7 +17,7 @@ class PkgProvider extends ChangeNotifier {
|
|||||||
PkgManager? type;
|
PkgManager? type;
|
||||||
Function()? onUpgrade;
|
Function()? onUpgrade;
|
||||||
Function()? onUpdate;
|
Function()? onUpdate;
|
||||||
PwdRequestFunc? onPasswordRequest;
|
BuildContext? context;
|
||||||
|
|
||||||
String? whoami;
|
String? whoami;
|
||||||
List<UpgradePkgInfo>? upgradeable;
|
List<UpgradePkgInfo>? upgradeable;
|
||||||
@@ -27,20 +25,18 @@ class PkgProvider extends ChangeNotifier {
|
|||||||
String? upgradeLog;
|
String? upgradeLog;
|
||||||
String? updateLog;
|
String? updateLog;
|
||||||
String lastLog = '';
|
String lastLog = '';
|
||||||
bool isRequestingPwd = false;
|
|
||||||
|
|
||||||
Future<void> init(
|
Future<void> init(
|
||||||
SSHClient client,
|
SSHClient client,
|
||||||
Dist? dist,
|
Dist? dist,
|
||||||
Function() onUpgrade,
|
Function() onUpgrade,
|
||||||
Function() onUpdate,
|
Function() onUpdate,
|
||||||
PwdRequestFunc onPasswordRequest,
|
|
||||||
String user,
|
String user,
|
||||||
|
BuildContext context,
|
||||||
) async {
|
) async {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.dist = dist;
|
this.dist = dist;
|
||||||
this.onUpgrade = onUpgrade;
|
this.onUpgrade = onUpgrade;
|
||||||
this.onPasswordRequest = onPasswordRequest;
|
|
||||||
whoami = user;
|
whoami = user;
|
||||||
|
|
||||||
type = fromDist(dist);
|
type = fromDist(dist);
|
||||||
@@ -52,9 +48,8 @@ class PkgProvider extends ChangeNotifier {
|
|||||||
bool get isSU => whoami == 'root';
|
bool get isSU => whoami == 'root';
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
client = dist = updateLog = upgradeLog = upgradeable =
|
client = dist = updateLog = upgradeLog =
|
||||||
error = whoami = onUpdate = onUpgrade = onPasswordRequest = null;
|
upgradeable = error = whoami = onUpdate = onUpgrade = context = null;
|
||||||
isRequestingPwd = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
@@ -78,9 +73,9 @@ class PkgProvider extends ChangeNotifier {
|
|||||||
Future<String?> _update() async {
|
Future<String?> _update() async {
|
||||||
final updateCmd = type?.update;
|
final updateCmd = type?.update;
|
||||||
if (updateCmd != null) {
|
if (updateCmd != null) {
|
||||||
await client!.exec(
|
await client!.execWithPwd(
|
||||||
_wrap(updateCmd),
|
_wrap(updateCmd),
|
||||||
onStderr: _onPwd,
|
context: context,
|
||||||
onStdout: (data, sink) {
|
onStdout: (data, sink) {
|
||||||
updateLog = (updateLog ?? '') + data;
|
updateLog = (updateLog ?? '') + data;
|
||||||
if (onUpdate != null) onUpdate!();
|
if (onUpdate != null) onUpdate!();
|
||||||
@@ -105,9 +100,9 @@ class PkgProvider extends ChangeNotifier {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await client!.exec(
|
await client!.execWithPwd(
|
||||||
_wrap(upgradeCmd),
|
_wrap(upgradeCmd),
|
||||||
onStderr: _onPwd,
|
context: context,
|
||||||
onStdout: (log, sink) {
|
onStdout: (log, sink) {
|
||||||
if (lastLog == log.trim()) return;
|
if (lastLog == log.trim()) return;
|
||||||
upgradeLog = (upgradeLog ?? '') + log;
|
upgradeLog = (upgradeLog ?? '') + log;
|
||||||
@@ -121,13 +116,6 @@ class PkgProvider extends ChangeNotifier {
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onPwd(String event, StreamSink<Uint8List> stdin) async {
|
|
||||||
if (isRequestingPwd) return;
|
|
||||||
isRequestingPwd = true;
|
|
||||||
await onPwd(event, stdin, onPasswordRequest);
|
|
||||||
isRequestingPwd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _wrap(String cmd) =>
|
String _wrap(String cmd) =>
|
||||||
'export LANG=en_US.utf-8 && ${isSU ? "" : "sudo -S "}$cmd';
|
'export LANG=en_US.utf-8 && ${isSU ? "" : "sudo -S "}$cmd';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
widget.spi.user,
|
widget.spi.user,
|
||||||
(user) async => await showPwdDialog(context, user),
|
(user) async => await showPwdDialog(context, user),
|
||||||
widget.spi.id,
|
widget.spi.id,
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:provider/provider.dart';
|
|||||||
|
|
||||||
import '../../data/model/pkg/upgrade_info.dart';
|
import '../../data/model/pkg/upgrade_info.dart';
|
||||||
import '../../data/model/server/dist.dart';
|
import '../../data/model/server/dist.dart';
|
||||||
import '../../core/utils/ui.dart';
|
|
||||||
import '../../data/model/server/server_private_info.dart';
|
import '../../data/model/server/server_private_info.dart';
|
||||||
import '../../data/provider/pkg.dart';
|
import '../../data/provider/pkg.dart';
|
||||||
import '../../data/provider/server.dart';
|
import '../../data/provider/server.dart';
|
||||||
@@ -61,8 +60,8 @@ class _PkgManagePageState extends State<PkgPage>
|
|||||||
_scrollController.jumpTo(_scrollController.position.maxScrollExtent),
|
_scrollController.jumpTo(_scrollController.position.maxScrollExtent),
|
||||||
() => _scrollControllerUpdate
|
() => _scrollControllerUpdate
|
||||||
.jumpTo(_scrollController.position.maxScrollExtent),
|
.jumpTo(_scrollController.position.maxScrollExtent),
|
||||||
(user) async => await showPwdDialog(context, user),
|
|
||||||
widget.spi.user,
|
widget.spi.user,
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
_pkgProvider.refresh();
|
_pkgProvider.refresh();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/extension/media_queryx.dart';
|
import 'package:toolbox/core/extension/media_queryx.dart';
|
||||||
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
|
import 'package:toolbox/data/model/app/shell_func.dart';
|
||||||
|
|
||||||
import '../../../core/route.dart';
|
import '../../../core/route.dart';
|
||||||
import '../../../core/utils/misc.dart';
|
import '../../../core/utils/misc.dart';
|
||||||
@@ -244,13 +246,18 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
// TODO: sudo | on pwd request
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => srv.client?.run('shutdown -h now'),
|
onPressed: () => srv.client?.execWithPwd(
|
||||||
|
AppShellFuncType.shutdown.cmd,
|
||||||
|
context: context,
|
||||||
|
),
|
||||||
icon: const Icon(Icons.power_off),
|
icon: const Icon(Icons.power_off),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => srv.client?.run('reboot'),
|
onPressed: () => srv.client?.execWithPwd(
|
||||||
|
AppShellFuncType.reboot.cmd,
|
||||||
|
context: context,
|
||||||
|
),
|
||||||
icon: const Icon(Icons.refresh),
|
icon: const Icon(Icons.refresh),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
|||||||
Reference in New Issue
Block a user