From 1b67a25800274ede5a1bc2314129f46483755954 Mon Sep 17 00:00:00 2001 From: niansa Date: Tue, 23 Mar 2021 14:37:14 +0100 Subject: [PATCH 1/2] Added customizability --- CMakeLists.txt | 17 +++++++++++------ bots.sql | 6 +++--- customstatic/.gitignore | 0 views/authsuccess.csp | 5 +++-- views/botdetail.csp | 5 +++-- views/botedit.csp | 5 +++-- views/botlist.csp | 5 +++-- views/botregister.csp | 5 +++-- 8 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 customstatic/.gitignore diff --git a/CMakeLists.txt b/CMakeLists.txt index 934abf2..64e7f19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,12 +60,17 @@ target_sources(${PROJECT_NAME} # uncomment the following line for dynamically loading views # set_property(TARGET ${PROJECT_NAME} PROPERTY ENABLE_EXPORTS ON) -file(GLOB files "static/*") -foreach(file ${files}) - get_filename_component(filename "${file}" NAME) - message("${file}: ${filename}") - configure_file("${file}" "./${filename}" COPYONLY) -endforeach() +function(staticinc dir) + file(GLOB files "${dir}/*") + foreach(file ${files}) + get_filename_component(filename "${file}" NAME) + message("${file}: ${filename}") + configure_file("${file}" "./${filename}" COPYONLY) + endforeach() +endfunction() + +staticinc(static) +staticinc(customstatic) find_package(PkgConfig REQUIRED) pkg_check_modules(format REQUIRED IMPORTED_TARGET fmt) diff --git a/bots.sql b/bots.sql index bc8481f..465b8bb 100644 --- a/bots.sql +++ b/bots.sql @@ -21,7 +21,7 @@ SET default_tablespace = ''; SET default_table_access_method = heap; -- --- Name: bots; Type: TABLE; Schema: public; Owner: nils +-- Name: bots; Type: TABLE; Schema: public; Owner: zdqulpzc -- CREATE TABLE public.bots ( @@ -40,10 +40,10 @@ CREATE TABLE public.bots ( ); -ALTER TABLE public.bots OWNER TO nils; +ALTER TABLE public.bots OWNER TO zdqulpzc; -- --- Data for Name: bots; Type: TABLE DATA; Schema: public; Owner: nils +-- Data for Name: bots; Type: TABLE DATA; Schema: public; Owner: zdqulpzc -- COPY public.bots (name, short_description, long_description, avatar_url, owner, support_server, prefix, owner_id, app_id, votes, approved) FROM stdin; diff --git a/customstatic/.gitignore b/customstatic/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/views/authsuccess.csp b/views/authsuccess.csp index 095d4f2..cc29294 100644 --- a/views/authsuccess.csp +++ b/views/authsuccess.csp @@ -1,9 +1,10 @@ -<%inc#include "controllers/views.h" %> +<%inc#include "controllers/views.h" +#include "config.h" %> <%c++ auto sessionData = @@.get("sessionData");%> <%layout global_layout%> -Authentication success - DFB +Authentication success - {%SHORT_NAME%}

Authenticated as: {%sessionData->discord_fullname()%}

diff --git a/views/botdetail.csp b/views/botdetail.csp index 3c4f29a..71b8603 100644 --- a/views/botdetail.csp +++ b/views/botdetail.csp @@ -1,4 +1,5 @@ -<%inc#include "controllers/views.h" %> +<%inc#include "controllers/views.h" +#include "config.h" %> <%c++ auto bot = @@.get("bot");%> <%c++ auto canVote = @@.get("canVote");%> <%c++ auto owner = @@.get("owner");%> @@ -6,7 +7,7 @@ <%layout global_layout%> -{%bot.name%} - DFB +{%bot.name%} - {%SHORT_NAME%}
diff --git a/views/botedit.csp b/views/botedit.csp index 7f867bc..970b648 100644 --- a/views/botedit.csp +++ b/views/botedit.csp @@ -1,8 +1,9 @@ -<%inc#include "controllers/views.h" %> +<%inc#include "controllers/views.h" +#include "config.h" %> <%c++ auto bot = @@.get("bot");%> <%layout global_layout%> -Editing a bot - DFB +Editing a bot - {%SHORT_NAME%}
diff --git a/views/botlist.csp b/views/botlist.csp index e63edfd..8a6c39f 100644 --- a/views/botlist.csp +++ b/views/botlist.csp @@ -1,9 +1,10 @@ -<%inc#include "controllers/views.h" %> +<%inc#include "controllers/views.h" +#include "config.h" %> <%c++ auto modView = @@.get("modView");%> <%c++ auto justMine = @@.get("justMine");%> <%layout global_layout%> -DFB +{%SHORT_NAME%}
diff --git a/views/botregister.csp b/views/botregister.csp index 7684e23..5fab5bd 100644 --- a/views/botregister.csp +++ b/views/botregister.csp @@ -1,9 +1,10 @@ -<%inc#include "controllers/views.h" %> +<%inc#include "controllers/views.h" +#include "config.h" %> <%c++ auto sessionData = @@.get("sessionData");%> <%c++ auto error = @@.get("error");%> <%layout global_layout%> -Registering a bot - DFB +Registering a bot - {%SHORT_NAME%}
From cfddb2ebe498096c90e292d6aebf258bea6bcd2c Mon Sep 17 00:00:00 2001 From: niansa Date: Tue, 23 Mar 2021 15:56:43 +0100 Subject: [PATCH 2/2] Further customizability --- views/botlist.csp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/botlist.csp b/views/botlist.csp index 8a6c39f..d053893 100644 --- a/views/botlist.csp +++ b/views/botlist.csp @@ -8,8 +8,8 @@
-

Discordlist for Bots

-

Find a lot of bots that will be useful to your server

+

{%LONG_NAME%}

+

{%DESCRIPTION%}

<%c++ if (@@.get("authed")) {%> <%c++ if (justMine or modView) {%> All bots