-
Notifications
You must be signed in to change notification settings - Fork 2
/
dashboard.mjs
36 lines (32 loc) · 969 Bytes
/
dashboard.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { acpManager } from "./index.mjs";
import * as alt from "alt-server";
import { acpServerStats } from "./serverstats.mjs";
const acpDashboard = {
/**
* @description Initializes the dashboard module for the admin control panel
*/
init() {
acpDashboard.registerEvents();
acpDashboard.addListener();
},
/**
* @description Register several events, such as alt events etc.
*/
registerEvents() {
//
},
/**
* @description Adds one or more listeners (get) requests to the acp manager.
*/
addListener() {
acpManager.addAcpListener("/acp/dashboard", (req, res) => {
const info = {
uptime: acpServerStats.calculateUptime(),
onlinePlayers: alt.Player.all.length,
visits: acpServerStats.visits.length
};
res.status(200).send(JSON.stringify(info));
});
},
};
export { acpDashboard };