This commit is contained in:
Jonny_Bro (Nikita) 2023-07-02 01:14:35 +05:00
parent 8416a3f661
commit 889f9fc954
3 changed files with 41 additions and 42 deletions

View file

@ -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;

View file

@ -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] = {};

View file

@ -79,49 +79,47 @@
</a>
</li>
<li class="nav-item mt-3">
<h6 class="ps-4 ms-2 text-uppercase text-xs font-weight-bolder opacity-6">Settings
Categories</h6>
<h6 class="ps-4 ms-2 text-uppercase text-xs font-weight-bolder opacity-6">Settings Categories</h6>
</li>
<% settings.forEach(s=> { %>
<% settings.forEach(s => { %>
<a class="<%- s.categoryId %>">
<% if(s.premium) { %>
<div class="sidebarPremium"><i style="color: var(--colone) !important;"
class="fas fa-crown"></i></div>
<% } %>
<li class="nav-item categories" id="<%- s.categoryId %>">
<a class="nav-link <% if (req.params.category == s.categoryId) { %>active<% } %>"
id="<%- s.categoryId %>">
<% if(s.categoryImageURL) { %>
<div
class="icon icon-shape icon-sm shadow border-radius-md bg-white text-center me-2 d-flex align-items-center justify-content-center">
<img width="20px" src="<%= s.categoryImageURL %>">
</div>
<% } %>
<span class="nav-link-text ms-1">
<%- s.categoryName %>
</span>
<% if(s.toggleable) { %>
<span style="text-align: right; width: 100%;">
<div class="form-check form-switch ps-0"
style="float: right !important;">
<input name="<%- s.categoryId %>"
category="<%- s.categoryName %>" switch="true"
class="form-check-input ms-auto category-toggle"
style="height: 20px !important; margin-left: 10px !important;"
type="checkbox" id="switch-<%= s.categoryId %>"
<%=toggle[s.categoryId] ? "checked" : "" %>
<div class="sidebarPremium"><i style="color: var(--colone) !important;" class="fas fa-crown"></i></div>
<% } %>
>
<label style="z-index: 100; position: relative;"
class="form-check-label text-body ms-3 text-truncate w-80 mb-0 d-none"
for="switch-<%= s.categoryId %>"></label>
</div>
</span>
<% } %>
</a>
</li>
<% }) %>
<li class="nav-item categories" id="<%- s.categoryId %>">
<a class="nav-link <% if (req.params.category == s.categoryId) { %>active<% } %>"
id="<%- s.categoryId %>">
<% if(s.categoryImageURL) { %>
<div
class="icon icon-shape icon-sm shadow border-radius-md bg-white text-center me-2 d-flex align-items-center justify-content-center">
<img width="20px" src="<%= s.categoryImageURL %>">
</div>
<% } %>
<span class="nav-link-text ms-1">
<%- s.categoryName %>
</span>
<% if(s.toggleable) { %>
<span style="text-align: right; width: 100%;">
<div class="form-check form-switch ps-0"
style="float: right !important;">
<input name="<%- s.categoryId %>"
category="<%- s.categoryName %>" switch="true"
class="form-check-input ms-auto category-toggle"
style="height: 20px !important; margin-left: 10px !important;"
type="checkbox" id="switch-<%= s.categoryId %>"
<%=toggle[s.categoryId] ? "checked" : "" %>
>
<label style="z-index: 100; position: relative;"
class="form-check-label text-body ms-3 text-truncate w-80 mb-0 d-none"
for="switch-<%= s.categoryId %>"></label>
</div>
</span>
<% } %>
</a>
</li>
<% }) %>
</ul>
</div>
<% if(themeConfig?.premium && req.session.user) { %>