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

View File

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