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

View File

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

View File

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

View File

@ -525,7 +525,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
final option = await bind.mainGetOption(key: key);
bind.mainSetOption(key: key, value: option == "Y" ? "" : "Y");
} else if (key == "change-id") {
changeId();
changeIdDialog();
} else if (key == "custom-server") {
changeServer();
} 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 {
final appName = await bind.mainGetAppName();
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: [
Expanded(
child: SingleChildScrollView(
controller: ScrollController(),
child: ObxValue<RxString>(
(searchText) {
final filteredEntries = searchText.isEmpty
@ -309,6 +310,7 @@ class _FileManagerPageState extends State<FileManagerPage>
// Center(child: listTail(isLocal: isLocal)),
// Expanded(
// child: ListView.builder(
// controller: ScrollController(),
// itemCount: entries.length + 1,
// itemBuilder: (context, index) {
// if (index >= entries.length) {
@ -424,6 +426,7 @@ class _FileManagerPageState extends State<FileManagerPage>
decoration: BoxDecoration(border: Border.all(color: Colors.grey)),
child: Obx(
() => ListView.builder(
controller: ScrollController(),
itemBuilder: (BuildContext context, int index) {
final item = model.jobTable[index];
return Column(

View File

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

View File

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

View File

@ -60,20 +60,27 @@ class _DesktopServerPageState extends State<DesktopServerPage>
],
child: Consumer<ServerModel>(
builder: (context, serverModel, child) => Container(
decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold(
backgroundColor: MyTheme.color(context).bg,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(child: ConnectionManager()),
SizedBox.fromSize(size: Size(0, 15.0)),
],
),
),
))));
decoration: BoxDecoration(
border:
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,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(child: ConnectionManager()),
SizedBox.fromSize(size: Size(0, 15.0)),
],
),
),
);
})
]),
)));
}
@override

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -228,6 +228,14 @@ pub fn get_uuid() -> Vec<u8> {
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)]
mod tests {
use super::*;

View File

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

View File

@ -4,15 +4,15 @@
use hbb_common::anyhow::{anyhow, Context};
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::STRIDE_ALIGN;
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::{ptr, slice};
use hbb_common::bytes::Bytes;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum VpxVideoCodecId {
@ -285,6 +285,7 @@ impl VpxEncoder {
frames: vp9s.into(),
..Default::default()
});
vf.timestamp = get_time();
msg_out.set_video_frame(vf);
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> {
#[cfg(not(feature = "appimage"))]
{
@ -676,4 +668,4 @@ lazy_static::lazy_static! {
#[cfg(target_os = "linux")]
lazy_static::lazy_static! {
pub static ref IS_X11: Mutex<bool> = Mutex::new("x11" == hbb_common::platform::linux::get_display_server());
}
}

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_FILE_TRANSFER: &str = "file transfer";
pub(super) const APP_TYPE_DESKTOP_PORT_FORWARD: &str = "port forward";
pub(super) const APP_TYPE_DESKTOP_RDP: &str = "rdp";
lazy_static::lazy_static! {
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_FILE_TRANSFER,
flutter::APP_TYPE_DESKTOP_PORT_FORWARD,
flutter::APP_TYPE_DESKTOP_RDP,
];
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 {
// if !config::APP_DIR.read().unwrap().is_empty() {
// res = LocalConfig::get_remote_id();

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "非安全连接"),
("Scale original", "原始尺寸"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nezabezpečené připojení"),
("Scale original", "Měřítko původní"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Usikker forbindelse"),
("Scale original", "Skala original"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Unsichere Verbindung"),
("Scale original", "Original 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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nesekura Konekto"),
("Scale original", "Skalo originalo"),
("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();
}

View File

@ -335,5 +335,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Conexión insegura"),
("Scale original", "escala originales"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Connexion non sécurisée"),
("Scale original", "Échelle d'origine"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nem biztonságos kapcsolat"),
("Scale original", "Eredeti méretarány"),
("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();
}

View File

@ -335,5 +335,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Koneksi Tidak Aman"),
("Scale original", "Skala asli"),
("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();
}

View File

@ -321,5 +321,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map 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();
}

View File

@ -319,5 +319,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "安全でない接続"),
("Scale original", "オリジナルサイズ"),
("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();
}

View File

@ -316,5 +316,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "안전하지 않은 연결"),
("Scale original", "원래 크기"),
("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();
}
}

View File

@ -320,5 +320,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Niepewne połączenie"),
("Scale original", "Skala oryginalna"),
("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();
}

View File

@ -316,5 +316,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Conexão insegura"),
("Scale original", "Escala original"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", ""),
("Scale original", ""),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Небезопасное соединение"),
("Scale original", "Оригинал масштаба"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Nezabezpečené pripojenie"),
("Scale original", "Pôvodná 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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", ""),
("Scale original", ""),
("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();
}

View File

@ -335,5 +335,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "Güvenli Bağlantı"),
("Scale original", "Orijinali ölçeklendir"),
("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();
}

View File

@ -322,5 +322,27 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Insecure Connection", "非安全連接"),
("Scale original", "原始尺寸"),
("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();
}

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"),
("Scale original", "Quy mô gốc"),
("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();
}

View File

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

View File

@ -12,7 +12,7 @@ use hbb_common::{
fs,
fs::can_enable_overwrite_detection,
futures::{SinkExt, StreamExt},
get_version_number,
get_time, get_version_number,
message_proto::{option_message::BoolOption, permission_info::Permission},
password_security as password, sleep, timeout,
tokio::{
@ -397,7 +397,7 @@ impl Connection {
conn.on_close("Timeout", true).await;
break;
}
let time = crate::get_time();
let time = get_time();
if time > 0 && conn.last_test_delay == 0 {
conn.last_test_delay = time;
let mut msg_out = Message::new();
@ -921,17 +921,23 @@ impl Connection {
self.file_transfer = Some((ft.dir, ft.show_hidden));
}
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;
if pf.host == "RDP" && pf.port == 0 {
pf.host = "localhost".to_owned();
pf.port = 3389;
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() {
pf.host = "localhost".to_owned();
}
@ -977,7 +983,7 @@ impl Connection {
.get(&self.ip)
.map(|x| x.clone())
.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 {
self.send_login_error("Too many wrong password attempts")
.await;
@ -1016,7 +1022,7 @@ impl Connection {
self.inner.send(msg_out.into());
} else {
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
.lock()
.unwrap()
@ -1032,9 +1038,9 @@ impl Connection {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.keyboard {
if is_left_up(&me) {
CLICK_TIME.store(crate::get_time(), Ordering::SeqCst);
CLICK_TIME.store(get_time(), Ordering::SeqCst);
} 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());
}
@ -1043,7 +1049,7 @@ impl Connection {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.keyboard {
if is_enter(&me) {
CLICK_TIME.store(crate::get_time(), Ordering::SeqCst);
CLICK_TIME.store(get_time(), Ordering::SeqCst);
}
// handle all down as press
// 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")]
use dispatch::Queue;
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 std::{
convert::TryFrom,
@ -111,7 +111,7 @@ fn run_pos(sp: GenericService, state: &mut StatePos) -> ResultType<()> {
..Default::default()
});
let exclude = {
let now = crate::get_time();
let now = get_time();
let lock = LATEST_INPUT.lock().unwrap();
if now - lock.time < 300 {
lock.conn
@ -365,7 +365,7 @@ fn handle_mouse_(evt: &MouseEvent, conn: i32) {
let buttons = evt.mask >> 3;
let evt_type = evt.mask & 0x7;
if evt_type == 0 {
let time = crate::get_time();
let time = get_time();
*LATEST_INPUT.lock().unwrap() = Input { time, conn };
}
let mut en = ENIGO.lock().unwrap();

View File

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

View File

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