SSL-Sniffer/src/lib/server/classes/endpoints/enpoint-manager.ts

56 lines
1.2 KiB
TypeScript
Raw Normal View History

import { EndpointBrokerManagerFS } from "$lib/server/broker-utils/FileSystem/Endpoint"
import type { IEndpoint } from "./endpoints-interfaces"
// UGLY: refactor this
export class EndpointManagerApp {
private static initialized = false
/** Here we store all endpoints
* - Key: path
* - Value: any IEndpointFS
*/
public static get ready() {
return EndpointManagerApp.initialized
}
public static init() {
// TODO: Read all files
// TODO: QUICK parse them
// TODO: Initialize a file watcher
}
public static async activateEndpoint(path: string): Promise<boolean> {
return await EndpointBrokerManagerFS.activateEndpoint(path)
}
public static async deactivateEndpoint(path: string): Promise<boolean> {
return await EndpointBrokerManagerFS.deactivateEndpoint(path)
}
public static getEndpointByPath(path: string): IEndpoint | null {
// UGLY: parse
return EndpointBrokerManagerFS.getEndpointByPath(path)
}
public static async getAll(): Promise<IEndpoint[]> {
// UGLY: parse
return await EndpointBrokerManagerFS.getAll()
}
}