[WIP] Encryption for secure values (#183)

This commit is contained in:
Gregory Schier
2025-04-15 07:18:26 -07:00
committed by GitHub
parent e114a85c39
commit 2e55a1bd6d
208 changed files with 4063 additions and 28698 deletions

View File

@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tauri::{Runtime, WebviewWindow};
use ts_rs::TS;
use yaak_common::window::WorkspaceWindowTrait;
use yaak_models::models::{
Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, WebsocketRequest, Workspace,
};
@@ -15,7 +15,7 @@ pub struct InternalEvent {
pub plugin_ref_id: String,
pub plugin_name: String,
pub reply_id: Option<String>,
pub window_context: WindowContext,
pub window_context: PluginWindowContext,
pub payload: InternalEventPayload,
}
@@ -29,22 +29,32 @@ pub(crate) struct InternalEventRawPayload {
pub plugin_ref_id: String,
pub plugin_name: String,
pub reply_id: Option<String>,
pub window_context: WindowContext,
pub window_context: PluginWindowContext,
pub payload: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[serde(rename_all = "snake_case", tag = "type")]
#[ts(export, export_to = "gen_events.ts")]
pub enum WindowContext {
pub enum PluginWindowContext {
None,
Label { label: String },
Label {
label: String,
workspace_id: Option<String>,
},
}
impl WindowContext {
pub fn from_window<R: Runtime>(window: &WebviewWindow<R>) -> Self {
impl PluginWindowContext {
pub fn new<R: Runtime>(window: &WebviewWindow<R>) -> Self {
Self::Label {
label: window.label().to_string(),
workspace_id: window.workspace_id(),
}
}
pub fn new_no_workspace<R: Runtime>(window: &WebviewWindow<R>) -> Self {
Self::Label {
label: window.label().to_string(),
workspace_id: None,
}
}
}
@@ -497,7 +507,15 @@ pub struct TemplateFunction {
/// tags when changing the `name` property
#[ts(optional)]
pub aliases: Option<Vec<String>>,
pub args: Vec<FormInput>,
pub args: Vec<TemplateFunctionArg>,
}
/// Similar to FormInput, but contains
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[serde(rename_all = "snake_case", untagged)]
#[ts(export, export_to = "gen_events.ts")]
pub enum TemplateFunctionArg {
FormInput(FormInput),
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]