Initial Commit

This commit is contained in:
Domingo Dirutigliano
2022-06-11 21:57:50 +02:00
committed by DomySh
commit 372ade7d6f
43 changed files with 30381 additions and 0 deletions

19
frontend/src/js/models.ts Executable file
View File

@@ -0,0 +1,19 @@
export const update_freq = 3000;
export type GeneralStats = {
services:number,
closed:number,
regex:number
}
export type Service = {
id:string,
name:string,
status:string,
public_port:number,
internal_port:number,
n_packets:number,
n_regex:number,
}

14
frontend/src/js/utils.ts Executable file
View File

@@ -0,0 +1,14 @@
import { GeneralStats, Service } from "./models";
export async function getapi(path:string):Promise<any>{
return await fetch(`/api/${path}`).then( res => res.json() )
}
export async function generalstats():Promise<GeneralStats>{
return await getapi("general-stats") as GeneralStats;
}
export async function servicelist():Promise<Service[]>{
return await getapi("services") as Service[];
}