-
Notifications
You must be signed in to change notification settings - Fork 1
/
check.html
68 lines (63 loc) · 3.02 KB
/
check.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
<html>
<head>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<meta charset="UTF-8" />
<script src="https://unpkg.com/react@18.2.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/@babel/standalone@7.24.4/babel.min.js"></script>
<style>
table { border-spacing: 0; }
tbody { font-size: 1.5em; font-weight: bold; }
.on { color: green; }
.off { color: red; }
td { padding: 0.2em; }
thead td { text-align: center; }
tbody > tr > td:nth-child(2) { text-align: center; }
tbody > tr > td:nth-child(3) { text-align: right; }
tbody > tr:nth-child(odd) { background-color: #00000011; }
</style>
</head>
<body>
<div id="main"></div>
<script type="text/babel">
let Component = function (props) {
let [state, setState] = React.useState({});
setTimeout(async () => {
try {
setState((await (await fetch('http://dilesoft.vangers.net:2222')).json()));
} catch {
}
}, 1000);
if (!state) {
return 'Loading...';
}
return <table>
<thead><tr>
<td>Адрес</td>
<td>Поддержка<br/>браузерной<br/>версии</td>
<td colspan="2">Состояние</td>
</tr></thead><tbody>
{Object.keys(state)
.sort((server1, server2) => server1 > server2 ? 1 : -1)
.map((server, index, keys) => {
if (state[server].data.websocket) return null;
const wsServer = keys.find(findServer =>state[findServer].data.websocket && state[findServer].data.host === state[server].data.host && state[findServer].data.version === state[server].data.version);
return <tr key={server} className={state[server].status ? 'on' : 'off'}>
<td>{server}</td>
<td>{wsServer ? (state[wsServer].status ? <span className="on">+</span> : <span className="off">-</span>) : ''}</td>
<td>{state[server].status ? "Работает": "Не работает"}</td>
<td>с {moment(state[server].changedTime).format('DD.MM.YYYY HH:mm:ss')}</td>
</tr>;
})
}
</tbody></table>;
}
ReactDOM.render(
<Component/>,
document.getElementById('main')
);
</script>
</body>
</html>