This commit is contained in:
Asura
2022-09-01 23:53:55 -07:00
64 changed files with 8523 additions and 5283 deletions

View File

@@ -2,7 +2,7 @@ use std::{
collections::HashMap,
net::SocketAddr,
ops::{Deref, Not},
sync::{mpsc, Arc, Mutex, RwLock},
sync::{atomic::AtomicBool, mpsc, Arc, Mutex, RwLock},
};
pub use async_trait::async_trait;
@@ -37,7 +37,6 @@ use hbb_common::{
};
pub use helper::LatencyController;
pub use helper::*;
use scrap::Image;
use scrap::{
codec::{Decoder, DecoderCfg},
VpxDecoderConfig, VpxVideoCodecId,
@@ -47,7 +46,12 @@ pub use super::lang::*;
pub mod file_trait;
pub mod helper;
pub mod io_loop;
pub static SERVER_KEYBOARD_ENABLED: AtomicBool = AtomicBool::new(true);
pub static SERVER_FILE_TRANSFER_ENABLED: AtomicBool = AtomicBool::new(true);
pub static SERVER_CLIPBOARD_ENABLED: AtomicBool = AtomicBool::new(true);
pub const MILLI1: Duration = Duration::from_millis(1);
pub const SEC30: Duration = Duration::from_secs(30);
/// Client of the remote desktop.
@@ -55,7 +59,23 @@ pub struct Client;
#[cfg(not(any(target_os = "android", target_os = "linux")))]
lazy_static::lazy_static! {
static ref AUDIO_HOST: Host = cpal::default_host();
static ref AUDIO_HOST: Host = cpal::default_host();
}
use rdev::{Event, EventType::*, Key as RdevKey, Keyboard as RdevKeyboard, KeyboardState};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
lazy_static::lazy_static! {
static ref ENIGO: Arc<Mutex<enigo::Enigo>> = Arc::new(Mutex::new(enigo::Enigo::new()));
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn get_key_state(key: enigo::Key) -> bool {
use enigo::KeyboardControllable;
#[cfg(target_os = "macos")]
if key == enigo::Key::NumLock {
return true;
}
ENIGO.lock().unwrap().get_key_state(key)
}
cfg_if::cfg_if! {
@@ -846,8 +866,7 @@ impl VideoHandler {
#[derive(Default)]
pub struct LoginConfigHandler {
id: String,
pub is_file_transfer: bool,
is_port_forward: bool,
pub conn_type: ConnType,
hash: Hash,
password: Vec<u8>, // remember password for reconnect
pub remember: bool,
@@ -886,12 +905,10 @@ impl LoginConfigHandler {
/// # Arguments
///
/// * `id` - id of peer
/// * `is_file_transfer` - Whether the connection is file transfer.
/// * `is_port_forward` - Whether the connection is port forward.
pub fn initialize(&mut self, id: String, is_file_transfer: bool, is_port_forward: bool) {
/// * `conn_type` - Connection type enum.
pub fn initialize(&mut self, id: String, conn_type: ConnType) {
self.id = id;
self.is_file_transfer = is_file_transfer;
self.is_port_forward = is_port_forward;
self.conn_type = conn_type;
let config = self.load_config();
self.remember = !config.password.is_empty();
self.config = config;
@@ -1048,7 +1065,8 @@ impl LoginConfigHandler {
///
/// * `ignore_default` - If `true`, ignore the default value of the option.
fn get_option_message(&self, ignore_default: bool) -> Option<OptionMessage> {
if self.is_port_forward || self.is_file_transfer {
if self.conn_type.eq(&ConnType::FILE_TRANSFER) || self.conn_type.eq(&ConnType::PORT_FORWARD)
{
return None;
}
let mut n = 0;
@@ -1094,7 +1112,8 @@ impl LoginConfigHandler {
}
pub fn get_option_message_after_login(&self) -> Option<OptionMessage> {
if self.is_port_forward || self.is_file_transfer {
if self.conn_type.eq(&ConnType::FILE_TRANSFER) || self.conn_type.eq(&ConnType::PORT_FORWARD)
{
return None;
}
let mut n = 0;
@@ -1260,13 +1279,13 @@ impl LoginConfigHandler {
///
/// * `username` - The name of the peer.
/// * `pi` - The peer info.
pub fn handle_peer_info(&mut self, username: String, pi: PeerInfo) {
pub fn handle_peer_info(&mut self, pi: &PeerInfo) {
if !pi.version.is_empty() {
self.version = hbb_common::get_version_number(&pi.version);
}
self.features = pi.features.into_option();
self.features = pi.features.clone().into_option();
let serde = PeerInfoSerde {
username,
username: pi.username.clone(),
hostname: pi.hostname.clone(),
platform: pi.platform.clone(),
};
@@ -1330,19 +1349,20 @@ impl LoginConfigHandler {
version: crate::VERSION.to_string(),
..Default::default()
};
if self.is_file_transfer {
lr.set_file_transfer(FileTransfer {
match self.conn_type {
ConnType::FILE_TRANSFER => lr.set_file_transfer(FileTransfer {
dir: self.get_remote_dir(),
show_hidden: !self.get_option("remote_show_hidden").is_empty(),
..Default::default()
});
} else if self.is_port_forward {
lr.set_port_forward(PortForward {
}),
ConnType::PORT_FORWARD => lr.set_port_forward(PortForward {
host: self.port_forward.0.clone(),
port: self.port_forward.1,
..Default::default()
});
}),
_ => {}
}
let mut msg_out = Message::new();
msg_out.set_login_request(lr);
msg_out
@@ -1651,6 +1671,12 @@ pub trait Interface: Send + Clone + 'static + Sized {
fn handle_login_error(&mut self, err: &str) -> bool;
fn handle_peer_info(&mut self, pi: PeerInfo);
fn set_force_relay(&mut self, direct: bool, received: bool);
fn is_file_transfer(&self) -> bool;
fn is_port_forward(&self) -> bool;
fn is_rdp(&self) -> bool;
fn on_error(&self, err: &str) {
self.msgbox("error", "Error", err);
}
fn is_force_relay(&self) -> bool;
async fn handle_hash(&mut self, pass: &str, hash: Hash, peer: &mut Stream);
async fn handle_login_from_ui(&mut self, password: String, remember: bool, peer: &mut Stream);

View File

@@ -1,4 +1,4 @@
use hbb_common::{fs, message_proto::*};
use hbb_common::{fs, message_proto::*, log};
use super::{Data, Interface};
@@ -114,4 +114,26 @@ pub trait FileManager: Interface {
fn resume_job(&self, id: i32, is_remote: bool) {
self.send(Data::ResumeJob((id, is_remote)));
}
fn set_confirm_override_file(
&self,
id: i32,
file_num: i32,
need_override: bool,
remember: bool,
is_upload: bool,
) {
log::info!(
"confirm file transfer, job: {}, need_override: {}",
id,
need_override
);
self.send(Data::SetConfirmOverrideFile((
id,
file_num,
need_override,
remember,
is_upload,
)));
}
}

1208
src/client/io_loop.rs Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -13,21 +13,22 @@ use hbb_common::{
};
use hbb_common::{password_security, ResultType};
use crate::client::file_trait::FileManager;
use crate::{client::file_trait::FileManager, flutter::{session_add, session_start_}};
use crate::common::make_fd_to_json;
use crate::flutter::connection_manager::{self, get_clients_length, get_clients_state};
use crate::flutter::{self, Session, SESSIONS};
use crate::flutter::{self, SESSIONS};
use crate::start_server;
use crate::ui_interface;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::ui_interface::{change_id, check_connect_status, is_ok_change_id};
use crate::ui_interface::{
check_super_user_permission, discover, forget_password, get_api_server, get_app_name,
get_async_job_status, get_connect_status, get_fav, get_id, get_lan_peers, get_langs,
get_license, get_local_option, get_option, get_options, get_peer, get_peer_option, get_socks,
get_sound_inputs, get_uuid, get_version, has_hwcodec, has_rendezvous_service, post_request,
set_local_option, set_option, set_options, set_peer_option, set_permanent_password, set_socks,
store_fav, test_if_valid_server, update_temporary_password, using_public_server,
check_mouse_time, check_super_user_permission, discover, forget_password, get_api_server,
get_app_name, get_async_job_status, get_connect_status, get_fav, get_id, get_lan_peers,
get_langs, get_license, get_local_option, get_mouse_time, get_option, get_options, get_peer,
get_peer_option, get_socks, get_sound_inputs, get_uuid, get_version, has_hwcodec,
has_rendezvous_service, post_request, set_local_option, set_option, set_options,
set_peer_option, set_permanent_password, set_socks, store_fav, test_if_valid_server,
update_temporary_password, using_public_server,
};
fn initialize(app_dir: &str) {
@@ -107,13 +108,18 @@ pub fn host_stop_system_key_propagate(stopped: bool) {
crate::platform::windows::stop_system_key_propagate(stopped);
}
pub fn session_connect(
events2ui: StreamSink<EventToUI>,
id: String,
is_file_transfer: bool,
) -> ResultType<()> {
Session::start(&id, is_file_transfer, events2ui);
Ok(())
// FIXME: -> ResultType<()> cannot be parsed by frb_codegen
// thread 'main' panicked at 'Failed to parse function output type `ResultType<()>`', $HOME\.cargo\git\checkouts\flutter_rust_bridge-ddba876d3ebb2a1e\e5adce5\frb_codegen\src\parser\mod.rs:151:25
pub fn session_add_sync(id: String, is_file_transfer: bool, is_port_forward: bool) -> SyncReturn<String> {
if let Err(e) = session_add(&id, is_file_transfer, is_port_forward) {
SyncReturn(format!("Failed to add session with id {}, {}", &id, e))
} else {
SyncReturn("".to_owned())
}
}
pub fn session_start(events2ui: StreamSink<EventToUI>, id: String) -> ResultType<()> {
session_start_(&id, events2ui)
}
pub fn session_get_remember(id: String) -> Option<bool> {
@@ -126,7 +132,7 @@ pub fn session_get_remember(id: String) -> Option<bool> {
pub fn session_get_toggle_option(id: String, arg: String) -> Option<bool> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_toggle_option(&arg))
Some(session.get_toggle_option(arg))
} else {
None
}
@@ -137,17 +143,9 @@ pub fn session_get_toggle_option_sync(id: String, arg: String) -> SyncReturn<boo
SyncReturn(res)
}
pub fn session_get_image_quality(id: String) -> Option<String> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_image_quality())
} else {
None
}
}
pub fn session_get_option(id: String, arg: String) -> Option<String> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_option(&arg))
Some(session.get_option(arg))
} else {
None
}
@@ -155,7 +153,7 @@ pub fn session_get_option(id: String, arg: String) -> Option<String> {
pub fn session_login(id: String, password: String, remember: bool) {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
session.login(&password, remember);
session.login(password, remember);
}
}
@@ -168,7 +166,7 @@ pub fn session_close(id: String) {
pub fn session_refresh(id: String) {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
session.refresh();
session.refresh_video();
}
}
@@ -179,14 +177,36 @@ pub fn session_reconnect(id: String) {
}
pub fn session_toggle_option(id: String, value: String) {
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.toggle_option(value);
}
}
pub fn session_get_image_quality(id: String) -> Option<String> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
session.toggle_option(&value);
Some(session.get_image_quality())
} else {
None
}
}
pub fn session_set_image_quality(id: String, value: String) {
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.save_image_quality(value);
}
}
pub fn session_get_custom_image_quality(id: String) -> Option<Vec<i32>> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
session.set_image_quality(&value);
Some(session.get_custom_image_quality())
} else {
None
}
}
pub fn session_set_custom_image_quality(id: String, value: i32) {
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.save_custom_image_quality(value);
}
}
@@ -208,11 +228,11 @@ pub fn session_switch_display(id: String, value: i32) {
}
}
pub fn session_input_raw_key(id: String, keycode: i32, scancode:i32, down: bool){
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
session.input_raw_key(keycode, scancode, down);
}
}
// pub fn session_input_raw_key(id: String, keycode: i32, scancode:i32, down: bool){
// if let Some(session) = SESSIONS.read().unwrap().get(&id) {
// session.input_raw_key(keycode, scancode, down);
// }
// }
pub fn session_input_key(
id: String,
@@ -250,7 +270,7 @@ pub fn session_peer_option(id: String, name: String, value: String) {
pub fn session_get_peer_option(id: String, name: String) -> String {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
return session.get_option(&name);
return session.get_option(name);
}
"".to_string()
}
@@ -349,7 +369,7 @@ pub fn session_get_platform(id: String, is_remote: bool) -> String {
pub fn session_load_last_transfer_jobs(id: String) {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
return session.load_last_jobs();
// return session.load_last_jobs();
} else {
// a tip for flutter dev
eprintln!(
@@ -473,7 +493,7 @@ pub fn main_get_connect_status() -> String {
pub fn main_check_connect_status() {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
check_connect_status(true);
check_mouse_time(); // avoid multi calls
}
pub fn main_is_using_public_server() -> bool {
@@ -598,12 +618,32 @@ pub fn main_load_lan_peers() {
{
let data = HashMap::from([
("name", "load_lan_peers".to_owned()),
("peers", serde_json::to_string(&get_lan_peers()).unwrap_or_default()),
(
"peers",
serde_json::to_string(&get_lan_peers()).unwrap_or_default(),
),
]);
s.add(serde_json::ser::to_string(&data).unwrap_or("".to_owned()));
};
}
pub fn session_add_port_forward(
id: String,
local_port: i32,
remote_host: String,
remote_port: i32,
) {
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.add_port_forward(local_port, remote_host, remote_port);
}
}
pub fn session_remove_port_forward(id: String, local_port: i32) {
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.remove_port_forward(local_port);
}
}
pub fn main_get_last_remote_id() -> String {
// if !config::APP_DIR.read().unwrap().is_empty() {
// res = LocalConfig::get_remote_id();
@@ -667,7 +707,6 @@ pub fn main_has_hwcodec() -> bool {
has_hwcodec()
}
// TODO
pub fn session_send_mouse(id: String, msg: String) {
if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(&msg) {
let alt = m.get("alt").is_some();
@@ -745,6 +784,14 @@ pub fn main_check_super_user_permission() -> bool {
check_super_user_permission()
}
pub fn main_check_mouse_time() {
check_mouse_time();
}
pub fn main_get_mouse_time() -> f64 {
get_mouse_time()
}
pub fn cm_send_chat(conn_id: i32, msg: String) {
connection_manager::send_chat(conn_id, msg);
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "正在重启远程设备"),
("remote_restarting_tip", "远程设备正在重启, 请关闭当前提示框, 并在一段时间后使用永久密码重新连接"),
("Copied", "已复制"),
("Exit Fullscreen", "退出全屏"),
("Fullscreen", "全屏"),
("Mobile Actions", "移动端操作"),
("Select Monitor", "选择监视器"),
("Control Actions", "控制操作"),
("Display Settings", "显示设置"),
("Ratio", "比例"),
("Image Quality", "画质"),
("Scroll Style", "滚屏方式"),
("Show Menubar", "显示菜单栏"),
("Hide Menubar", "隐藏菜单栏"),
("Direct Connection", "直接连接"),
("Relay Connection", "中继连接"),
("Secure Connection", "安全连接"),
("Insecure Connection", "非安全连接"),
("Scale original", "原始尺寸"),
("Scale adaptive", "适应窗口"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Ukončete celou obrazovku"),
("Fullscreen", "Celá obrazovka"),
("Mobile Actions", "Mobilní akce"),
("Select Monitor", "Vyberte možnost Monitor"),
("Control Actions", "Ovládací akce"),
("Display Settings", "Nastavení obrazovky"),
("Ratio", "Poměr"),
("Image Quality", "Kvalita obrazu"),
("Scroll Style", "Štýl posúvania"),
("Show Menubar", "Zobrazit panel nabídek"),
("Hide Menubar", "skrýt panel nabídek"),
("Direct Connection", "Přímé spojení"),
("Relay Connection", "Připojení relé"),
("Secure Connection", "Zabezpečené připojení"),
("Insecure Connection", "Nezabezpečené připojení"),
("Scale original", "Měřítko původní"),
("Scale adaptive", "Měřítko adaptivní"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Afslut fuldskærm"),
("Fullscreen", "Fuld skærm"),
("Mobile Actions", "Mobile handlinger"),
("Select Monitor", "Vælg Monitor"),
("Control Actions", "Kontrolhandlinger"),
("Display Settings", "Skærmindstillinger"),
("Ratio", "Forhold"),
("Image Quality", "Billede kvalitet"),
("Scroll Style", "Rulstil"),
("Show Menubar", "Vis menulinje"),
("Hide Menubar", "skjul menulinjen"),
("Direct Connection", "Direkte forbindelse"),
("Relay Connection", "Relæforbindelse"),
("Secure Connection", "Sikker forbindelse"),
("Insecure Connection", "Usikker forbindelse"),
("Scale original", "Skala original"),
("Scale adaptive", "Skala adaptiv"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "Entferntes Gerät wird neu gestartet"),
("remote_restarting_tip", "Entferntes Gerät startet neu, bitte schließen Sie diese Meldung und verbinden Sie sich mit dem dauerhaften Passwort erneut."),
("Copied", ""),
("Exit Fullscreen", "Vollbild beenden"),
("Fullscreen", "Ganzer Bildschirm"),
("Mobile Actions", "Mobile Aktionen"),
("Select Monitor", "Wählen Sie Überwachen aus"),
("Control Actions", "Kontrollaktionen"),
("Display Settings", "Bildschirmeinstellungen"),
("Ratio", "Verhältnis"),
("Image Quality", "Bildqualität"),
("Scroll Style", "Scroll-Stil"),
("Show Menubar", "Menüleiste anzeigen"),
("Hide Menubar", "Menüleiste ausblenden"),
("Direct Connection", "Direkte Verbindung"),
("Relay Connection", "Relaisverbindung"),
("Secure Connection", "Sichere Verbindung"),
("Insecure Connection", "Unsichere Verbindung"),
("Scale original", "Original skalieren"),
("Scale adaptive", "Adaptiv skalieren"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Eliru Plenekranon"),
("Fullscreen", "Plenekrane"),
("Mobile Actions", "Poŝtelefonaj Agoj"),
("Select Monitor", "Elektu Monitoron"),
("Control Actions", "Kontrolaj Agoj"),
("Display Settings", "Montraj Agordoj"),
("Ratio", "Proporcio"),
("Image Quality", "Bilda Kvalito"),
("Scroll Style", "Ruluma Stilo"),
("Show Menubar", "Montru menubreton"),
("Hide Menubar", "kaŝi menubreton"),
("Direct Connection", "Rekta Konekto"),
("Relay Connection", "Relajsa Konekto"),
("Secure Connection", "Sekura Konekto"),
("Insecure Connection", "Nesekura Konekto"),
("Scale original", "Skalo originalo"),
("Scale adaptive", "Skalo adapta"),
].iter().cloned().collect();
}

View File

@@ -318,5 +318,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "Reiniciando dispositivo remoto"),
("remote_restarting_tip", "Dispositivo remoto reiniciando, favor de cerrar este mensaje y reconectarse con la contraseña permamente despues de un momento."),
("Copied", ""),
("Exit Fullscreen", "Salir de pantalla completa"),
("Fullscreen", "Pantalla completa"),
("Mobile Actions", "Acciones móviles"),
("Select Monitor", "Seleccionar monitor"),
("Control Actions", "Acciones de control"),
("Display Settings", "Configuración de pantalla"),
("Ratio", "Relación"),
("Image Quality", "La calidad de imagen"),
("Scroll Style", "Estilo de desplazamiento"),
("Show Menubar", "ajustes de pantalla"),
("Hide Menubar", "ocultar barra de menú"),
("Direct Connection", "Conexión directa"),
("Relay Connection", "Conexión de relé"),
("Secure Connection", "Conexión segura"),
("Insecure Connection", "Conexión insegura"),
("Scale original", "escala originales"),
("Scale adaptive", "Adaptable a escala"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Quitter le mode plein écran"),
("Fullscreen", "Plein écran"),
("Mobile Actions", "Actions mobiles"),
("Select Monitor", "Sélectionnez Moniteur"),
("Control Actions", "Actions de contrôle"),
("Display Settings", "Paramètres d'affichage"),
("Ratio", "Rapport"),
("Image Quality", "Qualité d'image"),
("Scroll Style", "Style de défilement"),
("Show Menubar", "Afficher la barre de menus"),
("Hide Menubar", "masquer la barre de menus"),
("Direct Connection", "Connexion directe"),
("Relay Connection", "Connexion relais"),
("Secure Connection", "Connexion sécurisée"),
("Insecure Connection", "Connexion non sécurisée"),
("Scale original", "Échelle d'origine"),
("Scale adaptive", "Échelle adaptative"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Lépjen ki a teljes képernyőről"),
("Fullscreen", "Teljes képernyő"),
("Mobile Actions", "mobil műveletek"),
("Select Monitor", "Válassza a Monitor lehetőséget"),
("Control Actions", "Irányítási műveletek"),
("Display Settings", "Megjelenítési beállítások"),
("Ratio", "Hányados"),
("Image Quality", "Képminőség"),
("Scroll Style", "Görgetési stílus"),
("Show Menubar", "Menüsor megjelenítése"),
("Hide Menubar", "menüsor elrejtése"),
("Direct Connection", "Közvetlen kapcsolat"),
("Relay Connection", "Relé csatlakozás"),
("Secure Connection", "Biztonságos kapcsolat"),
("Insecure Connection", "Nem biztonságos kapcsolat"),
("Scale original", "Eredeti méretarány"),
("Scale adaptive", "Skála adaptív"),
].iter().cloned().collect();
}

View File

@@ -318,5 +318,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "Memulai Ulang Perangkat Jarak Jauh"),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Keluar dari Layar Penuh"),
("Fullscreen", "Layar penuh"),
("Mobile Actions", "Tindakan Seluler"),
("Select Monitor", "Pilih Monitor"),
("Control Actions", "Tindakan Kontrol"),
("Display Settings", "Pengaturan tampilan"),
("Ratio", "Perbandingan"),
("Image Quality", "Kualitas gambar"),
("Scroll Style", "Gaya Gulir"),
("Show Menubar", "Tampilkan bilah menu"),
("Hide Menubar", "sembunyikan bilah menu"),
("Direct Connection", "Koneksi langsung"),
("Relay Connection", "Koneksi Relay"),
("Secure Connection", "Koneksi aman"),
("Insecure Connection", "Koneksi Tidak Aman"),
("Scale original", "Skala asli"),
("Scale adaptive", "Skala adaptif"),
].iter().cloned().collect();
}

View File

@@ -301,6 +301,23 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Sei sicuro di voler riavviare?"),
("Restarting Remote Device", "Il dispositivo remoto si sta riavviando"),
("remote_restarting_tip", "Riavviare il dispositivo remoto"),
("Exit Fullscreen", "Esci dalla modalità schermo intero"),
("Fullscreen", "A schermo intero"),
("Mobile Actions", "Azioni mobili"),
("Select Monitor", "Seleziona Monitora"),
("Control Actions", "Azioni di controllo"),
("Display Settings", "Impostazioni di visualizzazione"),
("Ratio", "Rapporto"),
("Image Quality", "Qualità dell'immagine"),
("Scroll Style", "Stile di scorrimento"),
("Show Menubar", "Mostra la barra dei menu"),
("Hide Menubar", "nascondi la barra dei menu"),
("Direct Connection", "Connessione diretta"),
("Relay Connection", "Collegamento a relè"),
("Secure Connection", "Connessione sicura"),
("Insecure Connection", "Connessione insicura"),
("Scale original", "Scala originale"),
("Scale adaptive", "Scala adattiva"),
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),

View File

@@ -302,5 +302,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "本当に再起動しますか"),
("Restarting Remote Device", "リモート端末を再起動中"),
("remote_restarting_tip", "リモート端末は再起動中です。このメッセージボックスを閉じて、しばらくした後に固定のパスワードを使用して再接続してください。"),
("Exit Fullscreen", "全画面表示を終了"),
("Fullscreen", "全画面表示"),
("Mobile Actions", "モバイル アクション"),
("Select Monitor", "モニターを選択"),
("Control Actions", "コントロール アクション"),
("Display Settings", "ディスプレイの設定"),
("Ratio", "比率"),
("Image Quality", "画質"),
("Scroll Style", "スクロール スタイル"),
("Show Menubar", "メニューバーを表示"),
("Hide Menubar", "メニューバーを隠す"),
("Direct Connection", "直接接続"),
("Relay Connection", "リレー接続"),
("Secure Connection", "安全な接続"),
("Insecure Connection", "安全でない接続"),
("Scale original", "オリジナルサイズ"),
("Scale adaptive", "フィットウィンドウ"),
].iter().cloned().collect();
}

View File

@@ -299,5 +299,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "정말로 재시작 하시겠습니까"),
("Restarting Remote Device", "원격 기기를 다시 시작하는중"),
("remote_restarting_tip", "원격 장치를 다시 시작하는 중입니다. 이 메시지 상자를 닫고 잠시 후 영구 비밀번호로 다시 연결하십시오."),
("Exit Fullscreen", "전체 화면 종료"),
("Fullscreen", "전체화면"),
("Mobile Actions", "모바일 액션"),
("Select Monitor", "모니터 선택"),
("Control Actions", "제어 작업"),
("Display Settings", "화면 설정"),
("Ratio", "비율"),
("Image Quality", "이미지 품질"),
("Scroll Style", "스크롤 스타일"),
("Show Menubar", "메뉴 표시줄 표시"),
("Hide Menubar", "메뉴 표시줄 숨기기"),
("Direct Connection", "직접 연결"),
("Relay Connection", "릴레이 연결"),
("Secure Connection", "보안 연결"),
("Insecure Connection", "안전하지 않은 연결"),
("Scale original", "원래 크기"),
("Scale adaptive", "맞는 창"),
].iter().cloned().collect();
}

View File

@@ -303,5 +303,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Set security password", "Ustaw hasło zabezpieczające"),
("Connection not allowed", "Połączenie niedozwolone"),
("Copied", ""),
("Exit Fullscreen", "Wyłączyć tryb pełnoekranowy"),
("Fullscreen", "Pełny ekran"),
("Mobile Actions", "Działania mobilne"),
("Select Monitor", "Wybierz Monitor"),
("Control Actions", "Działania kontrolne"),
("Display Settings", "Ustawienia wyświetlania"),
("Ratio", "Stosunek"),
("Image Quality", "Jakość obrazu"),
("Scroll Style", "Styl przewijania"),
("Show Menubar", "Pokaż pasek menu"),
("Hide Menubar", "ukryj pasek menu"),
("Direct Connection", "Bezpośrednie połączenie"),
("Relay Connection", "Połączenie przekaźnika"),
("Secure Connection", "Bezpieczne połączenie"),
("Insecure Connection", "Niepewne połączenie"),
("Scale original", "Skala oryginalna"),
("Scale adaptive", "Skala adaptacyjna"),
].iter().cloned().collect();
}

