mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-10 20:29:06 +00:00
Added commands to read & store secrets
This commit is contained in:
parent
6bde4bb125
commit
b02b39c023
829
runtime/Cargo.lock
generated
829
runtime/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -9,9 +9,10 @@ authors = ["Thorsten Sommer"]
|
|||||||
tauri-build = { version = "1.5", features = [] }
|
tauri-build = { version = "1.5", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "1.6", features = ["shell-open"] }
|
tauri = { version = "1.6", features = [ "path-all", "shell-open"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
keyring = "2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
|
use keyring::Entry;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.invoke_handler(tauri::generate_handler![store_secret, get_secret])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn store_secret(destination: String, user_name: String, secret: String) {
|
||||||
|
let entry = Entry::new(&format!("mindwork-ai-studio::{}", destination), user_name.as_str()).unwrap();
|
||||||
|
entry.set_password(secret.as_str()).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn get_secret(destination: String, user_name: String) -> String {
|
||||||
|
let entry = Entry::new(&format!("mindwork-ai-studio::{}", destination), user_name.as_str()).unwrap();
|
||||||
|
entry.get_password().unwrap()
|
||||||
|
}
|
@ -14,6 +14,9 @@
|
|||||||
"shell": {
|
"shell": {
|
||||||
"all": false,
|
"all": false,
|
||||||
"open": true
|
"open": true
|
||||||
|
},
|
||||||
|
"path": {
|
||||||
|
"all": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"windows": [
|
"windows": [
|
||||||
|
Loading…
Reference in New Issue
Block a user