You've already forked AstralRinth
forked from didirus/AstralRinth
Add metadata GV loader api (#84)
* Add metadata GV loader api * Register commands * fix lint + docs issue
This commit is contained in:
27
theseus/src/api/metadata.rs
Normal file
27
theseus/src/api/metadata.rs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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 tags = state.metadata.minecraft.clone();
|
||||||
|
|
||||||
|
Ok(tags)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
pub async fn get_fabric_versions() -> crate::Result<Manifest> {
|
||||||
|
let state = State::get().await?;
|
||||||
|
let tags = state.metadata.fabric.clone();
|
||||||
|
|
||||||
|
Ok(tags)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
pub async fn get_forge_versions() -> crate::Result<Manifest> {
|
||||||
|
let state = State::get().await?;
|
||||||
|
let tags = state.metadata.forge.clone();
|
||||||
|
|
||||||
|
Ok(tags)
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
//! API for interacting with Theseus
|
//! API for interacting with Theseus
|
||||||
pub mod auth;
|
pub mod auth;
|
||||||
pub mod jre;
|
pub mod jre;
|
||||||
|
pub mod metadata;
|
||||||
pub mod pack;
|
pub mod pack;
|
||||||
pub mod process;
|
pub mod process;
|
||||||
pub mod profile;
|
pub mod profile;
|
||||||
@@ -19,7 +20,7 @@ pub mod prelude {
|
|||||||
pub use crate::{
|
pub use crate::{
|
||||||
auth::{self, Credentials},
|
auth::{self, Credentials},
|
||||||
data::*,
|
data::*,
|
||||||
jre, pack, process,
|
jre, metadata, pack, process,
|
||||||
profile::{self, Profile},
|
profile::{self, Profile},
|
||||||
profile_create, settings,
|
profile_create, settings,
|
||||||
state::JavaGlobals,
|
state::JavaGlobals,
|
||||||
|
|||||||
21
theseus_gui/src-tauri/src/api/metadata.rs
Normal file
21
theseus_gui/src-tauri/src/api/metadata.rs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
use crate::api::Result;
|
||||||
|
use daedalus::minecraft::VersionManifest;
|
||||||
|
use daedalus::modded::Manifest;
|
||||||
|
|
||||||
|
/// Gets the game versions from daedalus
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn metadata_get_game_versions() -> Result<VersionManifest> {
|
||||||
|
Ok(theseus::metadata::get_minecraft_versions().await?)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the fabric versions from daedalus
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn metadata_get_fabric_versions() -> Result<Manifest> {
|
||||||
|
Ok(theseus::metadata::get_fabric_versions().await?)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the forge versions from daedalus
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn metadata_get_forge_versions() -> Result<Manifest> {
|
||||||
|
Ok(theseus::metadata::get_forge_versions().await?)
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ use thiserror::Error;
|
|||||||
pub mod auth;
|
pub mod auth;
|
||||||
pub mod jre;
|
pub mod jre;
|
||||||
|
|
||||||
|
pub mod metadata;
|
||||||
pub mod pack;
|
pub mod pack;
|
||||||
pub mod process;
|
pub mod process;
|
||||||
pub mod profile;
|
pub mod profile;
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ fn main() {
|
|||||||
api::process::process_get_stdout_by_uuid,
|
api::process::process_get_stdout_by_uuid,
|
||||||
api::process::process_kill_by_uuid,
|
api::process::process_kill_by_uuid,
|
||||||
api::process::process_wait_for_by_uuid,
|
api::process::process_wait_for_by_uuid,
|
||||||
|
api::metadata::metadata_get_game_versions,
|
||||||
|
api::metadata::metadata_get_fabric_versions,
|
||||||
|
api::metadata::metadata_get_forge_versions,
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|||||||
19
theseus_gui/src/helpers/metadata.js
Normal file
19
theseus_gui/src/helpers/metadata.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { invoke } from '@tauri-apps/api/tauri'
|
||||||
|
|
||||||
|
/// Gets the game versions from daedalus
|
||||||
|
// Returns a VersionManifest
|
||||||
|
export async function get_game_versions() {
|
||||||
|
return await invoke('metadata_get_game_versions')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the fabric versions from daedalus
|
||||||
|
// Returns Manifest
|
||||||
|
export async function get_fabric_versions() {
|
||||||
|
return await invoke('metadata_get_fabric_versions')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the forge versions from daedalus
|
||||||
|
// Returns Manifest
|
||||||
|
export async function get_forge_versions() {
|
||||||
|
return await invoke('metadata_get_forge_versions')
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user