internet-check edit

This commit is contained in:
sco
2020-06-16 01:25:22 +02:00
parent 567aa48326
commit 82c366e05b
+14 -9
View File
@@ -4,6 +4,7 @@ const util = require('util');
const fs = require('fs');
const path = require('path');
const os = require('os');
const http = require("http");
const exec = util.promisify(require('child_process').exec);
const readFileAsync = util.promisify(fs.readFile);
@@ -61,18 +62,22 @@ app.get('/internetCheck', async (req, res) => {
res.set({
'Access-Control-Allow-Origin': '*'
});
const { stdout, stderr } = await exec('/media/hd/data/projects/icanhazip');
res.send(
{
"id": "internet-check",
"data": stdout,
"stderr": stderr
}
)
http.get('http://icanhazip.com', (httpRes) => {
httpRes.setEncoding('utf8');
httpRes.on('data', (body) => {
res.send(
{
"id": "internet-check",
"data": body,
"stderr": ""
}
)
});
});
});
app.get('/sysStatus', async (req, res) => {
app.get('/sysStatus', (req, res) => {
res.set({
'Access-Control-Allow-Origin': '*'
});