delete discovery from RustDesk_lan_peers.toml

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-02-24 13:13:51 +08:00
parent ca991ff39f
commit 920477bbb2
4 changed files with 18 additions and 5 deletions

View File

@ -534,7 +534,7 @@ abstract class BasePeerCard extends StatelessWidget {
proc: () {
() async {
if (isLan) {
// TODO
bind.mainRemoveDiscovered(id: id);
} else {
final favs = (await bind.mainGetFav()).toList();
if (favs.remove(id)) {
@ -859,7 +859,11 @@ class DiscoveredPeerCard extends BasePeerCard {
}
menuItems.add(MenuEntryDivider());
menuItems.add(_removeAction(peer.id, () async {}));
menuItems.add(
_removeAction(peer.id, () async {
await bind.mainLoadLanPeers();
}, isLan: true),
);
return menuItems;
}

View File

@ -796,6 +796,10 @@ pub fn main_load_lan_peers() {
};
}
pub fn main_remove_discovered(id: String) {
remove_discovered(id);
}
fn main_broadcast_message(data: &HashMap<&str, &str>) {
let apps = vec![
flutter::APP_TYPE_DESKTOP_REMOTE,

View File

@ -413,9 +413,7 @@ impl UI {
}
fn remove_discovered(&mut self, id: String) {
let mut peers = config::LanPeers::load().peers;
peers.retain(|x| x.id != id);
config::LanPeers::store(&peers);
remove_discovered(id);
}
fn send_wol(&mut self, id: String) {

View File

@ -596,6 +596,13 @@ pub fn get_lan_peers() -> Vec<HashMap<&'static str, String>> {
.collect()
}
#[inline]
pub fn remove_discovered(id: String) {
let mut peers = config::LanPeers::load().peers;
peers.retain(|x| x.id != id);
config::LanPeers::store(&peers);
}
#[inline]
pub fn get_uuid() -> String {
base64::encode(hbb_common::get_uuid())