improve version list computation

This commit is contained in:
moehreag 2024-06-28 09:32:54 +02:00
parent ccd50ba033
commit 72ba059e40
2 changed files with 24 additions and 28 deletions

View file

@ -26,7 +26,6 @@ Insert section about the installer here
const showSnapshots = ref() const showSnapshots = ref()
const versionSelector = ref() const versionSelector = ref()
let releases = [] let releases = []
let snapshots = []
let versions = [] let versions = []
let loaderLibs let loaderLibs
@ -35,17 +34,20 @@ Insert section about the installer here
return await response.json() return await response.json()
} }
function getVersions() { async function getVersions() {
versionSelector.value.innerHTML = "" let optionString = ""
for (let version of releases) {
versionSelector.value.innerHTML += "<option value=\""+version.id+"\">"+version.id+"</option>"
}
if (showSnapshots.value) { if (showSnapshots.value) {
for (let version of snapshots) { for (let version of versions) {
versionSelector.value.innerHTML += "<option value=\""+version.id+"\">"+version.id+"</option>" optionString += "<option value=\""+version.id+"\">"+version.id+"</option>"
}
} else {
for (let version of releases) {
optionString += "<option value=\""+version.id+"\">"+version.id+"</option>"
} }
} }
versionSelector.value.innerHTML = optionString
} }
async function fetchLibraries() { async function fetchLibraries() {
@ -59,9 +61,7 @@ Insert section about the installer here
getGameVersions().then((v) => { getGameVersions().then((v) => {
versions = v.versions versions = v.versions
for (let version of versions){ for (let version of versions){
if (version.type !== "release"){ if (version.type === "release"){
snapshots.push(version)
} else {
releases.push(version) releases.push(version)
} }
} }
@ -144,10 +144,10 @@ Insert section about the installer here
readAsset("/instance.cfg").then((data) => { readAsset("/instance.cfg").then((data) => {
if (platform === "linux") { if (platform === "linux") {
data = data.replaceAll("$override_env", "true") data = data.replaceAll("$override_env", "true")
data = data.replaceAll("$env", "Env=@Variant(\0\0\0\b\0\0\0\x1\0\0\0\x36\0_\0_\0G\0L\0_\0T\0H\0R\0\x45\0\x41\0\x44\0\x45\0\x44\0_\0O\0P\0T\0I\0M\0I\0Z\0\x41\0T\0I\0O\0N\0S\0\0\0\n\0\0\0\x2\0\x30)") data = data.replaceAll("$env", "Env=@Variant(\\0\\0\\0\\b\\0\\0\\0\\x1\\0\\0\\0\\x36\\0_\\0_\\0G\\0L\\0_\\0T\\0H\\0R\\0\\x45\\0\\x41\\0\\x44\\0\\x45\\0\\x44\\0_\\0O\\0P\\0T\\0I\\0M\\0I\\0Z\\0\\x41\\0T\\0I\\0O\\0N\\0S\\0\\0\\0\\n\\0\\0\\0\\x2\\0\\x30)")
} else { } else {
data = data.replaceAll("$override_env", "false") data = data.replaceAll("$override_env", "false")
data = data.replaceAll("$env", "@Variant(\0\0\0\b\0\0\0\0)") data = data.replaceAll("$env", "@Variant(\\0\\0\\0\\b\\0\\0\\0\\0)")
} }
zip.file("instance.cfg", data) zip.file("instance.cfg", data)
}) })
@ -217,10 +217,6 @@ PR direct support to Prism
<input type="checkbox" v-model="showSnapshots" @change="getVersions">Show Snapshots</input> <input type="checkbox" v-model="showSnapshots" @change="getVersions">Show Snapshots</input>
</td> </td>
</tr> </tr>
<!--<tr>
<td></td>
<td></td>
</tr>-->
</tbody> </tbody>
</table> </table>
<div id="missingBox"></div> <div id="missingBox"></div>

View file

@ -22,7 +22,6 @@ outline: false
const licenseRef = ref() const licenseRef = ref()
const useSnapshots = ref() const useSnapshots = ref()
let releases = [] let releases = []
let snapshots = []
let versions = [] let versions = []
let latestLoader let latestLoader
let latestPhytotelma let latestPhytotelma
@ -36,17 +35,20 @@ outline: false
return await response.json() return await response.json()
} }
function getVersions() { async function getVersions() {
versionSelector.value.innerHTML = "" let optionString = ""
for (let version of releases) {
versionSelector.value.innerHTML += "<option value=\""+version.id+"\">"+version.id+"</option>"
}
if (showSnapshots.value) { if (showSnapshots.value) {
for (let version of snapshots) { for (let version of versions) {
versionSelector.value.innerHTML += "<option value=\""+version.id+"\">"+version.id+"</option>" optionString += "<option value=\""+version.id+"\">"+version.id+"</option>"
}
} else {
for (let version of releases) {
optionString += "<option value=\""+version.id+"\">"+version.id+"</option>"
} }
} }
versionSelector.value.innerHTML = optionString
} }
onMounted(() => { onMounted(() => {
@ -54,9 +56,7 @@ outline: false
getGameVersions().then((v) => { getGameVersions().then((v) => {
versions = v.versions versions = v.versions
for (let version of versions){ for (let version of versions){
if (version.type !== "release"){ if (version.type === "release"){
snapshots.push(version)
} else {
releases.push(version) releases.push(version)
} }
} }