|
|
@@ -116,63 +116,4 @@
|
|
|
|
|
|
</script>
|
|
|
</body>
|
|
|
-
|
|
|
- <script>
|
|
|
- function reload() {
|
|
|
- // document.getElementById('log').innerHTML += "<br><b>Reloading...<b><br><br>";
|
|
|
- document.getElementById('log').innerHTML += "<b>Reloading...</b>";
|
|
|
- window.scrollBy(0,document.body.scrollHeight);
|
|
|
- funcRequest(getDomainname() + '/log');
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- function processLogLine(line, index, arr) {
|
|
|
- /* Make sure the whitespaces in the uptime field get persevered */
|
|
|
- uptimePart = line.slice(0, line.indexOf("]")).replace(/ /g, " ");
|
|
|
- line = uptimePart + line.slice(line.indexOf("]"))
|
|
|
-
|
|
|
- if (line.includes("<WRN>")) {
|
|
|
- arr[index] = "<span style=\"color:#e83c00\">" + line + "</span>";
|
|
|
- }
|
|
|
- else if (line.includes("<ERR>")) {
|
|
|
- arr[index] = "<span style=\"color:red\"><b>" + line + "</b></span>";
|
|
|
- }
|
|
|
- else if (line.includes("<DBG>")) {
|
|
|
- arr[index] = "<span style=\"color:gray\">" + line + "</span>";
|
|
|
- }
|
|
|
- else {
|
|
|
- arr[index] = line;
|
|
|
- }
|
|
|
-
|
|
|
- arr[index] += "<br>";
|
|
|
- }
|
|
|
-
|
|
|
- async function funcRequest(url){
|
|
|
- await fetch(url)
|
|
|
- .then((res) => {
|
|
|
- if (!res.ok) {
|
|
|
- document.getElementById("log").innerHTML = "HTTP error " + res.status;
|
|
|
- }
|
|
|
-
|
|
|
- return res.text();
|
|
|
- })
|
|
|
- .then((log) => {
|
|
|
- log = log.replace(/</g, "<");
|
|
|
- log = log.replace(/>/g, ">");
|
|
|
- logArr = log.split("\n");
|
|
|
- logArr.forEach(processLogLine);
|
|
|
-
|
|
|
- document.getElementById('log').innerHTML = "<br>" + logArr.join("\n") + " ";
|
|
|
-
|
|
|
- window.scrollBy(0,document.body.scrollHeight);
|
|
|
-
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- document.getElementById("log").innerHTML = err;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- funcRequest(getDomainname() + '/log');
|
|
|
-
|
|
|
- </script>
|
|
|
</html>
|