internet-check edit
This commit is contained in:
@@ -4,6 +4,7 @@ const util = require('util');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
const http = require("http");
|
||||||
|
|
||||||
const exec = util.promisify(require('child_process').exec);
|
const exec = util.promisify(require('child_process').exec);
|
||||||
const readFileAsync = util.promisify(fs.readFile);
|
const readFileAsync = util.promisify(fs.readFile);
|
||||||
@@ -61,18 +62,22 @@ app.get('/internetCheck', async (req, res) => {
|
|||||||
res.set({
|
res.set({
|
||||||
'Access-Control-Allow-Origin': '*'
|
'Access-Control-Allow-Origin': '*'
|
||||||
});
|
});
|
||||||
const { stdout, stderr } = await exec('/media/hd/data/projects/icanhazip');
|
http.get('http://icanhazip.com', (httpRes) => {
|
||||||
|
httpRes.setEncoding('utf8');
|
||||||
|
httpRes.on('data', (body) => {
|
||||||
res.send(
|
res.send(
|
||||||
{
|
{
|
||||||
"id": "internet-check",
|
"id": "internet-check",
|
||||||
"data": stdout,
|
"data": body,
|
||||||
"stderr": stderr
|
"stderr": ""
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/sysStatus', async (req, res) => {
|
app.get('/sysStatus', (req, res) => {
|
||||||
res.set({
|
res.set({
|
||||||
'Access-Control-Allow-Origin': '*'
|
'Access-Control-Allow-Origin': '*'
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user