Reload plugins on change

This commit is contained in:
Gregory Schier
2024-09-09 11:34:52 -07:00
parent 3bf192953d
commit c0707bb246
18 changed files with 240 additions and 118 deletions

View File

@@ -15,6 +15,7 @@ use std::time::Duration;
use tauri::{AppHandle, Runtime};
use tokio::sync::mpsc;
use tokio::sync::watch::Sender;
use crate::handle::PluginHandle;
pub struct PluginManager {
kill_tx: Sender<bool>,
@@ -38,6 +39,10 @@ impl PluginManager {
PluginManager { kill_tx, server }
}
pub async fn reload_all(&self) {
self.server.reload_plugins().await
}
pub async fn subscribe(&self) -> (String, mpsc::Receiver<InternalEvent>) {
self.server.subscribe().await
}
@@ -68,6 +73,10 @@ impl PluginManager {
self.server.plugin_by_dir(dir).await.ok()?.info().await
}
pub async fn get_plugin(&self, ref_id: &str) -> Result<PluginHandle> {
self.server.plugin_by_ref_id(ref_id).await
}
pub async fn get_http_request_actions(&self) -> Result<Vec<GetHttpRequestActionsResponse>> {
let reply_events = self
.server