mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-07 05:15:20 +02:00
Fix plugins commands
This commit is contained in:
@@ -1684,6 +1684,13 @@ pub fn run() {
|
|||||||
git_ext::cmd_git_add_remote,
|
git_ext::cmd_git_add_remote,
|
||||||
git_ext::cmd_git_rm_remote,
|
git_ext::cmd_git_rm_remote,
|
||||||
//
|
//
|
||||||
|
// Plugin commands
|
||||||
|
plugins_ext::cmd_plugins_search,
|
||||||
|
plugins_ext::cmd_plugins_install,
|
||||||
|
plugins_ext::cmd_plugins_uninstall,
|
||||||
|
plugins_ext::cmd_plugins_updates,
|
||||||
|
plugins_ext::cmd_plugins_update_all,
|
||||||
|
//
|
||||||
// WebSocket commands
|
// WebSocket commands
|
||||||
ws_ext::cmd_ws_upsert_request,
|
ws_ext::cmd_ws_upsert_request,
|
||||||
ws_ext::cmd_ws_duplicate_request,
|
ws_ext::cmd_ws_duplicate_request,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use tauri::path::BaseDirectory;
|
|||||||
use tauri::plugin::{Builder, TauriPlugin};
|
use tauri::plugin::{Builder, TauriPlugin};
|
||||||
use tauri::{
|
use tauri::{
|
||||||
AppHandle, Emitter, Manager, RunEvent, Runtime, State, WebviewWindow, WindowEvent, command,
|
AppHandle, Emitter, Manager, RunEvent, Runtime, State, WebviewWindow, WindowEvent, command,
|
||||||
generate_handler, is_dev,
|
is_dev,
|
||||||
};
|
};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use ts_rs::TS;
|
use ts_rs::TS;
|
||||||
@@ -132,7 +132,7 @@ impl PluginUpdater {
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) async fn cmd_plugins_search<R: Runtime>(
|
pub async fn cmd_plugins_search<R: Runtime>(
|
||||||
app_handle: AppHandle<R>,
|
app_handle: AppHandle<R>,
|
||||||
query: &str,
|
query: &str,
|
||||||
) -> Result<PluginSearchResponse> {
|
) -> Result<PluginSearchResponse> {
|
||||||
@@ -141,7 +141,7 @@ pub(crate) async fn cmd_plugins_search<R: Runtime>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) async fn cmd_plugins_install<R: Runtime>(
|
pub async fn cmd_plugins_install<R: Runtime>(
|
||||||
window: WebviewWindow<R>,
|
window: WebviewWindow<R>,
|
||||||
name: &str,
|
name: &str,
|
||||||
version: Option<String>,
|
version: Option<String>,
|
||||||
@@ -163,7 +163,7 @@ pub(crate) async fn cmd_plugins_install<R: Runtime>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) async fn cmd_plugins_uninstall<R: Runtime>(
|
pub async fn cmd_plugins_uninstall<R: Runtime>(
|
||||||
plugin_id: &str,
|
plugin_id: &str,
|
||||||
window: WebviewWindow<R>,
|
window: WebviewWindow<R>,
|
||||||
) -> Result<Plugin> {
|
) -> Result<Plugin> {
|
||||||
@@ -174,7 +174,7 @@ pub(crate) async fn cmd_plugins_uninstall<R: Runtime>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) async fn cmd_plugins_updates<R: Runtime>(
|
pub async fn cmd_plugins_updates<R: Runtime>(
|
||||||
app_handle: AppHandle<R>,
|
app_handle: AppHandle<R>,
|
||||||
) -> Result<PluginUpdatesResponse> {
|
) -> Result<PluginUpdatesResponse> {
|
||||||
let http_client = yaak_api_client(&app_handle)?;
|
let http_client = yaak_api_client(&app_handle)?;
|
||||||
@@ -183,7 +183,7 @@ pub(crate) async fn cmd_plugins_updates<R: Runtime>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) async fn cmd_plugins_update_all<R: Runtime>(
|
pub async fn cmd_plugins_update_all<R: Runtime>(
|
||||||
window: WebviewWindow<R>,
|
window: WebviewWindow<R>,
|
||||||
) -> Result<Vec<PluginNameVersion>> {
|
) -> Result<Vec<PluginNameVersion>> {
|
||||||
let http_client = yaak_api_client(window.app_handle())?;
|
let http_client = yaak_api_client(window.app_handle())?;
|
||||||
@@ -233,13 +233,6 @@ pub(crate) async fn cmd_plugins_update_all<R: Runtime>(
|
|||||||
|
|
||||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||||
Builder::new("yaak-plugins")
|
Builder::new("yaak-plugins")
|
||||||
.invoke_handler(generate_handler![
|
|
||||||
cmd_plugins_search,
|
|
||||||
cmd_plugins_install,
|
|
||||||
cmd_plugins_uninstall,
|
|
||||||
cmd_plugins_updates,
|
|
||||||
cmd_plugins_update_all
|
|
||||||
])
|
|
||||||
.setup(|app_handle, _| {
|
.setup(|app_handle, _| {
|
||||||
// Resolve paths for plugin manager
|
// Resolve paths for plugin manager
|
||||||
let vendored_plugin_dir = app_handle
|
let vendored_plugin_dir = app_handle
|
||||||
|
|||||||
Reference in New Issue
Block a user