You've already forked AstralRinth
forked from didirus/AstralRinth
Add auth servers unreachable warning to app (#4774)
* Add auth servers unreachable warning to app * Check auth status every 5 minutes * Use admonition in auth server warning * feat: tanstack * Fix auth server reachability query * Format * intl extract --------- Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
//! Authentication flow interface
|
||||
|
||||
use reqwest::StatusCode;
|
||||
|
||||
use crate::State;
|
||||
use crate::state::{Credentials, MinecraftLoginFlow};
|
||||
use crate::util::fetch::REQWEST_CLIENT;
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn check_reachable() -> crate::Result<()> {
|
||||
let resp = REQWEST_CLIENT
|
||||
.get("https://api.minecraftservices.com/entitlements/mcstore")
|
||||
.send()
|
||||
.await?;
|
||||
if resp.status() == StatusCode::UNAUTHORIZED {
|
||||
return Ok(());
|
||||
}
|
||||
resp.error_for_status()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn begin_login() -> crate::Result<MinecraftLoginFlow> {
|
||||
|
||||
Reference in New Issue
Block a user