|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<title>Сообщения</title> |
|
<style> |
|
.message { padding: 8px; margin: 10px 0; border-radius: 8px; } |
|
.source-user { background-color: #e0f7fa; } |
|
.source-cli { background-color: #dcedc8; } |
|
.source-llm { background-color: #f3e5f5; } |
|
.source-system { background-color: #fff3e0; } |
|
.private::after { content: " 🔒"; } |
|
.from-self::before { content: "🧍 "; } |
|
</style> |
|
</head> |
|
<body> |
|
<div style="margin-bottom: 10px;"> |
|
{% if username %} |
|
Привет, {{ username }} | <a href="/logout">Выход</a> |
|
{% else %} |
|
<a href="/login">Войти</a> | <a href="/register">Регистрация</a> |
|
{% endif %} |
|
</div> |
|
|
|
<h1>Сообщения</h1> |
|
|
|
<form method="post"> |
|
<textarea name="text" rows="3" cols="40" placeholder="Введите сообщение..."></textarea><br> |
|
<button name="hidden" value="false" type="submit">Отправить</button> |
|
<button name="hidden" value="true" type="submit">Отправить приватно</button> |
|
</form> |
|
|
|
<hr> |
|
|
|
<div> |
|
<a href="/messages">📢 Все сообщения</a> | |
|
<a href="/messages?only_personal=true">🙋 Только мои</a> |
|
</div> |
|
|
|
<hr> |
|
|
|
{% for msg in messages %} |
|
<div class="message source-{{ msg.source }} {% if msg.user_did == request.session['did'] %}from-self{% endif %}"> |
|
<div> |
|
<strong>{{ msg.source }}</strong> — {{ msg.timestamp }} |
|
{% if msg.hidden %}<span class="private"></span>{% endif %} |
|
</div> |
|
<div> |
|
от {{ msg.user_did[:10] }}... |
|
{% if msg.username %}({{ msg.username }}){% endif %} |
|
</div> |
|
<div>{{ msg.text }}</div> |
|
</div> |
|
{% endfor %} |
|
</body> |
|
</html> |
|
|