2026-02-24 18:15:44 +00:00
|
|
|
import * as plugins from '../../plugins.ts';
|
|
|
|
|
import type { OpsServer } from '../classes.opsserver.ts';
|
|
|
|
|
import * as interfaces from '../../../ts_interfaces/index.ts';
|
2026-04-19 01:30:54 +00:00
|
|
|
import { requireAdminIdentity } from '../helpers/guards.ts';
|
2026-02-24 18:15:44 +00:00
|
|
|
|
|
|
|
|
export class StatusHandler {
|
|
|
|
|
public typedrouter = new plugins.typedrequest.TypedRouter();
|
|
|
|
|
|
|
|
|
|
constructor(private opsServerRef: OpsServer) {
|
|
|
|
|
this.opsServerRef.typedrouter.addTypedRouter(this.typedrouter);
|
|
|
|
|
this.registerHandlers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private registerHandlers(): void {
|
|
|
|
|
this.typedrouter.addTypedHandler(
|
|
|
|
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_GetSystemStatus>(
|
|
|
|
|
'getSystemStatus',
|
|
|
|
|
async (dataArg) => {
|
2026-04-19 01:30:54 +00:00
|
|
|
await requireAdminIdentity(this.opsServerRef.adminHandler, dataArg);
|
2026-02-24 18:15:44 +00:00
|
|
|
const status = await this.opsServerRef.oneboxRef.getSystemStatus();
|
|
|
|
|
return { status: status as unknown as interfaces.data.ISystemStatus };
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|