fix: added ability for regenerate checksums with issued mr migrations.

This commit is contained in:
2025-07-10 21:09:06 +03:00
parent 1ef96c447e
commit 332a543f66
12 changed files with 349 additions and 141 deletions

View File

@@ -1,16 +1,20 @@
///
/// [AR] Feature
///
use crate::Result;
use crate::api::update;
use crate::state::db;
use serde::{Deserialize, Serialize};
use std::process;
use tokio::io;
/*
AstralRinth Utils
*/
const PACKAGE_JSON_CONTENT: &str =
// include_str!("../../../../apps/app-frontend/package.json");
include_str!("../../../../apps/app/tauri.conf.json");
#[derive(Serialize, Deserialize)]
pub struct Launcher {
pub version: String
pub version: String,
}
pub fn read_package_json() -> io::Result<Launcher> {
@@ -19,3 +23,41 @@ pub fn read_package_json() -> io::Result<Launcher> {
Ok(launcher)
}
pub async fn apply_migration_fix(eol: &str) -> Result<bool> {
tracing::info!("[AR] • Attempting to apply migration fix");
let patched = db::fix_version_hash(eol).await?;
if patched {
tracing::info!("[AR] • Successfully applied migration fix");
} else {
tracing::error!("[AR] • Failed to apply migration fix");
}
Ok(patched)
}
pub async fn init_download(
download_url: &str,
local_filename: &str,
os_type: &str,
auto_update_supported: bool,
) -> Result<()> {
println!("[AR] • Initialize downloading from • {:?}", download_url);
println!("[AR] • Save local file name • {:?}", local_filename);
if let Err(e) = update::download_file(
download_url,
local_filename,
os_type,
auto_update_supported,
)
.await
{
eprintln!(
"[AR] • An error occurred! Failed to download the file: {}",
e
);
} else {
println!("[AR] • Code finishes without errors.");
process::exit(0)
}
Ok(())
}