diff --git a/Routes/main.js b/Routes/main.js index 4e4c913..d08f7dd 100644 --- a/Routes/main.js +++ b/Routes/main.js @@ -42,23 +42,13 @@ module.exports = (app, config, themeConfig, modules) => { router.get("/invite", (req, res) => { const config = req.config; - config.invite ? null : (config.invite = {}); - const scopes = config.invite.scopes || ["bot"]; + const scopes = config.invite.scopes || ["bot"], + permissions = config.invite.permissions || "0", + other_params = config.invite.otherParams || "", + link = `https://discord.com/oauth2/authorize?client_id=${config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${permissions}&response_type=code${req.query.g ? `&guild_id=${req.query.g}` : ""}${other_params}`; - 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=${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; - if (!thingymabob) thingymabob = config.invite.specialredirectUri ? `&response_type=code&redirect_uri=${config.invite.specialRedirectUri.replace("{SERVER}", 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"}${thingymabob}&guild_id=${req.query.g}${config.invite.otherParams || ""}`); - } - - 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"}${config.invite.redirectUri ? `&response_type=code&redirect_uri=${config.invite.redirectUri}` : ""}${config.invite.otherParams || ""}`); + res.redirect(link); }); if (!config.supportServer) config.supportServer = {}; diff --git a/theme/dbd-soft-ui/views/guilds.ejs b/theme/dbd-soft-ui/views/guilds.ejs index 04a3fc3..3009721 100644 --- a/theme/dbd-soft-ui/views/guilds.ejs +++ b/theme/dbd-soft-ui/views/guilds.ejs @@ -55,7 +55,7 @@ else icon = icon + "?size=256" %> - +