mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
ab: sync all recent peers if option enabled
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -841,6 +841,10 @@ pub fn main_peer_has_password(id: String) -> bool {
|
||||
peer_has_password(id)
|
||||
}
|
||||
|
||||
pub fn main_peer_exists(id: String) -> bool {
|
||||
peer_exists(&id)
|
||||
}
|
||||
|
||||
pub fn main_load_recent_peers() {
|
||||
if !config::APP_DIR.read().unwrap().is_empty() {
|
||||
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers(None)
|
||||
@@ -883,8 +887,13 @@ pub fn main_load_recent_peers_sync() -> SyncReturn<String> {
|
||||
|
||||
pub fn main_load_recent_peers_for_ab(filter: String) -> String {
|
||||
let id_filters = serde_json::from_str::<Vec<String>>(&filter).unwrap_or_default();
|
||||
let id_filters = if id_filters.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(id_filters)
|
||||
};
|
||||
if !config::APP_DIR.read().unwrap().is_empty() {
|
||||
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers(Some(id_filters))
|
||||
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers(id_filters)
|
||||
.drain(..)
|
||||
.map(|(id, _, p)| peer_to_map_ab(id, p))
|
||||
.collect();
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", "未成功获取地址簿"),
|
||||
("push_ab_failed_tip", "未成功上传地址簿"),
|
||||
("synced_peer_readded_tip", "最近会话中存在的设备将会被重新添加到地址簿。"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", "Tags umschalten"),
|
||||
("pull_ab_failed_tip", "Aktualisierung des Adressbuchs fehlgeschlagen"),
|
||||
("push_ab_failed_tip", "Synchronisierung des Adressbuchs mit dem Server fehlgeschlagen"),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -76,5 +76,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", "You have reached the maximum number of managed devices."),
|
||||
("pull_ab_failed_tip", "Failed to refresh address book"),
|
||||
("push_ab_failed_tip", "Failed to sync address book to server"),
|
||||
("synced_peer_readded_tip", "The devices present in the recent sessions will be re-added to the address book."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", "Alternar Etiquetas"),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", "Attiva/disattiva tag"),
|
||||
("pull_ab_failed_tip", "Impossibile aggiornare la rubrica"),
|
||||
("push_ab_failed_tip", "Impossibile sincronizzare la rubrica con il server"),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", "Переключить метки"),
|
||||
("pull_ab_failed_tip", "Невозможно обновить адресную книгу"),
|
||||
("push_ab_failed_tip", "Невозможно синхронизировать адресную книгу с сервером"),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", "未成功獲取地址簿"),
|
||||
("push_ab_failed_tip", "未成功上傳地址簿"),
|
||||
("synced_peer_readded_tip", "最近會話中存在的設備將會被重新添加到地址簿。"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -537,5 +537,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Toggle Tags", ""),
|
||||
("pull_ab_failed_tip", ""),
|
||||
("push_ab_failed_tip", ""),
|
||||
("synced_peer_readded_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -648,6 +648,11 @@ pub fn peer_to_map_ab(id: String, p: PeerConfig) -> HashMap<&'static str, String
|
||||
m
|
||||
}
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
pub fn peer_exists(id: &str) -> bool {
|
||||
PeerConfig::exists(id)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_lan_peers() -> Vec<HashMap<&'static str, String>> {
|
||||
config::LanPeers::load()
|
||||
|
||||
Reference in New Issue
Block a user