diff --git a/src/html.gleam b/src/html.gleam index 581f7c1..6b4d374 100644 --- a/src/html.gleam +++ b/src/html.gleam @@ -135,7 +135,7 @@ fn decrypt_js(encrypted_content: String) -> String { try { let keyBase64 = hash.replace(/-/g, '+').replace(/_/g, '/'); while (keyBase64.length % 4) keyBase64 += '='; - + const encryptedBytes = Uint8Array.from(atob(encryptedContent), c => c.charCodeAt(0)); const keyBytes = Uint8Array.from(atob(keyBase64), c => c.charCodeAt(0)); const iv = encryptedBytes.slice(0, 12); @@ -218,19 +218,19 @@ function showShareUrl(url) { document.getElementById('paste-form')?.addEventListener('submit', async (e) => { e.preventDefault(); - + const submitButton = e.target.querySelector('button[type=\"submit\"]'); const contentInput = document.getElementById('content'); const encryptedInput = document.getElementById('encrypted-content'); const csrfInput = document.getElementById('csrf-token'); - + if (!contentInput || !encryptedInput || !csrfInput) { console.error('Required form elements not found'); return; } - + if (submitButton) submitButton.disabled = true; - + try { const content = contentInput.value; const { encrypted, key } = await encryptContent(content);