Added markdown
This commit is contained in:
1 parent
93f2c8b0a8
commit
4a3bb5ae9b
10 files changed
+150
-49
No files matched your search
+12
-6
@@ -21,16 +21,22 @@ module.exports = {
|
||||
mono: ["Menlo", "monospace"]
|
||||
},
|
||||
|
||||
typography: {
|
||||
typography: theme => ({
|
||||
DEFAULT: {
|
||||
css: {
|
||||
color: '#FFFFFF',
|
||||
code:{
|
||||
color: '#FFFFFF',
|
||||
}
|
||||
color: '#FFF',
|
||||
"code::before": {
|
||||
"content": "unset",
|
||||
},
|
||||
"code::after": {
|
||||
"content": "unset",
|
||||
},
|
||||
"code": {
|
||||
"background-color": "#747174",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
||||
@@ -158,10 +158,12 @@ app.get('/servers', async (req, res) => {
|
||||
app.get('/tag/:id', async (req, res) => {
|
||||
var id = req.params.id.toLowerCase();
|
||||
var bot = await bots.find({ tags: id });
|
||||
var servers = await server.find({ tags: id});
|
||||
res.render('tags/index', {
|
||||
bots: bot,
|
||||
user: req.user,
|
||||
tag: id,
|
||||
servers: servers,
|
||||
});
|
||||
});
|
||||
app.get('/i/:id', async (req, res) => {
|
||||
|
||||
@@ -586,7 +586,7 @@ video {
|
||||
}
|
||||
|
||||
.prose {
|
||||
color: #FFFFFF;
|
||||
color: #FFF;
|
||||
max-width: 65ch;
|
||||
}
|
||||
|
||||
@@ -599,15 +599,11 @@ video {
|
||||
}
|
||||
|
||||
.prose :where(a):not(:where([class~="not-prose"] *)) {
|
||||
color: #3182ce;
|
||||
color: var(--tw-prose-links);
|
||||
text-decoration: underline;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.prose :where(a):not(:where([class~="not-prose"] *)):hover {
|
||||
color: #2c5282;
|
||||
}
|
||||
|
||||
.prose :where(strong):not(:where([class~="not-prose"] *)) {
|
||||
color: var(--tw-prose-bold);
|
||||
font-weight: 600;
|
||||
@@ -784,17 +780,18 @@ video {
|
||||
}
|
||||
|
||||
.prose :where(code):not(:where([class~="not-prose"] *)) {
|
||||
color: #FFFFFF;
|
||||
color: var(--tw-prose-code);
|
||||
font-weight: 600;
|
||||
font-size: 0.875em;
|
||||
background-color: #747174;
|
||||
}
|
||||
|
||||
.prose :where(code):not(:where([class~="not-prose"] *))::before {
|
||||
content: "`";
|
||||
content: unset;
|
||||
}
|
||||
|
||||
.prose :where(code):not(:where([class~="not-prose"] *))::after {
|
||||
content: "`";
|
||||
content: unset;
|
||||
}
|
||||
|
||||
.prose :where(a code):not(:where([class~="not-prose"] *)) {
|
||||
@@ -2117,6 +2114,60 @@ video {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.prose-invert {
|
||||
--tw-prose-body: var(--tw-prose-invert-body);
|
||||
--tw-prose-headings: var(--tw-prose-invert-headings);
|
||||
--tw-prose-lead: var(--tw-prose-invert-lead);
|
||||
--tw-prose-links: var(--tw-prose-invert-links);
|
||||
--tw-prose-bold: var(--tw-prose-invert-bold);
|
||||
--tw-prose-counters: var(--tw-prose-invert-counters);
|
||||
--tw-prose-bullets: var(--tw-prose-invert-bullets);
|
||||
--tw-prose-hr: var(--tw-prose-invert-hr);
|
||||
--tw-prose-quotes: var(--tw-prose-invert-quotes);
|
||||
--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);
|
||||
--tw-prose-captions: var(--tw-prose-invert-captions);
|
||||
--tw-prose-code: var(--tw-prose-invert-code);
|
||||
--tw-prose-pre-code: var(--tw-prose-invert-pre-code);
|
||||
--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);
|
||||
--tw-prose-th-borders: var(--tw-prose-invert-th-borders);
|
||||
--tw-prose-td-borders: var(--tw-prose-invert-td-borders);
|
||||
}
|
||||
|
||||
.prose-neutral {
|
||||
--tw-prose-body: #404040;
|
||||
--tw-prose-headings: #171717;
|
||||
--tw-prose-lead: #525252;
|
||||
--tw-prose-links: #171717;
|
||||
--tw-prose-bold: #171717;
|
||||
--tw-prose-counters: #737373;
|
||||
--tw-prose-bullets: #d4d4d4;
|
||||
--tw-prose-hr: #e5e5e5;
|
||||
--tw-prose-quotes: #171717;
|
||||
--tw-prose-quote-borders: #e5e5e5;
|
||||
--tw-prose-captions: #737373;
|
||||
--tw-prose-code: #171717;
|
||||
--tw-prose-pre-code: #e5e5e5;
|
||||
--tw-prose-pre-bg: #262626;
|
||||
--tw-prose-th-borders: #d4d4d4;
|
||||
--tw-prose-td-borders: #e5e5e5;
|
||||
--tw-prose-invert-body: #d4d4d4;
|
||||
--tw-prose-invert-headings: #fff;
|
||||
--tw-prose-invert-lead: #a3a3a3;
|
||||
--tw-prose-invert-links: #fff;
|
||||
--tw-prose-invert-bold: #fff;
|
||||
--tw-prose-invert-counters: #a3a3a3;
|
||||
--tw-prose-invert-bullets: #525252;
|
||||
--tw-prose-invert-hr: #404040;
|
||||
--tw-prose-invert-quotes: #f5f5f5;
|
||||
--tw-prose-invert-quote-borders: #404040;
|
||||
--tw-prose-invert-captions: #a3a3a3;
|
||||
--tw-prose-invert-code: #fff;
|
||||
--tw-prose-invert-pre-code: #d4d4d4;
|
||||
--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
|
||||
--tw-prose-invert-th-borders: #525252;
|
||||
--tw-prose-invert-td-borders: #404040;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
@@ -2614,14 +2665,6 @@ video {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.w-2\/3 {
|
||||
width: 66.666667%;
|
||||
}
|
||||
|
||||
.w-1\/4 {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.min-w-fit {
|
||||
min-width: -webkit-fit-content;
|
||||
min-width: -moz-fit-content;
|
||||
@@ -4188,14 +4231,6 @@ body {
|
||||
height: 83.333333%;
|
||||
}
|
||||
|
||||
.lg\:w-1\/2 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.lg\:w-auto {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.lg\:w-2\/3 {
|
||||
width: 66.666667%;
|
||||
}
|
||||
@@ -4204,6 +4239,14 @@ body {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.lg\:w-1\/2 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.lg\:w-auto {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.lg\:flex-grow {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ router.get('/server/banner/:id', function (req, res) {
|
||||
context.fillText(serverName, canvas.width / 2.7, canvas.height / 1.8);
|
||||
context.font = '18px sans-serif';
|
||||
|
||||
context.fillText(`🙍♂️ ${serverMembers}`, canvas.width / 2.7, canvas.height / 1.1);
|
||||
context.fillText(`😊 ${serverMembers}`, canvas.width / 2.7, canvas.height / 1.1);
|
||||
context.fillText(`❤️ ${server.votes}`, canvas.width / 2.1, canvas.height / 1.1);
|
||||
|
||||
context.beginPath();
|
||||
|
||||
@@ -89,7 +89,7 @@ router.get('/:botID', async function (req, res) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
if (bot.verified == false) {
|
||||
if(!req.user) {
|
||||
if (!req.user) {
|
||||
req.backURL = req.originalUrl;
|
||||
return res.redirect('/auth');
|
||||
}
|
||||
@@ -104,7 +104,8 @@ router.get('/:botID', async function (req, res) {
|
||||
coowner.push(b)
|
||||
})
|
||||
var html = converter.makeHtml(bot.long_description);
|
||||
html = sanitizeHtml(html)
|
||||
html = sanitizeHtml(html,
|
||||
{ allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']) })
|
||||
res.render('bot/index', {
|
||||
bot: bot,
|
||||
user: req.user,
|
||||
|
||||
@@ -6,7 +6,8 @@ var bots = require('../../../models/bot');
|
||||
const client = require('../../../index');
|
||||
const Discord = require('discord.js');
|
||||
var showdown = require('showdown'),
|
||||
converter = new showdown.Converter();
|
||||
converter = new showdown.Converter()
|
||||
const sanitizeHtml = require('sanitize-html');
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
@@ -160,10 +161,15 @@ router.get('/:server', async function (req, res) {
|
||||
[`analytics.${referresURL}`]: 1
|
||||
}
|
||||
})
|
||||
var html = converter.makeHtml(server.long_description);
|
||||
console.log(html);
|
||||
html = sanitizeHtml(html,
|
||||
{ allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']) })
|
||||
res.render('server/index', {
|
||||
user: req.user,
|
||||
server: server,
|
||||
serverr: global.bsl.guilds.cache.get(server.id)
|
||||
serverr: global.bsl.guilds.cache.get(server.id),
|
||||
description: html,
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<%- include('../includes/header.ejs', { title: bot.name, bot: bot}) %>
|
||||
<br><br><br><br>
|
||||
<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">
|
||||
<article class="prose">
|
||||
<br><%- description %>
|
||||
<div class="lg:flex space-x-4 py-2 lg:h-5/6 sm:min-h-min">
|
||||
<div class="p-10 bg-blue-color w-full text-white h-full m-4 lg:mx-14 text-ellipsis lg:w-2/3">
|
||||
<div class="prose prose-invert">
|
||||
|
||||
</article>
|
||||
<%- description %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-blue-color w-1/4 p-10 text-white h-full m-4 ">
|
||||
<div class="bg-blue-color w-full p-10 text-white h-full lg:w-1/4 lg:m-4">
|
||||
<!-- bot avatar image -->
|
||||
<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'">
|
||||
<img class="w-full rounded-full" src="https://cdn.discordapp.com/avatars/<%= bot.id %>/<%=bota.avatar %>.webp" alt="<%= bot.name %>" onerror="this.src='/img/logo.webp'">
|
||||
<h1 class="text-3xl text-center">
|
||||
<%= bot.name %>
|
||||
</h1>
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
<br><br><br><br>
|
||||
<div class="lg:flex space-x-4 py-2 lg:h-5/6 sm:min-h-min">
|
||||
<div class="p-10 bg-blue-color w-full text-white h-full m-4 lg:mx-14 text-ellipsis lg:w-2/3">
|
||||
<p class="text-white text-clip">
|
||||
<pre style="white-space: pre-wrap;" class="text-clip break-wordsw-full h-full"><br><%= server.long_description %></pre>
|
||||
</p>
|
||||
<div class="prose prose-invert">
|
||||
|
||||
<%- description %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-blue-color w-full p-10 text-white h-full lg:w-1/4 lg:m-4">
|
||||
<img class="w-full rounded-full max-w-xs" src="https://cdn.discordapp.com/avatars/<%=server.id %>/<%=serverr.icon %>.png" alt="<%= server.name %>" onerror="this.src='/img/logo.png'">
|
||||
<img class="w-full rounded-full max-w-xs" src="https://cdn.discordapp.com/icons/<%=server.id %>/<%=serverr.icon %>.png" alt="<%= server.name %>" onerror="this.src='/img/logo.png'">
|
||||
<h1 class="text-3xl">
|
||||
<%= server.name %>
|
||||
</h1>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<% } %>
|
||||
<% for(let i=0; i < nbots.length; i++) { if (i===3) 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;">
|
||||
<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">
|
||||
<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>
|
||||
@@ -40,4 +40,46 @@
|
||||
</div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
<% var nbots= servers
|
||||
nbots.forEach((val, key) => {
|
||||
randomIndex = Math.ceil(Math.random()*(key + 1));
|
||||
nbots[key] = nbots[randomIndex];
|
||||
nbots[randomIndex] = val;
|
||||
});
|
||||
if(nbots.length > 0) { %>
|
||||
<div class="mx-auto text-center">
|
||||
<br>
|
||||
<h2 class="text-xl text-white text-center"><i class="fa fa-tag" aria-hidden="true"></i> Servers tagged with <%= tag %></h2>
|
||||
</h2>
|
||||
<p class="content text-white text-center" style="opacity:.6">These servers are tagged with <%= tag %> </p>
|
||||
</div>
|
||||
<div class="grid columns items-center content-center justify-center grid-cols-1 gap-4 col-auto sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 m-8">
|
||||
<% } %>
|
||||
<% for(let i=0; i < nbots.length; i++) { if (i===3) 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='/server/<%=bot.id%> ';" style="cursor: pointer;">
|
||||
<img class="w-full rounded-full" src="<%= global.bsl.guilds.cache.get(bot.id).iconURL({ format: 'png' }) %>" onerror="this.src='/img/logo.webp'" alt="<%= bot.name %>">
|
||||
<div class="px-6 text-white text-base">
|
||||
<p><i class="fa-solid fa-check-to-slot"></i>: <%= bot.votes || 0 %> <i class="fa fa-user"></i>: <%= global.bsl.guilds.cache.get(bot.id).memberCount.toLocaleString().replace(',', '.' ) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="px-6 py-4">
|
||||
<div class="font-bold text-xl mb-2 text-white">
|
||||
<%= bot.name %>
|
||||
</div>
|
||||
<p class="text-white text-base">
|
||||
<%= bot.description %>
|
||||
</p>
|
||||
</div>
|
||||
<% if(bot.tags) {%>
|
||||
<div class="px-6 pt-4 pb-2">
|
||||
<% bot.tags.slice(-3).forEach(tag=>{ %>
|
||||
<a href="/tag/<%= tag %>" class="inline-block bg-button-primary rounded-full px-3 py-1 text-sm font-semibold text-white mr-2 mb-2">#<%= tag %>
|
||||
</a>
|
||||
<% }) %>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="p-10 bg-blue-color w-full text-white h-full m-4 lg:mx-14 text-ellipsis lg:w-2/3">
|
||||
<p class="text-white text-clip">
|
||||
<pre style="white-space: pre-wrap;" class="text-clip break-wordsw-full h-full"><br>
|
||||
<% if(typeof users.biography !== 'undefined') { %>
|
||||
<% if(typeof users.biography != 'undefined') { %>
|
||||
<%= users.biography %>
|
||||
<% } else { %>
|
||||
User Has No biography
|
||||
|
||||
Reference in new issue
Block a user