dht added /ir get request for pinging
This commit is contained in:
8
dht.js
8
dht.js
@@ -244,9 +244,17 @@ app.post('/dht/ping', (req, res) => { (async (res) => {
|
||||
});
|
||||
|
||||
app.use('/ir', bodyParser.text(), function(rq, rs) {
|
||||
if(rq.method == "GET")
|
||||
{
|
||||
var t = moment.duration(parseInt(req.param('uptime')), 'milliseconds');
|
||||
var _message = req.param('ip') + " uptime " + t.hours() + "h " + t.minutes() + "m " + t.seconds() +"s";
|
||||
console.log("watchdog from " + _message);
|
||||
res.send("You are alive!");
|
||||
}else{
|
||||
console.log("REQ:"+rq.headers);
|
||||
console.log("BODY:"+rq.body);
|
||||
rs.sendStatus(200);
|
||||
}
|
||||
});
|
||||
|
||||
// app.post('/ir', (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user