From 7969fcb76c03d691388408ef2437524051d2ff8a Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 1 Oct 2025 10:22:06 -0700 Subject: [PATCH] Alias keyring function --- src-tauri/yaak-license/index.ts | 2 +- .../yaak-plugins/src/native_template_functions.rs | 12 ++++++------ src-tauri/yaak-plugins/src/template_callback.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src-tauri/yaak-license/index.ts b/src-tauri/yaak-license/index.ts index 2dac20ec..2a2fab8f 100644 --- a/src-tauri/yaak-license/index.ts +++ b/src-tauri/yaak-license/index.ts @@ -33,7 +33,7 @@ export function useLicense() { }; }, []); - const check = useQuery({ + const check = useQuery({ refetchInterval: 1000 * 60 * 60 * 12, // Refetch every 12 hours refetchOnWindowFocus: false, queryKey: CHECK_QUERY_KEY, diff --git a/src-tauri/yaak-plugins/src/native_template_functions.rs b/src-tauri/yaak-plugins/src/native_template_functions.rs index 5bcd01de..1ad93f8e 100644 --- a/src-tauri/yaak-plugins/src/native_template_functions.rs +++ b/src-tauri/yaak-plugins/src/native_template_functions.rs @@ -5,9 +5,9 @@ use crate::events::{ use crate::template_callback::PluginTemplateCallback; use base64::Engine; use base64::prelude::BASE64_STANDARD; -use std::collections::HashMap; use keyring::Error::NoEntry; use log::{debug, info}; +use std::collections::HashMap; use tauri::{AppHandle, Runtime}; use yaak_crypto::manager::EncryptionManagerExt; use yaak_templates::error::Error::RenderError; @@ -36,9 +36,9 @@ pub(crate) fn template_function_secure() -> TemplateFunction { pub(crate) fn template_function_keyring() -> TemplateFunction { TemplateFunction { - name: "keyring".to_string(), - description: Some("Get a password from the OS keychain/keyring".to_string()), - aliases: None, + name: "keychain".to_string(), + description: Some("Get a password from the OS keychain or keyring".to_string()), + aliases: Some(vec!["keyring".to_string()]), args: vec![ TemplateFunctionArg::FormInput(FormInput::Text(FormInputText { base: FormInputBase { @@ -202,7 +202,7 @@ pub fn template_function_keychain_run(args: HashMap) Ok(e) => e, Err(e) => { debug!("Failed to initialize keyring entry for '{}' and '{}' {:?}", service, user, e); - return Ok("".to_string()) // Don't fail for invalid args + return Ok("".to_string()); // Don't fail for invalid args } }; @@ -211,7 +211,7 @@ pub fn template_function_keychain_run(args: HashMap) Err(NoEntry) => { info!("No password found for '{}' and '{}'", service, user); Ok("".to_string()) // Don't fail for missing passwords - }, + } Err(e) => Err(RenderError(e.to_string())), } } diff --git a/src-tauri/yaak-plugins/src/template_callback.rs b/src-tauri/yaak-plugins/src/template_callback.rs index 2458f5c1..f09f7d35 100644 --- a/src-tauri/yaak-plugins/src/template_callback.rs +++ b/src-tauri/yaak-plugins/src/template_callback.rs @@ -38,7 +38,7 @@ impl TemplateCallback for PluginTemplateCallback { if fn_name == "secure" { return template_function_secure_run(&self.app_handle, args, &self.window_context); - } else if fn_name == "keyring" { + } else if fn_name == "keychain" || fn_name == "keyring" { return template_function_keychain_run(args); }