View File

@@ -299,5 +299,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Are you sure you want to restart", "Tem a certeza que pretende reiniciar"),
("Restarting Remote Device", "A reiniciar sistema remoto"),
("remote_restarting_tip", ""),
("Exit Fullscreen", "Sair da tela cheia"),
("Fullscreen", "Tela cheia"),
("Mobile Actions", "Ações para celular"),
("Select Monitor", "Selecionar monitor"),
("Control Actions", "Ações de controle"),
("Display Settings", "Configurações do visor"),
("Ratio", "Razão"),
("Image Quality", "Qualidade da imagem"),
("Scroll Style", "Estilo de rolagem"),
("Show Menubar", "Mostrar barra de menus"),
("Hide Menubar", "ocultar barra de menu"),
("Direct Connection", "Conexão direta"),
("Relay Connection", "Conexão de relé"),
("Secure Connection", "Conexão segura"),
("Insecure Connection", "Conexão insegura"),
("Scale original", "Escala original"),
("Scale adaptive", "Escala adaptável"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", ""),
("Fullscreen", ""),
("Mobile Actions", ""),
("Select Monitor", ""),
("Control Actions", ""),
("Display Settings", ""),
("Ratio", ""),
("Image Quality", ""),
("Scroll Style", ""),
("Show Menubar", ""),
("Hide Menubar", ""),
("Direct Connection", ""),
("Relay Connection", ""),
("Secure Connection", ""),
("Insecure Connection", ""),
("Scale original", ""),
("Scale adaptive", ""),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "Перезагрузка удаленного устройства"),
("remote_restarting_tip", "Удаленное устройство перезапускается. Пожалуйста, закройте это сообщение и через некоторое время переподключитесь, используя постоянный пароль."),
("Copied", ""),
("Exit Fullscreen", "Выйти из полноэкранного режима"),
("Fullscreen", "Полноэкранный"),
("Mobile Actions", "Мобильные действия"),
("Select Monitor", "Выберите монитор"),
("Control Actions", "Действия по управлению"),
("Display Settings", "Настройки отображения"),
("Ratio", "Соотношение"),
("Image Quality", "Качество изображения"),
("Scroll Style", "Стиль прокрутки"),
("Show Menubar", "Показать строку меню"),
("Hide Menubar", "скрыть строку меню"),
("Direct Connection", "Прямая связь"),
("Relay Connection", "Релейное соединение"),
("Secure Connection", "Безопасное соединение"),
("Insecure Connection", "Небезопасное соединение"),
("Scale original", "Оригинал масштаба"),
("Scale adaptive", "Масштаб адаптивный"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Ukončiť celú obrazovku"),
("Fullscreen", "Celá obrazovka"),
("Mobile Actions", "Mobilné akcie"),
("Select Monitor", "Vyberte možnosť Monitor"),
("Control Actions", "Kontrolné akcie"),
("Display Settings", "Nastavenia displeja"),
("Ratio", "Pomer"),
("Image Quality", "Kvalita obrazu"),
("Scroll Style", "Štýl posúvania"),
("Show Menubar", "Zobraziť panel s ponukami"),
("Hide Menubar", "skryť panel s ponukami"),
("Direct Connection", "Priame pripojenie"),
("Relay Connection", "Reléové pripojenie"),
("Secure Connection", "Zabezpečené pripojenie"),
("Insecure Connection", "Nezabezpečené pripojenie"),
("Scale original", "Pôvodná mierka"),
("Scale adaptive", "Prispôsobivá mierka"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", ""),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", ""),
("Fullscreen", ""),
("Mobile Actions", ""),
("Select Monitor", ""),
("Control Actions", ""),
("Display Settings", ""),
("Ratio", ""),
("Image Quality", ""),
("Scroll Style", ""),
("Show Menubar", ""),
("Hide Menubar", ""),
("Direct Connection", ""),
("Relay Connection", ""),
("Secure Connection", ""),
("Insecure Connection", ""),
("Scale original", ""),
("Scale adaptive", ""),
].iter().cloned().collect();
}

