dashboard-core/theme/dbd-soft-ui/pages/get/debug.js

45 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2023-06-22 19:36:52 +05:00
const fetch = require("node-fetch");
const fs = require("fs");
const DBD = require("../../../../index");
2023-06-19 14:21:58 +05:00
module.exports = {
2023-06-22 19:36:52 +05:00
page: "/debug",
execute: async (req, res, app, config, themeConfig, info) => {
/*
Do not remove this page.
It will be used with support in the discord server.
*/
if (!req.session.user) return res.redirect("/discord?r=/debug/");
if (!config.ownerIDs?.includes(req.session.user.id)) return res.redirect("/");
2023-06-19 14:21:58 +05:00
2023-06-22 19:36:52 +05:00
const onlineFiles = {
index: await fetch("https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/index.ejs"),
guild: await fetch("https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/guild.ejs"),
guilds: await fetch("https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/guilds.ejs"),
};
2023-06-19 14:21:58 +05:00
2023-06-22 19:36:52 +05:00
onlineFiles.index = await onlineFiles.index.text();
onlineFiles.guild = await onlineFiles.guild.text();
onlineFiles.guilds = await onlineFiles.guilds.text();
2023-06-19 14:21:58 +05:00
2023-06-22 19:36:52 +05:00
const localFiles = {
index: await fs.readFileSync(`${__dirname}/../../views/index.ejs`, "utf-8"),
guild: await fs.readFileSync(`${__dirname}/../../views/settings.ejs`, "utf-8"),
guilds: await fs.readFileSync(`${__dirname}/../../views/guilds.ejs`, "utf-8"),
};
2023-06-19 14:21:58 +05:00
2023-06-22 19:36:52 +05:00
res.render("debug", {
onlineFiles,
localFiles,
rawUptime: process.uptime(),
nodeVersion: process.version,
themeConfig,
discordVersion: require("discord.js").version,
dbdVersion: DBD.version,
themeVersion: require("dbd-soft-ui").version,
req,
config,
info,
});
},
};