-
Notifications
You must be signed in to change notification settings - Fork 1
/
health.html
116 lines (112 loc) · 3.94 KB
/
health.html
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<title>Health | gnaw</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<meta name="background-color" content="#010409">
<meta name="theme-color" content="#0d1117">
<link rel="icon" sizes="512x512" href="images/icon.png">
<link rel="icon" sizes="64x64" href="images/icon64.png">
<link rel="manifest" href="manifest.webmanifest">
<link rel="stylesheet" href="styles.css">
<script src="theme.js"></script>
<script>
window.addEventListener("load", function() {
fetchHealth();
});
function fetchHealth() {
fetch('https://corsproxy.io/?https://api.scratch.mit.edu/health').then(response => response.json()).then(data => {
var healthContainer = document.getElementById('health-container');
var healthHTML = '';
healthHTML += `<button id="expand-button" class="btn" onclick="toggleHealth()">+</button>`;
healthHTML += `<div id="health-details" style="display: none;">`;
healthHTML += `<p>Version: ${data.version}</p>`;
healthHTML += `<p>Uptime: ${data.uptime}</p>`;
healthHTML += `<p>Load: ${data.load.join(', ')}</p>`;
healthHTML += `<h3>SQL</h3>`;
for(var key in data.sql) {
healthHTML += `<h4>${key}</h4>`;
for(var type in data.sql[key]) {
healthHTML += `<h5>${type}</h5>`;
var sqlData = data.sql[key][type];
for(var property in sqlData) {
healthHTML += `<p>${property}: ${sqlData[property]}</p>`;
}
}
}
healthHTML += `</div>`;
healthContainer.innerHTML = healthHTML;
}).catch(error => {
console.error('Error:', error);
});
}
function toggleHealth() {
var healthDetails = document.getElementById('health-details');
var expandButton = document.getElementById('expand-button');
if(healthDetails.style.display === 'none') {
healthDetails.style.display = 'block';
expandButton.textContent = '-';
}
else {
healthDetails.style.display = 'none';
expandButton.textContent = '+';
}
}
function goBack() {
history.back();
}
function goToSearchPage() {
var url = 'index.html';
window.location.href = url;
}
</script>
</head>
<body>
<div class="nav">
<div class="inner-nav">
<div class="nav-item">
<a class="icon desktop" href="index.html">gnaw</a>
<a class="icon mobile" href="index.html">g</a>
</div>
<div class="nav-item desktop" style="justify-content: right;">
<a class="icon desktop nvl" href="explore.html">Explore</a>
<a class="icon desktop nvl" href="featured.html">Featured</a>
</div>
</div>
</div>
<div class="page">
<div class="header">
<h2>Health</h2>
</div>
<div class="read">
<div><img src="images/server.gif" alt="server cat"width="100px"></div>
</div>
<div class="header">
<h2>Scratch Health</h2>
</div>
<div class="read">
<div id="health-container"></div>
</div>
<div class="about">
<div id="about">
<a href="index.html" style="font-weight: bold; ">gnaw</a> / <a href="https://discord.com/users/797570703419244594">discord</a> / <a href="mailto:[email protected]">email me</a> / <a href="profile.html?username=3r1s_s">profile</a> / <a href="https://github.com/3r1s-s">github</a> / <a href="health.html">health</a> / <a href="about.html">about</a> / <a href="settings.html">settings</a> /
</div>
</div>
<div class="mobile-nav">
<div class="mobile-nav-item">
<a href="index.html"><i class="material-symbols-outlined">home</i></a>
</div>
<div class="mobile-nav-item">
<a href="featured.html"><i class="material-symbols-outlined">star</i></a>
</div>
<div class="mobile-nav-item">
<a href="explore.html"><i class="material-symbols-outlined">globe</i></a>
</div>
<div class="mobile-nav-item">
<a href="settings.html"><i class="material-symbols-outlined">settings</i></a>
</div>
</div>
</div>
</body>
</html>