mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-05 09:25:37 -05:00
89b112ea95
- Refactors server side code to use instance variable instead of background thread to generate a list of connected users - Send this user list anytime any change is made to the list. It can be: join, update username, disconnect - In js, render the entire user list everytime it is received. - Scroll to the bottom of the chat, everytime the current user sends a message - Else, if already at the bottom of the chat, scroll to the bottom after appending incoming status or chat message. But if the user is scrolled up in the chat window, then do not scroll to the bottom - When refreshed or close tab is clicked, default browser warning is shown. - On receiving disconnect, the browser removes user from room. - If refreshed, it is shown as if the user left and joined again.
53 lines
1.7 KiB
HTML
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">
|
|
<div class="editable-username">
|
|
<input id="username" value="{{ username }}" />
|
|
<button id="update-username">Save</button>
|
|
</div>
|
|
<ul id="user-list">
|
|
</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>
|