aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/mod_management/plugins.rs
blob: e2427a16e84d2f7ff1b398d2facc671632a21ba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
    }
}