aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/core/manifest.rs
diff options
context:
space:
mode:
authorHsiangNianian <i@jyunko.cn>2026-01-13 11:25:35 +0800
committerHsiangNianian <i@jyunko.cn>2026-01-13 11:25:35 +0800
commit68474e65c27323da62aad223cea7fb22356b0df6 (patch)
tree3e6806cb3d1b0c2a0b6483fcd1768119620f9012 /src/core/manifest.rs
parent431c117a55d06e45ef48305f67f71e6a2afb76fd (diff)
downloadDropOut-68474e65c27323da62aad223cea7fb22356b0df6.tar.gz
DropOut-68474e65c27323da62aad223cea7fb22356b0df6.zip
feat: Added version control functionality and integrated Tokio and Reqwest to support asynchronous operations
Diffstat (limited to 'src/core/manifest.rs')
-rw-r--r--src/core/manifest.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core/manifest.rs b/src/core/manifest.rs
new file mode 100644
index 0000000..1450e77
--- /dev/null
+++ b/src/core/manifest.rs
@@ -0,0 +1,31 @@
+use serde::Deserialize;
+use std::error::Error;
+
+#[derive(Debug, Deserialize)]
+pub struct VersionManifest {
+ pub latest: Latest,
+ pub versions: Vec<Version>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct Latest {
+ pub release: String,
+ pub snapshot: String,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct Version {
+ pub id: String,
+ #[serde(rename = "type")]
+ pub type_: String,
+ pub url: String,
+ pub time: String,
+ #[serde(rename = "releaseTime")]
+ pub release_time: String,
+}
+
+pub async fn fetch_version_manifest() -> Result<VersionManifest, Box<dyn Error>> {
+ let url = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json";
+ let resp = reqwest::get(url).await?.json::<VersionManifest>().await?;
+ Ok(resp)
+}