-
Notifications
You must be signed in to change notification settings - Fork 1
/
aida64.html
193 lines (163 loc) · 4.4 KB
/
aida64.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background-color: #000;
margin: 0;
padding: 0;
}
#panel {
background-image: url("bg.jpg");
width: 1024px;
height: 600px;
}
#panel>span {
display: block;
position: absolute;
}
.circle {
text-align: center;
width: 134px;
line-height: 134px;
font-size: 50px;
font-weight: bold;
}
#SCPUUTI {
left: 180px;
top: 104px;
}
#TCPU {
left: 330px;
top: 104px;
}
#SGPU1UTI {
left: 684px;
top: 104px;
}
#TGPU1DIOD {
left: 834px;
top: 104px;
}
#SMEMUTI {
left: 684px;
top: 376px;
}
#SNIC4ULRATE {
left: 900px;
top: 485px;
width: 96px;
text-align: right;
}
#SNIC4DLRATE {
left: 900px;
top: 545px;
width: 96px;
text-align: right;
}
#THDD1 {
left: 175px;
top: 308px;
width: 295px;
line-height: 58px;
text-align: right;
}
#FCPU {
left: 175px;
top: 445px;
width: 295px;
line-height: 58px;
text-align: right;
}
#FGPU1 {
left: 175px;
top: 470px;
width: 295px;
line-height: 58px;
text-align: right;
}
#FCHA {
left: 175px;
top: 495px;
width: 295px;
line-height: 58px;
text-align: right;
}
</style>
</head>
<body>
<div id="panel">
<span id="SCPUUTI" class="circle" unit=""></span>
<span id="TCPU" class="circle" unit=""></span>
<span id="SGPU1UTI" class="circle" unit=""></span>
<span id="TGPU1DIOD" class="circle" unit=""></span>
<span id="SMEMUTI" class="circle" unit=""></span>
<span id="SNIC4ULRATE" class="" unit="KB/s"></span>
<span id="SNIC4DLRATE" class="" unit="KB/s"></span>
<span id="THDD1" class="label" unit="℃"></span>
<!-- <span id="THDD3" class="center"></span>
<span id="THDD3TS2" class="center"></span> -->
<span id="FCPU" class="label" unit="RPM"></span>
<span id="FGPU1" class="label" unit="RPM"></span>
<span id="FCHA" class="label" unit="RPM"></span>
</div>
<script>
const apiHost = '192.168.6.91:5550';
const sensors = Array.from(document.querySelectorAll('#panel span')).map(el => ({ el, id: el.id }));
function apiCallback(data) {
console.log('data', JSON.stringify(data));
for (let i in sensors) {
const sensor = sensors[i];
const element = sensor.el;
const item = data[i];
let html = item.value;
if (element.classList.contains('label')) html = `${item.label} ${item.value}`;
if (element.hasAttribute('unit')) html += ' ' + element.getAttribute('unit');
element.innerHTML = html
}
}
if (window.EventSource) {
const parseData = function (rawData) {
const data = rawData.split('{|}').slice(1).map((s, i) => {
const line = s.slice(s.indexOf('|') + 1);
const gapIndex = line.lastIndexOf(' ');
const label = line.slice(0, gapIndex);
const value = line.slice(gapIndex + 1);
return { label, value };
});
apiCallback(data);
};
const source = new EventSource(`http://${apiHost}/sse`);
source.addEventListener('message', e => parseData(e.data));
source.addEventListener('slide', e => console.log('slide', e.data), false);
source.addEventListener('error', e => console.log('error', e.target.readyState), false);
} else {
function fetchJsonp() {
const script = document.createElement('script');
const nonce = Date.now().toString();
const func = 'callback' + nonce;
window[func] = apiCallback;
script.src = `http://${apiHost}/api?nonce=${nonce}&callback=${func}&sensors=${sensors.map(s => s.id).join(',')}`;
document.body.appendChild(script);
script.onload = e => {
e.currentTarget.remove();
delete window[func];
};
script.onerror = e => {
e.currentTarget.remove();
delete window[func];
};
setTimeout(fetchJsonp, 3000);
}
fetchJsonp();
}
</script>
</body>
</html>
Page0|{|}Simple1|CPU Utilization 2%{|}Simple2|CPU 41C{|}Simple3|GPU Utilization 0%{|}Simple4|GPU Diode (DispIO)
43C{|}Simple5|Memory Utilization 19%{|}Simple6|NIC4 Upload Rate 0.2 KB/s{|}Simple7|NIC4 Download Rate 0.9
KB/s{|}Simple8|Samsung SSD 850 EVO 250GB 43癈{|}Simple9|CPU 986 RPM{|}Simple10|GPU 1611 RPM{|}Simple11|Chassis 1000
RPM{|}