From 889f9fc9549e545f7a6fc7f7e5e2a76e1776894c Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sun, 2 Jul 2023 01:14:35 +0500 Subject: [PATCH] ? --- Routes/main.js | 6 +- .../utils/functions/settingsPage.js | 3 +- theme/dbd-soft-ui/views/settings.ejs | 74 +++++++++---------- 3 files changed, 41 insertions(+), 42 deletions(-) diff --git a/Routes/main.js b/Routes/main.js index 7e5cda3..4e4c913 100644 --- a/Routes/main.js +++ b/Routes/main.js @@ -46,10 +46,10 @@ module.exports = (app, config, themeConfig, modules) => { const scopes = config.invite.scopes || ["bot"]; - if (req.query.redirect && !req.query.g) - return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}&response_type=code&redirect_uri=${req.query.redirect}${config.invite.otherParams || ""}`); + if (req.query.redirect && !req.query.g) // TODO: Fix req.query.redirect + return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}&response_type=code&redirect_uri=${config.invite.redirectUri}${config.invite.otherParams || ""}`); if (req.query.redirect && req.query.g) - return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}&response_type=code&redirect_uri=${req.query.redirect}&guild_id=${req.query.g}${config.invite.otherParams || ""}`); + return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}&response_type=code&redirect_uri=${config.invite.redirectUri}&guild_id=${req.query.g}${config.invite.otherParams || ""}`); if (req.query.g) { let thingymabob = config.invite.redirectUri ? `&response_type=code&redirect_uri=${config.invite.redirectUri}` : null; diff --git a/theme/dbd-soft-ui/utils/functions/settingsPage.js b/theme/dbd-soft-ui/utils/functions/settingsPage.js index c8ea9e9..bf2cb6d 100644 --- a/theme/dbd-soft-ui/utils/functions/settingsPage.js +++ b/theme/dbd-soft-ui/utils/functions/settingsPage.js @@ -38,7 +38,8 @@ module.exports = function (config, themeConfig) { const canUseList = {}; if (config.settings?.length) { - config.settings = config.settings.filter(c => c.categoryPermissions ? bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id).permissions.has(c.categoryPermissions) : true); + bot.guilds.cache.get(req.params.id).members.fetch(req.session.user.id); + config.settings = config.settings.filter(c => c.categoryPermissions ? bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id).permissions.has(c.categoryPermissions, true) : true); for (const category of config.settings) { if (!canUseList[category.categoryId]) canUseList[category.categoryId] = {}; diff --git a/theme/dbd-soft-ui/views/settings.ejs b/theme/dbd-soft-ui/views/settings.ejs index 4eea0ac..2dd5b38 100644 --- a/theme/dbd-soft-ui/views/settings.ejs +++ b/theme/dbd-soft-ui/views/settings.ejs @@ -79,49 +79,47 @@ - <% settings.forEach(s=> { %> + <% settings.forEach(s => { %> <% if(s.premium) { %> -
- <% } %> -
- <% }) %> + + <% }) %> <% if(themeConfig?.premium && req.session.user) { %>