diff --git a/Cargo.toml b/Cargo.toml index 267fb53..2247f34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,6 @@ edition = "2024" anyhow = "1.0.99" base64 = "0.22.1" chrono = "0.4.42" -libloading = { version = "0.8.8", optional = true } once_cell = "1.21.3" rand = "0.9.2" rusqlite = "0.37.0" @@ -18,4 +17,3 @@ ureq = "3.1.2" [features] default = [] -loader = ["libloading"] diff --git a/src/server.rs b/src/server.rs index 18710c1..60404a7 100644 --- a/src/server.rs +++ b/src/server.rs @@ -63,11 +63,6 @@ impl Server { pub fn run(self: &Arc) -> crate::Result<()> { // Load plugins - #[cfg(feature = "loader")] - utils::loader::load_plugins( - &mut *self.plugins.lock().unwrap(), - &self.root.join("./plugins"), - )?; // Initialize plugins diff --git a/src/utils/loader.rs b/src/utils/loader.rs deleted file mode 100644 index 70d52ac..0000000 --- a/src/utils/loader.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::path::Path; - -use libloading::{Library, Symbol}; - -use crate::{logger, utils::plugin::DynPlugin, utils::vfs}; - -logger! { - const LOGGER "Loader" -} - -pub fn load_plugin(path: &Path) -> anyhow::Result { - unsafe { - LOGGER.info(format!("Loading plugin: {:?}", path)); - let lib = Library::new(path)?; - let func: Symbol DynPlugin> = lib.get(b"load_plugin").unwrap(); - Ok(func()) - } -} - -pub fn load_plugins(arr: &mut Vec, path: &Path) -> crate::Result<()> { - LOGGER.info("Loading plugins"); - vfs::dir(path)?; - if path.is_dir() { - for entry in std::fs::read_dir(path)? { - let entry = entry?; - let path = entry.path(); - if path.extension().and_then(|s| s.to_str()) == Some("dylib") { - match load_plugin(&path) { - Ok(plugin) => { - arr.push(plugin); - } - Err(e) => LOGGER.error(format!("Failed to load plugin {:?}: {}", path, e)), - } - } - } - } else { - LOGGER.error(format!("{:?} is not a directory", path)); - } - - Ok(()) -} diff --git a/src/utils/mod.rs b/src/utils/mod.rs index bd5900f..270e652 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,7 +1,5 @@ pub mod auth; pub mod client; pub mod database; -#[cfg(feature = "loader")] -pub mod loader; pub mod logger; pub mod vfs;