keep list structure

This commit is contained in:
Mylloon 2022-10-28 15:02:28 +02:00
parent 54137139e2
commit 0a7b0b7d4a
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 5 additions and 4 deletions

View file

@ -70,8 +70,9 @@ const send = (file, element) => {
gen_RSA_keypair(1024).then(([pub_key, sec_key]) => {
element = update(element, "Chiffrement du fichier...", "H3");
console.log(RSA_enc(content, sec_key));
let data = {
file: RSA_enc(content, sec_key).map((v) => v.toString()),
file: RSA_enc(content, sec_key).join(","),
};
element = update(element, "Téléversement...", "H3");
@ -109,7 +110,6 @@ const send = (file, element) => {
input.readOnly = true;
div.appendChild(input);
// TODO: Change button textContent on click
let button = document.createElement("BUTTON");
button.textContent = "Copier le lien";
div.appendChild(button);

View file

@ -1,7 +1,7 @@
from time import time
from config import Config
from flask import Blueprint, redirect, request, jsonify
from flask import Blueprint, jsonify, redirect, request
from utils.misc import hash_data
from werkzeug.wrappers.response import Response
@ -14,10 +14,11 @@ def upload() -> Response:
json = request.get_json()
if json:
data = "".join(json["file"])
data_hash = hash_data(data)
data_hash = hash_data(data.replace(",", ""))
with open(f"{Config.uploads_dir}/{data_hash}", 'w') as f:
f.write(data)
# Maybe add the encrypted filename ?
Config.database.add_file(data_hash, int(time()))
# Send the hash to the javascript client