mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-27 02:58:34 +02:00
Merge pull request #227
* Search and install plugins PoC * Checksum * Tab sidebar for settings * Fix nested tabs, and tweaks * Table for plugin results * Deep links working * Focus window during deep links * Merge branch 'master' into plugin-directory * More stuff
This commit is contained in:
45
src-tauri/yaak-plugins/src/commands.rs
Normal file
45
src-tauri/yaak-plugins/src/commands.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use crate::api::search_plugins;
|
||||
use crate::error::Result;
|
||||
use crate::install::download_and_install;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{AppHandle, Runtime, WebviewWindow, command};
|
||||
use ts_rs::TS;
|
||||
|
||||
#[command]
|
||||
pub(crate) async fn search<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
query: &str,
|
||||
) -> Result<PluginSearchResponse> {
|
||||
search_plugins(&app_handle, query).await
|
||||
}
|
||||
|
||||
#[command]
|
||||
pub(crate) async fn install<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
plugin: PluginVersion,
|
||||
) -> Result<String> {
|
||||
download_and_install(&window, &plugin).await
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, TS, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "gen_search.ts")]
|
||||
pub struct PluginSearchResponse {
|
||||
pub results: Vec<PluginVersion>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, TS, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "gen_search.ts")]
|
||||
pub struct PluginVersion {
|
||||
pub id: String,
|
||||
pub version: String,
|
||||
pub description: Option<String>,
|
||||
pub name: String,
|
||||
pub display_name: String,
|
||||
pub homepage_url: Option<String>,
|
||||
pub repository_url: Option<String>,
|
||||
pub checksum: String,
|
||||
pub readme: Option<String>,
|
||||
pub yanked: bool,
|
||||
}
|
||||
Reference in New Issue
Block a user