Code cleanup

This commit is contained in:
Aelita4 2022-08-22 11:28:10 +02:00
parent a4166221de
commit 5fad7eb8cb
Signed by: Aelita4
GPG Key ID: F8EC95519509D1D5
5 changed files with 3 additions and 15 deletions

View File

@ -1,6 +1,6 @@
import express, { Request, Response } from 'express'; import express from 'express';
import Ping from 'ping'; import Ping from 'ping';
import { existsSync, readdirSync, writeFileSync, readFileSync } from 'fs'; import { readdirSync } from 'fs';
import sessions from "express-session" import sessions from "express-session"
import cookieParser from "cookie-parser" import cookieParser from "cookie-parser"
import mysql from 'mysql' import mysql from 'mysql'

View File

@ -1,5 +1,4 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { existsSync, writeFileSync, readFileSync } from 'fs'
import { connection } from '../index.js'; import { connection } from '../index.js';
export default { export default {

View File

@ -1,5 +1,4 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { existsSync, writeFileSync, readFileSync } from 'fs'
import { connection } from '../index.js'; import { connection } from '../index.js';
export default { export default {
@ -20,8 +19,5 @@ export default {
}); });
} }
}); });
/*res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({ status: "OK" }));*/
} }
} }

View File

@ -1,5 +1,4 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { readFileSync } from 'fs';
import { getIP } from '../index.js'; import { getIP } from '../index.js';
export default { export default {

View File

@ -12,13 +12,7 @@
addrElement.innerHTML += '<div id="' + ip + '_main"><tr><td><input type="button" name="' + ip + '_rem" value="x" onClick="removeIP(\"' + ip + '\")"></td><td><div style="display: inline-block;" id="' + ip + '_addr">' + ip + '</div></td><td><div style="display: inline-block; margin-left: 5em" id="' + ip + '_status"><span style="color:blue;">PINGING...</span></div></td></tr></div>' addrElement.innerHTML += '<div id="' + ip + '_main"><tr><td><input type="button" name="' + ip + '_rem" value="x" onClick="removeIP(\"' + ip + '\")"></td><td><div style="display: inline-block;" id="' + ip + '_addr">' + ip + '</div></td><td><div style="display: inline-block; margin-left: 5em" id="' + ip + '_status"><span style="color:blue;">PINGING...</span></div></td></tr></div>'
const b = document.getElementById(ip + "_status"); const b = document.getElementById(ip + "_status");
await fetch('http://localhost:8080/addIP/' + ip) await fetch('http://localhost:8080/addIP/' + ip)
window.location.reload(true); window.location.reload(true);
/*await fetch('http://localhost:8080/ping/' + ip)
.then((response) => response.json())
.then((data) => {
b.innerHTML = data.alive ? '<span style="color:green;">UP (' + data.numeric_host + ") " + data.time + 'ms</span>' : '<span style="color:red;">DOWN' + ((data.host == "unknown") ? " (UNKNOWN HOST)" : (" (" + data.numeric_host + ")")) + '</span>'
});*/
} }
async function removeIP(ip) { async function removeIP(ip) {