View File

@@ -318,5 +318,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "Uzaktan yeniden başlatılıyor"),
("remote_restarting_tip", ""),
("Copied", ""),
("Exit Fullscreen", "Tam ekrandan çık"),
("Fullscreen", "Tam ekran"),
("Mobile Actions", "Mobil İşlemler"),
("Select Monitor", "Monitörü Seç"),
("Control Actions", "Kontrol Eylemleri"),
("Display Settings", "Görüntü ayarları"),
("Ratio", "Oran"),
("Image Quality", "Görüntü kalitesi"),
("Scroll Style", "Kaydırma Stili"),
("Show Menubar", "Menü çubuğunu göster"),
("Hide Menubar", "menü çubuğunu gizle"),
("Direct Connection", "Doğrudan Bağlantı"),
("Relay Connection", "Röle Bağlantısı"),
("Secure Connection", "Güvenli bağlantı"),
("Insecure Connection", "Güvenli Bağlantı"),
("Scale original", "Orijinali ölçeklendir"),
("Scale adaptive", "Ölçek uyarlanabilir"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "正在重啓遠程設備"),
("remote_restarting_tip", "遠程設備正在重啓,請關閉當前提示框,並在一段時間後使用永久密碼重新連接"),
("Copied", "已複製"),
("Exit Fullscreen", "退出全屏"),
("Fullscreen", "全屏"),
("Mobile Actions", "移動端操作"),
("Select Monitor", "選擇監視器"),
("Control Actions", "控制操作"),
("Display Settings", "顯示設置"),
("Ratio", "比例"),
("Image Quality", "畫質"),
("Scroll Style", "滾動樣式"),
("Show Menubar", "顯示菜單欄"),
("Hide Menubar", "隱藏菜單欄"),
("Direct Connection", "直接連接"),
("Relay Connection", "中繼連接"),
("Secure Connection", "安全連接"),
("Insecure Connection", "非安全連接"),
("Scale original", "原始尺寸"),
("Scale adaptive", "適應窗口"),
].iter().cloned().collect();
}

