diff --git a/src/macros.rs b/src/macros.rs index fd1d31e..b895dc7 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,13 +1,3 @@ -#[macro_export] -macro_rules! export_plugin { - ($p:expr) => { - #[unsafe(no_mangle)] - pub extern "C" fn load_plugin() -> $crate::utils::plugin::DynPlugin { - $p - } - }; -} - #[macro_export] macro_rules! logger { (const $i:ident $name:expr) => { diff --git a/src/server.rs b/src/server.rs index 0b6a9d9..3620357 100644 --- a/src/server.rs +++ b/src/server.rs @@ -7,7 +7,7 @@ use std::{ use crate::{ logger, types, - utils::{self, client::Client, plugin::DynPlugin}, + utils::{self, client::Client}, }; #[derive(serde::Serialize, serde::Deserialize)] @@ -23,7 +23,6 @@ pub struct ServerConfig { pub struct Server { pub root: PathBuf, pub config: ServerConfig, - pub plugins: Mutex>, pub clients: Mutex>, pub db: utils::database::Database, } @@ -56,7 +55,6 @@ impl Server { pub fn new_config(root: &Path, config: ServerConfig) -> Arc { Arc::new(Self { db: utils::database::Database::new(&config).unwrap(), - plugins: Mutex::new(Vec::new()), root: root.to_path_buf(), config, clients: Mutex::new(HashSet::new()), @@ -72,9 +70,6 @@ impl Server { )?; // Initialize plugins - for plugin in self.plugins.lock().unwrap().iter_mut() { - plugin.init(self); - } // Start server let listener = TcpListener::bind(format!("0.0.0.0:{}", self.config.port))?; @@ -167,11 +162,11 @@ impl Server { 'outer: loop { let req = client.read()?; if let Some(r) = &req { - for p in self.plugins.lock().unwrap().iter_mut() { - if p.on_request(r, client, self) { - continue 'outer; - } - } + // for p in self.plugins.lock().unwrap().iter_mut() { + // if p.on_request(r, client, self) { + // continue 'outer; + // } + // } self.wrap_err(&client, self.call_request(r, &client))?; } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index d7279fe..1d4eb67 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -3,5 +3,4 @@ pub mod database; #[cfg(feature = "loader")] pub mod loader; pub mod logger; -pub mod plugin; pub mod vfs; diff --git a/src/utils/plugin.rs b/src/utils/plugin.rs deleted file mode 100644 index e365ccd..0000000 --- a/src/utils/plugin.rs +++ /dev/null @@ -1,22 +0,0 @@ -use std::sync::Arc; - -use crate::{ - server::Server, - types::message::{ClientMessage, WsMessage}, - utils::client::Client, -}; - -pub type DynPlugin = Box; - -pub trait Plugin { - fn init(&mut self, server: &Arc); - #[allow(unused_variables)] - fn on_request( - &mut self, - req: &WsMessage, - client: &Client, - server: &Arc, - ) -> bool { - false - } -}