Format connected library Rust code
This commit is contained in:
@@ -372,7 +372,10 @@ async fn fetch_manifest(url: &str) -> crate::Result<ConnectedManifest> {
|
||||
Ok(manifest)
|
||||
}
|
||||
|
||||
async fn fetch_mrpack(url: &str, expected_sha512: &str) -> crate::Result<bytes::Bytes> {
|
||||
async fn fetch_mrpack(
|
||||
url: &str,
|
||||
expected_sha512: &str,
|
||||
) -> crate::Result<bytes::Bytes> {
|
||||
let parsed = Url::parse(url)?;
|
||||
if parsed.scheme() != "https" {
|
||||
return Err(ErrorKind::InputError(
|
||||
@@ -384,11 +387,9 @@ async fn fetch_mrpack(url: &str, expected_sha512: &str) -> crate::Result<bytes::
|
||||
let bytes = reqwest::get(url).await?.error_for_status()?.bytes().await?;
|
||||
let hash = format!("{:x}", Sha512::digest(&bytes[..]));
|
||||
if !hash.eq_ignore_ascii_case(expected_sha512) {
|
||||
return Err(ErrorKind::HashError(
|
||||
expected_sha512.to_string(),
|
||||
hash,
|
||||
)
|
||||
.into());
|
||||
return Err(
|
||||
ErrorKind::HashError(expected_sha512.to_string(), hash).into()
|
||||
);
|
||||
}
|
||||
Ok(bytes)
|
||||
}
|
||||
@@ -478,7 +479,10 @@ async fn upsert_manifest(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_by_id(pool: &SqlitePool, id: &str) -> crate::Result<ConnectedPack> {
|
||||
async fn get_by_id(
|
||||
pool: &SqlitePool,
|
||||
id: &str,
|
||||
) -> crate::Result<ConnectedPack> {
|
||||
let row = sqlx::query(
|
||||
"
|
||||
SELECT id, source_url, manifest_url, name, version, version_id,
|
||||
|
||||
@@ -32,11 +32,10 @@ pub mod data {
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{
|
||||
State,
|
||||
State, connected_library,
|
||||
data::*,
|
||||
event::CommandPayload,
|
||||
connected_library, jre, metadata, minecraft_auth, mr_auth, pack,
|
||||
process,
|
||||
jre, metadata, minecraft_auth, mr_auth, pack, process,
|
||||
profile::{self, Profile, create},
|
||||
settings,
|
||||
util::{
|
||||
|
||||
Reference in New Issue
Block a user