| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Сообщения</title> |
| <style> |
| .message { padding: 16px; margin: 16px 0; border-radius: 8px; border: 5px solid rgba(0, 0, 0, 0.3); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); } |
| .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: "🧍 "; } |
| pre.code-block { |
| background-color: #f0f0f0; |
| padding: 10px; |
| border-radius: 6px; |
| overflow-x: auto; |
| } |
| </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" enctype="multipart/form-data"> |
| <textarea name="text" rows="3" cols="60" placeholder="Введите сообщение..."></textarea><br> |
| <textarea name="code" rows="6" cols="60" placeholder="Прикрепите код (опционально)..."></textarea><br> |
| <label>Файлы: <input type="file" name="binary_files" multiple></label><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 }}"> |
| <div> |
| {% if msg.user_did == request.session['did'] %}<span class="from-self" title="это ваше сообщение"></span>{% endif %} |
| {% if msg.hidden %}<span class="private" title="личное сообщение"></span>{% endif %} |
| Источник: <i>{{ msg.source }}</i> — {{ msg.timestamp | format_timestamp }} |
| </div> |
| <div> |
| {% if msg.badges %}{{ msg.badges }}{% endif %}Пользователь: {% if msg.username %}<b>{{ msg.username }}</b>{% endif %} {% if msg.user_did %}({{ msg.user_did }}){% endif %} |
| </div> |
| <hr> |
| <div>{{ msg.text|safe }}</div> |
|
|
| {% if msg.code %} |
| <hr> |
| <div><b>Код:</b></div> |
| <pre class="code-block">{{ msg.code }}</pre> |
| {% endif %} |
|
|
| {% if msg.attachments %} |
| <hr> |
| <div><b>Файлы:</b></div> |
| <ul> |
| {% for file in msg.attachments %} |
| <li><a href="/download/{{ file.id }}">{{ file.filename }}</a> ({{ file.size }} байт)</li> |
| {% endfor %} |
| </ul> |
| {% endif %} |
| </div> |
| {% endfor %} |
| </body> |
| </html> |
|
|