fix: connection text in client now

This commit is contained in:
Kingtous 2023-04-17 20:49:37 +08:00
parent 83e63d57e1
commit f0b532426f
4 changed files with 12 additions and 12 deletions

View file

@ -1,5 +1,5 @@
use super::{linux::*, ResultType}; use super::{linux::*, ResultType};
use crate::server::{ use crate::client::{
LOGIN_MSG_DESKTOP_NO_DESKTOP, LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER, LOGIN_MSG_DESKTOP_NO_DESKTOP, LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER,
LOGIN_MSG_DESKTOP_SESSION_NOT_READY, LOGIN_MSG_DESKTOP_XORG_NOT_FOUND, LOGIN_MSG_DESKTOP_SESSION_NOT_READY, LOGIN_MSG_DESKTOP_XORG_NOT_FOUND,
LOGIN_MSG_DESKTOP_XSESSION_FAILED, LOGIN_MSG_DESKTOP_XSESSION_FAILED,
@ -152,7 +152,7 @@ fn try_start_x_session(username: &str, password: &str) -> ResultType<(String, bo
desktop_manager.is_running(), desktop_manager.is_running(),
)) ))
} else { } else {
bail!(crate::server::LOGIN_MSG_DESKTOP_NOT_INITED); bail!(crate::client::LOGIN_MSG_DESKTOP_NOT_INITED);
} }
} }

View file

@ -1270,13 +1270,13 @@ impl Connection {
// If err is LOGIN_MSG_DESKTOP_SESSION_NOT_READY, just keep this msg and go on checking password. // If err is LOGIN_MSG_DESKTOP_SESSION_NOT_READY, just keep this msg and go on checking password.
#[cfg(all(target_os = "linux", feature = "linux_headless"))] #[cfg(all(target_os = "linux", feature = "linux_headless"))]
#[cfg(not(any(feature = "flatpak", feature = "appimage")))] #[cfg(not(any(feature = "flatpak", feature = "appimage")))]
if !desktop_err.is_empty() && desktop_err != LOGIN_MSG_DESKTOP_SESSION_NOT_READY { if !desktop_err.is_empty() && desktop_err != crate::client::LOGIN_MSG_DESKTOP_SESSION_NOT_READY {
self.send_login_error(desktop_err).await; self.send_login_error(desktop_err).await;
return true; return true;
} }
if !hbb_common::is_ipv4_str(&lr.username) && lr.username != Config::get_id() { if !hbb_common::is_ipv4_str(&lr.username) && lr.username != Config::get_id() {
self.send_login_error(LOGIN_MSG_OFFLINE).await; self.send_login_error(crate::client::LOGIN_MSG_OFFLINE).await;
} else if password::approve_mode() == ApproveMode::Click } else if password::approve_mode() == ApproveMode::Click
|| password::approve_mode() == ApproveMode::Both && !password::has_valid_password() || password::approve_mode() == ApproveMode::Both && !password::has_valid_password()
{ {
@ -1284,7 +1284,7 @@ impl Connection {
if hbb_common::get_version_number(&lr.version) if hbb_common::get_version_number(&lr.version)
>= hbb_common::get_version_number("1.2.0") >= hbb_common::get_version_number("1.2.0")
{ {
self.send_login_error(LOGIN_MSG_NO_PASSWORD_ACCESS).await; self.send_login_error(crate::client::LOGIN_MSG_NO_PASSWORD_ACCESS).await;
} }
return true; return true;
} else if password::approve_mode() == ApproveMode::Password } else if password::approve_mode() == ApproveMode::Password
@ -1323,7 +1323,7 @@ impl Connection {
if desktop_err.is_empty() { if desktop_err.is_empty() {
self.try_start_cm(lr.my_id, lr.my_name, false); self.try_start_cm(lr.my_id, lr.my_name, false);
} else { } else {
self.send_login_error(LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_EMPTY) self.send_login_error(crate::client::LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_EMPTY)
.await; .await;
} }
#[cfg(not(all(target_os = "linux", feature = "linux_headless")))] #[cfg(not(all(target_os = "linux", feature = "linux_headless")))]
@ -1371,15 +1371,15 @@ impl Connection {
#[cfg(all(target_os = "linux", feature = "linux_headless"))] #[cfg(all(target_os = "linux", feature = "linux_headless"))]
#[cfg(not(any(feature = "flatpak", feature = "appimage")))] #[cfg(not(any(feature = "flatpak", feature = "appimage")))]
if desktop_err.is_empty() { if desktop_err.is_empty() {
self.send_login_error(LOGIN_MSG_PASSWORD_WRONG).await; self.send_login_error(crate::client::LOGIN_MSG_PASSWORD_WRONG).await;
self.try_start_cm(lr.my_id, lr.my_name, false); self.try_start_cm(lr.my_id, lr.my_name, false);
} else { } else {
self.send_login_error(LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_WRONG) self.send_login_error(crate::client::LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_WRONG)
.await; .await;
} }
#[cfg(not(all(target_os = "linux", feature = "linux_headless")))] #[cfg(not(all(target_os = "linux", feature = "linux_headless")))]
{ {
self.send_login_error(LOGIN_MSG_PASSWORD_WRONG).await; self.send_login_error(crate::client::LOGIN_MSG_PASSWORD_WRONG).await;
self.try_start_cm(lr.my_id, lr.my_name, false); self.try_start_cm(lr.my_id, lr.my_name, false);
} }
} else { } else {

View file

@ -3,7 +3,7 @@ use hbb_common::{allow_err, platform::linux::DISTRO};
use scrap::{is_cursor_embedded, set_map_err, Capturer, Display, Frame, TraitCapturer}; use scrap::{is_cursor_embedded, set_map_err, Capturer, Display, Frame, TraitCapturer};
use std::io; use std::io;
use super::video_service::{ use crate::client::{
SCRAP_OTHER_VERSION_OR_X11_REQUIRED, SCRAP_UBUNTU_HIGHER_REQUIRED, SCRAP_X11_REQUIRED, SCRAP_OTHER_VERSION_OR_X11_REQUIRED, SCRAP_UBUNTU_HIGHER_REQUIRED, SCRAP_X11_REQUIRED,
}; };

View file

@ -17,7 +17,7 @@ use serde_derive::Serialize;
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::ipc::Connection; use crate::ipc::Connection;
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "ios")))]
use crate::ipc::{self, Data}; use crate::ipc::{self, Data};
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::tokio::sync::mpsc::unbounded_channel; use hbb_common::tokio::sync::mpsc::unbounded_channel;
@ -150,7 +150,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
recording, recording,
from_switch, from_switch,
#[cfg(not(any(target_os = "ios")))] #[cfg(not(any(target_os = "ios")))]
_tx, tx,
in_voice_call: false, in_voice_call: false,
incoming_voice_call: false, incoming_voice_call: false,
}; };