onionshare/share/templates/chat.html
Saptak S c63a7605ee
Adds list of active users in the chat and allows username change
- allows users to update their username and save the new username
- runs a background thread for every user session which emits a
broadcast with the username so every user can build their list of
active users in the frontend via the socket information
- on updating username, stop the old thread and start a new thread
with the new username being emitted. The username is updated in
everyone's list along with a status message for the same.
2020-03-12 14:54:48 +05:30

53 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>OnionShare</title>
<link href="{{ static_url_path }}/img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="stylesheet" rel="subresource" type="text/css" href="{{ static_url_path }}/css/style.css" media="all">
</head>
<body>
<header class="clearfix">
<img class="logo" src="{{ static_url_path }}/img/logo.png" title="OnionShare">
<h1>OnionShare</h1>
</header>
<div>
<ul id="flashes" class="flashes">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<li class="{{ category }}">{{ message }}</li>
{% endfor %}
{% endif %}
{% endwith %}
</ul>
</div>
<div class="chat-container">
<div class="chat-users">
<ul id="user-list">
<li class="editable-username">
<input id="username" value="{{ username }}" />
<button id="update-username">Save</button>
</li>
</ul>
</div>
<div class="chat-wrapper">
<p class="chat-header">Chat Messages</p>
<div id="chat"></div>
<div class="chat-form">
<p><input type="text" id="new-message" name="new-message" placeholder="Type your message"/></p>
<p><button type="button" id="send-button" class="button">Send Message</button></p>
</div>
</div>
</div>
<script src="{{ static_url_path }}/js/jquery-3.4.0.min.js"></script>
<script src="{{ static_url_path }}/js/socket.io.min.js"></script>
<script async src="{{ static_url_path }}/js/chat.js"></script>
</body>
</html>