forked from didirus/AstralRinth
* initial migration * barebones profiles * Finish profiles * Add back file watcher * UI support progress * Finish most of cache * Fix options page * Fix forge, finish modrinth auth * Accounts, process cache * Run SQLX prepare * Finish * Run lint + actions * Fix version to be compat with windows * fix lint * actually fix lint * actually fix lint again
38 lines
968 B
Rust
38 lines
968 B
Rust
use crate::state::CachedEntry;
|
|
use crate::State;
|
|
pub use daedalus::minecraft::VersionManifest;
|
|
pub use daedalus::modded::Manifest;
|
|
|
|
#[tracing::instrument]
|
|
pub async fn get_minecraft_versions() -> crate::Result<VersionManifest> {
|
|
let state = State::get().await?;
|
|
let minecraft_versions = CachedEntry::get_minecraft_manifest(
|
|
None,
|
|
&state.pool,
|
|
&state.api_semaphore,
|
|
)
|
|
.await?
|
|
.ok_or_else(|| {
|
|
crate::ErrorKind::NoValueFor("minecraft versions".to_string())
|
|
})?;
|
|
|
|
Ok(minecraft_versions)
|
|
}
|
|
|
|
#[tracing::instrument]
|
|
pub async fn get_loader_versions(loader: &str) -> crate::Result<Manifest> {
|
|
let state = State::get().await?;
|
|
let loaders = CachedEntry::get_loader_manifest(
|
|
loader,
|
|
None,
|
|
&state.pool,
|
|
&state.api_semaphore,
|
|
)
|
|
.await?
|
|
.ok_or_else(|| {
|
|
crate::ErrorKind::NoValueFor(format!("{} loader versions", loader))
|
|
})?;
|
|
|
|
Ok(loaders.manifest)
|
|
}
|