mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-07 18:02:48 +08:00
tmp commit
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
9448e35b46
commit
3fd1da05f4
@ -625,7 +625,7 @@ _connectDialog(
|
||||
osAccountWidget(),
|
||||
osUsernameController == null || passwordController == null
|
||||
? Offstage()
|
||||
: Container(height: 10),
|
||||
: Container(height: 12),
|
||||
passwdWidget(),
|
||||
]),
|
||||
actions: [
|
||||
|
@ -639,7 +639,7 @@ class _ControlMenu extends StatelessWidget {
|
||||
ffi: ffi,
|
||||
menuChildren: [
|
||||
requestElevation(),
|
||||
osPassword(),
|
||||
ffi.ffiModel.pi.is_headless ? osAccount() : osPassword(),
|
||||
transferFile(context),
|
||||
tcpTunneling(context),
|
||||
note(),
|
||||
@ -662,6 +662,72 @@ class _ControlMenu extends StatelessWidget {
|
||||
onPressed: () => showRequestElevationDialog(id, ffi.dialogManager));
|
||||
}
|
||||
|
||||
osAccount() {
|
||||
return _MenuItemButton(
|
||||
child: Text(translate('OS Account')),
|
||||
trailingIcon: Transform.scale(scale: 0.8, child: Icon(Icons.edit)),
|
||||
ffi: ffi,
|
||||
onPressed: () => _showSetOSAccount(id, false, ffi.dialogManager));
|
||||
}
|
||||
|
||||
_showSetOSAccount(
|
||||
String id, bool login, OverlayDialogManager dialogManager) async {
|
||||
final usernameController = TextEditingController();
|
||||
final passwdController = TextEditingController();
|
||||
var username =
|
||||
await bind.sessionGetOption(id: id, arg: 'os-username') ?? '';
|
||||
var password =
|
||||
await bind.sessionGetOption(id: id, arg: 'os-password') ?? '';
|
||||
usernameController.text = username;
|
||||
passwdController.text = password;
|
||||
dialogManager.show((setState, close) {
|
||||
submit() {
|
||||
final username = usernameController.text.trim();
|
||||
final password = usernameController.text.trim();
|
||||
bind.sessionPeerOption(id: id, name: 'os-username', value: username);
|
||||
bind.sessionPeerOption(id: id, name: 'os-password', value: password);
|
||||
close();
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.password_rounded, color: MyTheme.accent),
|
||||
Text(translate('OS Password')).paddingOnly(left: 10),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DialogTextField(
|
||||
title: translate(DialogTextField.kUsernameTitle),
|
||||
controller: usernameController,
|
||||
prefixIcon: DialogTextField.kUsernameIcon,
|
||||
errorText: null,
|
||||
),
|
||||
PasswordWidget(controller: passwdController),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
dialogButton(
|
||||
"Cancel",
|
||||
icon: Icon(Icons.close_rounded),
|
||||
onPressed: close,
|
||||
isOutline: true,
|
||||
),
|
||||
dialogButton(
|
||||
"OK",
|
||||
icon: Icon(Icons.done_rounded),
|
||||
onPressed: submit,
|
||||
),
|
||||
],
|
||||
onSubmit: submit,
|
||||
onCancel: close,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
osPassword() {
|
||||
return _MenuItemButton(
|
||||
child: Text(translate('OS Password')),
|
||||
|
@ -1725,6 +1725,7 @@ class PeerInfo {
|
||||
Map<String, dynamic> platform_additions = {};
|
||||
|
||||
bool get is_wayland => platform_additions['is_wayland'] == true;
|
||||
bool get is_headless => platform_additions['headless'] == true;
|
||||
}
|
||||
|
||||
const canvasKey = 'canvas';
|
||||
|
@ -54,12 +54,12 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("empty_address_book_tip", "Oh dear, it appears that there are currently no peers listed in your address book."),
|
||||
("identical_file_tip", "This file is identical with the peer's one."),
|
||||
("show_monitors_tip", "Show monitors in toolbar."),
|
||||
("enter_rustdesk_passwd_tip", "Enter RustDesk password."),
|
||||
("remember_rustdesk_passwd_tip", "Remember RustDesk password."),
|
||||
("login_linux_tip", "Login to remote Linux account."),
|
||||
("login_linux_tooltip_tip", "You need to login to remote Linux account to enable a X desktop session."),
|
||||
("verify_rustdesk_password_tip", "Veryfy RustDesk password."),
|
||||
("remember_account_tip", "Remember this account."),
|
||||
("remember_password_tip", "Remember password."),
|
||||
("enter_rustdesk_passwd_tip", "Enter RustDesk password"),
|
||||
("remember_rustdesk_passwd_tip", "Remember RustDesk password"),
|
||||
("login_linux_tip", "Login to remote Linux account"),
|
||||
("login_linux_tooltip_tip", "You need to login to remote Linux account to enable a X desktop session"),
|
||||
("verify_rustdesk_password_tip", "Veryfy RustDesk password"),
|
||||
("remember_account_tip", "Remember this account"),
|
||||
("remember_password_tip", "Remember password"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -80,6 +80,15 @@ pub fn try_start_x_session(username: &str, password: &str) -> ResultType<(String
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_headless() -> bool {
|
||||
DESKTOP_MANAGER
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.map_or(false, |manager| manager.x11_username.is_empty())
|
||||
}
|
||||
|
||||
pub fn get_username() -> String {
|
||||
match &*DESKTOP_MANAGER.lock().unwrap() {
|
||||
Some(manager) => {
|
||||
|
@ -3,6 +3,8 @@ use super::{input_service::*, *};
|
||||
use crate::clipboard_file::*;
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use crate::common::update_clipboard;
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::platform::linux_desktop_manager;
|
||||
#[cfg(windows)]
|
||||
use crate::portable_service::client as portable_client;
|
||||
use crate::{
|
||||
@ -866,6 +868,9 @@ impl Connection {
|
||||
if crate::platform::current_is_wayland() {
|
||||
platform_additions.insert("is_wayland".into(), json!(true));
|
||||
}
|
||||
if linux_desktop_manager::is_headless() {
|
||||
platform_additions.insert("headless".into(), json!(true));
|
||||
}
|
||||
if !platform_additions.is_empty() {
|
||||
pi.platform_additions =
|
||||
serde_json::to_string(&platform_additions).unwrap_or("".into());
|
||||
@ -1074,7 +1079,7 @@ impl Connection {
|
||||
fn try_start_desktop(_username: &str, _passsword: &str) -> String {
|
||||
#[cfg(target_os = "linux")]
|
||||
if _username.is_empty() {
|
||||
let username = crate::platform::linux_desktop_manager::get_username();
|
||||
let username = linux_desktop_manager::get_username();
|
||||
if username.is_empty() {
|
||||
LOGIN_MSG_XSESSION_NOT_READY
|
||||
} else {
|
||||
@ -1082,8 +1087,7 @@ impl Connection {
|
||||
}
|
||||
.to_owned()
|
||||
} else {
|
||||
match crate::platform::linux_desktop_manager::try_start_x_session(_username, _passsword)
|
||||
{
|
||||
match linux_desktop_manager::try_start_x_session(_username, _passsword) {
|
||||
Ok((username, x11_ready)) => {
|
||||
if x11_ready {
|
||||
if _username != username {
|
||||
|
Loading…
Reference in New Issue
Block a user