run fmt
This commit is contained in:
parent
89e56ae279
commit
568e5a9bb8
@ -207,7 +207,7 @@ pub enum Os {
|
||||
/// Linux ARM 32
|
||||
LinuxArm32,
|
||||
/// The OS is unknown
|
||||
Unknown
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "bincode", derive(Encode, Decode))]
|
||||
@ -321,6 +321,7 @@ pub struct PartialLibrary {
|
||||
pub include_in_classpath: Option<bool>,
|
||||
}
|
||||
|
||||
/// Merges a partial library to make a complete library
|
||||
pub fn merge_partial_library(
|
||||
partial: PartialLibrary,
|
||||
mut merge: Library,
|
||||
|
||||
@ -217,7 +217,9 @@ pub async fn retrieve_data(
|
||||
|
||||
let mut loader_version_mutex = loader_version_mutex.into_inner();
|
||||
if !loader_version_mutex.is_empty() {
|
||||
if let Some(version) = versions.iter_mut().find(|x| x.id == DUMMY_REPLACE_STRING) {
|
||||
if let Some(version) =
|
||||
versions.iter_mut().find(|x| x.id == DUMMY_REPLACE_STRING)
|
||||
{
|
||||
version.loaders.append(&mut loader_version_mutex);
|
||||
} else {
|
||||
versions.push(Version {
|
||||
|
||||
@ -93,7 +93,7 @@ async fn main() {
|
||||
&mut uploaded_files,
|
||||
semaphore.clone(),
|
||||
)
|
||||
.await
|
||||
.await
|
||||
{
|
||||
Ok(..) => {}
|
||||
Err(err) => error!("{:?}", err),
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
use crate::download_file;
|
||||
use crate::{format_url, upload_file_to_bucket, Error};
|
||||
use daedalus::minecraft::{Library, merge_partial_library, PartialLibrary, VersionManifest};
|
||||
use daedalus::get_hash;
|
||||
use daedalus::minecraft::{
|
||||
merge_partial_library, Library, PartialLibrary, VersionManifest,
|
||||
};
|
||||
use log::info;
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use tokio::sync::{Mutex, Semaphore};
|
||||
use serde::Deserialize;
|
||||
use daedalus::get_hash;
|
||||
|
||||
pub async fn retrieve_data(
|
||||
uploaded_files: &mut Vec<String>,
|
||||
@ -66,14 +68,22 @@ pub async fn retrieve_data(
|
||||
|
||||
let mut new_libraries = Vec::new();
|
||||
for library in version_info.libraries {
|
||||
if let Some(patch) = patches.iter().find(|x| x.match_.contains(&library.name)) {
|
||||
if let Some(additional_libraries) = &patch.additional_libraries {
|
||||
if let Some(patch) = patches
|
||||
.iter()
|
||||
.find(|x| x.match_.contains(&library.name))
|
||||
{
|
||||
if let Some(additional_libraries) =
|
||||
&patch.additional_libraries
|
||||
{
|
||||
new_libraries.push(library);
|
||||
for additional_library in additional_libraries {
|
||||
new_libraries.push(additional_library.clone());
|
||||
}
|
||||
} else if let Some(override_) = &patch.override_ {
|
||||
new_libraries.push(merge_partial_library(override_.clone(), library));
|
||||
new_libraries.push(merge_partial_library(
|
||||
override_.clone(),
|
||||
library,
|
||||
));
|
||||
} else {
|
||||
new_libraries.push(library);
|
||||
}
|
||||
@ -83,7 +93,10 @@ pub async fn retrieve_data(
|
||||
}
|
||||
version_info.libraries = new_libraries;
|
||||
|
||||
let version_info_hash = get_hash(bytes::Bytes::from(serde_json::to_vec(&version_info)?)).await?;
|
||||
let version_info_hash = get_hash(bytes::Bytes::from(
|
||||
serde_json::to_vec(&version_info)?,
|
||||
))
|
||||
.await?;
|
||||
|
||||
let version_path = format!(
|
||||
"minecraft/v{}/versions/{}.json",
|
||||
@ -227,7 +240,7 @@ struct LibraryPatch {
|
||||
pub additional_libraries: Option<Vec<Library>>,
|
||||
#[serde(rename = "override")]
|
||||
pub override_: Option<PartialLibrary>,
|
||||
pub patch_additional_libraries: Option<bool>,
|
||||
// pub patch_additional_libraries: Option<bool>,
|
||||
}
|
||||
|
||||
/// Fetches the list of fabric versions
|
||||
@ -241,6 +254,6 @@ async fn fetch_library_patches(
|
||||
None,
|
||||
semaphore,
|
||||
)
|
||||
.await?,
|
||||
.await?,
|
||||
)?)
|
||||
}
|
||||
|
||||
@ -217,7 +217,9 @@ pub async fn retrieve_data(
|
||||
|
||||
let mut loader_version_mutex = loader_version_mutex.into_inner();
|
||||
if !loader_version_mutex.is_empty() {
|
||||
if let Some(version) = versions.iter_mut().find(|x| x.id == DUMMY_REPLACE_STRING) {
|
||||
if let Some(version) =
|
||||
versions.iter_mut().find(|x| x.id == DUMMY_REPLACE_STRING)
|
||||
{
|
||||
version.loaders.append(&mut loader_version_mutex);
|
||||
} else {
|
||||
versions.push(Version {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user