24 lines
No EOL
782 B
JavaScript
24 lines
No EOL
782 B
JavaScript
module.exports = {
|
|
page: "/control",
|
|
// eslint-disable-next-line no-unused-vars
|
|
execute: async (req, res, app, config, themeConfig, info) => {
|
|
const { uuid, action } = req.query;
|
|
|
|
if (!uuid && action && req.query.type) {
|
|
return res.redirect("/admin?result=true");
|
|
}
|
|
|
|
if (!uuid || !action) return res.sendStatus(412);
|
|
|
|
try {
|
|
if (action === "start") await themeConfig.nodeactyl.startServer(uuid);
|
|
if (action === "restart") await themeConfig.nodeactyl.restartServer(uuid);
|
|
if (action === "stop") await themeConfig.nodeactyl.stopServer(uuid);
|
|
if (action === "kill") await themeConfig.nodeactyl.killServer(uuid);
|
|
} catch (error) {
|
|
console.error(error);
|
|
return res.redirect("/admin?result=false");
|
|
}
|
|
return res.redirect("/admin?result=true");
|
|
}
|
|
}; |