Initial Commit
This commit is contained in:
19
frontend/src/js/models.ts
Executable file
19
frontend/src/js/models.ts
Executable 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
14
frontend/src/js/utils.ts
Executable 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[];
|
||||
}
|
||||
Reference in New Issue
Block a user