Compare commits
No commits in common. "da2ae85c5159c517d993ba82f872ff2df9b1c0a3" and "db83f9e445d6e915be66ea0f2cc08d513ec185df" have entirely different histories.
da2ae85c51
...
db83f9e445
2 changed files with 12 additions and 15 deletions
|
@ -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"
|
||||
|
|
|
@ -74,12 +74,16 @@ const send = (file, element) => {
|
|||
reader.readAsDataURL(file);
|
||||
reader.onload = () => {
|
||||
const content = reader.result.split(";base64,").pop();
|
||||
const req = new XMLHttpRequest();
|
||||
|
||||
if (file.size > 512000 || file.size == 0) {
|
||||
let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)";
|
||||
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 ${message}, cliquez pour revenir en arrière.`,
|
||||
"Fichier vide, cliquez pour revenir en arrière.",
|
||||
"H3"
|
||||
).parentElement.addEventListener("click", () => {
|
||||
location.href = "/";
|
||||
|
@ -87,13 +91,6 @@ const send = (file, element) => {
|
|||
|
||||
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");
|
||||
|
||||
let data = {
|
||||
file: RSA_enc(content, sec_key).join(","),
|
||||
filename: RSA_enc(file.name, sec_key).join(","),
|
||||
|
|
Reference in a new issue