mirror of
https://github.com/ShaYmez/HBMonv2.git
synced 2025-09-05 06:37:52 -04:00
fixed bridges display
This commit is contained in:
parent
3043844741
commit
e3441cb703
14
monitor.py
14
monitor.py
@ -519,7 +519,7 @@ def build_stats():
|
|||||||
if URL_PATH == "sinfo":
|
if URL_PATH == "sinfo":
|
||||||
sinfo = 's'+ stemplate.render(themec=THEME_COLOR,auth=WEB_AUTH)
|
sinfo = 's'+ stemplate.render(themec=THEME_COLOR,auth=WEB_AUTH)
|
||||||
dashboard_server.broadcast(sinfo)
|
dashboard_server.broadcast(sinfo)
|
||||||
if BRIDGES and BRIDGES_INC and BTABLE['SETUP']['BRIDGES']:
|
if URL_PATH == "bridges" and BRIDGES and BRIDGES_INC and BTABLE['SETUP']['BRIDGES']:
|
||||||
bridges = 'b' + btemplate.render(_table=BTABLE,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)
|
bridges = 'b' + btemplate.render(_table=BTABLE,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)
|
||||||
dashboard_server.broadcast(bridges)
|
dashboard_server.broadcast(bridges)
|
||||||
build_time = now
|
build_time = now
|
||||||
@ -791,7 +791,7 @@ class dashboard(WebSocketServerProtocol):
|
|||||||
self.sendMessage(('o' + otemplate.render(_table=CTABLE,themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
self.sendMessage(('o' + otemplate.render(_table=CTABLE,themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
||||||
if URL_PATH == "main":
|
if URL_PATH == "main":
|
||||||
self.sendMessage(('i' + itemplate.render(_table=CTABLE,themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
self.sendMessage(('i' + itemplate.render(_table=CTABLE,themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
||||||
if URL_PATH == "bridge":
|
if URL_PATH == "bridges":
|
||||||
self.sendMessage(('b' + btemplate.render(_table=BTABLE,themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
self.sendMessage(('b' + btemplate.render(_table=BTABLE,themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
||||||
if URL_PATH == "moni":
|
if URL_PATH == "moni":
|
||||||
self.sendMessage(('m' + mtemplate.render(themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
self.sendMessage(('m' + mtemplate.render(themec=THEME_COLOR,dbridges=BTABLE['SETUP']['BRIDGES'],auth=WEB_AUTH)).encode('utf-8'))
|
||||||
@ -853,7 +853,7 @@ class web_server(Resource):
|
|||||||
def render_GET(self, request):
|
def render_GET(self, request):
|
||||||
global BRIDGES_INC, URL_PATH
|
global BRIDGES_INC, URL_PATH
|
||||||
logging.info('static website requested: %s', request)
|
logging.info('static website requested: %s', request)
|
||||||
if WEB_AUTH and (request.uri == b'/masters' or request.uri == b'/peers' or request.uri == b'/opb' or request.uri == b'/moni' or request.uri == b'/bridges' or request.uri == b'/sinfo'):
|
if WEB_AUTH and (request.uri == b'/masters' or request.uri == b'/peers' or request.uri == b'/opb' or request.uri == b'/moni' or request.uri == b'/bridge' or request.uri == b'/sinfo'):
|
||||||
user = WEB_USER.encode('utf-8')
|
user = WEB_USER.encode('utf-8')
|
||||||
password = WEB_PASS.encode('utf-8')
|
password = WEB_PASS.encode('utf-8')
|
||||||
auth = request.getHeader('Authorization')
|
auth = request.getHeader('Authorization')
|
||||||
@ -861,8 +861,8 @@ class web_server(Resource):
|
|||||||
decodeddata = base64.b64decode(auth.split(' ')[1])
|
decodeddata = base64.b64decode(auth.split(' ')[1])
|
||||||
if decodeddata.split(b':') == [user, password]:
|
if decodeddata.split(b':') == [user, password]:
|
||||||
logging.info('Authorization OK')
|
logging.info('Authorization OK')
|
||||||
if request.uri == b'/bridges' and BRIDGES_INC:
|
if request.uri == b'/bridges':
|
||||||
URL_PATH = "bridge"
|
URL_PATH = "bridges"
|
||||||
BRIDGES_INC = True
|
BRIDGES_INC = True
|
||||||
return (bridges_html).encode('utf-8')
|
return (bridges_html).encode('utf-8')
|
||||||
elif request.uri == b'/':
|
elif request.uri == b'/':
|
||||||
@ -909,8 +909,8 @@ class web_server(Resource):
|
|||||||
BRIDGES_INC = False
|
BRIDGES_INC = False
|
||||||
URL_PATH = "main"
|
URL_PATH = "main"
|
||||||
return (main_html).encode('utf-8')
|
return (main_html).encode('utf-8')
|
||||||
elif request.uri == b'/bridges' and BRIDGES_INC:
|
elif request.uri == b'/bridges':
|
||||||
URL_PATH = "bridge"
|
URL_PATH = "bridges"
|
||||||
BRIDGES_INC = True
|
BRIDGES_INC = True
|
||||||
return (bridges_html).encode('utf-8')
|
return (bridges_html).encode('utf-8')
|
||||||
elif request.uri == b'/masters':
|
elif request.uri == b'/masters':
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
<a href="/masters"> Masters </a>
|
<a href="/masters"> Masters </a>
|
||||||
<a href="/peers"> Peers </a>
|
<a href="/peers"> Peers </a>
|
||||||
<a href="/opb"> OpenBridge </a>
|
<a href="/opb"> OpenBridge </a>
|
||||||
<a href="/moni"> Monitor </a>
|
|
||||||
<a href="/sinfo"> System Info </a>
|
|
||||||
{% if dbridges == True %}
|
{% if dbridges == True %}
|
||||||
<a href="/bridges"> Bridges </a>
|
<a href="/bridges"> Bridges </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<a href="/moni"> Monitor </a>
|
||||||
|
<a href="/sinfo"> System Info </a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -23,6 +23,10 @@
|
|||||||
<a href="/peers"><button class="button link"> Peers </button></a>
|
<a href="/peers"><button class="button link"> Peers </button></a>
|
||||||
|
|
||||||
<a href="/opb"><button class="button link"> OpenBridge </button></a>
|
<a href="/opb"><button class="button link"> OpenBridge </button></a>
|
||||||
|
{% if dbridges == True %}
|
||||||
|
|
||||||
|
<a href="/bridges"><button class="button link"> Bridges </button></a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<a href="/moni"><button class="button link"> Monitor </button></a>
|
<a href="/moni"><button class="button link"> Monitor </button></a>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user