68 lines
2.4 KiB
HTML
68 lines
2.4 KiB
HTML
<!--
|
|
This file is part of iros
|
|
Copyright (C) 2024 Alex <uni@vrsal.xyz>
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published
|
|
by the Free Software Foundation, version 3 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
-->
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>IROS | Dashboard</title>
|
|
<link rel='stylesheet' type='text/css' media='screen' href='./static/css/dashboard.css'>
|
|
<link rel="icon" href="static/img/favicon.png" type="image/x-icon" />
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
// get the token from the cookie
|
|
function getCookie(name) {
|
|
const value = `; ${document.cookie}`;
|
|
const parts = value.split(`; ${name}=`);
|
|
if (parts.length === 2) return parts.pop().split(';').shift();
|
|
}
|
|
const token = getCookie('authToken');
|
|
function purge_sessions() {
|
|
fetch('./api/v1/purgeSessions', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': token
|
|
}
|
|
}).then(response => {
|
|
if (response.status === 200)
|
|
location.reload();
|
|
else
|
|
console.error('Error:', response.status);
|
|
}).catch((error) => {
|
|
console.error('Error:', error);
|
|
});
|
|
}
|
|
</script>
|
|
<div class="stats-header">
|
|
<ul class="stats-list">
|
|
<li title="Uptime">🕐 {{.Uptime}}</li>
|
|
<li title="Number of sessions">📒 {{.NumSessions}}</li>
|
|
<li title="Connected web sockets">🔌 {{.NumWSConnections}}</li>
|
|
<li title="Last message">📥 {{.LastMessage}}</li>
|
|
<li title="Number of inactive sessions">🗑️ {{.InactiveSessions}}</li>
|
|
</ul>
|
|
</div>
|
|
<div class="dashboard">
|
|
<h3>Dashboard actions</h3>
|
|
<button class="button" onclick="purge_sessions()">Purge inactive sessions</button>
|
|
</div>
|
|
</body>
|
|
|
|
</html> |