58 lines
1.8 KiB
HTML
Raw Normal View History

2017-10-03 00:43:29 +02:00
{% if gallery %}
{% set pathstatic = ".." %}
{% else %}
{% set pathstatic = "." %}
{% endif %}
2017-09-27 13:48:21 +02:00
<!doctype html>
<html class="staticrypt-html">
<head>
<meta charset="utf-8">
2017-10-03 00:43:29 +02:00
<title>{% if gallery %}{{ gallery.title }} · {% endif %}{{ settings.title }}</title>
2017-09-27 13:48:21 +02:00
<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"/>
2017-10-03 00:43:29 +02:00
<link type="text/css" rel="stylesheet" href="{{ pathstatic }}/static/css/style-page.css" media="screen,projection"/>
2017-09-27 13:48:21 +02:00
2017-10-02 11:14:50 +02:00
</head>
2017-10-03 00:43:29 +02:00
<script type="text/javascript" src="{{ pathstatic }}/static/js/crypto-js.min.js" charset="utf-8"></script>
2017-10-02 11:14:50 +02:00
<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.write(plainHTML);
document.close();
} else {
var plainHTML = CryptoJS.enc.Base64.parse(form).toString(CryptoJS.enc.Utf8);
document.write(plainHTML);
document.close();
}
2017-09-27 13:48:21 +02:00
document.getElementById('staticrypt-form').addEventListener('submit', function(e) {
e.preventDefault();
2017-10-02 11:14:50 +02:00
var passphrase = document.getElementById('staticrypt-password').value;
2017-09-27 13:48:21 +02:00
try{
var plainHTML = CryptoJS.AES.decrypt(encryptedMsg, passphrase).toString(CryptoJS.enc.Utf8);
}
catch(err) {
2017-10-02 11:14:50 +02:00
document.getElementById("error").innerHTML = "Wrong keyword entry.";
2017-09-27 13:48:21 +02:00
return;
}
2017-10-03 00:43:29 +02:00
sessionStorage.setItem("password", passphrase);
2017-09-27 13:48:21 +02:00
document.write(plainHTML);
document.close();
});
2017-10-02 11:14:50 +02:00
</script>
2017-09-27 13:48:21 +02:00
</body>
</html>