diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-07-24 14:16:24 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-07-24 14:16:24 +0200 |
commit | 31ecd728ba2bb6244214423c951b40e308d16edf (patch) | |
tree | 81d167f87e16220e479b9e4effa57ba8ec7b4798 /src-tauri/src | |
parent | c227cd0111298f6d341e7b00a27d36bd0a483a36 (diff) | |
parent | 399f0e78b4773aa97a8a80c43fb2312ea830a845 (diff) | |
download | FlightCore-31ecd728ba2bb6244214423c951b40e308d16edf.tar.gz FlightCore-31ecd728ba2bb6244214423c951b40e308d16edf.zip |
Merge branch 'main' into feat/launch-parameters
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/mod_management/mod.rs | 7 | ||||
-rw-r--r-- | src-tauri/src/mod_management/plugins.rs | 26 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index 0d4edd87..879d3b04 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -12,6 +12,7 @@ use std::string::ToString; use std::{fs, path::PathBuf}; mod legacy; +mod plugins; use crate::GameInstall; #[derive(Debug, Clone)] @@ -498,8 +499,10 @@ fn fc_sanity_check(input: &&fs::File) -> bool { if file_path.starts_with("plugins/") { if let Some(name) = file_path.file_name() { if name.to_str().unwrap().contains(".dll") { - log::warn!("Plugin detected, skipping"); - return false; // We disallow plugins for now + log::warn!("Plugin detected, prompting user"); + if !plugins::plugin_prompt() { + return false; // Plugin detected and user denied install + } } } } diff --git a/src-tauri/src/mod_management/plugins.rs b/src-tauri/src/mod_management/plugins.rs new file mode 100644 index 00000000..e2427a16 --- /dev/null +++ b/src-tauri/src/mod_management/plugins.rs @@ -0,0 +1,26 @@ +use tauri::api::dialog::blocking::MessageDialogBuilder; +use tauri::api::dialog::{MessageDialogButtons, MessageDialogKind}; + +/// Prompt on plugin +/// Returns: +/// - true: user accepted plugin install +/// - false: user denied plugin install +pub fn plugin_prompt() -> bool { + let dialog = MessageDialogBuilder::new( + "Plugin in package detected", + "This mod contains a plugin. Plugins have unrestricted access to your computer! + \nMake sure you trust the author! + \n + \nPress 'Ok' to continue or 'Cancel' to abort mod installation", + ) + .kind(MessageDialogKind::Warning) + .buttons(MessageDialogButtons::OkCancel); + + if dialog.show() { + log::info!("Accepted plugin install"); + true + } else { + log::warn!("Plugin install cancelled"); + false + } +} |