unlock keyring etc
This commit is contained in:
parent
a810842e68
commit
f4ba44fcb7
2 changed files with 14 additions and 4 deletions
|
@ -125,6 +125,7 @@ mod imp {
|
|||
|
||||
use adw::subclass::prelude::*;
|
||||
use gtk::glib;
|
||||
use tracing::{event, Level};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct Setup(ObjectSubclass<imp::Setup>)
|
||||
|
@ -148,6 +149,8 @@ impl Setup {
|
|||
|
||||
// TODO remove unwraps, make sure authn_can_edit is set back to true
|
||||
let keyring = oo7::Keyring::new().await.unwrap();
|
||||
// make sure the keyring is unlocked
|
||||
keyring.unlock().await.unwrap();
|
||||
let attributes = vec![("xdg:schema", crate::APP_ID)];
|
||||
let items = keyring.search_items(&attributes).await.unwrap();
|
||||
|
||||
|
@ -156,12 +159,19 @@ impl Setup {
|
|||
// TODO: onboarding
|
||||
self.set_authn_can_edit(true);
|
||||
self.set_authn_can_validate(true);
|
||||
|
||||
event!(Level::DEBUG, "TODO: setup onboarding");
|
||||
} else {
|
||||
let item = &items[0];
|
||||
let attributes = item.attributes().await.unwrap();
|
||||
|
||||
self.set_server_url(attributes["server-url"].clone());
|
||||
self.set_username(attributes["username"].clone());
|
||||
let server_url = &attributes["server-url"];
|
||||
let username = &attributes["username"];
|
||||
|
||||
event!(Level::DEBUG, "logging in as {} at {}", username, server_url);
|
||||
|
||||
self.set_server_url(server_url.clone());
|
||||
self.set_username(username.clone());
|
||||
// strip non-utf8 elements from the pw, i guess
|
||||
self.set_password(String::from_utf8_lossy(&item.secret().await.unwrap()));
|
||||
|
||||
|
|
|
@ -613,7 +613,7 @@ mod imp {
|
|||
};
|
||||
|
||||
match perform.await {
|
||||
Ok(()) => {},
|
||||
Ok(()) => {}
|
||||
Err(err) => event!(Level::ERROR, "could not refresh album list: {err}"),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue