Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Sep 24, 2024
2 parents 6537adc + ba88bc9 commit cc861e3
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 17 deletions.
2 changes: 2 additions & 0 deletions flutter/lib/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,5 @@ enum WindowsTarget {
extension WindowsTargetExt on int {
WindowsTarget get windowsVersion => getWindowsTarget(this);
}

const kCheckSoftwareUpdateFinish = 'check_software_update_finish';
16 changes: 14 additions & 2 deletions flutter/lib/desktop/pages/desktop_home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,17 @@ class _DesktopHomePageState extends State<DesktopHomePage>
void initState() {
super.initState();
if (!bind.isCustomClient()) {
platformFFI.registerEventHandler(
kCheckSoftwareUpdateFinish, kCheckSoftwareUpdateFinish,
(Map<String, dynamic> evt) async {
if (evt['url'] is String) {
setState(() {
updateUrl = evt['url'];
});
}
});
Timer(const Duration(seconds: 1), () async {
updateUrl = await bind.mainGetSoftwareUpdateUrl();
if (updateUrl.isNotEmpty) setState(() {});
bind.mainGetSoftwareUpdateUrl();
});
}
_updateTimer = periodic_immediate(const Duration(seconds: 1), () async {
Expand Down Expand Up @@ -824,6 +832,10 @@ class _DesktopHomePageState extends State<DesktopHomePage>
_uniLinksSubscription?.cancel();
Get.delete<RxBool>(tag: 'stop-service');
_updateTimer?.cancel();
if (!bind.isCustomClient()) {
platformFFI.unregisterEventHandler(
kCheckSoftwareUpdateFinish, kCheckSoftwareUpdateFinish);
}
super.dispose();
}

Expand Down
16 changes: 14 additions & 2 deletions flutter/lib/mobile/pages/connection_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,17 @@ class _ConnectionPageState extends State<ConnectionPage> {
}
if (isAndroid) {
if (!bind.isCustomClient()) {
platformFFI.registerEventHandler(
kCheckSoftwareUpdateFinish, kCheckSoftwareUpdateFinish,
(Map<String, dynamic> evt) async {
if (evt['url'] is String) {
setState(() {
_updateUrl = evt['url'];
});
}
});
Timer(const Duration(seconds: 1), () async {
_updateUrl = await bind.mainGetSoftwareUpdateUrl();
if (_updateUrl.isNotEmpty) setState(() {});
bind.mainGetSoftwareUpdateUrl();
});
}
}
Expand Down Expand Up @@ -353,6 +361,10 @@ class _ConnectionPageState extends State<ConnectionPage> {
if (Get.isRegistered<IDTextEditingController>()) {
Get.delete<IDTextEditingController>();
}
if (!bind.isCustomClient()) {
platformFFI.unregisterEventHandler(
kCheckSoftwareUpdateFinish, kCheckSoftwareUpdateFinish);
}
super.dispose();
}
}
6 changes: 3 additions & 3 deletions flutter/lib/web/bridge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class RustdeskImpl {

Future<void> sessionElevateDirect(
{required UuidValue sessionId, dynamic hint}) {
throw UnimplementedError();
return Future(() => js.context.callMethod('setByName', ['elevate_direct']));
}

Future<void> sessionElevateWithLogon(
Expand All @@ -618,7 +618,7 @@ class RustdeskImpl {
dynamic hint}) {
return Future(() => js.context.callMethod('setByName', [
'elevate_with_logon',
jsonEncode({username, password})
jsonEncode({'username': username, 'password': password})
]));
}

Expand Down Expand Up @@ -1063,7 +1063,7 @@ class RustdeskImpl {
() => js.context.callMethod('getByName', ['option', 'last_remote_id']));
}

Future<String> mainGetSoftwareUpdateUrl({dynamic hint}) {
Future<void> mainGetSoftwareUpdateUrl({dynamic hint}) {
throw UnimplementedError();
}

Expand Down
11 changes: 10 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,16 @@ async fn check_software_update_() -> hbb_common::ResultType<()> {
let response_url = latest_release_response.url().to_string();

if get_version_number(&latest_release_version) > get_version_number(crate::VERSION) {
*SOFTWARE_UPDATE_URL.lock().unwrap() = response_url;
#[cfg(feature = "flutter")]
{
let mut m = HashMap::new();
m.insert("name", "check_software_update_finish");
m.insert("url", &response_url);
if let Ok(data) = serde_json::to_string(&m) {
let _ = crate::flutter::push_global_event(crate::flutter::APP_TYPE_MAIN, data);
}
}
*SOFTWARE_UPDATE_URL.lock().unwrap() = response_url;
}
Ok(())
}
Expand Down
4 changes: 1 addition & 3 deletions src/flutter_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ fn initialize(app_dir: &str, custom_client_config: &str) {
scrap::mediacodec::check_mediacodec();
crate::common::test_rendezvous_server();
crate::common::test_nat_type();
crate::common::check_software_update();
}
#[cfg(target_os = "ios")]
{
Expand Down Expand Up @@ -1376,11 +1375,10 @@ pub fn main_get_last_remote_id() -> String {
LocalConfig::get_remote_id()
}

pub fn main_get_software_update_url() -> String {
pub fn main_get_software_update_url() {
if get_local_option("enable-check-update".to_string()) != "N" {
crate::common::check_software_update();
}
crate::common::SOFTWARE_UPDATE_URL.lock().unwrap().clone()
}

pub fn main_get_home_dir() -> String {
Expand Down
8 changes: 4 additions & 4 deletions src/lang/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Stop session recording", "Ferma registrazione sessione"),
("Enable recording session", "Abilita registrazione sessione"),
("Enable LAN discovery", "Abilita rilevamento LAN"),
("Deny LAN discovery", "Nega rilevamento LAN"),
("Deny LAN discovery", "Disabilita rilevamento LAN"),
("Write a message", "Scrivi un messaggio"),
("Prompt", "Richiedi"),
("Please wait for confirmation of UAC...", "Attendi la conferma dell'UAC..."),
Expand Down Expand Up @@ -532,7 +532,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("HSV Color", "Colore HSV"),
("Installation Successful!", "Installazione completata"),
("Installation failed!", "Installazione fallita"),
("Reverse mouse wheel", "Rotella mouse inversa"),
("Reverse mouse wheel", "Funzione rotellina mouse inversa"),
("{} sessions", "{} sessioni"),
("scam_title", "Potresti essere stato TRUFFATO!"),
("scam_text1", "Se sei al telefono con qualcuno che NON conosci NON DI TUA FIDUCIA che ti ha chiesto di usare RustDesk e di avviare il servizio, non procedere e riattacca subito."),
Expand Down Expand Up @@ -632,7 +632,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("About RustDesk", "Info su RustDesk"),
("Send clipboard keystrokes", "Invia sequenze tasti appunti"),
("network_error_tip", "Controlla la connessione di rete, quindi seleziona 'Riprova'."),
("Unlock with PIN", "Sblocca con PIN"),
("Unlock with PIN", "Abilita sblocco con PIN"),
("Requires at least {} characters", "Richiede almeno {} caratteri"),
("Wrong PIN", "PIN errato"),
("Set PIN", "Imposta PIN"),
Expand All @@ -644,7 +644,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Parent directory", "Cartella principale"),
("Resume", "Riprendi"),
("Invalid file name", "Nome file non valido"),
("one-way-file-transfer-tip", "Il trasferimento file unidirezionale è abilitato sul lato controllato."),
("one-way-file-transfer-tip", "Sul lato controllato è abilitato il trasferimento file unidirezionale."),
("Authentication Required", "Richiesta autenticazione"),
("Authenticate", "Autentica"),
].iter().cloned().collect();
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ fn main() {
}
common::test_rendezvous_server();
common::test_nat_type();
#[cfg(target_os = "android")]
crate::common::check_software_update();
common::global_clean();
}

Expand Down

0 comments on commit cc861e3

Please sign in to comment.