🔨 chore: format

This commit is contained in:
Pauline 2024-07-28 21:55:49 +02:00
parent dab365f048
commit d44b1dc35c
No known key found for this signature in database
GPG key ID: 722BB181973296AE
4 changed files with 26 additions and 9 deletions

View file

@ -245,9 +245,12 @@ pub async fn auth_login(handle: AppHandle) -> Result<Option<MinecraftCredentials
let win = tauri::WebviewWindowBuilder::new(
&handle,
"login",
tauri::WebviewUrl::External(flow.redirect_uri.parse().map_err(|_|
anyhow::anyhow!("failed to parse auth redirect url")
).map_err(|err| err.to_string())?),
tauri::WebviewUrl::External(
flow.redirect_uri
.parse()
.map_err(|_| anyhow::anyhow!("failed to parse auth redirect url"))
.map_err(|err| err.to_string())?,
),
)
.title("Log into OneLauncher")
.always_on_top(true)
@ -255,15 +258,26 @@ pub async fn auth_login(handle: AppHandle) -> Result<Option<MinecraftCredentials
.build()
.map_err(|err| err.to_string())?;
win.request_user_attention(Some(tauri::UserAttentionType::Critical)).map_err(|err| err.to_string())?;
win.request_user_attention(Some(tauri::UserAttentionType::Critical))
.map_err(|err| err.to_string())?;
while (chrono::Utc::now() - now) < chrono::Duration::minutes(10) {
if win.title().is_err() {
return Ok(None);
}
if win.url().map_err(|err| err.to_string())?.as_str().starts_with("https://login.live.com/oauth20_desktop.srf") {
if let Some((_, code)) = win.url().map_err(|err| err.to_string())?.query_pairs().find(|x| x.0 == "code") {
if win
.url()
.map_err(|err| err.to_string())?
.as_str()
.starts_with("https://login.live.com/oauth20_desktop.srf")
{
if let Some((_, code)) = win
.url()
.map_err(|err| err.to_string())?
.query_pairs()
.find(|x| x.0 == "code")
{
win.close().map_err(|err| err.to_string())?;
let value = minecraft::finish(&code.clone(), flow).await?;

View file

@ -167,7 +167,8 @@ pub async fn set_directory(new: PathBuf) -> crate::Result<()> {
tracing::trace!("re-resetting file watching system");
let mut file_watcher = crate::utils::watcher::initialize_watcher().await?;
state_write.clusters = RwLock::new(Clusters::initialize(&state_write.directories, &mut file_watcher).await?);
state_write.clusters =
RwLock::new(Clusters::initialize(&state_write.directories, &mut file_watcher).await?);
state_write.watcher = RwLock::new(file_watcher);
send_ingress(&ingress, 10.0, None).await?;

View file

@ -1034,5 +1034,5 @@ pub enum MinecraftAuthError {
#[error("failed to read user hash")]
HashError,
#[error("failed to read user xbox session ID")]
SessionIdError
SessionIdError,
}

View file

@ -582,7 +582,9 @@ impl Processor {
if let Err(err) = cluster::edit(&cluster_path, |cluster| {
cluster.meta.recently_played += update as u64;
async { Ok(()) }
}).await {
})
.await
{
tracing::warn!(
"failed to update playtime for cluster {}: {}",
&cluster_path,