This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
<button class="btn-green" onclick="decrypt()">🔓 Decifra in chiaro</button>
|
||||
|
||||
<label style="display:block; margin-top: 25px;">Risultato decifrato:</label>
|
||||
<textarea id="testoDecifrato" readonly placeholder="Il messaggio originale tornerà qui..."></textarea>
|
||||
<textarea id="decodedtext" readonly placeholder="Il messaggio originale tornerà qui..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
@@ -16,16 +16,14 @@ async function encrypt() {
|
||||
|
||||
async function decrypt() {
|
||||
const ciphertext = document.getElementById("ciphertext").value;
|
||||
const key = document.getElementById("key").value;
|
||||
|
||||
if (!ciphertext) return alert("Nessun testo da decifrare!");
|
||||
try {
|
||||
const res = await fetch("/seal/caesar/decrypt", {
|
||||
method: "POST", headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) })
|
||||
body: JSON.stringify({ ciphertext: ciphertext })
|
||||
});
|
||||
// TODO: SISTEMARE IL SISTEMA DI DECIFRATURA !!
|
||||
document.getElementById("testoDecifrato").value = await res.text();
|
||||
document.getElementById("decodedtext").value = await res.text();
|
||||
} catch (e) { alert("Errore di connessione!"); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user