mirror of
https://gitlab.com/niansa/discordlistforbots.git
synced 2025-03-06 20:49:22 +01:00
Added layout
This commit is contained in:
parent
34c3e3cd3d
commit
459be65c27
7 changed files with 123 additions and 150 deletions
|
@ -55,6 +55,7 @@ std::string htmlEsc(const std::string& src) {
|
|||
case '>': fres << ">"; break;
|
||||
case '&': fres << "&"; break;
|
||||
case '"': fres << """; break;
|
||||
case '\n': fres << "<br>"; break;
|
||||
default: fres << character;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
<%c++ auto fullname = @@.get<std::string>("fullname");%>
|
||||
<%layout global_layout%>
|
||||
|
||||
<meta http-equiv = "refresh" content = "2; url = /" />
|
||||
<title>Authentication success - DFB</title>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<meta http-equiv = "refresh" content = "2; url = /" />
|
||||
<title>Authentication success - DFB</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<p class="title text-center">Authenticated as: {%fullname%}</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<div class="container">
|
||||
<p class="title text-center">Authenticated as: {%fullname%}</p>
|
||||
</div>
|
||||
|
|
|
@ -4,67 +4,58 @@
|
|||
<%c++ auto canVote = @@.get<bool>("canVote");%>
|
||||
<%c++ auto owner = @@.get<bool>("owner");%>
|
||||
<%c++ auto modView = @@.get<bool>("modView");%>
|
||||
<%layout global_layout%>
|
||||
|
||||
<link rel="stylesheet" href="/botdetail.css">
|
||||
<title>{%bot.name%} - DFB</title>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<div class="container">
|
||||
<h1 class="text text-center"></h1>
|
||||
<div class="bot-flex">
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<link rel="stylesheet" href="/botdetail.css">
|
||||
<title>{%bot.name%} - DFB</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="text text-center"></h1>
|
||||
<div class="bot-flex">
|
||||
|
||||
<img class="bot-image" src="{%bot.avatar_url%}"></img>
|
||||
<div class="bot-text text text-center title">
|
||||
{%bot.name%}
|
||||
</div>
|
||||
<%c++ if (owner or modView) {%>
|
||||
<div class="actionsWrapper actions">
|
||||
<a class="special-button" href="edit" style="background-color:yellow;color:black;">Edit</a>
|
||||
<a class="special-button" href="delete" style="background-color:red;color:black;">Delete</a>
|
||||
</div>
|
||||
<%c++ if (modView) {%>
|
||||
<div class="actionsWrapper actions">
|
||||
<a class="special-button" href="approve" style="background-color:green;color:white;">Approve</a>
|
||||
<a class="special-button" href="decline" style="background-color:black;color:white;">Decline</a>
|
||||
</div>
|
||||
<%c++ }%>
|
||||
<%c++ }%>
|
||||
<img class="bot-image" src="{%bot.avatar_url%}"></img>
|
||||
<div class="bot-text text text-center title">
|
||||
{%bot.name%}
|
||||
</div>
|
||||
<%c++ if (owner or modView) {%>
|
||||
<div class="actionsWrapper actions">
|
||||
<a class="special-button" href="https://discord.com/oauth2/authorize?client_id={%bot_id%}&permissions=8&scope=applications.commands%20bot">Invite</a>
|
||||
<a class="special-button" {%(canVote?"href='vote'":"style='color:grey;'")%}>Vote <b>{%bot.votes%}</b></a>
|
||||
<a class="special-button" href="edit" style="background-color:yellow;color:black;">Edit</a>
|
||||
<a class="special-button" href="delete" style="background-color:red;color:black;">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<br>
|
||||
<div class="text long-description">
|
||||
{%bot.long_description%}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="text overview">
|
||||
<h2>Overview</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="overview-key">Prefix</td>
|
||||
<td class="overview-value">{%bot.prefix%}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="overview-key">Owner</td>
|
||||
<td class="overview-value">{%bot.owner%}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<a class="special-button" style="margin:0px;" href="https://discord.gg/{%bot.support_server%}">Support Server</a>
|
||||
<%c++ if (modView) {%>
|
||||
<div class="actionsWrapper actions">
|
||||
<a class="special-button" href="approve" style="background-color:green;color:white;">Approve</a>
|
||||
<a class="special-button" href="decline" style="background-color:black;color:white;">Decline</a>
|
||||
</div>
|
||||
<%c++ }%>
|
||||
<%c++ }%>
|
||||
<div class="actionsWrapper actions">
|
||||
<a class="special-button" href="https://discord.com/oauth2/authorize?client_id={%bot_id%}&permissions=8&scope=applications.commands%20bot">Invite</a>
|
||||
<a class="special-button" {%(canVote?"href='vote'":"style='color:grey;'")%}>Vote <b>{%bot.votes%}</b></a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<hr>
|
||||
<br>
|
||||
<div class="text long-description">
|
||||
{%bot.long_description%}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="text overview">
|
||||
<h2>Overview</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="overview-key">Prefix</td>
|
||||
<td class="overview-value">{%bot.prefix%}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="overview-key">Owner</td>
|
||||
<td class="overview-value">{%bot.owner%}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<a class="special-button" style="margin:0px;" href="https://discord.gg/{%bot.support_server%}">Support Server</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,50 +1,43 @@
|
|||
<%inc#include "controllers/views.h" %>
|
||||
<%c++ auto modView = @@.get<bool>("modView");%>
|
||||
<%c++ auto justMine = @@.get<bool>("justMine");%>
|
||||
<%layout global_layout%>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>DFB</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container text-center">
|
||||
<img style="width:15%;height:15%;" src="/logo.png">
|
||||
<p class="title">Discordlist for Bots</p>
|
||||
<p>Find a lot of bots that will be useful to your server</p>
|
||||
<%c++ if (@@.get<bool>("authed")) {%>
|
||||
<%c++ if (justMine) {%>
|
||||
<a class="special-button" href="@all">All bots</a>
|
||||
<%c++ } else {%>
|
||||
<a class="special-button" href="@me">My bots</a>
|
||||
<%c++ }%>
|
||||
<a class="special-button" href="register">Register bot</a>
|
||||
<a class="special-button" href="/discorddeauth">Logout</a>
|
||||
<%c++ } else {%>
|
||||
<a class="special-button" href="/discordauth">Login</a>
|
||||
<title>DFB</title>
|
||||
|
||||
<div class="container text-center">
|
||||
<img style="width:15%;height:15%;" src="/logo.png">
|
||||
<p class="title">Discordlist for Bots</p>
|
||||
<p>Find a lot of bots that will be useful to your server</p>
|
||||
<%c++ if (@@.get<bool>("authed")) {%>
|
||||
<%c++ if (justMine) {%>
|
||||
<a class="special-button" href="@all">All bots</a>
|
||||
<%c++ } else {%>
|
||||
<a class="special-button" href="@me">My bots</a>
|
||||
<%c++ }%>
|
||||
<a class="special-button" href="register">Register bot</a>
|
||||
<a class="special-button" href="/discorddeauth">Logout</a>
|
||||
<%c++ } else {%>
|
||||
<a class="special-button" href="/discordauth">Login</a>
|
||||
<%c++ }%>
|
||||
<hr>
|
||||
<br>
|
||||
<%c++ for (const auto& [bot_id, bot] : @@.get<std::map<uint64_t, Bot>>("bots")) {%>
|
||||
<a class="special-button" href="{%bot_id%}/detail" {%(bot.approved?"":"style='background-color:red;'")%}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{%bot.avatar_url%}" style="width:128px;height:128px;">
|
||||
</td>
|
||||
<td style="padding:10px;">
|
||||
<h1 style="line-height:0px;">{%bot.name%}</h1>
|
||||
<p>{%bot.short_description%}</p>
|
||||
<%c++ if (not bot.approved) {%>
|
||||
<i>Not yet approved</i>
|
||||
<%c++ }%>
|
||||
<hr>
|
||||
<br>
|
||||
<%c++ for (const auto& [bot_id, bot] : @@.get<std::map<uint64_t, Bot>>("bots")) {%>
|
||||
<a class="special-button" href="{%bot_id%}/detail" {%(bot.approved?"":"style='background-color:red;'")%}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{%bot.avatar_url%}" style="width:128px;height:128px;">
|
||||
</td>
|
||||
<td style="padding:10px;">
|
||||
<h1 style="line-height:0px;">{%bot.name%}</h1>
|
||||
<p>{%bot.short_description%}</p>
|
||||
<%c++ if (not bot.approved) {%>
|
||||
<i>Not yet approved</i>
|
||||
<%c++ }%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</a>
|
||||
<%c++ }%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</a>
|
||||
<%c++ }%>
|
||||
</div>
|
||||
|
|
|
@ -1,31 +1,20 @@
|
|||
<%c++ auto owner = @@.get<std::string>("owner");%>
|
||||
<%c++ auto error = @@.get<std::string>("error");%>
|
||||
<%layout global_layout%>
|
||||
|
||||
<title>Registering a bot - DFB</title>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<title>Registering a bot - DFB</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<form action="register" method="POST">
|
||||
<p class="title text-center">Registering a bot</p>
|
||||
<i style="color:red;">{%error%}</i>
|
||||
<p>Client ID</p><input tyep="number" class="special-input maxwidth" name="app_id" maxlength="19" minlength="17" pattern="^[0-9]+$" required>
|
||||
<p>Short description</p><input class="special-input maxwidth" name="short_description" maxlength="80" required>
|
||||
<p>Long description</p><textarea class="special-input maxwidth" name="long_description" style="height:200px;" required></textarea>
|
||||
<p>Prefix</p><input class="special-input maxwidth" name="prefix" maxlength="6" required>
|
||||
<p>Permanent support server invite code</p><input class="special-input maxwidth" name="support_server" maxlength="15" minlength="5" required>
|
||||
<p>Owner</p><input class="special-input maxwidth" value="{%owner%}" autocomplete="off" disabled>
|
||||
<br><br><br>
|
||||
<input type="submit" class="special-button" style="margin:0px;" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<div class="container">
|
||||
<form action="register" method="POST">
|
||||
<p class="title text-center">Registering a bot</p>
|
||||
<i style="color:red;">{%error%}</i>
|
||||
<p>Client ID</p><input tyep="number" class="special-input maxwidth" name="app_id" maxlength="19" minlength="17" pattern="^[0-9]+$" required>
|
||||
<p>Short description</p><input class="special-input maxwidth" name="short_description" maxlength="80" required>
|
||||
<p>Long description</p><textarea class="special-input maxwidth" name="long_description" style="height:200px;" required></textarea>
|
||||
<p>Prefix</p><input class="special-input maxwidth" name="prefix" maxlength="6" required>
|
||||
<p>Permanent support server invite code</p><input class="special-input maxwidth" name="support_server" maxlength="15" minlength="5" required>
|
||||
<p>Owner</p><input class="special-input maxwidth" value="{%owner%}" autocomplete="off" disabled>
|
||||
<br><br><br>
|
||||
<input type="submit" class="special-button" style="margin:0px;" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -6,15 +6,12 @@
|
|||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<title>Exception - DFB</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container text-center">
|
||||
<p class="title text-center">An exception has occured</p>
|
||||
<p>{%message%}</p>
|
||||
</div>
|
||||
<p class="title text-center">An exception has occured</p>
|
||||
<p>{%message%}</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
13
views/global_layout.csp
Normal file
13
views/global_layout.csp
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
[[]]
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Reference in a new issue