plugin_framework, update lang

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-05-12 08:53:43 +08:00
parent 8a70bddd76
commit bff54a61f8
36 changed files with 234 additions and 108 deletions

2
Cargo.lock generated
View File

@ -7406,7 +7406,7 @@ dependencies = [
"hmac", "hmac",
"pbkdf2", "pbkdf2",
"sha1", "sha1",
"time 0.3.20", "time 0.3.21",
"zstd 0.11.2+zstd.1.5.2", "zstd 0.11.2+zstd.1.5.2",
] ]

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "没有指纹"), ("no fingerprints", "没有指纹"),
("Select a peer", "选择一个被控端"), ("Select a peer", "选择一个被控端"),
("Select peers", "选择被控"), ("Select peers", "选择被控"),
("Plugins", "插件") ("Plugins", "插件"),
("Uninstall", "卸载"),
("Update", "更新"),
("Enable", "启用"),
("Disable", "禁用"),
("Options", "选项"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "Keine Fingerabdrücke"), ("no fingerprints", "Keine Fingerabdrücke"),
("Select a peer", "Gegenstelle auswählen"), ("Select a peer", "Gegenstelle auswählen"),
("Select peers", "Gegenstellen auswählen"), ("Select peers", "Gegenstellen auswählen"),
("Plugins", "Plugins") ("Plugins", "Plugins"),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "sin huellas digitales"), ("no fingerprints", "sin huellas digitales"),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "بدون اثر انگشت"), ("no fingerprints", "بدون اثر انگشت"),
("Select a peer", "یک همتا را انتخاب کنید"), ("Select a peer", "یک همتا را انتخاب کنید"),
("Select peers", "همتایان را انتخاب کنید"), ("Select peers", "همتایان را انتخاب کنید"),
("Plugins", "پلاگین ها") ("Plugins", "پلاگین ها"),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "Nessuna firma digitale"), ("no fingerprints", "Nessuna firma digitale"),
("Select a peer", "Seleziona un peer"), ("Select a peer", "Seleziona un peer"),
("Select peers", "Seelziona peer"), ("Select peers", "Seelziona peer"),
("Plugins", "Plugin") ("Plugins", "Plugin"),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "geen vingerafdrukken"), ("no fingerprints", "geen vingerafdrukken"),
("Select a peer", "Selecteer een peer"), ("Select a peer", "Selecteer een peer"),
("Select peers", "Selecteer peers"), ("Select peers", "Selecteer peers"),
("Plugins", "Plugins") ("Plugins", "Plugins"),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "brak sygnatur"), ("no fingerprints", "brak sygnatur"),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "sem Impressões Digitais"), ("no fingerprints", "sem Impressões Digitais"),
("Select a peer", "Selecione um parceiro"), ("Select a peer", "Selecione um parceiro"),
("Select peers", "Selecione parceiros"), ("Select peers", "Selecione parceiros"),
("Plugins", "Plugins") ("Plugins", "Plugins"),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "отпечатки отсутствуют"), ("no fingerprints", "отпечатки отсутствуют"),
("Select a peer", "Выберите удалённый узел"), ("Select a peer", "Выберите удалённый узел"),
("Select peers", "Выберите удалённые узлы"), ("Select peers", "Выберите удалённые узлы"),
("Plugins", "Плагины") ("Plugins", "Плагины"),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", "沒有指紋"), ("no fingerprints", "沒有指紋"),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -500,6 +500,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("no fingerprints", ""), ("no fingerprints", ""),
("Select a peer", ""), ("Select a peer", ""),
("Select peers", ""), ("Select peers", ""),
("Plugins", "") ("Plugins", ""),
("Uninstall", ""),
("Update", ""),
("Enable", ""),
("Disable", ""),
("Options", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -67,82 +67,38 @@ fn get_source_plugins() -> HashMap<String, PluginInfo> {
let mut plugins = HashMap::new(); let mut plugins = HashMap::new();
for source in get_plugin_source_list().into_iter() { for source in get_plugin_source_list().into_iter() {
let url = format!("{}/meta.toml", source.url); let url = format!("{}/meta.toml", source.url);
// match reqwest::blocking::get(&url) { match reqwest::blocking::get(&url) {
// Ok(resp) => { Ok(resp) => {
// if !resp.status().is_success() { if !resp.status().is_success() {
// log::error!( log::error!(
// "Failed to get plugin list from '{}', status code: {}", "Failed to get plugin list from '{}', status code: {}",
// url, url,
// resp.status() resp.status()
// );
// }
// if let Ok(text) = resp.text() {
// match toml::from_str::<ManagerMeta>(&text) {
// Ok(manager_meta) => {
// for meta in manager_meta.plugins.iter() {
// if !meta.platforms.to_uppercase().contains(&PLUGIN_PLATFORM.to_uppercase()) {
// continue;
// }
// plugins.insert(
// meta.id.clone(),
// PluginInfo {
// source: source.clone(),
// meta: meta.clone(),
// installed_version: "".to_string(),
// invalid_reason: "".to_string(),
// },
// );
// }
// }
// Err(e) => log::error!("Failed to parse plugin list from '{}', {}", url, e),
// }
// }
// }
// Err(e) => log::error!("Failed to get plugin list from '{}', {}", url, e),
// }
let text = r#"
version = "v0.1.0"
description = ""
[[plugins]]
id = "RustDesk.c.privacy-mode"
name = "Privacy Mode"
version = "v0.1.0"
description = "This plugin can enable private mode to prevent others from seeing your operations."
platforms = "Windows,Linux,MacOS"
author = "RustDesk"
home = ""
license = "MIT"
source = ""
[plugins.publish_info]
published = "2023-05-07 14:00:00"
last_released = "2023-05-07 14:00:00"
"#
.to_string();
match toml::from_str::<ManagerMeta>(&text) {
Ok(manager_meta) => {
for meta in manager_meta.plugins.iter() {
if !meta
.platforms
.to_uppercase()
.contains(&PLUGIN_PLATFORM.to_uppercase())
{
continue;
}
plugins.insert(
meta.id.clone(),
PluginInfo {
source: source.clone(),
meta: meta.clone(),
installed_version: "".to_string(),
invalid_reason: "".to_string(),
},
); );
} }
if let Ok(text) = resp.text() {
match toml::from_str::<ManagerMeta>(&text) {
Ok(manager_meta) => {
for meta in manager_meta.plugins.iter() {
if !meta.platforms.to_uppercase().contains(&PLUGIN_PLATFORM.to_uppercase()) {
continue;
}
plugins.insert(
meta.id.clone(),
PluginInfo {
source: source.clone(),
meta: meta.clone(),
installed_version: "".to_string(),
invalid_reason: "".to_string(),
},
);
}
}
Err(e) => log::error!("Failed to parse plugin list from '{}', {}", url, e),
}
}
} }
Err(e) => log::error!("Failed to parse plugin list from '{}', {}", url, e), Err(e) => log::error!("Failed to get plugin list from '{}', {}", url, e),
} }
} }
plugins plugins