aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-06 16:28:38 +0300
committerGravatar Vitaly Takmazov2018-02-06 17:09:57 +0300
commita2fcaac118db98ddf0b028639f4276f417e45d8f (patch)
tree06946e4a31e18533c521755bb9e114f38bfbc18f /juick-www
parentde2f87cadd8725d3bf23e2a5b7ac4359d7a32a0d (diff)
www: authenticated user receives all ws messages
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/static/scripts.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 22a75fac..25e65731 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -125,18 +125,13 @@ var ws,
pageTitle;
function initWS() {
- var content = document.getElementById('content');
- if (!content) { return; }
- var pageMID = content.getAttribute('data-mid');
- if (!pageMID) { return; }
-
- var url = (window.location.protocol === 'https:' ? 'wss' : 'ws') + ':'
- + (typeof juickDebug !== 'undefined' ?
- '//ws.juick.com/_replies' : ('//ws.juick.com/' + pageMID)),
- hash = document.getElementById('body').getAttribute('data-hash');
-
+ let url = (window.location.protocol === 'https:' ? 'wss' : 'ws') + ':'
+ + '//ws.juick.com/';
+ let hash = document.getElementById('body').getAttribute('data-hash');
if (hash) {
url += '?hash=' + hash;
+ } else {
+ url += pageMID;
}
ws = new WebSocket(url);
@@ -192,6 +187,10 @@ function isTreeMode() {
}
function wsIncomingReply(msg) {
+ let content = document.getElementById('content');
+ if (!content) { return; }
+ let pageMID = content.getAttribute('data-mid');
+ if (!pageMID || pageMID != msg.mid) { return; }
let msgNum = '/' + msg.rid;
if (msg.replyto > 0) {
msgNum += ` ${i18n('message.inReplyTo')} <a href="#${msg.replyto}">/${msg.replyto}</a>`;