From aa8472994dce3661a66ea487311b7c2e97cdf550 Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Fri, 21 May 2021 14:05:13 +0300 Subject: [PATCH] Revert "SSL and nonSSL at the same time." This reverts commit 15a966ad5e14052d92b6ef870fd5f1c16e61dd01. --- html/scripts/hbmon.js | 12 +++--------- monitor.py | 10 +++++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/html/scripts/hbmon.js b/html/scripts/hbmon.js index ba03d91..3dc2d50 100644 --- a/html/scripts/hbmon.js +++ b/html/scripts/hbmon.js @@ -11,15 +11,9 @@ masters_table = document.getElementById('masters'); opb_table = document.getElementById('opb'); peers_table = document.getElementById('peers'); - -// Use both https and http protocols - if (window.location.protocol != "https:") { - wsuri = "ws://" + window.location.hostname + ":9000"; - } - else { - wsuri = (((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.hostname + ":9001"); - } - + + wsuri = (((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.hostname + ":9000"); + if ("WebSocket" in window) { sock = new WebSocket(wsuri); } else if ("MozWebSocket" in window) { diff --git a/monitor.py b/monitor.py index 3b5c7d3..33ca53f 100644 --- a/monitor.py +++ b/monitor.py @@ -40,7 +40,7 @@ from subprocess import check_call, CalledProcessError # Twisted modules from twisted.internet.protocol import ReconnectingClientFactory, Protocol from twisted.protocols.basic import NetstringReceiver -from twisted.internet import reactor, task, ssl +from twisted.internet import reactor, task import base64 @@ -1012,10 +1012,10 @@ if __name__ == '__main__': # and add load ssl module in line number 43: from twisted.internet import reactor, task, ssl # # put certificate https://letsencrypt.org/ used in apache server - certificate = ssl.DefaultOpenSSLContextFactory('/etc/letsencrypt/live/hbmon.dmrserver.org/privkey.pem', '/etc/letsencrypt/live/hbmon.dmrserver.org/cert.pem') - dashboard_server = dashboardFactory('wss://*:9001') - dashboard_server.protocol = dashboard - reactor.listenSSL(9001, dashboard_server,certificate) + #certificate = ssl.DefaultOpenSSLContextFactory('/etc/letsencrypt/live/hbmon.dmrserver.org/privkey.pem', '/etc/letsencrypt/live/hbmon.dmrserver.org/cert.pem') + #dashboard_server = dashboardFactory('wss://*:9000') + #dashboard_server.protocol = dashboard + #reactor.listenSSL(9000, dashboard_server,certificate) # Create websocket server to push content to clients via http:// non SSL dashboard_server = dashboardFactory('ws://*:9000')