diff --git a/themes/default/public/js/lufi-download.js b/themes/default/public/js/lufi-download.js
index 5f95b76..5e70021 100644
--- a/themes/default/public/js/lufi-download.js
+++ b/themes/default/public/js/lufi-download.js
@@ -39,7 +39,7 @@ document.addEventListener("DOMContentLoaded", () => {
passwordFormDOM.onsubmit = (event) => {
event.preventDefault();
- passwordFormDOM.classList.add("hidden");
+ hideNode(passwordFormDOM);
startDownload();
};
@@ -48,14 +48,14 @@ document.addEventListener("DOMContentLoaded", () => {
const showZipContent = (zipFile, cardDOM) => {
const zipContainerDOM = cardDOM.querySelector(".content .zip-container");
- zipContainerDOM.classList.remove("hidden");
+ showNode(zipContainerDOM);
zipContainerDOM.querySelector(".action-show-zip").onclick = (event) => {
- event.target.classList.add("hidden");
+ hideNode(event.target);
const zipContentDOM = zipContainerDOM.querySelector(".zip-content");
- zipContentDOM.classList.remove("hidden");
+ showNode(zipContentDOM);
document.body.style.cursor = "wait";
@@ -64,7 +64,7 @@ document.addEventListener("DOMContentLoaded", () => {
.andThen((job) => job.waitForCompletion())
.map((job) => {
job.archiveFiles.forEach((file) => {
- const itemDOM = zipContainerDOM
+ const itemDOM = document
.querySelector("template#zip-item")
.content.cloneNode(true).children[0];
diff --git a/themes/default/public/js/lufi-list-invitations.js b/themes/default/public/js/lufi-list-invitations.js
index 020df17..ce3a564 100644
--- a/themes/default/public/js/lufi-list-invitations.js
+++ b/themes/default/public/js/lufi-list-invitations.js
@@ -31,14 +31,14 @@ const toggleHidden = () => {
if (invitationsListDOM.getAttribute("data-visibility") === "hidden") {
toggleButtonDOM.innerText = i18n.hideText;
- itemsHiddenDOM.forEach((item) => item.classList.remove("hidden"));
+ itemsHiddenDOM.forEach((item) => showNode(item));
invitationsListDOM.setAttribute("data-visibility", "shown");
} else {
toggleButtonDOM.innerText = i18n.showText;
itemsHiddenDOM.forEach((item) => {
- item.classList.add("hidden");
+ hideNode(item);
const checkbox = item.querySelector("input");
@@ -157,7 +157,7 @@ const toggleVisibility = () => {
if (t.show) {
itemDOM.setAttribute("data-visibility", 1);
- itemDOM.classList.remove("hidden");
+ showNode(itemDOM);
itemDOM
.querySelector(".column.selection .icon.hide-source")
.remove();
@@ -169,7 +169,7 @@ const toggleVisibility = () => {
.querySelector(".invitations-list")
.getAttribute("data-visibility") === "hidden"
) {
- itemDOM.classList.add("hidden");
+ hideNode(itemDOM);
}
itemDOM
diff --git a/themes/default/public/js/lufi-upload.js b/themes/default/public/js/lufi-upload.js
index 928c2e5..49c0cc4 100644
--- a/themes/default/public/js/lufi-upload.js
+++ b/themes/default/public/js/lufi-upload.js
@@ -70,14 +70,15 @@ document.addEventListener("DOMContentLoaded", () => {
};
const clearZip = () => {
- zipZoneDOM.classList.add("hidden");
- zipZoneDOM.querySelector(".action-upload-zip").classList.remove("hidden");
- zipZoneDOM.querySelector(".zip-compressing").classList.add("hidden");
+ hideNode(zipZoneDOM);
+ showNode(zipZoneDOM.querySelector(".action-upload-zip"));
+ hideNode(zipZoneDOM.querySelector(".zip-compressing"));
+ hideNode(inputZipNameDOM);
+
zipZoneDOM.querySelector(".files-list").replaceChildren();
- inputZipNameDOM.classList.add("hidden");
-
archiveEntries = undefined;
+ zipSize = 0;
mustZipDOM.checked = false;
};
@@ -176,7 +177,7 @@ document.addEventListener("DOMContentLoaded", () => {
}
if (fileCardsDOM.querySelectorAll(".file-card.success").length > 0) {
- uploadedZoneDOM.querySelector(".buttons").classList.remove("hidden");
+ showNode(uploadedZoneDOM.querySelector(".buttons"));
}
return cardDOM;
@@ -191,7 +192,7 @@ document.addEventListener("DOMContentLoaded", () => {
if (!mustZipDOM.checked) {
clearZip();
} else {
- inputZipNameDOM.classList.remove("hidden");
+ showNode(inputZipNameDOM);
}
};
@@ -237,7 +238,8 @@ document.addEventListener("DOMContentLoaded", () => {
password
);
} else {
- zipZoneDOM.classList.remove("hidden");
+ showNode(zipZoneDOM);
+
lufi
.addFilesToArchive(files, archiveEntries)
.andThen((entries) => {
@@ -295,11 +297,11 @@ document.addEventListener("DOMContentLoaded", () => {
updateMailLinksButton(serverKey, true);
if (fileCardsDOM.children.length === 0) {
- uploadedZoneDOM.classList.add("hidden");
+ hideNode(uploadedZoneDOM);
}
if (fileCardsDOM.querySelectorAll(".file-card.success").length === 0) {
- uploadedZoneDOM.querySelector(".buttons").classList.add("hidden");
+ hideNode(uploadedZoneDOM);
}
};
@@ -388,7 +390,7 @@ document.addEventListener("DOMContentLoaded", () => {
zipName,
password
) => {
- uploadedZoneDOM.classList.remove("hidden");
+ showNode(uploadedZoneDOM);
const serverUrl = new URL(ws_url.replace("/upload", ""));
serverUrl.protocol = serverUrl.protocol === "ws:" ? "http:" : "https:";
@@ -511,8 +513,8 @@ document.addEventListener("DOMContentLoaded", () => {
const uploadZip = () => {
document.body.style.cursor = "wait";
- zipZoneDOM.querySelector(".action-upload-zip").classList.add("hidden");
- zipZoneDOM.querySelector(".zip-compressing").classList.remove("hidden");
+ hideNode(zipZoneDOM.querySelector(".action-upload-zip"));
+ showNode(zipZoneDOM.querySelector(".zip-compressing"));
const { zipName, deleteDays, shouldDeleteOnFirstView, password } =
retrieveUploadParams();
@@ -522,9 +524,15 @@ document.addEventListener("DOMContentLoaded", () => {
.andThen((job) => {
document.body.style.cursor = "auto";
+ zipZoneDOM.querySelector(".action-close").onclick = () => {
+ job.terminate();
+
+ clearZip();
+ };
+
return job.waitForCompletion();
})
- .andThen((job) => {
+ .map((job) => {
// if '.zip-zone' is hidden, the zipping has been aborted
if (!zipZoneDOM.classList.contains("hidden")) {
addToast(i18n.enqueued.replace("XXX", zipName), "success");
diff --git a/themes/default/templates/about.html.ep b/themes/default/templates/about.html.ep
index fc60ecc..d0af0d2 100644
--- a/themes/default/templates/about.html.ep
+++ b/themes/default/templates/about.html.ep
@@ -1,23 +1,24 @@
<%= l('Lufi is a free (as in free speech) file hosting software.') %> <%= l('The files uploaded on a Lufi instance are encrypted before the upload to the server: the administrator of the server can not see the file\'s content.') %> <%= l('You don\'t need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don\'t panic, this is normally the case for all sites on which you send files.') %> <%= l('Drag and drop files in the appropriate area or use the traditional way to send files and the files will be chunked, encrypted and sent to the server. You will get two links per file: a download link, that you give to the people you want to share the file with and a deletion link, allowing you to delete the file whenever you want.') %> <%= l('You can see the list of your files by clicking on the "My files" link at the top right of this page.') %> <%== l('Please contact the administrator: %1', config('contact')) %> <%== l('The original (and only for now) author is Luc Didry.') %> <%== l('As Lufi is a free software licensed under of the terms of the AGPLv3, you can install it on you own server. Have a look on the Wiki for the procedure.') %> <%== l('Latest tag of this instance: %1', sprintf('%s', stash('version')->{tag}, stash('version')->{tag})) %> <%== l('Latest commit of this instance: %1', sprintf('%s', stash('version')->{commit}, stash('version')->{commit})) %> <%= link_to url_for('/') => ( class => "button action-back-homepage" ) => begin %><%= l('Back to homepage') %><% end%> <%= l('Lufi is a free (as in free speech) file hosting software.') %> <%= l('The files uploaded on a Lufi instance are encrypted before the upload to the server: the administrator of the server can not see the file\'s content.') %> <%= l('You don\'t need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don\'t panic, this is normally the case for all sites on which you send files.') %> <%= l('Drag and drop files in the appropriate area or use the traditional way to send files and the files will be chunked, encrypted and sent to the server. You will get two links per file: a download link, that you give to the people you want to share the file with and a deletion link, allowing you to delete the file whenever you want.') %> <%= l('You can see the list of your files by clicking on the "My files" link at the top right of this page.') %> <%== l('Please contact the administrator: %1', config('contact')) %> <%== l('The original (and only for now) author is Luc Didry.') %> <%== l('As Lufi is a free software licensed under of the terms of the AGPLv3, you can install it on you own server. Have a look on the Wiki for the procedure.') %> <%== l('Latest tag of this instance: %1', sprintf('%s', stash('version')->{tag}, stash('version')->{tag})) %> <%== l('Latest commit of this instance: %1', sprintf('%s', stash('version')->{commit}, stash('version')->{commit})) %> <%= link_to url_for('/') => ( class => "button action-back-homepage" ) => begin %><%= l('Back to homepage') %><% end%><%= l('What is Lufi?') %>
- <%= l('Privacy') %>
-
- <%= l('The administrator can only see the file\'s name, its size and its mimetype (what kind of file it is: video, text, etc.).') %><%= l('How does it work?') %>
- <%= l('How to report an illegal file?') %>
- <%= l('Who wrote this software?') %>
- <%= l('How to install the software on my server?') %>
-
- <%== l('Get the source code on the official repository or on its Github mirror') %>
- <%= l('Version') %>
- <%= l('About') %>
+ <%= l('What is Lufi?') %>
+ <%= l('Privacy') %>
+
+ <%= l('The administrator can only see the file\'s name, its size and its mimetype (what kind of file it is: video, text, etc.).') %><%= l('How does it work?') %>
+ <%= l('How to report an illegal file?') %>
+ <%= l('Who wrote this software?') %>
+ <%= l('How to install the software on my server?') %>
+
+ <%== l('Get the source code on the official repository or on its Github mirror') %>
+ <%= l('Version') %>
+