remotes/1693045480750635534/spooky-22
Aevann1 2022-03-22 16:26:42 +02:00
parent b6e76a7a0b
commit 85cf7cc2a6
2 changed files with 15 additions and 5 deletions

View File

@ -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)

View File

@ -47,7 +47,12 @@
<img src="{{m['avatar']}}" class="mobile-avatar profile-pic-30 mr-1 d-inline-block d-md-none" data-toggle="tooltip" data-placement="right">
<a class="font-weight-bold text-black userlink" style="color:#{{m['namecolor']}}" target="_blank" href="/@{{m['username']}}">{{m['username']}}</a>
<div style="overflow:hidden">
<span class="chat-message text-black text-break">{{m['text'] | safe}}</span>
{% set text=m['text'] %}
<span class="chat-message text-black text-break">{{m['text_html'] | safe}}
<button onclick="quote('{{text}}')">
<i class="fas fa-reply" aria-hidden="true"></i>
</button>
</span>
</div>
</div>
</div>
@ -146,7 +151,7 @@
socket.on('speak', function(json) {
let text = json['text']
let text = json['text_html']
if (text.includes('<a href="/id/{{v.id}}">')){
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') {