🔨 chore: format
This commit is contained in:
parent
dab365f048
commit
d44b1dc35c
4 changed files with 26 additions and 9 deletions
|
|
@ -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?;
|
||||
|
||||
|
|
|
|||
|
|
@ -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?;
|
||||
|
||||
|
|
|
|||
|
|
@ -1034,5 +1034,5 @@ pub enum MinecraftAuthError {
|
|||
#[error("failed to read user hash")]
|
||||
HashError,
|
||||
#[error("failed to read user xbox session ID")]
|
||||
SessionIdError
|
||||
SessionIdError,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue