fix download

This commit is contained in:
C4illin 2024-05-20 00:56:40 +02:00
parent 13cc37d5a2
commit 61a75c6d36
13 changed files with 198 additions and 27 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

BIN
src/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -28,9 +28,7 @@ fileInput.addEventListener("change", (e) => {
fileType = file.name.split(".").pop();
console.log(file.type);
fileInput.setAttribute("accept", `.${fileType}`);
const title = document.querySelector("h1");
title.textContent = `Convert .${fileType}`;
setTitle();
fetch("/conversions", {
method: "POST",
@ -57,6 +55,11 @@ fileInput.addEventListener("change", (e) => {
uploadFiles(files);
});
const setTitle = () => {
const title = document.querySelector("h1");
title.textContent = `Convert ${fileType ? `.${fileType}` : "___"}`;
};
// Add a onclick for the delete button
const deleteRow = (target) => {
const filename = target.parentElement.parentElement.children[0].textContent;
@ -67,6 +70,13 @@ const deleteRow = (target) => {
const index = fileNames.indexOf(filename);
fileNames.splice(index, 1);
// if fileNames is empty, reset fileType
if (fileNames.length === 0) {
fileType = null;
fileInput.removeAttribute("accept");
setTitle();
}
fetch("/delete", {
method: "POST",
body: JSON.stringify({ filename: filename }),

View file

@ -0,0 +1,19 @@
{
"name": "ConvertX | Self Hosted File Converter",
"short_name": "ConvertX",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#a5d601",
"background_color": "#13171f",
"display": "standalone"
}