Fix bedrock zip imports

This commit is contained in:
Andrew 2024-05-28 19:39:13 -04:00
parent a9856a8a2c
commit 5340670ceb

View File

@ -246,11 +246,6 @@
</div> </div>
</div> </div>
</div> </div>
<div style="visibility: hidden;">
<div class="form-group">
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
</div>
</div>
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select" <div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
aria-hidden="true"> aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
@ -378,11 +373,6 @@
</div> </div>
</div> </div>
</div> </div>
<div style="visibility: hidden;">
<div class="form-group">
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
</div>
</div>
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog" aria-labelledby="dir_select" <div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
aria-hidden="true"> aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
@ -591,7 +581,7 @@
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>', message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
closeButton: false closeButton: false
}); });
setTimeout(function(){ setTimeout(function () {
getDirView(); getDirView();
}, 2000); }, 2000);
} else { } else {
@ -640,7 +630,7 @@
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>', message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
closeButton: false closeButton: false
}); });
setTimeout(function(){ setTimeout(function () {
getDirView(); getDirView();
}, 2000); }, 2000);
} else { } else {
@ -796,7 +786,13 @@
wait_msg(true); wait_msg(true);
e.preventDefault(); e.preventDefault();
let jarForm = document.getElementById("import-zip"); let jarForm = document.getElementById("import-zip");
var checkedRadio = $('.root-input:checked');
let zip_root_path = ""
if (checkedRadio.length > 0) {
// Get the value of the checked radio button
var checkedValue = checkedRadio.val();
zip_root_path = checkedValue; // Return the checked value if needed
}
let formData = new FormData(jarForm); let formData = new FormData(jarForm);
//Create an object from the form data entries //Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries()); let formDataObject = Object.fromEntries(formData.entries());
@ -813,7 +809,7 @@
"minecraft_bedrock_create_data": { "minecraft_bedrock_create_data": {
"create_type": "import_server", "create_type": "import_server",
"import_server_create_data": { "import_server_create_data": {
"existing_server_path": formDataObject.root_path, "existing_server_path": zip_root_path,
"executable": formDataObject.server_jar, "executable": formDataObject.server_jar,
} }
} }
@ -834,6 +830,13 @@
//Create an object from the form data entries //Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries()); let formDataObject = Object.fromEntries(formData.entries());
console.log(formDataObject); console.log(formDataObject);
var checkedRadio = $('.root-input:checked');
let zip_root_path = ""
if (checkedRadio.length > 0) {
// Get the value of the checked radio button
var checkedValue = checkedRadio.val();
zip_root_path = checkedValue; // Return the checked value if needed
}
let send_data = { let send_data = {
"name": formDataObject.name, "name": formDataObject.name,
"roles": calcRoles(), "roles": calcRoles(),
@ -846,7 +849,7 @@
"minecraft_bedrock_create_data": { "minecraft_bedrock_create_data": {
"create_type": "import_server", "create_type": "import_server",
"import_server_create_data": { "import_server_create_data": {
"existing_server_path": formDataObject.root_path, "existing_server_path": zip_root_path,
"executable": formDataObject.server_jar, "executable": formDataObject.server_jar,
} }
} }