View File

@@ -305,5 +305,22 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Restarting Remote Device", "Đang khởi động lại thiết bị từ xa"),
("remote_restarting_tip", "Thiết bị từ xa đang khởi động lại, hãy đóng cửa sổ tin nhắn này và kết nối lại với mật khẩu vĩnh viễn sau một khoảng thời gian"),
("Copied", ""),
("Exit Fullscreen", "Thoát toàn màn hình"),
("Fullscreen", "Toàn màn hình"),
("Mobile Actions", "Hành động trên thiết bị di động"),
("Select Monitor", "Chọn màn hình"),
("Control Actions", "Kiểm soát hành động"),
("Display Settings", "Thiết lập hiển thị"),
("Ratio", "Tỉ lệ"),
("Image Quality", "Chất lượng hình ảnh"),
("Scroll Style", "Kiểu cuộn"),
("Show Menubar", "Hiển thị thanh menu"),
("Hide Menubar", "ẩn thanh menu"),
("Direct Connection", "Kết nối trực tiếp"),
("Relay Connection", "Kết nối chuyển tiếp"),
("Secure Connection", "Kết nối an toàn"),
("Insecure Connection", "Kết nối không an toàn"),
("Scale original", "Quy mô gốc"),
("Scale adaptive", "Quy mô thích ứng"),
].iter().cloned().collect();
}

