Added filesystem info to /system

This commit is contained in:
Arne van Iterson 2020-01-21 09:26:36 +01:00
parent 13bee291bc
commit 293a97d256
2 changed files with 26 additions and 8 deletions

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -9,6 +10,7 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div>
<h1>ARNweb API</h1>
@ -32,9 +34,15 @@
<a href="/chat/socket.io/"><code>/chat/socket.io/</code></a><br>
<div>
<span>Socket.io instance used by the chat on ARNweb.</span><br><br>
<span><bold>Server -> Client</bold><br><code>user_identify { }</code></span><br><br>
<span><bold>Server <- Client</bold><br><code>user_login { "username", "mailHash" }</code></span><br><br>
<span><bold>Client -> Server</bold><br><code>message_send { "username", "mailHash", "message" }</code></span>
<span>
<bold>Server -> Client</bold><br><code>user_identify { }</code>
</span><br><br>
<span>
<bold>Server <- Client</bold> <br><code>user_login { "username", "mailHash" }</code>
</span><br><br>
<span>
<bold>Client -> Server</bold><br><code>message_send { "username", "mailHash", "message" }</code>
</span>
</div>
</span>
<span class="apiReference get">
@ -53,4 +61,5 @@
</div>
</span>
</body>
</html>

View File

@ -104,16 +104,25 @@ app.get('/system/', function (req, res) {
});
si.mem(function (data) {
sysInfo["mem"] = data;
res.json(sysInfo);
});
si.fsSize(function (data) {
sysInfo["fs"] = data;
res.json(sysInfo);
})
});
// cURL
app.get('/curl/', function (req, res) {
const userAgent = req.headers['user-agent'];
if (userAgent.search(/curl|wget/i) !== -1) {
res.send(`
${style.green.open}Hello Green!${style.green.close}
${style.red.open}Hello Red!${style.red.close}
`);
} else {
res.send('Only cURL requests!');
}
});
app.get('/css/:stylesheet', function (req, res) {