mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-18 15:53:00 +08:00
refactor
This commit is contained in:
parent
6fe4344cb0
commit
d069b73303
@ -15,6 +15,7 @@ use std::{
|
||||
pub const APP_NAME: &str = "RustDesk";
|
||||
pub const RENDEZVOUS_TIMEOUT: u64 = 12_000;
|
||||
pub const CONNECT_TIMEOUT: u64 = 18_000;
|
||||
pub const REG_INTERVAL: i64 = 12_000;
|
||||
pub const COMPRESS_LEVEL: i32 = 3;
|
||||
const SERIAL: i32 = 1;
|
||||
// 128x128
|
||||
|
@ -941,7 +941,7 @@ impl LoginConfigHandler {
|
||||
if !pi.version.is_empty() {
|
||||
self.support_press = true;
|
||||
self.support_refresh = true;
|
||||
self.version = crate::get_version_number(&pi.version);
|
||||
self.version = hbb_common::get_version_number(&pi.version);
|
||||
}
|
||||
let serde = PeerInfoSerde {
|
||||
username,
|
||||
|
@ -4,7 +4,7 @@ use hbb_common::{
|
||||
anyhow::bail,
|
||||
compress::{compress as compress_func, decompress},
|
||||
config::{Config, COMPRESS_LEVEL, RENDEZVOUS_TIMEOUT},
|
||||
log,
|
||||
get_version_number, log,
|
||||
message_proto::*,
|
||||
protobuf::Message as _,
|
||||
protobuf::ProtobufEnum,
|
||||
@ -413,14 +413,6 @@ pub fn is_modifier(evt: &KeyEvent) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_version_number(v: &str) -> i64 {
|
||||
let mut n = 0;
|
||||
for x in v.split(".") {
|
||||
n = n * 1000 + x.parse::<i64>().unwrap_or(0);
|
||||
}
|
||||
n
|
||||
}
|
||||
|
||||
pub fn check_software_update() {
|
||||
std::thread::spawn(move || allow_err!(_check_software_update()));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ use crate::server::{check_zombie, new as new_server, ServerPtr};
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
anyhow::bail,
|
||||
config::{self, Config, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT},
|
||||
config::{self, Config, REG_INTERVAL, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT},
|
||||
futures::future::join_all,
|
||||
log,
|
||||
protobuf::Message as _,
|
||||
@ -31,7 +31,6 @@ lazy_static::lazy_static! {
|
||||
static ref SOLVING_PK_MISMATCH: Arc<Mutex<String>> = Default::default();
|
||||
}
|
||||
static SHOULD_EXIT: AtomicBool = AtomicBool::new(false);
|
||||
const REG_INTERVAL: i64 = 12_000;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RendezvousMediator {
|
||||
|
@ -23,7 +23,6 @@ use service::{GenericService, Service, ServiceTmpl, Subscriber};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
net::SocketAddr,
|
||||
path::PathBuf,
|
||||
sync::{Arc, Mutex, RwLock, Weak},
|
||||
time::Duration,
|
||||
};
|
||||
|
@ -904,10 +904,12 @@ async fn start_ipc(
|
||||
mut rx_to_cm: mpsc::UnboundedReceiver<ipc::Data>,
|
||||
tx_from_cm: mpsc::UnboundedSender<ipc::Data>,
|
||||
) -> ResultType<()> {
|
||||
if crate::platform::is_prelogin() {
|
||||
return Ok(());
|
||||
loop {
|
||||
if !crate::platform::is_prelogin() {
|
||||
break;
|
||||
}
|
||||
sleep(1.).await;
|
||||
}
|
||||
|
||||
let mut stream = None;
|
||||
if let Ok(s) = crate::ipc::connect(1000, "_cm").await {
|
||||
stream = Some(s);
|
||||
|
@ -287,7 +287,7 @@ class MultipleSessions: Reactor.Component {
|
||||
function onSize() {
|
||||
var w = this.$(.sessions-bar).box(#width) - 220;
|
||||
this.$(#sessions-type span).style.set{
|
||||
"max-width": (w / 2) + "px",
|
||||
"max-width": (w / (handler.is_installed() ? 2 : 3)) + "px",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ class Header: Reactor.Component {
|
||||
event click $(#ctrl-alt-del) {
|
||||
handler.ctrl_alt_del();
|
||||
}
|
||||
|
||||
|
||||
event click $(#lock-screen) {
|
||||
handler.lock_screen();
|
||||
}
|
||||
|
@ -361,3 +361,21 @@ div#myid svg#menu {
|
||||
position: absolute;
|
||||
right: -1em;
|
||||
}
|
||||
|
||||
div.remote-session svg#menu {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.install-me .button {
|
||||
height: 2em;
|
||||
line-height: 2em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 1.6em;
|
||||
margin-top: 1em;
|
||||
border-color: white;
|
||||
border: 1px;
|
||||
background: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user