mirror of https://github.com/Aelita4/sshmon.git
				
				
				
			Code cleanup
This commit is contained in:
		
							parent
							
								
									a4166221de
								
							
						
					
					
						commit
						5fad7eb8cb
					
				| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import express, { Request, Response } from 'express';
 | 
			
		||||
import express from 'express';
 | 
			
		||||
import Ping from 'ping';
 | 
			
		||||
import { existsSync, readdirSync, writeFileSync, readFileSync } from 'fs';
 | 
			
		||||
import { readdirSync } from 'fs';
 | 
			
		||||
import sessions from "express-session"
 | 
			
		||||
import cookieParser from "cookie-parser"
 | 
			
		||||
import mysql from 'mysql'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
import { Request, Response } from 'express';
 | 
			
		||||
import { existsSync, writeFileSync, readFileSync } from 'fs'
 | 
			
		||||
import { connection } from '../index.js';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
import { Request, Response } from 'express';
 | 
			
		||||
import { existsSync, writeFileSync, readFileSync } from 'fs'
 | 
			
		||||
import { connection } from '../index.js';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
| 
						 | 
				
			
			@ -20,8 +19,5 @@ export default {
 | 
			
		|||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    
 | 
			
		||||
        /*res.setHeader('Content-Type', 'application/json');
 | 
			
		||||
        res.end(JSON.stringify({ status: "OK" }));*/
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
import { Request, Response } from 'express';
 | 
			
		||||
import { readFileSync } from 'fs';
 | 
			
		||||
import { getIP } from '../index.js';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>'
 | 
			
		||||
            const b = document.getElementById(ip + "_status");
 | 
			
		||||
            await fetch('http://localhost:8080/addIP/' + ip)
 | 
			
		||||
            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>'
 | 
			
		||||
            });*/
 | 
			
		||||
            
 | 
			
		||||
            window.location.reload(true);           
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        async function removeIP(ip) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue