internet-check edit
This commit is contained in:
@@ -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': '*'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user