|
|
@ -19,6 +19,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
body { padding-left: 10px; padding-right: 10px; font-family: Arial, Helvetica, sans-serif; }
|
|
|
|
body { padding-left: 10px; padding-right: 10px; font-family: Arial, Helvetica, sans-serif; }
|
|
|
|
|
|
|
|
.button { display: inline-block; text-align: center; cursor: pointer; }
|
|
|
|
|
|
|
|
.button span:first-child { font-size: x-large; }
|
|
|
|
|
|
|
|
.button span:last-child { font-size: smaller; }
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
@ -37,13 +40,14 @@
|
|
|
|
window.addEventListener('load', load);
|
|
|
|
window.addEventListener('load', load);
|
|
|
|
|
|
|
|
|
|
|
|
function load() {
|
|
|
|
function load() {
|
|
|
|
let form = document.getElementById('form')
|
|
|
|
const form = document.getElementById('form')
|
|
|
|
let message = document.getElementById('message');
|
|
|
|
const message = document.getElementById('message');
|
|
|
|
let copy = document.getElementById('copy');
|
|
|
|
const copy = document.getElementById('copy');
|
|
|
|
let email = document.getElementById('email');
|
|
|
|
const email = document.getElementById('email');
|
|
|
|
let error = document.getElementById('error');
|
|
|
|
const close = document.getElementById('close');
|
|
|
|
let details = document.getElementById('details');
|
|
|
|
const error = document.getElementById('error');
|
|
|
|
let year = document.getElementById('year');
|
|
|
|
const details = document.getElementById('details');
|
|
|
|
|
|
|
|
const year = document.getElementById('year');
|
|
|
|
|
|
|
|
|
|
|
|
form.addEventListener('submit', submit);
|
|
|
|
form.addEventListener('submit', submit);
|
|
|
|
|
|
|
|
|
|
|
@ -81,12 +85,20 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
email.onclick = function (event) {
|
|
|
|
email.onclick = function (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.preventDefault();
|
|
|
|
window.location.href = "mailto:?body=" + encodeURIComponent(message.textContent);
|
|
|
|
window.location.href = "mailto:?body=" + encodeURIComponent(message.textContent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close.onclick = function (event) {
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
form.fields.disabled = false;
|
|
|
|
|
|
|
|
form.style.display = 'block';
|
|
|
|
|
|
|
|
content.style.display = 'none';
|
|
|
|
|
|
|
|
message.innerHTML = '';
|
|
|
|
|
|
|
|
form.password.focus();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
year.textContent = new Date().getFullYear();
|
|
|
|
year.textContent = new Date().getFullYear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -96,12 +108,11 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function decrypt() {
|
|
|
|
async function decrypt() {
|
|
|
|
let form = document.getElementById('form')
|
|
|
|
const form = document.getElementById('form')
|
|
|
|
let content = document.getElementById('content');
|
|
|
|
const content = document.getElementById('content');
|
|
|
|
let message = document.getElementById('message');
|
|
|
|
const message = document.getElementById('message');
|
|
|
|
let error = document.getElementById('error');
|
|
|
|
const error = document.getElementById('error');
|
|
|
|
let details = document.getElementById('details');
|
|
|
|
const details = document.getElementById('details');
|
|
|
|
let copyright = document.getElementById('copyright');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
form.fields.disabled = true;
|
|
|
|
form.fields.disabled = true;
|
|
|
@ -112,13 +123,13 @@
|
|
|
|
if (!form.password.value)
|
|
|
|
if (!form.password.value)
|
|
|
|
throw new Error('Password required');
|
|
|
|
throw new Error('Password required');
|
|
|
|
|
|
|
|
|
|
|
|
let dirty = await _decrypt(form.password.value);
|
|
|
|
const dirty = await _decrypt(form.password.value);
|
|
|
|
let clean = DOMPurify.sanitize(dirty, { USE_PROFILES: { html: true } });
|
|
|
|
const clean = DOMPurify.sanitize(dirty, { USE_PROFILES: { html: true } });
|
|
|
|
|
|
|
|
|
|
|
|
form.style.display = 'none';
|
|
|
|
form.password.value = '';
|
|
|
|
message.innerHTML = clean;
|
|
|
|
message.innerHTML = clean;
|
|
|
|
|
|
|
|
form.style.display = 'none';
|
|
|
|
content.style.display = 'block';
|
|
|
|
content.style.display = 'block';
|
|
|
|
copyright.style.display = 'none';
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log("%O", e);
|
|
|
|
console.log("%O", e);
|
|
|
|
form.fields.disabled = false;
|
|
|
|
form.fields.disabled = false;
|
|
|
@ -132,7 +143,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function _decrypt(password) {
|
|
|
|
async function _decrypt(password) {
|
|
|
|
let msg = atob(window.location.hash.substr(1).replaceAll('-', '+').replaceAll('_', '/'));
|
|
|
|
const msg = atob(window.location.hash.substr(1).replaceAll('-', '+').replaceAll('_', '/'));
|
|
|
|
|
|
|
|
|
|
|
|
const buf = new Uint8Array(msg.length);
|
|
|
|
const buf = new Uint8Array(msg.length);
|
|
|
|
for (let i = 0; i < msg.length; i++)
|
|
|
|
for (let i = 0; i < msg.length; i++)
|
|
|
@ -167,12 +178,12 @@
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<fieldset id="fields" style="border:0 none; margin: 0; padding: 0;">
|
|
|
|
<fieldset id="fields" style="border:0 none; margin: 0; padding: 0;">
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<label for="password">Enter password:</label><br>
|
|
|
|
<label for="password">Enter password 🔑</label><br>
|
|
|
|
<input id="password" name="password" type="password" required><br>
|
|
|
|
<input id="password" name="password" type="password" required><br>
|
|
|
|
<span style="font-size: smaller;">Passwords are case-sensitive </span>
|
|
|
|
<span style="font-size: smaller;">Passwords are case-sensitive </span>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<input id="submit" type="submit" value="Decrypt">
|
|
|
|
<input id="submit" style="padding: 3px;" type="submit" value="🔓 Decrypt">
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</fieldset>
|
|
|
|
</fieldset>
|
|
|
|
<p style="font-size: smaller;">
|
|
|
|
<p style="font-size: smaller;">
|
|
|
@ -181,19 +192,24 @@
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="content" style="display: none; width: 100%;">
|
|
|
|
<div id="content" style="display: none; width: 100%;">
|
|
|
|
<h2>Decrypted content</h2>
|
|
|
|
<p>The sender sent you this password protected content with <a href="https://email.faircode.eu/" target="_blank">FairEmail</a>:</p>
|
|
|
|
<hr>
|
|
|
|
<hr style="margin-top: 30px;">
|
|
|
|
<p id="message" style="width: 100%;"></p>
|
|
|
|
<p id="message" style="width: 100%;"></p>
|
|
|
|
<hr>
|
|
|
|
<hr style="margin-bottom: 30px;">
|
|
|
|
<div style="margin-top: 20px;">
|
|
|
|
<div>
|
|
|
|
<div id="copy" style="display: inline-block; text-align: center;">
|
|
|
|
<div id="copy" class="button">
|
|
|
|
<span style="font-size: x-large">📋</span><br>
|
|
|
|
<span>📋</span><br>
|
|
|
|
<span style="font-size: smaller;">Copy</span>
|
|
|
|
<span>Copy</span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
 
|
|
|
|
|
|
|
|
<div id="email" class="button">
|
|
|
|
|
|
|
|
<span>📧</span><br>
|
|
|
|
|
|
|
|
<span>Email</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
 
|
|
|
|
 
|
|
|
|
<div id="email" style="display: inline-block; text-align: center;">
|
|
|
|
<div id="close" class="button">
|
|
|
|
<span style="font-size: x-large">📧</span><br>
|
|
|
|
<span>✕</span><br>
|
|
|
|
<span style="font-size: smaller;">Email</span><br>
|
|
|
|
<span>Close</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -202,7 +218,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<p id="details" style="font-size: x-small; display: none;"></p>
|
|
|
|
<p id="details" style="font-size: x-small; display: none;"></p>
|
|
|
|
|
|
|
|
|
|
|
|
<p id="copyright" style="padding-top: 20px;">
|
|
|
|
<p style="padding-top: 30px;">
|
|
|
|
Copyright © 2018–<span id="year">2022</span> by Marcel Bokhorst (M66B)
|
|
|
|
Copyright © 2018–<span id="year">2022</span> by Marcel Bokhorst (M66B)
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|