feat: Allow to chose webroot

issue #180
This commit is contained in:
C4illin 2024-11-06 08:49:53 +01:00
parent f3a4aece46
commit 36cb6cc589
7 changed files with 114 additions and 86 deletions

View file

@ -1,3 +1,5 @@
const webroot = document.querySelector("meta[name='webroot']").content;
// Select the file input element
const fileInput = document.querySelector('input[type="file"]');
const dropZone = document.getElementById("dropzone");
@ -132,7 +134,7 @@ fileInput.addEventListener("change", (e) => {
// }
// }
fetch("/conversions", {
fetch(`${webroot}/conversions`, {
method: "POST",
body: JSON.stringify({ fileType: fileType }),
headers: {
@ -180,7 +182,7 @@ const deleteRow = (target) => {
setTitle();
}
fetch("/delete", {
fetch(`${webroot}/delete`, {
method: "POST",
body: JSON.stringify({ filename: filename }),
headers: {
@ -201,7 +203,7 @@ const uploadFiles = (files) => {
formData.append("file", file, file.name);
}
fetch("/upload", {
fetch(`${webroot}/upload`, {
method: "POST",
body: formData,
})
@ -212,7 +214,7 @@ const uploadFiles = (files) => {
.catch((err) => console.log(err));
};
const formConvert = document.querySelector("form[action='/convert']");
const formConvert = document.querySelector(`form[action='${webroot}/convert']`);
formConvert.addEventListener("submit", () => {
const hiddenInput = document.querySelector("input[name='file_names']");