-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
98 lines (87 loc) · 2.44 KB
/
index.html
File metadata and controls
98 lines (87 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Status Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
color: #333;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
text-align: center;
}
h1 {
color: #4CAF50;
margin-bottom: 20px;
font-size: 2rem;
}
#status {
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
font-size: 1.2rem;
color: #333;
display: inline-block;
min-width: 200px;
}
/* Status messages */
.online {
color: green;
}
.offline {
color: red;
}
.loading {
color: orange;
}
/* Responsive styling */
@media (max-width: 600px) {
h1 {
font-size: 1.5rem;
}
#status {
min-width: 150px;
font-size: 1rem;
}
}
</style>
</head>
<body>
<div>
<h1>Server Status</h1>
<div id="status" class="loading">Loading...</div>
</div>
<script>
async function updateStatus() {
try {
const response = await fetch("/status");
const data = await response.text();
const statusElement = document.getElementById("status");
statusElement.innerHTML = data;
// Update status color
if (data.toLowerCase().includes("error")) {
statusElement.className = "offline";
} else if (data.toLowerCase().includes("success")) {
statusElement.className = "online";
} else {
statusElement.className = "loading";
}
} catch (error) {
console.error("Error fetching status:", error);
document.getElementById("status").innerHTML = "Error fetching status";
document.getElementById("status").className = "offline";
}
}
setInterval(updateStatus, 200); // Fetch every 200ms
updateStatus(); // Initial fetch
</script>
</body>
</html>