fix graphic interface again !!
All checks were successful
Deploy / trigger (push) Successful in 23s

This commit is contained in:
2026-03-28 11:33:03 +01:00
parent d371b504f5
commit b8f0ba86e1
7 changed files with 180 additions and 43 deletions

View File

@@ -1,30 +1,37 @@
async function encrypt() {
const plaintext = document.getElementById("plaintext").value;
const key = document.getElementById("key").value;
if(!plaintext) return alert("Inserisci del testo!");
const plaintext = document.getElementById("plaintext").value;
const key = document.getElementById("key").value;
try {
const risposta = await fetch("/seal/cesare/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
// Invia il testo e la chiave (convertita in numero) al server
body: JSON.stringify({ plaintext: plaintext, key: parseInt(key) })
});
document.getElementById("ciphertext").value = await risposta.text();
} catch (e) { alert("Errore di connessione con le API di Cesare!"); }
}
if (!plaintext) return alert("Inserisci del testo!");
async function decrypt() {
const ciphertext = document.getElementById("ciphertext").value;
const key = document.getElementById("key").value;
try {
const risposta = await fetch("/seal/cesare/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
// Invia il testo e la chiave (convertita in numero) al server
body: JSON.stringify({ plaintext: plaintext, key: parseInt(key) })
});
document.getElementById("ciphertext").value = await risposta.text();
} catch (e) { alert("Errore di connessione con le API di Cesare!"); }
}
if(!ciphertext) return alert("Nessun testo da decifrare!");
try {
const res = await fetch("/seal/cesare/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) })
});
// TODO: SISTEMARE IL SISTEMA DI DECIFRATURA !!
document.getElementById("testoDecifrato").value = await res.text();
} catch (e) { alert("Errore di connessione!"); }
}
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/cesare/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) })
});
// TODO: SISTEMARE IL SISTEMA DI DECIFRATURA !!
document.getElementById("testoDecifrato").value = await res.text();
} catch (e) { alert("Errore di connessione!"); }
}
// Gestione Menu Mobile
function toggleMenu() {
document.getElementById("nav-links").classList.toggle("active");
}
// Anno dinamico Footer
document.getElementById("year").innerText = new Date().getFullYear();