Loading index.php +13 −7 Original line number Diff line number Diff line Loading @@ -251,6 +251,7 @@ header('X-Robots-Tag: noindex, nofollow'); } const decryptBtn = document.getElementById('decryptBtn'); let secretResponse = null; decryptBtn.addEventListener('click', async () => { const passphrase = document.getElementById('decryptPassphrase').value.trim(); Loading @@ -259,13 +260,18 @@ header('X-Robots-Tag: noindex, nofollow'); try { // IMPORTANT: ideally this should be a POST that only "consumes" on purpose. let result; if (!secretResponse) { const response = await fetch(`/secret-api.php?id=${encodeURIComponent(id)}&retrieve`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({passphraseHint: !!passphrase}) // optional, backend can ignore }); const result = await response.json().catch(() => ({})); result = await response.json().catch(() => ({})); } else { result = secretResponse; } // Generic failure (don’t reveal if id exists) if (!response.ok || !result || !result.secret) { Loading Loading
index.php +13 −7 Original line number Diff line number Diff line Loading @@ -251,6 +251,7 @@ header('X-Robots-Tag: noindex, nofollow'); } const decryptBtn = document.getElementById('decryptBtn'); let secretResponse = null; decryptBtn.addEventListener('click', async () => { const passphrase = document.getElementById('decryptPassphrase').value.trim(); Loading @@ -259,13 +260,18 @@ header('X-Robots-Tag: noindex, nofollow'); try { // IMPORTANT: ideally this should be a POST that only "consumes" on purpose. let result; if (!secretResponse) { const response = await fetch(`/secret-api.php?id=${encodeURIComponent(id)}&retrieve`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({passphraseHint: !!passphrase}) // optional, backend can ignore }); const result = await response.json().catch(() => ({})); result = await response.json().catch(() => ({})); } else { result = secretResponse; } // Generic failure (don’t reveal if id exists) if (!response.ok || !result || !result.secret) { Loading