From 85cf7cc2a622a6c241a8d6691e2e03d89e0ad5ee Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 22 Mar 2022 16:26:42 +0200 Subject: [PATCH] fsd --- files/routes/chat.py | 7 ++++--- files/templates/chat.html | 13 +++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/files/routes/chat.py b/files/routes/chat.py index ff7a2bec4..276bd2baf 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -25,14 +25,15 @@ if "load_chat" in sys.argv: @auth_required def speak(data, v): global messages - data = data[:1000].strip() - if not data: abort(403) + text = data[:1000].strip() + if not text: abort(403) data={ "avatar": v.profile_url, "username":v.username, "namecolor":v.namecolor, - "text":sanitize(data), + "text":text, + "text_html":sanitize(text), } messages.append(data) diff --git a/files/templates/chat.html b/files/templates/chat.html index f6db9a1b4..fce829efc 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -47,7 +47,12 @@ {{m['username']}}
- {{m['text'] | safe}} + {% set text=m['text'] %} + {{m['text_html'] | safe}} + +
@@ -146,7 +151,7 @@ socket.on('speak', function(json) { - let text = json['text'] + let text = json['text_html'] if (text.includes('')){ chatline.classList.add('chat-mention'); @@ -184,6 +189,10 @@ } } + function quote(text) { + textbox.value = text + '\n' + textbox.focus() + } textbox.addEventListener("keyup", function(e) { if (!e.shiftKey && e.key === 'Enter') {