bastebin/templates/raw_decryptor.html

38 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Raw | {{ cfg.site.name }}</title>
<style>
body { margin: 0; padding: 1rem; background: #fff; color: #000; font-family: monospace; }
pre { white-space: pre-wrap; word-wrap: break-word; margin: 0; }
#error { display: none; color: red; font-weight: bold; }
</style>
</head>
<body>
<pre id="rawContent"></pre>
<div id="error">Decryption Failed — Key missing or incorrect.</div>
<script src="{{ url_for('static', filename='js/crypto.js') }}" nonce="{{ csp_nonce }}"></script>
<script nonce="{{ csp_nonce }}">
(async function decryptRaw() {
const raw = {{ paste.encrypted_data | tojson }};
const keyBase64 = window.location.hash.slice(1);
const pre = document.getElementById('rawContent');
const error = document.getElementById('error');
if (!keyBase64) { error.style.display = 'block'; return; }
try {
const key = await PasteCrypto.importKey(keyBase64);
const plaintext = await PasteCrypto.decrypt(raw, key);
const data = JSON.parse(plaintext);
pre.textContent = data.content;
} catch (e) {
error.style.display = 'block';
}
})();
</script>
</body>
</html>