mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-27 04:09:46 -06:00
feat: add game server monitoring support
- Added a new `/games` route in `monitorRoute.js` to fetch all supported games. - Implemented `getAllGames` method in `monitorController.js` using the `gamedig` library. - Introduced `useFetchMonitorGames` hook in `monitorHooks.js` to fetch game data in the frontend. - Updated `UptimeCreate` page to support game server monitoring: - Added a new monitor type `"game"`. - Dynamically fetches and displays game options using the new `/games` API. - Removed hardcoded `GAMES` object and replaced it with dynamic fetching from the backend. - Updated `NetworkService.js` with a new `getMonitorGames` method for API calls. This update introduces game server monitoring functionality, allowing users to monitor game servers dynamically.
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
import sslChecker from "ssl-checker";
|
||||
import { fetchMonitorCertificate } from "./controllerUtils.js";
|
||||
import BaseController from "./baseController.js";
|
||||
import { games } from "gamedig";
|
||||
|
||||
const SERVICE_NAME = "monitorController";
|
||||
class MonitorController extends BaseController {
|
||||
@@ -441,6 +442,17 @@ class MonitorController extends BaseController {
|
||||
SERVICE_NAME,
|
||||
"exportMonitorsToCSV"
|
||||
);
|
||||
|
||||
getAllGames = this.asyncHandler(
|
||||
async (req, res) => {
|
||||
return res.success({
|
||||
msg: "OK",
|
||||
data: games,
|
||||
});
|
||||
},
|
||||
SERVICE_NAME,
|
||||
"getAllGames"
|
||||
);
|
||||
}
|
||||
|
||||
export default MonitorController;
|
||||
|
||||
@@ -25,6 +25,9 @@ class MonitorRoutes {
|
||||
// Hardware routes
|
||||
this.router.get("/hardware/details/:monitorId", this.monitorController.getHardwareDetailsById);
|
||||
|
||||
// Game routes
|
||||
this.router.get("/games", this.monitorController.getAllGames);
|
||||
|
||||
// General monitor routes
|
||||
this.router.post("/pause/:monitorId", isAllowed(["admin", "superadmin"]), this.monitorController.pauseMonitor);
|
||||
this.router.get("/stats/:monitorId", this.monitorController.getMonitorStatsById);
|
||||
|
||||
Reference in New Issue
Block a user