mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 12:43:17 +03:00
feat: get versions
This commit is contained in:
parent
dfa54d3f65
commit
4a5b47e054
4 changed files with 90 additions and 4 deletions
36
components/utils.js
Normal file
36
components/utils.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
const axios = require("axios");
|
||||
|
||||
async function getVersions() {
|
||||
return (
|
||||
await axios.get(
|
||||
"https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
|
||||
)
|
||||
).data.versions;
|
||||
}
|
||||
|
||||
async function getLatestVersion() {
|
||||
return getVersions()[0];
|
||||
}
|
||||
|
||||
async function getLatestRelease() {
|
||||
return (
|
||||
await axios.get(
|
||||
"https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
|
||||
)
|
||||
).data.latest.release;
|
||||
}
|
||||
|
||||
async function getLatestSnapshot() {
|
||||
return (
|
||||
await axios.get(
|
||||
"https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
|
||||
)
|
||||
).data.latest.snapshot;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getVersions,
|
||||
getLatestVersion,
|
||||
getLatestRelease,
|
||||
getLatestSnapshot,
|
||||
};
|
Loading…
Add table
Reference in a new issue