mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-25 06:01:00 +03:00
plugin_framework, flutter event handlers
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -14,6 +14,9 @@ lazy_static::lazy_static! {
|
||||
static ref CONFIG_PEER_ITEMS: Arc<Mutex<HashMap<String, Vec<ConfigItem>>>> = Default::default();
|
||||
}
|
||||
|
||||
pub(super) const CONFIG_TYPE_LOCAL: &str = "local";
|
||||
pub(super) const CONFIG_TYPE_PEER: &str = "peer";
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
pub struct LocalConfig(HashMap<String, String>);
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
@@ -72,14 +75,6 @@ impl LocalConfig {
|
||||
CONFIG_LOCAL.lock().unwrap().insert(id.to_owned(), conf);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn save(id: &str) -> ResultType<()> {
|
||||
match CONFIG_LOCAL.lock().unwrap().get(id) {
|
||||
Some(config) => hbb_common::config::store_path(Self::path(id), config),
|
||||
None => bail!("No such plugin {}", id),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get(id: &str, key: &str) -> Option<String> {
|
||||
if let Some(conf) = CONFIG_LOCAL.lock().unwrap().get(id) {
|
||||
@@ -136,17 +131,6 @@ impl PeerConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn save(id: &str, peer: &str) -> ResultType<()> {
|
||||
match CONFIG_PEERS.lock().unwrap().get(id) {
|
||||
Some(peers) => match peers.get(peer) {
|
||||
Some(config) => hbb_common::config::store_path(Self::path(id, peer), config),
|
||||
None => bail!("No such peer {}", peer),
|
||||
},
|
||||
None => bail!("No such plugin {}", id),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get(id: &str, peer: &str, key: &str) -> Option<String> {
|
||||
if let Some(peers) = CONFIG_PEERS.lock().unwrap().get(id) {
|
||||
|
||||
Reference in New Issue
Block a user