Plugin execution context (#119)

This commit is contained in:
Gregory Schier
2024-09-30 17:45:51 -07:00
committed by GitHub
parent 917adcfb2e
commit 9915c57817
29 changed files with 637 additions and 373 deletions

View File

@@ -27,6 +27,7 @@ use yaak_models::models::{
Cookie, CookieJar, Environment, HttpRequest, HttpResponse, HttpResponseHeader, HttpUrlParameter,
};
use yaak_models::queries::{get_workspace, update_response_if_id, upsert_cookie_jar};
use yaak_plugin_runtime::events::{RenderPurpose, WindowContext};
pub async fn send_http_request<R: Runtime>(
window: &WebviewWindow<R>,
@@ -39,8 +40,11 @@ pub async fn send_http_request<R: Runtime>(
let workspace = get_workspace(window, &request.workspace_id)
.await
.expect("Failed to get Workspace");
let cb = &*window.app_handle().state::<PluginTemplateCallback>();
let cb = cb.for_send();
let cb = PluginTemplateCallback::new(
window.app_handle(),
&WindowContext::from_window(window),
RenderPurpose::Send,
);
let rendered_request =
render_http_request(&request, &workspace, environment.as_ref(), &cb).await;