3.4 KiB
REQ-2026-04-16-vanilla-versions-fix
From: Chronicler #93
Date: 2026-04-16
Priority: HIGH — versions not loading in vanilla form
Status: PENDING
The Bug
Vanilla form version dropdown shows "Loading versions..." but never populates. The fetch('/admin/modpack-installer/mc-versions?paper=1') call inside _vanilla_form.ejs never executes because the form is injected via innerHTML in loadVanillaForm() — and browsers strip/don't execute <script> tags inserted via innerHTML.
The Fix
Move the version-loading logic OUT of _vanilla_form.ejs and INTO loadVanillaForm() in index.ejs, where it runs in a proper script context.
In index.ejs, update loadVanillaForm() to:
function loadVanillaForm() {
document.getElementById('search-section').classList.add('hidden');
document.getElementById('search-results').innerHTML = '';
document.querySelectorAll('.provider-card').forEach(function(el) { el.classList.remove('selected'); });
document.getElementById('pack-details').innerHTML = '<div class="text-gray-500 text-sm p-4">Loading...</div>';
fetch('/admin/modpack-installer/vanilla-form', { headers: { 'HX-Request': 'true' } })
.then(function(r) { return r.text(); })
.then(function(html) {
document.getElementById('pack-details').innerHTML = html;
// Scripts don't execute when injected via innerHTML — run them here instead
// Load MC versions (Paper-supported only)
fetch('/admin/modpack-installer/mc-versions?paper=1', { headers: { 'HX-Request': 'true' } })
.then(function(r) { return r.json(); })
.then(function(versions) {
var sel = document.getElementById('vf-mcversion');
if (!sel) return;
sel.innerHTML = '';
versions.forEach(function(v, i) {
var opt = document.createElement('option');
opt.value = v.version;
opt.dataset.mc = v.version;
opt.dataset.java = v.java_version;
opt.textContent = v.version + (i === 0 ? ' (latest)' : '');
if (i === 0) opt.selected = true;
sel.appendChild(opt);
});
if (versions.length > 0) {
var javaEl = document.getElementById('vf-java');
if (javaEl) javaEl.value = versions[0].java_version;
}
});
// Load node stats
fetch('/admin/modpack-installer/node-info', { headers: { 'HX-Request': 'true' } })
.then(function(r) { return r.json(); })
.then(function(nodes) {
// populate node selector with live stats (same logic as was in the form script)
var sel = document.getElementById('vf-node');
if (!sel || !nodes) return;
sel.innerHTML = '';
nodes.forEach(function(n) {
var opt = document.createElement('option');
opt.value = n.id;
opt.textContent = n.label + ' | RAM: ' + n.ramUsed + '/' + n.ramTotal + ' | Disk: ' + n.diskUsed + '/' + n.diskTotal;
sel.appendChild(opt);
});
vfRefreshPort();
});
});
}
Also remove the duplicate fetch blocks from _vanilla_form.ejs <script> section (they'll never run anyway and just add noise).
Files to Touch
src/views/admin/modpack-installer/index.ejs— move fetch logic into loadVanillaForm()src/views/admin/modpack-installer/_vanilla_form.ejs— remove dead script blocks
Deploy
Standard pattern, no migrations needed.