mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-22 08:38:29 +02:00
Alias keyring function
This commit is contained in:
@@ -33,7 +33,7 @@ export function useLicense() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const check = useQuery({
|
const check = useQuery<LicenseCheckStatus | null, string>({
|
||||||
refetchInterval: 1000 * 60 * 60 * 12, // Refetch every 12 hours
|
refetchInterval: 1000 * 60 * 60 * 12, // Refetch every 12 hours
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
queryKey: CHECK_QUERY_KEY,
|
queryKey: CHECK_QUERY_KEY,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ use crate::events::{
|
|||||||
use crate::template_callback::PluginTemplateCallback;
|
use crate::template_callback::PluginTemplateCallback;
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use base64::prelude::BASE64_STANDARD;
|
use base64::prelude::BASE64_STANDARD;
|
||||||
use std::collections::HashMap;
|
|
||||||
use keyring::Error::NoEntry;
|
use keyring::Error::NoEntry;
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
|
use std::collections::HashMap;
|
||||||
use tauri::{AppHandle, Runtime};
|
use tauri::{AppHandle, Runtime};
|
||||||
use yaak_crypto::manager::EncryptionManagerExt;
|
use yaak_crypto::manager::EncryptionManagerExt;
|
||||||
use yaak_templates::error::Error::RenderError;
|
use yaak_templates::error::Error::RenderError;
|
||||||
@@ -36,9 +36,9 @@ pub(crate) fn template_function_secure() -> TemplateFunction {
|
|||||||
|
|
||||||
pub(crate) fn template_function_keyring() -> TemplateFunction {
|
pub(crate) fn template_function_keyring() -> TemplateFunction {
|
||||||
TemplateFunction {
|
TemplateFunction {
|
||||||
name: "keyring".to_string(),
|
name: "keychain".to_string(),
|
||||||
description: Some("Get a password from the OS keychain/keyring".to_string()),
|
description: Some("Get a password from the OS keychain or keyring".to_string()),
|
||||||
aliases: None,
|
aliases: Some(vec!["keyring".to_string()]),
|
||||||
args: vec![
|
args: vec![
|
||||||
TemplateFunctionArg::FormInput(FormInput::Text(FormInputText {
|
TemplateFunctionArg::FormInput(FormInput::Text(FormInputText {
|
||||||
base: FormInputBase {
|
base: FormInputBase {
|
||||||
@@ -202,7 +202,7 @@ pub fn template_function_keychain_run(args: HashMap<String, serde_json::Value>)
|
|||||||
Ok(e) => e,
|
Ok(e) => e,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Failed to initialize keyring entry for '{}' and '{}' {:?}", service, user, 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<String, serde_json::Value>)
|
|||||||
Err(NoEntry) => {
|
Err(NoEntry) => {
|
||||||
info!("No password found for '{}' and '{}'", service, user);
|
info!("No password found for '{}' and '{}'", service, user);
|
||||||
Ok("".to_string()) // Don't fail for missing passwords
|
Ok("".to_string()) // Don't fail for missing passwords
|
||||||
},
|
}
|
||||||
Err(e) => Err(RenderError(e.to_string())),
|
Err(e) => Err(RenderError(e.to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ impl<R: Runtime> TemplateCallback for PluginTemplateCallback<R> {
|
|||||||
|
|
||||||
if fn_name == "secure" {
|
if fn_name == "secure" {
|
||||||
return template_function_secure_run(&self.app_handle, args, &self.window_context);
|
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);
|
return template_function_keychain_run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user