mirror of
https://github.com/ShaYmez/HBMonv2.git
synced 2025-03-04 02:18:49 -05:00
SSL and nonSSL at the same time.
Add the possibility of using SSL and non-SSL connections to HBMon. Please adjust the network ports (according to your needs) both in monitor.py and hbmon.js
This commit is contained in:
parent
9922d3dd74
commit
15a966ad5e
@ -12,7 +12,13 @@
|
||||
opb_table = document.getElementById('opb');
|
||||
peers_table = document.getElementById('peers');
|
||||
|
||||
wsuri = (((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.hostname + ":9000");
|
||||
// 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");
|
||||
}
|
||||
|
||||
if ("WebSocket" in window) {
|
||||
sock = new WebSocket(wsuri);
|
||||
|
10
monitor.py
10
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
|
||||
from twisted.internet import reactor, task, ssl
|
||||
|
||||
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://*:9000')
|
||||
#dashboard_server.protocol = dashboard
|
||||
#reactor.listenSSL(9000, 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://*:9001')
|
||||
dashboard_server.protocol = dashboard
|
||||
reactor.listenSSL(9001, dashboard_server,certificate)
|
||||
|
||||
# Create websocket server to push content to clients via http:// non SSL
|
||||
dashboard_server = dashboardFactory('ws://*:9000')
|
||||
|
Loading…
Reference in New Issue
Block a user