mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
b0deb2e447
Статистика пользователя и сервера на сайте Удалён лишний файл Отключена комадна someone Фикс currentURL в переменных страниц Обновлена локализация
38 lines
No EOL
1.1 KiB
JavaScript
38 lines
No EOL
1.1 KiB
JavaScript
const express = require("express"),
|
|
utils = require("../utils"),
|
|
CheckAuth = require("../auth/CheckAuth"),
|
|
router = express.Router();
|
|
|
|
// Gets user page
|
|
router.get("/:userID/:serverID", CheckAuth, async function (req, res) {
|
|
const guild = req.client.guilds.cache.get(req.params.serverID);
|
|
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) {
|
|
return res.render("404", {
|
|
user: req.userInfos,
|
|
translate: req.translate,
|
|
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`
|
|
});
|
|
}
|
|
|
|
const guildData = await req.client.findOrCreateGuild({ id: guild.id });
|
|
await utils.fetchUser({
|
|
id: req.params.userID
|
|
}, req.client).catch(() => {
|
|
res.render("404", {
|
|
user: req.userInfos,
|
|
translate: req.translate,
|
|
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`
|
|
});
|
|
});
|
|
|
|
res.render("user", {
|
|
user: req.userInfos,
|
|
guild: guildData,
|
|
bot: req.client,
|
|
translate: req.translate,
|
|
printDate: req.printDate,
|
|
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`
|
|
});
|
|
});
|
|
|
|
module.exports = router; |