aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/mod_management/plugins.rs
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-07-23 23:32:59 +0200
committerGitHub <noreply@github.com>2023-07-23 23:32:59 +0200
commitdac7b0b18ab5a36d3a25154108e9acecc6c5fe93 (patch)
tree9475ffa7d856991e1bd3d88a4950962869d42a8e /src-tauri/src/mod_management/plugins.rs
parent031ced476c38d08f7bec5312c16d1343a24e2469 (diff)
downloadFlightCore-dac7b0b18ab5a36d3a25154108e9acecc6c5fe93.tar.gz
FlightCore-dac7b0b18ab5a36d3a25154108e9acecc6c5fe93.zip
feat: Add basic warning on plugin install (#441)
Plugins in Northstar have unrestricted device access. As such we want to warn user before installing one with an option to abort.
Diffstat (limited to 'src-tauri/src/mod_management/plugins.rs')
-rw-r--r--src-tauri/src/mod_management/plugins.rs26
1 files changed, 26 insertions, 0 deletions
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
+ }
+}