37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
const CFXStatus = require("cfx-status")
|
|
const cfxre = new CFXStatus()
|
|
|
|
/**
|
|
* @param {string} key
|
|
* @returns {JSON}
|
|
*/
|
|
|
|
app.use("/getCfxReStatus.lvorex", express.json())
|
|
app.post("/getCfxReStatus.lvorex", async (req, res) => {
|
|
const postBody = req.body
|
|
const { keyFound, userKey } = await controlKey(req, postBody.key)
|
|
|
|
if (keyFound === false) return res.json({ code: 404, message: "Not authorized." })
|
|
const PermissionCheck = await checkPermission(userKey.rank, "LiveConsole", 0)
|
|
if (!PermissionCheck) return res.json({ code: 401, message: "Your rank is not enough." })
|
|
|
|
const KeymasterStatus = await cfxre.getComponentById("c3jjdxcs1phm")
|
|
const RuntimeStatus = await cfxre.getComponentById("k62947p2hfft")
|
|
const IDMSStatus = await cfxre.getComponentById("l6l8lvk1q8fc")
|
|
const CnLStatus = await cfxre.getComponentById("ll24lpv0ns6f")
|
|
const PolicyStatus = await cfxre.getComponentById("3hngttkgrq7t")
|
|
const ForumsStatus = await cfxre.getComponentById("gtfcnznk6pwb")
|
|
const ServerListFrontendStatus = await cfxre.getComponentById("m05ppx2rkdh7")
|
|
|
|
const toInsertMessage = {
|
|
Keymaster: KeymasterStatus.status,
|
|
Runtime: RuntimeStatus.status,
|
|
IDMS: IDMSStatus.status,
|
|
CnL: CnLStatus.status,
|
|
Policy: PolicyStatus.status,
|
|
Forums: ForumsStatus.status,
|
|
"Server List Frontend": ServerListFrontendStatus.status
|
|
}
|
|
|
|
res.json({ code: 200, message: toInsertMessage })
|
|
}) |