Update connected library install reason
This commit is contained in:
@@ -2,6 +2,7 @@ use crate::pack::install_from::{CreatePack, CreatePackDescription};
|
|||||||
use crate::pack::install_mrpack::install_zipped_mrpack_files;
|
use crate::pack::install_mrpack::install_zipped_mrpack_files;
|
||||||
use crate::profile;
|
use crate::profile;
|
||||||
use crate::state::ModLoader;
|
use crate::state::ModLoader;
|
||||||
|
use crate::util::fetch::DownloadReason;
|
||||||
use crate::{ErrorKind, State};
|
use crate::{ErrorKind, State};
|
||||||
use chrono::{TimeZone, Utc};
|
use chrono::{TimeZone, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -259,6 +260,11 @@ pub async fn install(id: String) -> crate::Result<ConnectedPack> {
|
|||||||
let state = State::get().await?;
|
let state = State::get().await?;
|
||||||
let pack = get_by_id(&state.pool, &id).await?;
|
let pack = get_by_id(&state.pool, &id).await?;
|
||||||
let bytes = fetch_mrpack(&pack.mrpack_url, &pack.sha512).await?;
|
let bytes = fetch_mrpack(&pack.mrpack_url, &pack.sha512).await?;
|
||||||
|
let download_reason = if pack.profile_path.is_some() {
|
||||||
|
DownloadReason::Update
|
||||||
|
} else {
|
||||||
|
DownloadReason::Modpack
|
||||||
|
};
|
||||||
|
|
||||||
let profile_path = if let Some(profile_path) = &pack.profile_path {
|
let profile_path = if let Some(profile_path) = &pack.profile_path {
|
||||||
profile_path.clone()
|
profile_path.clone()
|
||||||
@@ -287,7 +293,7 @@ pub async fn install(id: String) -> crate::Result<ConnectedPack> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
install_zipped_mrpack_files(create_pack, true).await?;
|
install_zipped_mrpack_files(create_pack, true, download_reason).await?;
|
||||||
|
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
"
|
"
|
||||||
|
|||||||
Reference in New Issue
Block a user