62 lines
2.0 KiB
HTML
62 lines
2.0 KiB
HTML
{% if gallery %}
|
|
{% set pathstatic = ".." %}
|
|
{% else %}
|
|
{% set pathstatic = "." %}
|
|
{% endif %}
|
|
<!doctype html>
|
|
<html class="staticrypt-html">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>{% if gallery %}{{ gallery.title }} · {% endif %}{{ settings.title }}</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<!-- do not cache this page -->
|
|
<meta http-equiv="cache-control" content="max-age=0"/>
|
|
<meta http-equiv="cache-control" content="no-cache"/>
|
|
<meta http-equiv="expires" content="0"/>
|
|
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
|
|
<meta http-equiv="pragma" content="no-cache"/>
|
|
<link type="text/css" rel="stylesheet" href="{{ pathstatic }}/static/css/encrypt.css" media="screen,projection"/>
|
|
|
|
</head>
|
|
<body id="encrypt-body" class="staticrypt-body">
|
|
<script type="text/javascript" src="{{ pathstatic }}/static/js/crypto-js.min.js" charset="utf-8"></script>
|
|
<script>
|
|
var form = '{{ form }}';
|
|
var encryptedMsg = '{{ ciphertext }}';
|
|
|
|
if (sessionStorage.getItem("password")) {
|
|
var passphrase = sessionStorage.getItem("password");
|
|
var plainHTML = CryptoJS.AES.decrypt(encryptedMsg, passphrase).toString(CryptoJS.enc.Utf8);
|
|
document.open();
|
|
document.write(plainHTML);
|
|
document.close();
|
|
} else {
|
|
var plainHTML = CryptoJS.enc.Base64.parse(form).toString(CryptoJS.enc.Utf8);
|
|
document.open();
|
|
document.write(plainHTML);
|
|
document.close();
|
|
|
|
document.getElementById('staticrypt-form').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
var passphrase = document.getElementById('staticrypt-password').value;
|
|
|
|
try{
|
|
var plainHTML = CryptoJS.AES.decrypt(encryptedMsg, passphrase).toString(CryptoJS.enc.Utf8);
|
|
}
|
|
catch(err) {
|
|
document.getElementById("error").innerHTML = "Wrong keyword entry.";
|
|
return;
|
|
}
|
|
|
|
sessionStorage.setItem("password", passphrase);
|
|
document.open();
|
|
document.write(plainHTML);
|
|
document.close();
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|