forked from didirus/AstralRinth
Merge tag 'v0.10.21' into beta
This commit is contained in:
@@ -9,10 +9,10 @@ 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")
|
||||
.get("https://sessionserver.mojang.com/session/minecraft/hasJoined")
|
||||
.send()
|
||||
.await?;
|
||||
if resp.status() == StatusCode::UNAUTHORIZED {
|
||||
if resp.status() == StatusCode::NO_CONTENT {
|
||||
return Ok(());
|
||||
}
|
||||
resp.error_for_status()?;
|
||||
|
||||
@@ -395,17 +395,36 @@ pub async fn download_libraries(
|
||||
.unwrap_or("https://libraries.minecraft.net/")
|
||||
);
|
||||
|
||||
let bytes =
|
||||
fetch(&url, None, &st.fetch_semaphore, &st.pool)
|
||||
.await?;
|
||||
|
||||
write(&path, &bytes, &st.io_semaphore).await?;
|
||||
|
||||
tracing::trace!(
|
||||
"Fetched library {} to path {:?}",
|
||||
&library.name,
|
||||
&path
|
||||
"Attempting to fetch {} from {url}",
|
||||
library.name,
|
||||
);
|
||||
|
||||
// It's OK for this fetch to fail, since the URL might not even be valid.
|
||||
// We're constructing a download URL basically out of thin air, and hoping
|
||||
// that it's valid. Since PrismLauncher ignores the library (see above), a
|
||||
// failed download here is not a fatal condition.
|
||||
//
|
||||
// See DEV-479.
|
||||
match fetch(&url, None, &st.fetch_semaphore, &st.pool).await
|
||||
{
|
||||
Ok(bytes) => {
|
||||
write(&path, &bytes, &st.io_semaphore).await?;
|
||||
|
||||
tracing::debug!(
|
||||
"Fetched library {} to path {:?}",
|
||||
&library.name,
|
||||
&path
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::debug!(
|
||||
"Failed to download library {} from {url} - \
|
||||
this is not necessarily an error: {err:#?}",
|
||||
&library.name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user