Compare commits

..

No commits in common. "da2ae85c5159c517d993ba82f872ff2df9b1c0a3" and "db83f9e445d6e915be66ea0f2cc08d513ec185df" have entirely different histories.

2 changed files with 12 additions and 15 deletions

View file

@ -17,7 +17,7 @@ class Config:
# Desc of the index page
desc = "Sand permet le partage de fichiers. Attention, je n'accepte que \
les petits fichiers de quelques <code>ko</code> car je chiffre via \
RSA 🙂.<br><br>Ne supportes pas les binaires."
RSA 🙂.<br><br>Ne supportes que les fichiers ASCII."
# Footer of webpages
footer = "NPNO"

View file

@ -74,26 +74,23 @@ const send = (file, element) => {
reader.readAsDataURL(file);
reader.onload = () => {
const content = reader.result.split(";base64,").pop();
if (file.size > 512000 || file.size == 0) {
let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)";
update(
element,
`Fichier ${message}, cliquez pour revenir en arrière.`,
"H3"
).parentElement.addEventListener("click", () => {
location.href = "/";
});
return;
}
const req = new XMLHttpRequest();
element = update(element, "Génération des clefs...", "H3");
gen_RSA_keypair(1024).then(([pub_key, sec_key]) => {
element = update(element, "Chiffrement du fichier...", "H3");
if (content.length == 0) {
update(
element,
"Fichier vide, cliquez pour revenir en arrière.",
"H3"
).parentElement.addEventListener("click", () => {
location.href = "/";
});
return;
}
let data = {
file: RSA_enc(content, sec_key).join(","),
filename: RSA_enc(file.name, sec_key).join(","),