Compare commits
No commits in common. "3543ef28245c3c7e6339fe045e3d5a0ede9896fd" and "dc9fde39beccdeffa3f4c395b14721683ff9960f" have entirely different histories.
3543ef2824
...
dc9fde39be
|
@ -43,6 +43,3 @@ yaml-rust = "0.4" #only in debug mode
|
|||
html-minifier = "3.0"
|
||||
yaml-rust = "0.4"
|
||||
linked-hash-map = "0.5"
|
||||
|
||||
[profile.dev.package.scrypt]
|
||||
opt-level = 3
|
||||
|
|
|
@ -255,8 +255,7 @@ button:hover::after {
|
|||
#left_panel ul li.is_verified p::after {
|
||||
content: url("/static/imgs/icons/verified/ACCENT_COLOR");
|
||||
}
|
||||
#left_panel ul li.not_seen::after {
|
||||
content: "";
|
||||
#left_panel ul li .not_seen_marker {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background-color: var(--accent);
|
||||
|
@ -356,6 +355,7 @@ button:hover::after {
|
|||
}
|
||||
#file_transfer {
|
||||
border-top: 2px solid var(--accent);
|
||||
display: none;
|
||||
position: relative;
|
||||
}
|
||||
#file_transfer.active {
|
||||
|
@ -407,7 +407,7 @@ button:hover::after {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
#msg_log {
|
||||
overflow-y: auto;
|
||||
overflow-y: scroll;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
#msg_log p {
|
||||
|
@ -453,19 +453,6 @@ button:hover::after {
|
|||
width: 2em;
|
||||
margin-left: 15px;
|
||||
}
|
||||
#message_box, #chat_header, #msg_log, #file_transfer {
|
||||
#message_box, #chat_header, #msg_log {
|
||||
display: none;
|
||||
}
|
||||
#disconnected {
|
||||
display: none;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#disconnected.disconnected {
|
||||
display: flex;
|
||||
}
|
||||
#disconnected img {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
}
|
|
@ -61,10 +61,6 @@
|
|||
<input type="file" id="attach_file" multiple>
|
||||
</label>
|
||||
</div>
|
||||
<div id="disconnected">
|
||||
<img src="/static/imgs/icons/warning/ff0000">
|
||||
<h1>Websocket connection closed</h1>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
let identityName = undefined;
|
||||
let socket = new WebSocket("ws://"+location.hostname+":"+websocketPort+"/ws");;
|
||||
let socket = null;
|
||||
let notificationAllowed = false;
|
||||
let localIps = [];
|
||||
let currentSessionId = -1;
|
||||
|
@ -14,7 +14,7 @@ let avatarTimestamps = new Map([
|
|||
|
||||
function onClickSession(event) {
|
||||
let sessionId = event.currentTarget.getAttribute("data-sessionId");
|
||||
if (sessionId != null && socket.readyState === WebSocket.OPEN) {
|
||||
if (sessionId != null) {
|
||||
currentSessionId = sessionId;
|
||||
let session = sessionsData.get(sessionId);
|
||||
if (!session.seen) {
|
||||
|
@ -437,6 +437,7 @@ function getCookie(cname) {
|
|||
return "";
|
||||
}
|
||||
|
||||
socket = new WebSocket("ws://"+location.hostname+":"+websocketPort+"/ws");
|
||||
socket.onopen = function() {
|
||||
console.log("Connected");
|
||||
socket.send(getCookie("aira_auth")); //authenticating websocket connection
|
||||
|
@ -518,12 +519,6 @@ socket.onmessage = function(msg) {
|
|||
};
|
||||
socket.onclose = function() {
|
||||
console.log("Disconnected");
|
||||
currentSessionId = -1;
|
||||
displayHistory();
|
||||
displayHeader();
|
||||
displayChatBottom();
|
||||
displaySessions();
|
||||
document.getElementById("disconnected").classList.add("disconnected");
|
||||
};
|
||||
|
||||
function onNewSession(sessionId, outgoing, fingerprint, ip, name) {
|
||||
|
@ -1007,7 +1002,9 @@ function generateSession(sessionId, session) {
|
|||
li.classList.add("is_verified");
|
||||
}
|
||||
if (!session.seen) {
|
||||
li.classList.add("not_seen");
|
||||
let marker = document.createElement("div");
|
||||
marker.classList.add("not_seen_marker");
|
||||
li.appendChild(marker);
|
||||
}
|
||||
if (sessionId == currentSessionId) {
|
||||
li.classList.add("current");
|
||||
|
@ -1133,34 +1130,32 @@ function displayChatBottom(speed = undefined) {
|
|||
}
|
||||
}
|
||||
function displayHistory(scrollToBottom = true) {
|
||||
msg_log.style.display = "block";
|
||||
msg_log.innerHTML = "";
|
||||
let session = sessionsData.get(currentSessionId);
|
||||
if (typeof session === "undefined") {
|
||||
msg_log.style.display = "none";
|
||||
} else {
|
||||
msg_log.style.display = "block";
|
||||
let previousOutgoing = undefined;
|
||||
msgHistory.get(currentSessionId).forEach(entry => {
|
||||
let name = undefined;
|
||||
let sessionId = undefined;
|
||||
if (previousOutgoing != entry[0]) {
|
||||
previousOutgoing = entry[0];
|
||||
if (entry[0]) { //outgoing msg
|
||||
name = identityName;
|
||||
} else {
|
||||
name = session.name;
|
||||
sessionId = currentSessionId;
|
||||
}
|
||||
}
|
||||
if (entry[1]) { //is file
|
||||
msg_log.appendChild(generateFile(name, sessionId, entry[0], entry[2]));
|
||||
let previousOutgoing = undefined;
|
||||
msgHistory.get(currentSessionId).forEach(entry => {
|
||||
let name = undefined;
|
||||
let sessionId = undefined;
|
||||
if (previousOutgoing != entry[0]) {
|
||||
previousOutgoing = entry[0];
|
||||
if (entry[0]) { //outgoing msg
|
||||
name = identityName;
|
||||
} else {
|
||||
msg_log.appendChild(generateMessage(name, sessionId, entry[2]));
|
||||
name = session.name;
|
||||
sessionId = currentSessionId;
|
||||
}
|
||||
});
|
||||
if (scrollToBottom) {
|
||||
msg_log.scrollTop = msg_log.scrollHeight;
|
||||
}
|
||||
if (entry[1]) { //is file
|
||||
msg_log.appendChild(generateFile(name, sessionId, entry[0], entry[2]));
|
||||
} else {
|
||||
msg_log.appendChild(generateMessage(name, sessionId, entry[2]));
|
||||
}
|
||||
});
|
||||
if (scrollToBottom) {
|
||||
msg_log.scrollTop = msg_log.scrollHeight;
|
||||
}
|
||||
if (typeof session !== "undefined") {
|
||||
if (msg_log.scrollHeight <= msg_log.clientHeight && session.isContact) {
|
||||
socket.send("load_msgs "+currentSessionId);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue