Merge pull request #1500 from 21pages/optimize

update setting page && fix audio no sound
This commit is contained in:
RustDesk 2022-09-13 09:49:41 +08:00 committed by GitHub
commit 2234c4a61d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1023 additions and 465 deletions

View File

@ -52,7 +52,6 @@ enum DesktopType {
fileTransfer, fileTransfer,
cm, cm,
portForward, portForward,
rdp,
} }
class IconFont { class IconFont {
@ -196,7 +195,7 @@ class MyTheme {
); );
static changeTo(bool dark) { static changeTo(bool dark) {
if (Get.isDarkMode != dark) { if (isDarkTheme() != dark) {
Get.find<SharedPreferences>().setString("darkTheme", dark ? "Y" : ""); Get.find<SharedPreferences>().setString("darkTheme", dark ? "Y" : "");
Get.changeThemeMode(dark ? ThemeMode.dark : ThemeMode.light); Get.changeThemeMode(dark ? ThemeMode.dark : ThemeMode.light);
if (desktopType == DesktopType.main) { if (desktopType == DesktopType.main) {
@ -211,7 +210,7 @@ class MyTheme {
bool dark; bool dark;
// Brightnesss is always light on windows, Flutter 3.0.5 // Brightnesss is always light on windows, Flutter 3.0.5
if (_themeInitialed || !mainPage || Platform.isWindows) { if (_themeInitialed || !mainPage || Platform.isWindows) {
dark = "Y" == Get.find<SharedPreferences>().getString("darkTheme"); dark = isDarkTheme();
} else { } else {
dark = WidgetsBinding.instance.platformDispatcher.platformBrightness == dark = WidgetsBinding.instance.platformDispatcher.platformBrightness ==
Brightness.dark; Brightness.dark;
@ -231,7 +230,7 @@ class MyTheme {
} }
bool isDarkTheme() { bool isDarkTheme() {
return Get.isDarkMode; return "Y" == Get.find<SharedPreferences>().getString("darkTheme");
} }
final ButtonStyle flatButtonStyle = TextButton.styleFrom( final ButtonStyle flatButtonStyle = TextButton.styleFrom(
@ -572,9 +571,7 @@ void msgBox(
submit() { submit() {
dialogManager.dismissAll(); dialogManager.dismissAll();
// https://github.com/fufesou/rustdesk/blob/5e9a31340b899822090a3731769ae79c6bf5f3e5/src/ui/common.tis#L263 // https://github.com/fufesou/rustdesk/blob/5e9a31340b899822090a3731769ae79c6bf5f3e5/src/ui/common.tis#L263
if (!type.contains("custom") && if (!type.contains("custom") && desktopType != DesktopType.portForward) {
!(desktopType == DesktopType.portForward ||
desktopType == DesktopType.rdp)) {
closeConnection(); closeConnection();
} }
} }

View File

@ -5,7 +5,6 @@ const String kAppTypeMain = "main";
const String kAppTypeDesktopRemote = "remote"; const String kAppTypeDesktopRemote = "remote";
const String kAppTypeDesktopFileTransfer = "file transfer"; const String kAppTypeDesktopFileTransfer = "file transfer";
const String kAppTypeDesktopPortForward = "port forward"; const String kAppTypeDesktopPortForward = "port forward";
const String kAppTypeDesktopRDP = "rdp";
const String kTabLabelHomePage = "Home"; const String kTabLabelHomePage = "Home";
const String kTabLabelSettingPage = "Settings"; const String kTabLabelSettingPage = "Settings";

View File

@ -428,8 +428,12 @@ class _ConnectionPageState extends State<ConnectionPage> {
light, light,
Text(translate("Service is not running")), Text(translate("Service is not running")),
TextButton( TextButton(
onPressed: () => onPressed: () async {
bind.mainSetOption(key: "stop-service", value: ""), bool checked = await bind.mainCheckSuperUserPermission();
if (checked) {
bind.mainSetOption(key: "stop-service", value: "");
}
},
child: Text(translate("Start Service"))) child: Text(translate("Start Service")))
], ],
); );
@ -1019,6 +1023,7 @@ class _PeerTabbedPageState extends State<_PeerTabbedPage>
return ListView( return ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,
controller: ScrollController(),
children: super.widget.tabs.asMap().entries.map((t) { children: super.widget.tabs.asMap().entries.map((t) {
return Obx(() => GestureDetector( return Obx(() => GestureDetector(
child: Container( child: Container(

View File

@ -525,7 +525,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
final option = await bind.mainGetOption(key: key); final option = await bind.mainGetOption(key: key);
bind.mainSetOption(key: key, value: option == "Y" ? "" : "Y"); bind.mainSetOption(key: key, value: option == "Y" ? "" : "Y");
} else if (key == "change-id") { } else if (key == "change-id") {
changeId(); changeIdDialog();
} else if (key == "custom-server") { } else if (key == "custom-server") {
changeServer(); changeServer();
} else if (key == "whitelist") { } else if (key == "whitelist") {
@ -648,85 +648,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
); );
} }
/// change local ID
void changeId() {
var newId = "";
var msg = "";
var isInProgress = false;
TextEditingController controller = TextEditingController();
gFFI.dialogManager.show((setState, close) {
submit() async {
newId = controller.text.trim();
setState(() {
msg = "";
isInProgress = true;
bind.mainChangeId(newId: newId);
});
var status = await bind.mainGetAsyncStatus();
while (status == " ") {
await Future.delayed(const Duration(milliseconds: 100));
status = await bind.mainGetAsyncStatus();
}
if (status.isEmpty) {
// ok
close();
return;
}
setState(() {
isInProgress = false;
msg = translate(status);
});
}
return CustomAlertDialog(
title: Text(translate("Change ID")),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(translate("id_change_tip")),
const SizedBox(
height: 8.0,
),
Row(
children: [
const Text("ID:").marginOnly(bottom: 16.0),
const SizedBox(
width: 24.0,
),
Expanded(
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(),
errorText: msg.isEmpty ? null : translate(msg)),
inputFormatters: [
LengthLimitingTextInputFormatter(16),
// FilteringTextInputFormatter(RegExp(r"[a-zA-z][a-zA-z0-9\_]*"), allow: true)
],
maxLength: 16,
controller: controller,
focusNode: FocusNode()..requestFocus(),
),
),
],
),
const SizedBox(
height: 4.0,
),
Offstage(
offstage: !isInProgress, child: const LinearProgressIndicator())
],
),
actions: [
TextButton(onPressed: close, child: Text(translate("Cancel"))),
TextButton(onPressed: submit, child: Text(translate("OK"))),
],
onSubmit: submit,
onCancel: close,
);
});
}
void about() async { void about() async {
final appName = await bind.mainGetAppName(); final appName = await bind.mainGetAppName();
final license = await bind.mainGetLicense(); final license = await bind.mainGetLicense();

File diff suppressed because it is too large Load Diff

View File

@ -184,6 +184,7 @@ class _FileManagerPageState extends State<FileManagerPage>
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
controller: ScrollController(),
child: ObxValue<RxString>( child: ObxValue<RxString>(
(searchText) { (searchText) {
final filteredEntries = searchText.isEmpty final filteredEntries = searchText.isEmpty
@ -309,6 +310,7 @@ class _FileManagerPageState extends State<FileManagerPage>
// Center(child: listTail(isLocal: isLocal)), // Center(child: listTail(isLocal: isLocal)),
// Expanded( // Expanded(
// child: ListView.builder( // child: ListView.builder(
// controller: ScrollController(),
// itemCount: entries.length + 1, // itemCount: entries.length + 1,
// itemBuilder: (context, index) { // itemBuilder: (context, index) {
// if (index >= entries.length) { // if (index >= entries.length) {
@ -424,6 +426,7 @@ class _FileManagerPageState extends State<FileManagerPage>
decoration: BoxDecoration(border: Border.all(color: Colors.grey)), decoration: BoxDecoration(border: Border.all(color: Colors.grey)),
child: Obx( child: Obx(
() => ListView.builder( () => ListView.builder(
controller: ScrollController(),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final item = model.jobTable[index]; final item = model.jobTable[index];
return Column( return Column(

View File

@ -37,7 +37,6 @@ class PortForwardPage extends StatefulWidget {
class _PortForwardPageState extends State<PortForwardPage> class _PortForwardPageState extends State<PortForwardPage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final bool isRdp = false;
final TextEditingController localPortController = TextEditingController(); final TextEditingController localPortController = TextEditingController();
final TextEditingController remoteHostController = TextEditingController(); final TextEditingController remoteHostController = TextEditingController();
final TextEditingController remotePortController = TextEditingController(); final TextEditingController remotePortController = TextEditingController();
@ -53,7 +52,7 @@ class _PortForwardPageState extends State<PortForwardPage>
if (!Platform.isLinux) { if (!Platform.isLinux) {
Wakelock.enable(); Wakelock.enable();
} }
print("init success with id ${widget.id}"); debugPrint("init success with id ${widget.id}");
} }
@override @override
@ -73,7 +72,7 @@ class _PortForwardPageState extends State<PortForwardPage>
return Scaffold( return Scaffold(
backgroundColor: MyTheme.color(context).grayBg, backgroundColor: MyTheme.color(context).grayBg,
body: FutureBuilder(future: () async { body: FutureBuilder(future: () async {
if (!isRdp) { if (!widget.isRDP) {
refreshTunnelConfig(); refreshTunnelConfig();
} }
}(), builder: (context, snapshot) { }(), builder: (context, snapshot) {
@ -134,6 +133,7 @@ class _PortForwardPageState extends State<PortForwardPage>
data: Theme.of(context) data: Theme.of(context)
.copyWith(backgroundColor: MyTheme.color(context).bg), .copyWith(backgroundColor: MyTheme.color(context).bg),
child: Obx(() => ListView.builder( child: Obx(() => ListView.builder(
controller: ScrollController(),
itemCount: pfs.length + 2, itemCount: pfs.length + 2,
itemBuilder: ((context, index) { itemBuilder: ((context, index) {
if (index == 0) { if (index == 0) {
@ -283,17 +283,18 @@ class _PortForwardPageState extends State<PortForwardPage>
} }
buildRdp(BuildContext context) { buildRdp(BuildContext context) {
text1(String lable) => text1(String lable) => Expanded(
Expanded(child: Text(lable).marginOnly(left: _kTextLeftMargin)); child: Text(translate(lable)).marginOnly(left: _kTextLeftMargin));
text2(String lable) => Expanded( text2(String lable) => Expanded(
child: Text( child: Text(
lable, lable,
style: TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
).marginOnly(left: _kTextLeftMargin)); ).marginOnly(left: _kTextLeftMargin));
return Theme( return Theme(
data: Theme.of(context) data: Theme.of(context)
.copyWith(backgroundColor: MyTheme.color(context).bg), .copyWith(backgroundColor: MyTheme.color(context).bg),
child: ListView.builder( child: ListView.builder(
controller: ScrollController(),
itemCount: 2, itemCount: 2,
itemBuilder: ((context, index) { itemBuilder: ((context, index) {
if (index == 0) { if (index == 0) {
@ -321,10 +322,10 @@ class _PortForwardPageState extends State<PortForwardPage>
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 0, elevation: 0,
side: const BorderSide(color: MyTheme.border)), side: const BorderSide(color: MyTheme.border)),
onPressed: () {}, onPressed: () => bind.sessionNewRdp(id: widget.id),
child: Text( child: Text(
translate('New RDP'), translate('New RDP'),
style: TextStyle( style: const TextStyle(
fontWeight: FontWeight.w300, fontSize: 14), fontWeight: FontWeight.w300, fontSize: 14),
), ),
).marginSymmetric(vertical: 10), ).marginSymmetric(vertical: 10),

View File

@ -26,8 +26,8 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
_PortForwardTabPageState(Map<String, dynamic> params) { _PortForwardTabPageState(Map<String, dynamic> params) {
isRDP = params['isRDP']; isRDP = params['isRDP'];
tabController = Get.put(DesktopTabController( tabController =
tabType: isRDP ? DesktopTabType.rdp : DesktopTabType.portForward)); Get.put(DesktopTabController(tabType: DesktopTabType.portForward));
tabController.add(TabInfo( tabController.add(TabInfo(
key: params['id'], key: params['id'],
label: params['id'], label: params['id'],
@ -55,6 +55,11 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
final id = args['id']; final id = args['id'];
final isRDP = args['isRDP']; final isRDP = args['isRDP'];
window_on_top(windowId()); window_on_top(windowId());
if (tabController.state.value.tabs.indexWhere((e) => e.key == id) >=
0) {
debugPrint("port forward $id exists");
return;
}
tabController.add(TabInfo( tabController.add(TabInfo(
key: id, key: id,
label: id, label: id,

View File

@ -61,8 +61,12 @@ class _DesktopServerPageState extends State<DesktopServerPage>
child: Consumer<ServerModel>( child: Consumer<ServerModel>(
builder: (context, serverModel, child) => Container( builder: (context, serverModel, child) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border:
child: Scaffold( Border.all(color: MyTheme.color(context).border!)),
child: Overlay(initialEntries: [
OverlayEntry(builder: (context) {
gFFI.dialogManager.setOverlayState(Overlay.of(context));
return Scaffold(
backgroundColor: MyTheme.color(context).bg, backgroundColor: MyTheme.color(context).bg,
body: Center( body: Center(
child: Column( child: Column(
@ -73,7 +77,10 @@ class _DesktopServerPageState extends State<DesktopServerPage>
], ],
), ),
), ),
)))); );
})
]),
)));
} }
@override @override

View File

@ -614,6 +614,7 @@ class _PopupMenu<T> extends StatelessWidget {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: _kMenuVerticalPadding, vertical: _kMenuVerticalPadding,
), ),
controller: ScrollController(),
child: ListBody(children: children), child: ListBody(children: children),
), ),
), ),

View File

@ -85,6 +85,7 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener {
child: Text(translate("Empty")), child: Text(translate("Empty")),
) )
: SingleChildScrollView( : SingleChildScrollView(
controller: ScrollController(),
child: ObxValue<RxString>((searchText) { child: ObxValue<RxString>((searchText) {
return FutureBuilder<List<Peer>>( return FutureBuilder<List<Peer>>(
builder: (context, snapshot) { builder: (context, snapshot) {

View File

@ -44,7 +44,6 @@ enum DesktopTabType {
remoteScreen, remoteScreen,
fileTransfer, fileTransfer,
portForward, portForward,
rdp,
} }
class DesktopTabState { class DesktopTabState {

View File

@ -51,8 +51,7 @@ Future<Null> main(List<String> args) async {
runFileTransferScreen(argument); runFileTransferScreen(argument);
break; break;
case WindowType.PortForward: case WindowType.PortForward:
desktopType = desktopType = DesktopType.portForward;
argument['isRDP'] ? DesktopType.rdp : DesktopType.portForward;
runPortForwardScreen(argument); runPortForwardScreen(argument);
break; break;
default: default:

View File

@ -66,6 +66,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Provider.of<FfiModel>(context); Provider.of<FfiModel>(context);
return SingleChildScrollView( return SingleChildScrollView(
controller: ScrollController(),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,

View File

@ -203,6 +203,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
headTools(), headTools(),
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
controller: ScrollController(),
itemCount: entries.length + 1, itemCount: entries.length + 1,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index >= entries.length) { if (index >= entries.length) {

View File

@ -759,6 +759,7 @@ class _RemotePageState extends State<RemotePage> {
expand: false, expand: false,
builder: (context, scrollController) { builder: (context, scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
controller: ScrollController(),
padding: EdgeInsets.symmetric(vertical: 10), padding: EdgeInsets.symmetric(vertical: 10),
child: GestureHelp( child: GestureHelp(
touchMode: gFFI.ffiModel.touchMode, touchMode: gFFI.ffiModel.touchMode,

View File

@ -228,6 +228,14 @@ pub fn get_uuid() -> Vec<u8> {
Config::get_key_pair().1 Config::get_key_pair().1
} }
#[inline]
pub fn get_time() -> i64 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_millis())
.unwrap_or(0) as _
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View File

@ -4,10 +4,11 @@ use crate::{
}; };
use hbb_common::{ use hbb_common::{
anyhow::{anyhow, Context}, anyhow::{anyhow, Context},
bytes::Bytes,
config::HwCodecConfig, config::HwCodecConfig,
lazy_static, log, get_time, lazy_static, log,
message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame}, message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame},
ResultType, bytes::Bytes, ResultType,
}; };
use hwcodec::{ use hwcodec::{
decode::{DecodeContext, DecodeFrame, Decoder}, decode::{DecodeContext, DecodeFrame, Decoder},
@ -105,6 +106,7 @@ impl EncoderApi for HwEncoder {
DataFormat::H264 => vf.set_h264s(frames), DataFormat::H264 => vf.set_h264s(frames),
DataFormat::H265 => vf.set_h265s(frames), DataFormat::H265 => vf.set_h265s(frames),
} }
vf.timestamp = get_time();
msg_out.set_video_frame(vf); msg_out.set_video_frame(vf);
Ok(msg_out) Ok(msg_out)
} else { } else {

View File

@ -4,15 +4,15 @@
use hbb_common::anyhow::{anyhow, Context}; use hbb_common::anyhow::{anyhow, Context};
use hbb_common::message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame}; use hbb_common::message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame};
use hbb_common::ResultType; use hbb_common::{ResultType, get_time};
use crate::codec::EncoderApi; use crate::codec::EncoderApi;
use crate::STRIDE_ALIGN; use crate::STRIDE_ALIGN;
use super::vpx::{vp8e_enc_control_id::*, vpx_codec_err_t::*, *}; use super::vpx::{vp8e_enc_control_id::*, vpx_codec_err_t::*, *};
use hbb_common::bytes::Bytes;
use std::os::raw::{c_int, c_uint}; use std::os::raw::{c_int, c_uint};
use std::{ptr, slice}; use std::{ptr, slice};
use hbb_common::bytes::Bytes;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum VpxVideoCodecId { pub enum VpxVideoCodecId {
@ -285,6 +285,7 @@ impl VpxEncoder {
frames: vp9s.into(), frames: vp9s.into(),
..Default::default() ..Default::default()
}); });
vf.timestamp = get_time();
msg_out.set_video_frame(vf); msg_out.set_video_frame(vf);
msg_out msg_out
} }

View File

@ -426,14 +426,6 @@ pub fn refresh_rendezvous_server() {
}); });
} }
#[inline]
pub fn get_time() -> i64 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_millis())
.unwrap_or(0) as _
}
pub fn run_me<T: AsRef<std::ffi::OsStr>>(args: Vec<T>) -> std::io::Result<std::process::Child> { pub fn run_me<T: AsRef<std::ffi::OsStr>>(args: Vec<T>) -> std::io::Result<std::process::Child> {
#[cfg(not(feature = "appimage"))] #[cfg(not(feature = "appimage"))]
{ {

View File

@ -18,7 +18,6 @@ pub(super) const APP_TYPE_MAIN: &str = "main";
pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote"; pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote";
pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer"; pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer";
pub(super) const APP_TYPE_DESKTOP_PORT_FORWARD: &str = "port forward"; pub(super) const APP_TYPE_DESKTOP_PORT_FORWARD: &str = "port forward";
pub(super) const APP_TYPE_DESKTOP_RDP: &str = "rdp";
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref SESSIONS: RwLock<HashMap<String,Session<FlutterHandler>>> = Default::default(); pub static ref SESSIONS: RwLock<HashMap<String,Session<FlutterHandler>>> = Default::default();

View File

@ -663,7 +663,6 @@ fn main_broadcast_message(data: &HashMap<&str, &str>) {
flutter::APP_TYPE_DESKTOP_REMOTE, flutter::APP_TYPE_DESKTOP_REMOTE,
flutter::APP_TYPE_DESKTOP_FILE_TRANSFER, flutter::APP_TYPE_DESKTOP_FILE_TRANSFER,
flutter::APP_TYPE_DESKTOP_PORT_FORWARD, flutter::APP_TYPE_DESKTOP_PORT_FORWARD,
flutter::APP_TYPE_DESKTOP_RDP,
]; ];
for app in apps { for app in apps {
@ -703,6 +702,12 @@ pub fn session_remove_port_forward(id: String, local_port: i32) {
} }
} }
pub fn session_new_rdp(id: String) {
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.new_rdp();
}
}
pub fn main_get_last_remote_id() -> String { pub fn main_get_last_remote_id() -> String {
// if !config::APP_DIR.read().unwrap().is_empty() { // if !config::APP_DIR.read().unwrap().is_empty() {
// res = LocalConfig::get_remote_id(); // res = LocalConfig::get_remote_id();

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "非安全连接"), ("Insecure Connection", "非安全连接"),
("Scale original", "原始尺寸"), ("Scale original", "原始尺寸"),
("Scale adaptive", "适应窗口"), ("Scale adaptive", "适应窗口"),
("General", "常规"),
("Security", "安全"),
("Acount", "账户"),
("Theme", "主题"),
("Dark Theme", "暗黑主题"),
("Enable hardware codec", "使用硬件编解码"),
("Unlock Security Settings", "解锁安全设置"),
("Enable Audio", "允许传输音频"),
("Temporary Password Length", "临时密码长度"),
("Unlock Network Settings", "解锁网络设置"),
("Server", "服务器"),
("Direct IP Access", "IP直接访问"),
("Proxy", "代理"),
("Port", "端口"),
("Apply", "应用"),
("Disconnect all devices?", "断开所有远程连接?"),
("Clear", "清空"),
("Audio Input Device", "音频输入设备"),
("Deny remote access", "拒绝远程访问"),
("Use IP Whitelisting", "只允许白名单上的IP访问"),
("Network", "网络"),
("Enable RDP", "允许RDP访问"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nezabezpečené připojení"), ("Insecure Connection", "Nezabezpečené připojení"),
("Scale original", "Měřítko původní"), ("Scale original", "Měřítko původní"),
("Scale adaptive", "Měřítko adaptivní"), ("Scale adaptive", "Měřítko adaptivní"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Usikker forbindelse"), ("Insecure Connection", "Usikker forbindelse"),
("Scale original", "Skala original"), ("Scale original", "Skala original"),
("Scale adaptive", "Skala adaptiv"), ("Scale adaptive", "Skala adaptiv"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Unsichere Verbindung"), ("Insecure Connection", "Unsichere Verbindung"),
("Scale original", "Original skalieren"), ("Scale original", "Original skalieren"),
("Scale adaptive", "Adaptiv skalieren"), ("Scale adaptive", "Adaptiv skalieren"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nesekura Konekto"), ("Insecure Connection", "Nesekura Konekto"),
("Scale original", "Skalo originalo"), ("Scale original", "Skalo originalo"),
("Scale adaptive", "Skalo adapta"), ("Scale adaptive", "Skalo adapta"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -335,5 +335,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Conexión insegura"), ("Insecure Connection", "Conexión insegura"),
("Scale original", "escala originales"), ("Scale original", "escala originales"),
("Scale adaptive", "Adaptable a escala"), ("Scale adaptive", "Adaptable a escala"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Connexion non sécurisée"), ("Insecure Connection", "Connexion non sécurisée"),
("Scale original", "Échelle d'origine"), ("Scale original", "Échelle d'origine"),
("Scale adaptive", "Échelle adaptative"), ("Scale adaptive", "Échelle adaptative"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nem biztonságos kapcsolat"), ("Insecure Connection", "Nem biztonságos kapcsolat"),
("Scale original", "Eredeti méretarány"), ("Scale original", "Eredeti méretarány"),
("Scale adaptive", "Skála adaptív"), ("Scale adaptive", "Skála adaptív"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -335,5 +335,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Koneksi Tidak Aman"), ("Insecure Connection", "Koneksi Tidak Aman"),
("Scale original", "Skala asli"), ("Scale original", "Skala asli"),
("Scale adaptive", "Skala adaptif"), ("Scale adaptive", "Skala adaptif"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -321,5 +321,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""), ("Legacy mode", ""),
("Map mode", ""), ("Map mode", ""),
("Translate mode", ""), ("Translate mode", ""),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -319,5 +319,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "安全でない接続"), ("Insecure Connection", "安全でない接続"),
("Scale original", "オリジナルサイズ"), ("Scale original", "オリジナルサイズ"),
("Scale adaptive", "フィットウィンドウ"), ("Scale adaptive", "フィットウィンドウ"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -316,5 +316,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "안전하지 않은 연결"), ("Insecure Connection", "안전하지 않은 연결"),
("Scale original", "원래 크기"), ("Scale original", "원래 크기"),
("Scale adaptive", "맞는 창"), ("Scale adaptive", "맞는 창"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -320,5 +320,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Niepewne połączenie"), ("Insecure Connection", "Niepewne połączenie"),
("Scale original", "Skala oryginalna"), ("Scale original", "Skala oryginalna"),
("Scale adaptive", "Skala adaptacyjna"), ("Scale adaptive", "Skala adaptacyjna"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -316,5 +316,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Conexão insegura"), ("Insecure Connection", "Conexão insegura"),
("Scale original", "Escala original"), ("Scale original", "Escala original"),
("Scale adaptive", "Escala adaptável"), ("Scale adaptive", "Escala adaptável"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", ""), ("Insecure Connection", ""),
("Scale original", ""), ("Scale original", ""),
("Scale adaptive", ""), ("Scale adaptive", ""),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Небезопасное соединение"), ("Insecure Connection", "Небезопасное соединение"),
("Scale original", "Оригинал масштаба"), ("Scale original", "Оригинал масштаба"),
("Scale adaptive", "Масштаб адаптивный"), ("Scale adaptive", "Масштаб адаптивный"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nezabezpečené pripojenie"), ("Insecure Connection", "Nezabezpečené pripojenie"),
("Scale original", "Pôvodná mierka"), ("Scale original", "Pôvodná mierka"),
("Scale adaptive", "Prispôsobivá mierka"), ("Scale adaptive", "Prispôsobivá mierka"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", ""), ("Insecure Connection", ""),
("Scale original", ""), ("Scale original", ""),
("Scale adaptive", ""), ("Scale adaptive", ""),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -335,5 +335,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Güvenli Bağlantı"), ("Insecure Connection", "Güvenli Bağlantı"),
("Scale original", "Orijinali ölçeklendir"), ("Scale original", "Orijinali ölçeklendir"),
("Scale adaptive", "Ölçek uyarlanabilir"), ("Scale adaptive", "Ölçek uyarlanabilir"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "非安全連接"), ("Insecure Connection", "非安全連接"),
("Scale original", "原始尺寸"), ("Scale original", "原始尺寸"),
("Scale adaptive", "適應窗口"), ("Scale adaptive", "適應窗口"),
("General", "常規"),
("Security", "安全"),
("Acount", "賬戶"),
("Theme", "主題"),
("Dark Theme", "暗黑主題"),
("Enable hardware codec", "使用硬件編解碼"),
("Unlock Security Settings", "解鎖安全設置"),
("Enable Audio", "允許傳輸音頻"),
("Temporary Password Length", "临时密码长度"),
("Unlock Network Settings", "臨時密碼長度"),
("Server", "服務器"),
("Direct IP Access", "IP直接訪問"),
("Proxy", "代理"),
("Port", "端口"),
("Apply", "應用"),
("Disconnect all devices?", "斷開所有遠程連接?"),
("Clear", "清空"),
("Audio Input Device", "音頻輸入設備"),
("Deny remote access", "拒絕遠程訪問"),
("Use IP Whitelisting", "只允許白名單上的IP訪問"),
("Network", "網絡"),
("Enable RDP", "允許RDP訪問"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Kết nối không an toàn"), ("Insecure Connection", "Kết nối không an toàn"),
("Scale original", "Quy mô gốc"), ("Scale original", "Quy mô gốc"),
("Scale adaptive", "Quy mô thích ứng"), ("Scale adaptive", "Quy mô thích ứng"),
("General", ""),
("Security", ""),
("Acount", ""),
("Theme", ""),
("Dark Theme", ""),
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
("Proxy", ""),
("Port", ""),
("Apply", ""),
("Disconnect all devices?", ""),
("Clear", ""),
("Audio Input Device", ""),
("Deny remote access", ""),
("Use IP Whitelisting", ""),
("Network", ""),
("Enable RDP", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -13,6 +13,7 @@
// https://github.com/krruzic/pulsectl // https://github.com/krruzic/pulsectl
use super::*; use super::*;
use hbb_common::get_time;
use magnum_opus::{Application::*, Channels::*, Encoder}; use magnum_opus::{Application::*, Channels::*, Encoder};
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
@ -348,7 +349,7 @@ fn send_f32(data: &[f32], encoder: &mut Encoder, sp: &GenericService) {
let mut msg_out = Message::new(); let mut msg_out = Message::new();
msg_out.set_audio_frame(AudioFrame { msg_out.set_audio_frame(AudioFrame {
data: data.into(), data: data.into(),
timestamp: crate::common::get_time(), timestamp: get_time(),
..Default::default() ..Default::default()
}); });
sp.send(msg_out); sp.send(msg_out);
@ -368,7 +369,7 @@ fn send_f32(data: &[f32], encoder: &mut Encoder, sp: &GenericService) {
let mut msg_out = Message::new(); let mut msg_out = Message::new();
msg_out.set_audio_frame(AudioFrame { msg_out.set_audio_frame(AudioFrame {
data: data.into(), data: data.into(),
timestamp: crate::common::get_time(), timestamp: get_time(),
..Default::default() ..Default::default()
}); });
sp.send(msg_out); sp.send(msg_out);

View File

@ -12,7 +12,7 @@ use hbb_common::{
fs, fs,
fs::can_enable_overwrite_detection, fs::can_enable_overwrite_detection,
futures::{SinkExt, StreamExt}, futures::{SinkExt, StreamExt},
get_version_number, get_time, get_version_number,
message_proto::{option_message::BoolOption, permission_info::Permission}, message_proto::{option_message::BoolOption, permission_info::Permission},
password_security as password, sleep, timeout, password_security as password, sleep, timeout,
tokio::{ tokio::{
@ -397,7 +397,7 @@ impl Connection {
conn.on_close("Timeout", true).await; conn.on_close("Timeout", true).await;
break; break;
} }
let time = crate::get_time(); let time = get_time();
if time > 0 && conn.last_test_delay == 0 { if time > 0 && conn.last_test_delay == 0 {
conn.last_test_delay = time; conn.last_test_delay = time;
let mut msg_out = Message::new(); let mut msg_out = Message::new();
@ -921,17 +921,23 @@ impl Connection {
self.file_transfer = Some((ft.dir, ft.show_hidden)); self.file_transfer = Some((ft.dir, ft.show_hidden));
} }
Some(login_request::Union::PortForward(mut pf)) => { Some(login_request::Union::PortForward(mut pf)) => {
if !Config::get_option("enable-tunnel").is_empty() {
self.send_login_error("No permission of IP tunneling").await;
sleep(1.).await;
return false;
}
let mut is_rdp = false; let mut is_rdp = false;
if pf.host == "RDP" && pf.port == 0 { if pf.host == "RDP" && pf.port == 0 {
pf.host = "localhost".to_owned(); pf.host = "localhost".to_owned();
pf.port = 3389; pf.port = 3389;
is_rdp = true; is_rdp = true;
} }
if is_rdp && !Config::get_option("enable-rdp").is_empty()
|| !is_rdp && !Config::get_option("enable-tunnel").is_empty()
{
if is_rdp {
self.send_login_error("No permission of RDP").await;
} else {
self.send_login_error("No permission of IP tunneling").await;
}
sleep(1.).await;
return false;
}
if pf.host.is_empty() { if pf.host.is_empty() {
pf.host = "localhost".to_owned(); pf.host = "localhost".to_owned();
} }
@ -977,7 +983,7 @@ impl Connection {
.get(&self.ip) .get(&self.ip)
.map(|x| x.clone()) .map(|x| x.clone())
.unwrap_or((0, 0, 0)); .unwrap_or((0, 0, 0));
let time = (crate::get_time() / 60_000) as i32; let time = (get_time() / 60_000) as i32;
if failure.2 > 30 { if failure.2 > 30 {
self.send_login_error("Too many wrong password attempts") self.send_login_error("Too many wrong password attempts")
.await; .await;
@ -1016,7 +1022,7 @@ impl Connection {
self.inner.send(msg_out.into()); self.inner.send(msg_out.into());
} else { } else {
self.last_test_delay = 0; self.last_test_delay = 0;
let new_delay = (crate::get_time() - t.time) as u32; let new_delay = (get_time() - t.time) as u32;
video_service::VIDEO_QOS video_service::VIDEO_QOS
.lock() .lock()
.unwrap() .unwrap()
@ -1032,9 +1038,9 @@ impl Connection {
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.keyboard { if self.keyboard {
if is_left_up(&me) { if is_left_up(&me) {
CLICK_TIME.store(crate::get_time(), Ordering::SeqCst); CLICK_TIME.store(get_time(), Ordering::SeqCst);
} else { } else {
MOUSE_MOVE_TIME.store(crate::get_time(), Ordering::SeqCst); MOUSE_MOVE_TIME.store(get_time(), Ordering::SeqCst);
} }
self.input_mouse(me, self.inner.id()); self.input_mouse(me, self.inner.id());
} }
@ -1043,7 +1049,7 @@ impl Connection {
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.keyboard { if self.keyboard {
if is_enter(&me) { if is_enter(&me) {
CLICK_TIME.store(crate::get_time(), Ordering::SeqCst); CLICK_TIME.store(get_time(), Ordering::SeqCst);
} }
// handle all down as press // handle all down as press
// fix unexpected repeating key on remote linux, seems also fix abnormal alt/shift, which // fix unexpected repeating key on remote linux, seems also fix abnormal alt/shift, which

View File

@ -3,7 +3,7 @@ use crate::common::IS_X11;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use dispatch::Queue; use dispatch::Queue;
use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable};
use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown}; use hbb_common::{config::COMPRESS_LEVEL, get_time, protobuf::EnumOrUnknown};
use rdev::{simulate, EventType, Key as RdevKey}; use rdev::{simulate, EventType, Key as RdevKey};
use std::{ use std::{
convert::TryFrom, convert::TryFrom,
@ -111,7 +111,7 @@ fn run_pos(sp: GenericService, state: &mut StatePos) -> ResultType<()> {
..Default::default() ..Default::default()
}); });
let exclude = { let exclude = {
let now = crate::get_time(); let now = get_time();
let lock = LATEST_INPUT.lock().unwrap(); let lock = LATEST_INPUT.lock().unwrap();
if now - lock.time < 300 { if now - lock.time < 300 {
lock.conn lock.conn
@ -365,7 +365,7 @@ fn handle_mouse_(evt: &MouseEvent, conn: i32) {
let buttons = evt.mask >> 3; let buttons = evt.mask >> 3;
let evt_type = evt.mask & 0x7; let evt_type = evt.mask & 0x7;
if evt_type == 0 { if evt_type == 0 {
let time = crate::get_time(); let time = get_time();
*LATEST_INPUT.lock().unwrap() = Input { time, conn }; *LATEST_INPUT.lock().unwrap() = Input { time, conn };
} }
let mut en = ENIGO.lock().unwrap(); let mut en = ENIGO.lock().unwrap();

View File

@ -601,7 +601,7 @@ fn create_msg(vp9s: Vec<EncodedVideoFrame>) -> Message {
frames: vp9s.into(), frames: vp9s.into(),
..Default::default() ..Default::default()
}); });
vf.timestamp = crate::common::get_time(); vf.timestamp = hbb_common::get_time();
msg_out.set_video_frame(vf); msg_out.set_video_frame(vf);
msg_out msg_out
} }

View File

@ -206,7 +206,7 @@ pub fn test_if_valid_server(host: String) -> String {
pub fn get_sound_inputs() -> Vec<String> { pub fn get_sound_inputs() -> Vec<String> {
let mut a = Vec::new(); let mut a = Vec::new();
#[cfg(windows)] #[cfg(not(target_os = "linux"))]
{ {
// TODO TEST // TODO TEST
fn get_sound_inputs_() -> Vec<String> { fn get_sound_inputs_() -> Vec<String> {