|
|
@ -1,4 +1,4 @@
|
|
|
|
const https = require("https");
|
|
|
|
const http = require("http");
|
|
|
|
const fs = require("fs");
|
|
|
|
const fs = require("fs");
|
|
|
|
const ini = require("ini");
|
|
|
|
const ini = require("ini");
|
|
|
|
const lineReader = require('line-reader');
|
|
|
|
const lineReader = require('line-reader');
|
|
|
@ -32,12 +32,8 @@ updatelinks();
|
|
|
|
|
|
|
|
|
|
|
|
let serverPort = inifile.config.port;
|
|
|
|
let serverPort = inifile.config.port;
|
|
|
|
|
|
|
|
|
|
|
|
const server = https
|
|
|
|
const server = http
|
|
|
|
.createServer(
|
|
|
|
.createServer(
|
|
|
|
{
|
|
|
|
|
|
|
|
key: fs.readFileSync("key.pem"),
|
|
|
|
|
|
|
|
cert: fs.readFileSync("cert.pem"),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
app
|
|
|
|
app
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.listen(serverPort, ()=>{
|
|
|
|
.listen(serverPort, ()=>{
|
|
|
@ -83,7 +79,7 @@ function updatelinks() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let i = 0;
|
|
|
|
let i = 0;
|
|
|
|
while (i < lines.length) {
|
|
|
|
while (i < lines.length) {
|
|
|
|
if(lines[i] != "") {
|
|
|
|
if(lines[i] != "" && lines[i].match(linksregex)) {
|
|
|
|
var mylinks = lines[i].match(linksregex);
|
|
|
|
var mylinks = lines[i].match(linksregex);
|
|
|
|
// console.log(JSON.stringify(lines[i]));
|
|
|
|
// console.log(JSON.stringify(lines[i]));
|
|
|
|
var linkrec = {'timestamp':mylinks[1].substr(0,19)+'Z' , 'protocol':mylinks[2] , 'device':mylinks[4],
|
|
|
|
var linkrec = {'timestamp':mylinks[1].substr(0,19)+'Z' , 'protocol':mylinks[2] , 'device':mylinks[4],
|
|
|
|