update setting page, add option enable-rdp

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-09-08 21:40:43 +08:00
parent f5dba0f7aa
commit 302a43d68c
29 changed files with 956 additions and 420 deletions

View File

@ -195,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) {
@ -210,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;
@ -230,7 +230,7 @@ class MyTheme {
}
bool isDarkTheme() {
return Get.isDarkMode;
return "Y" == Get.find<SharedPreferences>().getString("darkTheme");
}
final ButtonStyle flatButtonStyle = TextButton.styleFrom(

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")))
],
);

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

@ -282,8 +282,8 @@ 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,

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

@ -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

@ -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();
}

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> {