fix json creation

This commit is contained in:
moehreag 2024-06-17 16:45:51 +02:00
parent 4fde4f5e50
commit fd526f42d6
2 changed files with 21 additions and 24 deletions

View file

@ -1,3 +1,8 @@
---
- head:
---
# Client
Here's how to install FrogLoader to your game.
@ -20,7 +25,6 @@ Insert section about the installer here
const instanceNameRef = ref()
const showSnapshots = ref()
const versionSelector = ref()
const useSnapshots = ref()
let releases = []
let snapshots = []
let versions = []
@ -45,7 +49,7 @@ Insert section about the installer here
}
async function fetchLibraries() {
let response = await fetch("https://meta.frogmc.dev/v1/loader/versions/latest")
let response = await fetch("https://meta.frogmc.dev/v1/loader/version/latest")
let json = await response.json()
loaderLibs = json
}
@ -82,10 +86,10 @@ Insert section about the installer here
let versionResponse = await fetch(versionUrl)
let versionJson = await versionResponse.json()
for (let lib of version.libraries) {
let matcher = lib.name.matcher(/org.lwjgl:lwjgl:(\d+\.\d+\.\d+.*)/)
if (matcher.matches()) {
return matcher.group(1)
for (let lib of versionJson.libraries) {
let matcher = lib.name.match(/org.lwjgl:lwjgl:(\d+\.\d+\.\d+.*)/)
if (matcher != undefined) {
return matcher[1]
}
}
}
@ -104,7 +108,7 @@ Insert section about the installer here
}
}
function download(){
async function download(){
let missing = []
if (instanceNameRef.value === undefined){
@ -121,10 +125,9 @@ Insert section about the installer here
let zip = JSZip()
let promises = []
let lwjglVersion = getLwjglVersion()
let lwjglVersion = await getLwjglVersion()
let platform = getPlatform()
promises.push(
readAsset("/mmc-pack.json").then((data) => {
if (lwjglVersion.split(".")[0] == 3) {
@ -154,17 +157,18 @@ Insert section about the installer here
readAsset("/patches/dev.frogmc.frogloader.json").then((data) => {
let json = JSON.parse(data)
let libs = json.libraries
for (let lib in loaderLibs.libraries) {
libs.push({
for (let lib of loaderLibs.libraries) {
let value = {
"download": {
"artifact": {
"url": lib.url
"size": lib.size
"url": lib.url,
"size": lib.size,
"sha1": lib.sha1
}
},
"name": lib.name
})
}
libs.push(value)
}
zip.folder("patches").file("dev.frogmc.frogloader.json", JSON.stringify(json))
})
@ -184,6 +188,7 @@ Insert section about the installer here
return await response.text().then((data) => {
return data.replaceAll("$instance_name", instanceNameRef.value)
.replaceAll("$loader_version", loaderLibs.version)
.replaceAll("$game_version", versionSelector.value.value)
})
}
@ -212,12 +217,6 @@ PR direct support to Prism
<input type="checkbox" v-model="showSnapshots" @change="getVersions">Show Snapshots</input>
</td>
</tr>
<tr>
<td>Library Versions</td>
<td>
<input type="checkbox" v-model="useSnapshots">Use Snapshots (Beta Versions)</input>
</td>
</tr>
<tr>
<td></td>
<td></td>

View file

@ -2,21 +2,19 @@
"components": [
{
"cachedName": "LWJGL $lwjgl_major",
"cachedVersion": "$lwjlg_version",
"cachedVolatile": true,
"dependencyOnly": true,
"uid": "org.lwjgl$lwjgl_major",
"version": "$lwjlg_version"
"version": "$lwjgl_version"
},
{
"cachedName": "Minecraft",
"cachedRequires": [
{
"suggests": "$lwjlg_version",
"suggests": "$lwjgl_version",
"uid": "org.lwjgl$lwjgl_major"
}
],
"cachedVersion": "$game_version",
"important": true,
"uid": "net.minecraft",
"version": "$game_version"