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