From ae50a8b11dbad85cded6058bf56a2e5f434100f6 Mon Sep 17 00:00:00 2001 From: Wingy Date: Mon, 30 Jan 2023 10:55:40 -0500 Subject: [PATCH] Implement custom HTML placement (#78) --- README.md | 6 ++++++ src/config/index.js | 6 +++++- src/views/login.pug | 3 ++- src/views/wishlists.pug | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d6d2f7..bcf2b9f 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,12 @@ TABLE=true SMILE=true # Allow Markdown in item notes. Does not work with TABLE=false. Defaults to false. MARKDOWN=false + +## Custom HTML Snippets +# These are inserted into specific locations in the relevant page +# HTML is not escaped. Don't put untrusted data here. +# CUSTOM_HTML_LOGIN=

Some custom text for the Login page

+# CUSTOM_HTML_WISHLISTS= ``` ## Default Profile Pictures diff --git a/src/config/index.js b/src/config/index.js index 75f22bc..1c732c4 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -16,7 +16,11 @@ module.exports = { bulmaswatch: (process.env.BULMASWATCH || 'default').toLowerCase(), pfp: process.env.PFP !== 'false', language: process.env.LANGUAGE?.toLowerCase() || 'en-us', - guestPassword: process.env.GUEST_PASSWORD + guestPassword: process.env.GUEST_PASSWORD, + customHtml: { + wishlists: process.env.CUSTOM_HTML_WISHLISTS, + login: process.env.CUSTOM_HTML_LOGIN + } } if (module.exports.guestPassword) module.exports.wishlist.public = false diff --git a/src/views/login.pug b/src/views/login.pug index 5c3fc5b..f672210 100644 --- a/src/views/login.pug +++ b/src/views/login.pug @@ -17,4 +17,5 @@ block content .field .control input.button.is-primary(type='submit' value=lang('LOGIN_BUTTON')) - + if _CC.config.customHtml.login + div!= _CC.config.customHtml.login \ No newline at end of file diff --git a/src/views/wishlists.pug b/src/views/wishlists.pug index 732910b..0bb0129 100644 --- a/src/views/wishlists.pug +++ b/src/views/wishlists.pug @@ -44,6 +44,9 @@ block content display: inline-block; } + if _CC.config.customHtml.wishlists + div!= _CC.config.customHtml.wishlists + ul.noStyle.noLeftMargin if req.user._id !== '_CCUNKNOWN' li