diff --git a/src-tauri/src/init.rs b/src-tauri/src/init.rs index 0608c7c1..268a7f1f 100644 --- a/src-tauri/src/init.rs +++ b/src-tauri/src/init.rs @@ -1,7 +1,7 @@ use tauri::Manager; use crate::injection::injection_runner; -use std::{time::Duration, sync::Arc}; +use std::{sync::Arc, time::Duration}; // Global "is injected" var static mut IS_READY: bool = false; @@ -22,14 +22,12 @@ pub fn inject_routine(win: tauri::Window) { IS_READY = true; println!("JS context ready!"); - let win = evt_app - .get_window("main"); + let win = evt_app.get_window("main"); // Set window.dorion to true in the window if let Some(win) = win { - win.eval("window.dorion = true") - .unwrap_or_default(); - + win.eval("window.dorion = true").unwrap_or_default(); + injection_runner::do_injection(win); } }); @@ -47,11 +45,11 @@ pub fn inject_routine(win: tauri::Window) { // Send javascript that sends the "initial_inject" event // // If it succeeds, that means the web context is ready - let win = app - .get_window("main"); - + let win = app.get_window("main"); + if let Some(win) = win { - win.eval("!window.dorion && window.__TAURI__.event.emit('initial_inject')") + win + .eval("!window.dorion && window.__TAURI__.event.emit('initial_inject')") .unwrap_or_default(); } diff --git a/src-tauri/src/injection/plugin.rs b/src-tauri/src/injection/plugin.rs index 2f4ad186..cf962a44 100644 --- a/src-tauri/src/injection/plugin.rs +++ b/src-tauri/src/injection/plugin.rs @@ -42,12 +42,11 @@ pub fn load_plugins(preload_only: Option) -> Result Result, String> { let plugins_dir = get_plugin_dir(); let mut plugin_list: Vec = Vec::new(); - let plugin_folders = fs::read_dir(&plugins_dir) - .map_err(|e| format!("Error reading directory: {}", e))?; + let plugin_folders = + fs::read_dir(&plugins_dir).map_err(|e| format!("Error reading directory: {}", e))?; for entry in plugin_folders { - let full_path = - entry.map_err(|e| format!("Error reading directory entry: {}", e))?; + let full_path = entry.map_err(|e| format!("Error reading directory entry: {}", e))?; let meta = full_path .metadata() .map_err(|e| format!("Error getting metadata: {}", e))?; diff --git a/src-tauri/src/util/notifications.rs b/src-tauri/src/util/notifications.rs index 84e904b5..3f785d71 100644 --- a/src-tauri/src/util/notifications.rs +++ b/src-tauri/src/util/notifications.rs @@ -5,8 +5,8 @@ pub fn send_notification(win: tauri::Window, title: String, body: String) { let app = win.app_handle(); notification::Notification::new(&app.config().tauri.bundle.identifier) - .title(&title) - .body(&body) + .title(title) + .body(body) .notify(&app) .unwrap_or_default(); }