feat(cipher): add ciphering

master
Romain J 10 months ago
parent 62b5d7d3ef
commit 54766d60c1
No known key found for this signature in database
GPG Key ID: 3227578329C2A3A7

@ -38,4 +38,12 @@ B
H
chat/apps/users/forms.py,c/5/c590740c4ac867b1db50168e191a9f5bbca5397c
H
chat/apps/guilds/apps.py,f/8/f8550eeba98ecb491e727fb1d0f24ad5c394d099
chat/apps/guilds/apps.py,f/8/f8550eeba98ecb491e727fb1d0f24ad5c394d099
@
.readthedocs.yml,8/1/81ccd5c4e1f93eb3ab80c73b5532455bf4f82fe9
V
&chat/libs/templatetags/qr_generator.py,7/a/7a7f2347c6fcd297de4ae8b927d4e209a2c0f861
Y
)chat/templates/layouts/parts/sidebar.html,e/a/eabbd5a8b009dae85951e8d6a0cac8957aacfcf5
Q
!chat/libs/templatetags/abs_url.py,a/5/a5dc085793ad7a9c90ce7a0624500212ae09a943

@ -59,7 +59,7 @@ function createMessage(data) {
</header>
<div class="uk-comment-body">
<p>${data.content}</p>
<p>${decipher(data.content, data.author.id)}</p>
</div>
</article>`;
}

File diff suppressed because one or more lines are too long

@ -1 +1,9 @@
/* Project specific Javascript goes here. */
function cipher(text) {
return CryptoJS.AES.encrypt(text, me).toString();
}
function decipher(text, key) {
return CryptoJS.AES.decrypt(text, key).toString(CryptoJS.enc.Utf8);
}

@ -0,0 +1 @@
function cipher(t){return CryptoJS.AES.encrypt(t,me).toString()}function decipher(t,r){return CryptoJS.AES.decrypt(t,r).toString(CryptoJS.enc.Utf8)}

@ -77,7 +77,7 @@
window.ws.send(JSON.stringify({
"cmd": "POST_MESSAGE",
"data": {
"content": textarea.value,
"content": cipher(textarea.value),
"attachments": attachments
}
}));

@ -32,6 +32,7 @@
<script defer src="{% static 'js/libs/uikit/uikit.js' %}"></script>
<script defer src="{% static 'js/libs/uikit/uikit-icons.js' %}"></script>
<script defer src="{% static 'js/components/message.js' %}"></script>
<script defer src="{% static 'js/libs/CryptoJS.js' %}"></script>
<script defer src="{% static 'js/project.js' %}"></script>
{% endcompress %}
{% endblock javascript %}

@ -49,6 +49,11 @@
</header>
<div class="uk-comment-body">
<p>{{ message.content }}</p>
<p id="{{ message.id }}">{{ message.content }}</p>
<script>
window.addEventListener('load', () => {
document.getElementById("{{ message.id }}").innerText = decipher('{{ message.content }}', '{{ message.author.id }}');
});
</script>
</div>
</article>

Loading…
Cancel
Save