Moved statuspage from proxy to gatekeeper and refactored correctly

This commit is contained in:
kexkey
2018-12-15 15:01:45 -05:00
parent 57f2217abb
commit 7db08bf43f
8 changed files with 59 additions and 33 deletions

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
trace=true;
function log() {
if (trace) {
console.log(arguments.callee.caller.name, arguments.callee.caller.arguments);
}
}
function httpget(url) {
log();
return fetch(url, { method: "GET" })
.catch(err => {
console.log('HTTP GET Error: ' + err.message + ' :: STACK : ' + err.stack);
$("#result").text((JSON.stringify(err.message)));
return Promise.reject(err.message);
})
.then(res => {
if (!res.ok) {
return res.json().then(data => {
console.log('HTTP GET Error: ' + data.error.message);
$("#result").text(JSON.stringify(data.error.message));
return Promise.reject(data.error.message);
});
}
return res.json();
})
.then(data => Promise.resolve(JSON.stringify(data)))
}
function installation_status() {
log();
httpget("installation.json")
.then(result => {
$("#result").text(result);
});
}
</script>
</head>
<body>
<button onclick="installation_status();">Installation Status</button>
<p/>
<pre lang="xml" id="result" style="white-space: pre-wrap"></pre>
</body>
</html>