Security Patch(AnyOne has access to analytics)

This commit is contained in:
CorwinDev committed 2022-08-18 15:22:11 +02:00
1 parent f16305c6ad
commit 93f2c8b0a8
7 files changed
+1596 -63

No files matched your search

+3 -1
View File
@@ -4,7 +4,9 @@ let hm = new mongoose.Schema({
name: String, name: String,
icon: String, icon: String,
verified: Boolean, verified: Boolean,
description: String, description: {
type: String, maxLength: 100
},
owners: [String], owners: [String],
long_description: String, long_description: String,
banner: String, banner: String,
+13 -2
View File
@@ -1,4 +1,3 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
"./website/**/*.{html,css}", "./website/**/*.{html,css}",
@@ -7,6 +6,7 @@ module.exports = {
"./website/views/**/**/*.ejs", "./website/views/**/**/*.ejs",
], ],
theme: { theme: {
extend: { extend: {
colors: { colors: {
"primary-color": "#1E2023;", "primary-color": "#1E2023;",
@@ -20,13 +20,24 @@ module.exports = {
serif: ["Georgia", "serif"], serif: ["Georgia", "serif"],
mono: ["Menlo", "monospace"] mono: ["Menlo", "monospace"]
}, },
typography: {
DEFAULT: {
css: {
color: '#FFFFFF',
code:{
color: '#FFFFFF',
}
},
},
},
}, },
}, },
plugins: [ plugins: [
require('@tailwindcss/typography'),
{ {
tailwindcss: {}, tailwindcss: {},
autoprefixer: {}, autoprefixer: {},
typography: {}
}, },
], ],
}; };
File diff suppressed because it is too large. Load diff
+17 -5
View File
@@ -428,12 +428,24 @@ router.get('/:botID/analytics', async function (req, res) {
req.session.error = "No bot found"; req.session.error = "No bot found";
return res.redirect('/'); return res.redirect('/');
} }
res.render('server/analytics', { var serverr = await global.bsl.guilds.cache.get(bot.id)
bot: bot, if (serverr.members.cache.get(req.user.id)) {
user: req.user if (serverr.members.cache.get(req.user.id).permissions.has('ADMINISTRATOR')) {
}); res.render('server/analytics', {
bot: bot,
user: req.user
});
}); } else {
req.session.error = "You don't have permission to do this";
return res.redirect('/');
}
} else {
req.session.error = "You don't have permission to do this";
return res.redirect('/');
}
})
} }
}); });
module.exports = router; module.exports = router;
+2 -2
View File
@@ -18,8 +18,8 @@
<label for="bot_name" class="peer-focus:font-medium absolute text-sm text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Bot Description (MarkDown supported!)</label> <label for="bot_name" class="peer-focus:font-medium absolute text-sm text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Bot Description (MarkDown supported!)</label>
</div> </div>
<div class="relative z-0 mb-6 w-full group"> <div class="relative z-0 mb-6 w-full group">
<input type="text" name="bot_short" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none text-white border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required /> <input type="text" name="bot_short" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none text-white border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required maxlength="100"/>
<label for="bot_name" class="peer-focus:font-medium absolute text-sm text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Short Description (Will be show on home page)</label> <label for="bot_name" class="peer-focus:font-medium absolute text-sm text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Short Description (Will be show on home page, MaxLength: 100)</label>
</div> </div>
<div class="relative z-0 mb-6 w-full group"> <div class="relative z-0 mb-6 w-full group">
<input type="text" name="bot_owners" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none text-white border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required /> <input type="text" name="bot_owners" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none text-white border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required />
+2 -5
View File
@@ -2,17 +2,14 @@
<br><br><br><br> <br><br><br><br>
<div class="flex space-x-4 py-2 lg:h-5/6 sm:min-h-min"> <div class="flex space-x-4 py-2 lg:h-5/6 sm:min-h-min">
<div class="p-10 bg-blue-color w-2/3 text-white h-full m-4 mx-14"> <div class="p-10 bg-blue-color w-2/3 text-white h-full m-4 mx-14">
<article class="prose prose-xl text-white"> <article class="prose">
<br><%- description %> <br><%- description %>
</article> </article>
<div class="prose">
</div>
</div> </div>
<div class="bg-blue-color w-1/4 p-10 text-white h-full m-4 "> <div class="bg-blue-color w-1/4 p-10 text-white h-full m-4 ">
<!-- bot avatar image --> <!-- bot avatar image -->
<img class="w-full rounded-full" src="<%= bot.icon %>" alt="<%= bot.name %>" onerror="this.src='https://cdn.discordapp.com/avatars/<%= bot.id %>/<%=bota.avatar %>.webp'"> <img class="w-full rounded-full" src="https://cdn.discordapp.com/avatars/<%= bot.id %>/<%=bota.avatar %>.webp" alt="<%= bot.name %>" onerror="this.src='https://cdn.discordapp.com/avatars/<%= bot.id %>/<%=bota.avatar %>.webp'">
<h1 class="text-3xl text-center"> <h1 class="text-3xl text-center">
<%= bot.name %> <%= bot.name %>
</h1> </h1>
+2 -2
View File
@@ -83,7 +83,7 @@
<% } %> <% } %>
<% for(let i=0; i < nbots.length; i++) { if (i===5) break; var bot=nbots[i]; if(bot) { %> <% for(let i=0; i < nbots.length; i++) { if (i===5) break; var bot=nbots[i]; if(bot) { %>
<div class="transition-shadow ease-in-out duration-300 hover:shadow-blue-900 shadow-2xl rounded-lg max-w-sm bg-blue-color " onclick="location.href='/bot/<%=bot.id%> ';" style="cursor: pointer;"> <div class="transition-shadow ease-in-out duration-300 hover:shadow-blue-900 shadow-2xl rounded-lg max-w-sm bg-blue-color " onclick="location.href='/bot/<%=bot.id%> ';" style="cursor: pointer;">
<img class="w-full rounded-full" src="<%= bot.icon %>" onerror="this.src='/img/logo.webp'" alt="<%= bot.name %>"> <img class="w-full rounded-full" src="https://cdn.discordapp.com/avatars/<%= bot.id %>/<%= global.bsl.users.cache.get(bot.id).avatar %>.webp" onerror="this.src='/img/logo.webp'" alt="<%= bot.name %>">
<div class="px-6 text-white text-base"> <div class="px-6 text-white text-base">
<p><i class="fa-solid fa-check-to-slot"></i>: <%= bot.votes || 0 %> <%if(bot.servers) { %><i class="fa fa-server"></i>: <%= bot.servers %><% } %> <p><i class="fa-solid fa-check-to-slot"></i>: <%= bot.votes || 0 %> <%if(bot.servers) { %><i class="fa fa-server"></i>: <%= bot.servers %><% } %>
</p> </p>
@@ -127,7 +127,7 @@
<% } %> <% } %>
<% for(let i=0; i < nbots.length; i++) { if (i===5) break; var bot=nbots[i]; if(bot) { %> <% for(let i=0; i < nbots.length; i++) { if (i===5) break; var bot=nbots[i]; if(bot) { %>
<div class="transition-shadow ease-in-out duration-300 hover:shadow-blue-900 shadow-2xl rounded-lg max-w-sm bg-blue-color " onclick="location.href='/bot/<%=bot.id%> ';" style="cursor: pointer;"> <div class="transition-shadow ease-in-out duration-300 hover:shadow-blue-900 shadow-2xl rounded-lg max-w-sm bg-blue-color " onclick="location.href='/bot/<%=bot.id%> ';" style="cursor: pointer;">
<img class="w-full rounded-full" src="<%= bot.icon %>" onerror="this.src='/img/logo.webp'" alt="<%= bot.name %>"> <img class="w-full rounded-full" src="https://cdn.discordapp.com/avatars/<%= bot.id %>/<%=global.bsl.users.cache.get(bot.id).avatar %>.webp" onerror="this.src='/img/logo.webp'" alt="<%= bot.name %>">
<div class="px-6 text-white text-base"> <div class="px-6 text-white text-base">
<p><i class="fa-solid fa-check-to-slot"></i>: <%= bot.votes || 0 %> <%if(bot.servers) { %><i class="fa fa-server"></i>: <%= bot.servers %><% } %> <p><i class="fa-solid fa-check-to-slot"></i>: <%= bot.votes || 0 %> <%if(bot.servers) { %><i class="fa fa-server"></i>: <%= bot.servers %><% } %>
</p> </p>