Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: implement PluginHost trait and ProxyConfig struct for plugin management

Tonhod03358404071
diff --git a/src-tauri/omniget-plugin-sdk/src/host.rs b/src-tauri/omniget-plugin-sdk/src/host.rs
new file mode 100644
index 00000000..81a75bfc
--- /dev/null
+++ b/src-tauri/omniget-plugin-sdk/src/host.rs
@@ -0,0 +1,22 @@
+use std::path::PathBuf;
+
+pub trait PluginHost: Send + Sync {
+ fn emit_event(&self, name: &str, payload: serde_json::Value) -> anyhow::Result<()>;
+ fn show_toast(&self, toast_type: &str, message: &str) -> anyhow::Result<()>;
+ fn plugin_data_dir(&self, plugin_id: &str) -> PathBuf;
+ fn plugin_frontend_dir(&self, plugin_id: &str) -> PathBuf;
+ fn get_settings(&self, plugin_id: &str) -> serde_json::Value;
+ fn save_settings(&self, plugin_id: &str, settings: serde_json::Value) -> anyhow::Result<()>;
+ fn proxy_config(&self) -> Option<ProxyConfig>;
+ fn tool_path(&self, tool: &str) -> Option<PathBuf>;
+ fn default_output_dir(&self) -> PathBuf;
+}
+
+#[derive(Debug, Clone)]
+pub struct ProxyConfig {
+ pub proxy_type: String,
+ pub host: String,
+ pub port: u16,
+ pub username: Option<String>,
+ pub password: Option<String>,
+}