mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:37 +01:00
Add plugin API to open URL in external browser (#340)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,9 @@ pub enum Error {
|
||||
#[error(transparent)]
|
||||
ClipboardError(#[from] tauri_plugin_clipboard_manager::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
OpenerError(#[from] tauri_plugin_opener::Error),
|
||||
|
||||
#[error("Updater error: {0}")]
|
||||
UpdaterError(#[from] tauri_plugin_updater::Error),
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use cookie::Cookie;
|
||||
use log::error;
|
||||
use tauri::{AppHandle, Emitter, Manager, Runtime};
|
||||
use tauri_plugin_clipboard_manager::ClipboardExt;
|
||||
use tauri_plugin_opener::OpenerExt;
|
||||
use yaak_common::window::WorkspaceWindowTrait;
|
||||
use yaak_models::blob_manager::BlobManagerExt;
|
||||
use yaak_models::models::{AnyModel, HttpResponse, Plugin};
|
||||
@@ -370,6 +371,10 @@ pub(crate) async fn handle_plugin_event<R: Runtime>(
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
InternalEventPayload::OpenExternalUrlRequest(req) => {
|
||||
app_handle.opener().open_url(&req.url, None::<&str>)?;
|
||||
Ok(Some(InternalEventPayload::OpenExternalUrlResponse(EmptyPayload {})))
|
||||
}
|
||||
InternalEventPayload::SetKeyValueRequest(req) => {
|
||||
let name = plugin_handle.info().name;
|
||||
app_handle.db().set_plugin_key_value(&name, &req.key, &req.value);
|
||||
|
||||
Reference in New Issue
Block a user