mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -598,6 +598,7 @@ class _ControlMenu extends StatelessWidget {
|
||||
hoverColor: _MenubarTheme.hoverBlueColor,
|
||||
ffi: ffi,
|
||||
menuChildren: [
|
||||
requestElevation(),
|
||||
osPassword(),
|
||||
transferFile(context),
|
||||
tcpTunneling(context),
|
||||
@@ -611,6 +612,15 @@ class _ControlMenu extends StatelessWidget {
|
||||
]);
|
||||
}
|
||||
|
||||
requestElevation() {
|
||||
final visible = ffi.elevationModel.showRequestMenu;
|
||||
if (!visible) return Offstage();
|
||||
return _MenuItemButton(
|
||||
child: Text(translate('Request Elevation')),
|
||||
ffi: ffi,
|
||||
onPressed: () => showRequestElevationDialog(id, ffi.dialogManager));
|
||||
}
|
||||
|
||||
osPassword() {
|
||||
return _MenuItemButton(
|
||||
child: Text(translate('OS Password')),
|
||||
|
||||
@@ -374,8 +374,7 @@ void showWaitUacDialog(
|
||||
));
|
||||
}
|
||||
|
||||
void _showRequestElevationDialog(
|
||||
String id, OverlayDialogManager dialogManager) {
|
||||
void showRequestElevationDialog(String id, OverlayDialogManager dialogManager) {
|
||||
RxString groupValue = ''.obs;
|
||||
RxString errUser = ''.obs;
|
||||
RxString errPwd = ''.obs;
|
||||
@@ -531,7 +530,7 @@ void showOnBlockDialog(
|
||||
dialogManager.show(tag: '$id-$type', (setState, close) {
|
||||
void submit() {
|
||||
close();
|
||||
_showRequestElevationDialog(id, dialogManager);
|
||||
showRequestElevationDialog(id, dialogManager);
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
@@ -553,7 +552,7 @@ void showElevationError(String id, String type, String title, String text,
|
||||
dialogManager.show(tag: '$id-$type', (setState, close) {
|
||||
void submit() {
|
||||
close();
|
||||
_showRequestElevationDialog(id, dialogManager);
|
||||
showRequestElevationDialog(id, dialogManager);
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
|
||||
@@ -203,6 +203,8 @@ class FfiModel with ChangeNotifier {
|
||||
final peer_id = evt['peer_id'].toString();
|
||||
await bind.sessionSwitchSides(id: peer_id);
|
||||
closeConnection(id: peer_id);
|
||||
} else if (name == 'portable_service_running') {
|
||||
parent.target?.elevationModel.onPortableServiceRunning(evt);
|
||||
} else if (name == "on_url_scheme_received") {
|
||||
final url = evt['url'].toString();
|
||||
parseRustdeskUri(url);
|
||||
@@ -439,6 +441,7 @@ class FfiModel with ChangeNotifier {
|
||||
Map<String, dynamic> features = json.decode(evt['features']);
|
||||
_pi.features.privacyMode = features['privacy_mode'] == 1;
|
||||
handleResolutions(peerId, evt["resolutions"]);
|
||||
parent.target?.elevationModel.onPeerInfo(_pi);
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -1395,6 +1398,21 @@ class RecordingModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
class ElevationModel with ChangeNotifier {
|
||||
WeakReference<FFI> parent;
|
||||
ElevationModel(this.parent);
|
||||
bool _running = false;
|
||||
bool _canElevate = false;
|
||||
bool get showRequestMenu => _canElevate && !_running;
|
||||
onPeerInfo(PeerInfo pi) {
|
||||
_canElevate = pi.platform == kPeerPlatformWindows && pi.sasEnabled == false;
|
||||
}
|
||||
|
||||
onPortableServiceRunning(Map<String, dynamic> evt) {
|
||||
_running = evt['running'] == 'true';
|
||||
}
|
||||
}
|
||||
|
||||
enum ConnType { defaultConn, fileTransfer, portForward, rdp }
|
||||
|
||||
/// Flutter state manager and data communication with the Rust core.
|
||||
@@ -1420,6 +1438,7 @@ class FFI {
|
||||
late final QualityMonitorModel qualityMonitorModel; // session
|
||||
late final RecordingModel recordingModel; // session
|
||||
late final InputModel inputModel; // session
|
||||
late final ElevationModel elevationModel; // session
|
||||
|
||||
FFI() {
|
||||
imageModel = ImageModel(WeakReference(this));
|
||||
@@ -1436,6 +1455,7 @@ class FFI {
|
||||
qualityMonitorModel = QualityMonitorModel(WeakReference(this));
|
||||
recordingModel = RecordingModel(WeakReference(this));
|
||||
inputModel = InputModel(WeakReference(this));
|
||||
elevationModel = ElevationModel(WeakReference(this));
|
||||
}
|
||||
|
||||
/// Start with the given [id]. Only transfer file if [isFileTransfer], only port forward if [isPortForward].
|
||||
|
||||
Reference in New Issue
Block a user