View File

@@ -48,6 +48,7 @@ mod port_forward;
mod tray;
mod ui_interface;
mod ui_session_interface;
#[cfg(windows)]
pub mod clipboard_file;

View File

@@ -1,3 +1,5 @@
use std::sync::{Arc, RwLock};
use crate::client::*;
use hbb_common::{
allow_err, bail,
@@ -48,6 +50,9 @@ pub async fn listen(
ui_receiver: mpsc::UnboundedReceiver<Data>,
key: &str,
token: &str,
lc: Arc<RwLock<LoginConfigHandler>>,
remote_host: String,
remote_port: i32,
) -> ResultType<()> {
let listener = tcp::new_listener(format!("0.0.0.0:{}", port), true).await?;
let addr = listener.local_addr()?;
@@ -61,6 +66,7 @@ pub async fn listen(
tokio::select! {
Ok((forward, addr)) = listener.accept() => {
log::info!("new connection from {:?}", addr);
lc.write().unwrap().port_forward = (remote_host.clone(), remote_port);
let id = id.clone();
let password = password.clone();
let mut forward = Framed::new(forward, BytesCodec::new());

View File

@@ -950,6 +950,7 @@ impl Connection {
addr
))
.await;
return false;
}
}
}

View File

@@ -146,7 +146,7 @@ pub fn start(args: &mut [String]) {
let args: Vec<String> = iter.map(|x| x.clone()).collect();
frame.set_title(&id);
frame.register_behavior("native-remote", move || {
Box::new(remote::Handler::new(
Box::new(remote::SciterSession::new(
cmd.clone(),
id.clone(),
pass.clone(),

File diff suppressed because it is too large Load Diff

1305
src/ui_session_interface.rs Normal file

File diff suppressed because it is too large Load Diff