From 723d7ed2508d386fc4605fafbcec6843d98d07d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Sun, 16 Jan 2022 14:14:42 +0100 Subject: [PATCH] __matrix_element: add more branding parameters --- type/__matrix_element/files/config.json.sh | 10 +++++++--- type/__matrix_element/man.rst | 10 ++++++++++ type/__matrix_element/manifest | 19 +++++++++++++++---- .../default/branding_welcome_background_url | 1 + .../parameter/default/identity_server | 0 type/__matrix_element/parameter/optional | 1 + 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 type/__matrix_element/parameter/default/branding_welcome_background_url create mode 100644 type/__matrix_element/parameter/default/identity_server diff --git a/type/__matrix_element/files/config.json.sh b/type/__matrix_element/files/config.json.sh index 30ba9e7..fa30cda 100755 --- a/type/__matrix_element/files/config.json.sh +++ b/type/__matrix_element/files/config.json.sh @@ -34,12 +34,12 @@ EOF if [ "$BRANDING_AUTH_FOOTER_LINKS" != "" ]; then cat << EOF - "authFooterLinks": "$BRANDING_AUTH_FOOTER_LINKS", + "authFooterLinks": $BRANDING_AUTH_FOOTER_LINKS, EOF fi cat << EOF - "welcomeBackgroundUrl": "themes/element/img/backgrounds/lake.jpg" + "welcomeBackgroundUrl": "$BRANDING_WELCOME_BACKGROUND_URL" EOF echo '},' } @@ -85,6 +85,10 @@ cat << EOF "url": "$COOKIE_POLICY_URL", "text": "Cookie Policy" } - ] + ], + "embeddedPages": { + "welcomeUrl": "$WELCOME_PAGE_URL", + "homeUrl": "$HOME_PAGE_URL" + } } EOF diff --git a/type/__matrix_element/man.rst b/type/__matrix_element/man.rst index c91379f..0d748a3 100644 --- a/type/__matrix_element/man.rst +++ b/type/__matrix_element/man.rst @@ -39,6 +39,16 @@ owner brand Web UI branding, defaults to 'Element'. +branding_auth_header_logo_url + A logo image that is shown in the header during authentication flows. + +branding_welcome_background_url + An image to use as a wallpaper outside the app during authentication flows. If an array is passed, an image is chosen randomly for each visit. + +branding_auth_footer_links + a list of links to show in the authentication page footer: `[{"text": "Link + text", "url": "https://link.target"}, {"text": "Other link", ...}]` + default_country_code ISO 3166 alpha2 country code to use when showing country selectors, such as phone number inputs. Defaults to GB. diff --git a/type/__matrix_element/manifest b/type/__matrix_element/manifest index 292cefd..fe937c5 100755 --- a/type/__matrix_element/manifest +++ b/type/__matrix_element/manifest @@ -31,6 +31,7 @@ export DEFAULT_COUNTRY_CODE=$(cat "$__object/parameter/default_country_code") export ROOM_DIRECTORY_SERVERS=$(cat "$__object/parameter/room_directory_servers") export PRIVACY_POLICY_URL=$(cat "$__object/parameter/privacy_policy_url") export COOKIE_POLICY_URL=$(cat "$__object/parameter/cookie_policy_url") +export BRANDING_WELCOME_BACKGROUND_URL=$(cat "$__object/parameter/branding_welcome_background_url") if [ -f "$__object/parameter/jitsi_domain" ]; then export JITSI_DOMAIN=$(cat "$__object/parameter/jitsi_domain") @@ -45,14 +46,24 @@ if [ -f "$__object/parameter/branding_auth_footer_links" ]; then fi if [ -f "$__object/parameter/homepage" ]; then - export EMBED_HOMEPAGE=1 homepage=$(cat "$__object/parameter/homepage") + if [ -f "$homepage" ]; then + upload_homepage=1 + else + export HOME_PAGE_URL=$homepage + fi fi +WELCOME_PAGE_URL="welcome.html" if [ -f "$__object/parameter/welcomepage" ]; then - export EMBED_WELCOMEPAGE=1 welcomepage=$(cat "$__object/parameter/welcomepage") + if [ -f welcomepage ]; then + export UPLOAD_WELCOMEPAGE=1 + else + WELCOME_PAGE_URL=$welcomepage + fi fi +export WELCOME_PAGE_URL if [ -f "$__object/parameter/custom_asset" ]; then "$__object/parameter/custom_asset" | while IFS= read -r file; do @@ -92,14 +103,14 @@ require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/config.json" --mode 0664 \ --state present -if [ $EMBED_HOMEPAGE ]; then +if [ $upload_homepage ]; then require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/home.html" \ --source "$homepage" \ --mode 0664 \ --state present fi -if [ $EMBED_WELCOMEPAGE ]; then +if [ $upload_welcomepage ]; then require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/welcome.html" \ --source "$welcomepage" \ --mode 0664 \ diff --git a/type/__matrix_element/parameter/default/branding_welcome_background_url b/type/__matrix_element/parameter/default/branding_welcome_background_url new file mode 100644 index 0000000..5f5acef --- /dev/null +++ b/type/__matrix_element/parameter/default/branding_welcome_background_url @@ -0,0 +1 @@ +themes/element/img/backgrounds/lake.jpg diff --git a/type/__matrix_element/parameter/default/identity_server b/type/__matrix_element/parameter/default/identity_server new file mode 100644 index 0000000..e69de29 diff --git a/type/__matrix_element/parameter/optional b/type/__matrix_element/parameter/optional index 65a142b..2830f81 100644 --- a/type/__matrix_element/parameter/optional +++ b/type/__matrix_element/parameter/optional @@ -12,3 +12,4 @@ welcomepage jitsi_domain branding_auth_header_logo_url branding_auth_footer_links +branding_welcome_background_url