Skip to content

Commit 362d612

Browse files
Add Portal link to all pages
1 parent f3fa1d4 commit 362d612

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

public/config.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,24 @@
139139
command.send(null);
140140
}
141141

142+
function relayShowStatus (response) {
143+
document.getElementById('portal').href = 'http://'+response.proxy+'/index.html';
144+
}
145+
146+
function relayStatus () {
147+
var command = new XMLHttpRequest();
148+
command.open("GET", "/relays/status");
149+
command.onreadystatechange = function () {
150+
if (command.readyState === 4 && command.status === 200) {
151+
relayShowStatus (JSON.parse(command.responseText));
152+
}
153+
}
154+
command.send(null);
155+
}
156+
142157
window.onload = function() {
143158
relayConfig();
159+
relayStatus();
144160
};
145161
</script>
146162
<head>
@@ -151,6 +167,7 @@
151167
<tr><td>
152168
<table class="housetop">
153169
<tr>
170+
<td><a id="portal" href="/index.html">Portal</a></td>
154171
<td><a href="/relays/index.html">Relays</a></td>
155172
<td><a href="/relays/events.html">Events</a></td>
156173
<td><span>Config</span></td>

public/events.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
<head>
44
<link rel=stylesheet type="text/css" href="/house.css" title="House">
55
<script>
6+
function relayShowStatus (response) {
7+
document.getElementById('portal').href = 'http://'+response.proxy+'/index.html';
8+
}
9+
10+
function relayStatus () {
11+
var command = new XMLHttpRequest();
12+
command.open("GET", "/relays/status");
13+
command.onreadystatechange = function () {
14+
if (command.readyState === 4 && command.status === 200) {
15+
relayShowStatus (JSON.parse(command.responseText));
16+
}
17+
}
18+
command.send(null);
19+
}
620
window.onload = function() {
721

822
function newColumn (text) {
@@ -71,6 +85,7 @@
7185

7286
updateEvents();
7387
setInterval (function() {checkEvents()}, 1000);
88+
relayStatus();
7489
}
7590
</script>
7691
<head>
@@ -81,6 +96,7 @@
8196
<tr><td>
8297
<table class="housetop">
8398
<tr>
99+
<td><a id="portal" href="/index.html">Portal</a></td>
84100
<td><a href="/relays/index.html">Relays</a></td>
85101
<td><span>Events</span></td>
86102
<td><a href="/relays/config.html">Config</a></td>

0 commit comments

Comments
 (0)