mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 01:49:13 +01:00
Reload template functions on window focus
This commit is contained in:
@@ -10,6 +10,7 @@ use std::time::Duration;
|
||||
use crate::render::render_http_request;
|
||||
use crate::response_err;
|
||||
use crate::template_callback::PluginTemplateCallback;
|
||||
use base64::prelude::BASE64_STANDARD;
|
||||
use base64::Engine;
|
||||
use http::header::{ACCEPT, USER_AGENT};
|
||||
use http::{HeaderMap, HeaderName, HeaderValue};
|
||||
@@ -204,7 +205,7 @@ pub async fn send_http_request<R: Runtime>(
|
||||
.unwrap_or_default();
|
||||
|
||||
let auth = format!("{username}:{password}");
|
||||
let encoded = base64::engine::general_purpose::STANDARD.encode(auth);
|
||||
let encoded = BASE64_STANDARD.encode(auth);
|
||||
headers.insert(
|
||||
"Authorization",
|
||||
HeaderValue::from_str(&format!("Basic {}", encoded)).unwrap(),
|
||||
|
||||
@@ -59,7 +59,7 @@ use yaak_models::queries::{
|
||||
use yaak_plugin_runtime::events::{
|
||||
CallHttpRequestActionRequest, FilterResponse, FindHttpResponsesResponse,
|
||||
GetHttpRequestActionsResponse, GetHttpRequestByIdResponse, GetTemplateFunctionsResponse,
|
||||
InternalEvent, InternalEventPayload, PluginBootResponse, RenderHttpRequestResponse,
|
||||
InternalEvent, InternalEventPayload, BootResponse, RenderHttpRequestResponse,
|
||||
SendHttpRequestResponse, ShowToastRequest, ToastVariant,
|
||||
};
|
||||
use yaak_plugin_runtime::handle::PluginHandle;
|
||||
@@ -1473,7 +1473,7 @@ async fn cmd_plugin_info(
|
||||
id: &str,
|
||||
w: WebviewWindow,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> Result<PluginBootResponse, String> {
|
||||
) -> Result<BootResponse, String> {
|
||||
let plugin = get_plugin(&w, id).await.map_err(|e| e.to_string())?;
|
||||
plugin_manager
|
||||
.get_plugin_info(plugin.directory.as_str())
|
||||
@@ -2085,7 +2085,7 @@ async fn handle_plugin_event<R: Runtime>(
|
||||
},
|
||||
))
|
||||
}
|
||||
InternalEventPayload::ReloadResponse(_) => {
|
||||
InternalEventPayload::ReloadResponse => {
|
||||
let w = get_focused_window_no_lock(app_handle).expect("No focused window");
|
||||
let plugins = list_plugins(&w).await.unwrap();
|
||||
for plugin in plugins {
|
||||
|
||||
Reference in New Issue
Block a user