feat: settings screens

This commit is contained in:
2024-04-02 13:19:26 +07:00
parent 09aa2ecafc
commit 89bb8d88f6
20 changed files with 419 additions and 74 deletions

View File

@@ -234,7 +234,7 @@
}
},
"user": {
"title": "User"
"title": "Account"
},
"zap": {
"title": "Zap",

View File

@@ -103,6 +103,7 @@ fn main() {
nostr::keys::create_keys,
nostr::keys::save_key,
nostr::keys::get_encrypted_key,
nostr::keys::get_stored_nsec,
nostr::keys::verify_signer,
nostr::keys::load_selected_account,
nostr::keys::event_to_bech32,

View File

@@ -103,6 +103,17 @@ pub fn get_encrypted_key(npub: &str, password: &str) -> Result<String, String> {
}
}
#[tauri::command]
pub fn get_stored_nsec(npub: &str) -> Result<String, String> {
let keyring = Entry::new("Lume Secret Storage", npub).unwrap();
if let Ok(nsec) = keyring.get_password() {
Ok(nsec)
} else {
Err("Key not found".into())
}
}
#[tauri::command]
pub async fn load_selected_account(npub: &str, state: State<'_, Nostr>) -> Result<bool, String> {
let client = &state.client;

View File

@@ -60,15 +60,18 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
println!("todo!")
}
"settings" => {
let _ =
WebviewWindowBuilder::new(app, "settings", WebviewUrl::App(PathBuf::from("settings")))
.title("Editor")
.min_inner_size(600., 500.)
.inner_size(800., 500.)
.hidden_title(true)
.title_bar_style(TitleBarStyle::Overlay)
.build()
.unwrap();
let _ = WebviewWindowBuilder::new(
app,
"settings",
WebviewUrl::App(PathBuf::from("settings/general")),
)
.title("Editor")
.min_inner_size(600., 500.)
.inner_size(800., 500.)
.hidden_title(true)
.title_bar_style(TitleBarStyle::Overlay)
.build()
.unwrap();
}
"quit" => {
app.exit(0);