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 versionSelector = ref()
let releases = []
let snapshots = []
let versions = []
let loaderLibs
@ -35,17 +34,20 @@ Insert section about the installer here
return await response.json()
}
function getVersions() {
versionSelector.value.innerHTML = ""
async function getVersions() {
let optionString = ""
for (let version of releases) {
versionSelector.value.innerHTML += "<option value=\""+version.id+"\">"+version.id+"</option>"
}
if (showSnapshots.value) {
for (let version of snapshots) {
versionSelector.value.innerHTML += "<option value=\""+version.id+"\">"+version.id+"</option>"
for (let version of versions) {
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() {
@ -59,9 +61,7 @@ Insert section about the installer here
getGameVersions().then((v) => {
versions = v.versions
for (let version of versions){
if (version.type !== "release"){
snapshots.push(version)
} else {
if (version.type === "release"){
releases.push(version)
}
}
@ -144,10 +144,10 @@ Insert section about the installer here
readAsset("/instance.cfg").then((data) => {
if (platform === "linux") {
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 {
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)
})
@ -217,10 +217,6 @@ PR direct support to Prism
<input type="checkbox" v-model="showSnapshots" @change="getVersions">Show Snapshots</input>
</td>
</tr>
<!--<tr>
<td></td>
<td></td>
</tr>-->
</tbody>
</table>
<div id="missingBox"></div>

View file

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