Fix forge format version 1
This commit is contained in:
parent
0ae1e40d79
commit
93ae24e707
@ -430,10 +430,8 @@ pub struct VersionInfo {
|
|||||||
/// The minimum version of the Minecraft Launcher that can run this version of the game
|
/// The minimum version of the Minecraft Launcher that can run this version of the game
|
||||||
pub minimum_launcher_version: u32,
|
pub minimum_launcher_version: u32,
|
||||||
/// The time that the version was released
|
/// The time that the version was released
|
||||||
#[cfg_attr(feature = "bincode", bincode(with_serde))]
|
|
||||||
pub release_time: DateTime<Utc>,
|
pub release_time: DateTime<Utc>,
|
||||||
/// The latest time a file in this version was updated
|
/// The latest time a file in this version was updated
|
||||||
#[cfg_attr(feature = "bincode", bincode(with_serde))]
|
|
||||||
pub time: DateTime<Utc>,
|
pub time: DateTime<Utc>,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
/// The type of version
|
/// The type of version
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use crate::util::{
|
use crate::util::{
|
||||||
download_file, fetch_json, fetch_xml, format_url, sha1_async,
|
download_file, fetch_json, fetch_xml, format_url,
|
||||||
};
|
};
|
||||||
use crate::{insert_mirrored_artifact, Error, MirrorArtifact, UploadFile};
|
use crate::{insert_mirrored_artifact, Error, MirrorArtifact, UploadFile};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
@ -403,9 +403,10 @@ async fn fetch(
|
|||||||
.map(|mut lib| {
|
.map(|mut lib| {
|
||||||
// For all libraries besides the forge lib extracted, we mirror them from maven servers
|
// For all libraries besides the forge lib extracted, we mirror them from maven servers
|
||||||
// unless the URL is empty/null or available on Minecraft's servers
|
// unless the URL is empty/null or available on Minecraft's servers
|
||||||
if let Some(url) = lib.url {
|
if let Some(ref url) = lib.url {
|
||||||
if lib.name != install_profile.install.path
|
if lib.name == install_profile.install.path {
|
||||||
&& !url.is_empty()
|
lib.url = Some(format_url("maven/"));
|
||||||
|
} else if !url.is_empty()
|
||||||
&& !url.contains(
|
&& !url.contains(
|
||||||
"https://libraries.minecraft.net/",
|
"https://libraries.minecraft.net/",
|
||||||
)
|
)
|
||||||
@ -414,7 +415,7 @@ async fn fetch(
|
|||||||
&lib.name,
|
&lib.name,
|
||||||
None,
|
None,
|
||||||
vec![
|
vec![
|
||||||
url,
|
url.clone(),
|
||||||
"https://maven.creeperhost.net/"
|
"https://maven.creeperhost.net/"
|
||||||
.to_string(),
|
.to_string(),
|
||||||
maven_url.to_string(),
|
maven_url.to_string(),
|
||||||
@ -422,10 +423,10 @@ async fn fetch(
|
|||||||
false,
|
false,
|
||||||
mirror_artifacts,
|
mirror_artifacts,
|
||||||
)?;
|
)?;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lib.url = Some(format_url("maven/"));
|
lib.url = Some(format_url("maven/"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(lib)
|
Ok(lib)
|
||||||
})
|
})
|
||||||
@ -442,7 +443,7 @@ async fn fetch(
|
|||||||
// pub profile: String,
|
// pub profile: String,
|
||||||
// pub version: String,
|
// pub version: String,
|
||||||
// pub json: String,
|
// pub json: String,
|
||||||
pub path: Option<String>,
|
// pub path: Option<String>,
|
||||||
// pub minecraft: String,
|
// pub minecraft: String,
|
||||||
pub data: HashMap<String, daedalus::modded::SidedDataEntry>,
|
pub data: HashMap<String, daedalus::modded::SidedDataEntry>,
|
||||||
pub libraries: Vec<daedalus::minecraft::Library>,
|
pub libraries: Vec<daedalus::minecraft::Library>,
|
||||||
|
|||||||
@ -160,7 +160,7 @@ pub fn insert_mirrored_artifact(
|
|||||||
entire_url: bool,
|
entire_url: bool,
|
||||||
mirror_artifacts: &DashMap<String, MirrorArtifact>,
|
mirror_artifacts: &DashMap<String, MirrorArtifact>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut val = mirror_artifacts
|
let val = mirror_artifacts
|
||||||
.entry(get_path_from_artifact(artifact)?)
|
.entry(get_path_from_artifact(artifact)?)
|
||||||
.or_insert(MirrorArtifact {
|
.or_insert(MirrorArtifact {
|
||||||
sha1,
|
sha1,
|
||||||
|
|||||||
@ -159,7 +159,7 @@ pub async fn download_file(
|
|||||||
const RETRIES: u32 = 10;
|
const RETRIES: u32 = 10;
|
||||||
for attempt in 1..=(RETRIES + 1) {
|
for attempt in 1..=(RETRIES + 1) {
|
||||||
let result = REQWEST_CLIENT
|
let result = REQWEST_CLIENT
|
||||||
.get(&url.replace("http://", "https://"))
|
.get(url.replace("http://", "https://"))
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.and_then(|x| x.error_for_status());
|
.and_then(|x| x.error_for_status());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user