From 57bfb970a997f54653386f87810378f38cbec3f7 Mon Sep 17 00:00:00 2001 From: anadahz Date: Tue, 11 Dec 2018 13:48:54 +0000 Subject: [PATCH] Enable support for custom HTML in riot-web homepage * Add default template file for homepage HTML * Add default riot-web config options for homepage --- roles/matrix-server/defaults/main.yml | 11 + .../tasks/setup/setup_riot_web.yml | 9 +- .../templates/riot-web/home.html.j2 | 308 ++++++++++++++++++ .../systemd/matrix-riot-web.service.j2 | 1 + 4 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 roles/matrix-server/templates/riot-web/home.html.j2 diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index c85ae796..4e40df27 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -323,6 +323,17 @@ matrix_riot_web_roomdir_servers: ['matrix.org'] matrix_riot_web_welcome_user_id: "@riot-bot:matrix.org" +# Riot home.html customizations +# Default home.html template file +matrix_riot_web_homepage_template: "{{ role_path }}/templates/riot-web/home.html.j2" +# Show general discussion about Matrix and Riot row +matrix_riot_web_homepage_template_general: true +# Show Matrix technical discussions row +matrix_riot_web_homepage_template_technical: true +# Show building services on Matrix row +matrix_riot_web_homepage_template_building: true +# Show contributing code to Matrix and Riot row +matrix_riot_web_homepage_template_contributing: true # Matrix mautrix is a Matrix <-> Telegram bridge # Enable telegram bridge diff --git a/roles/matrix-server/tasks/setup/setup_riot_web.yml b/roles/matrix-server/tasks/setup/setup_riot_web.yml index dad384c1..60b1cdcd 100644 --- a/roles/matrix-server/tasks/setup/setup_riot_web.yml +++ b/roles/matrix-server/tasks/setup/setup_riot_web.yml @@ -20,14 +20,15 @@ - name: Ensure Matrix riot-web configured template: - src: "{{ role_path }}/templates/riot-web/{{ item }}.j2" - dest: "{{ matrix_riot_web_data_path }}/{{ item }}" + src: "{{ item.src }}" + dest: "{{ matrix_riot_web_data_path }}/{{ item.name }}" mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" with_items: - - "riot.im.conf" - - "config.json" + - {src: "{{ role_path }}/templates/riot-web/riot.im.conf.j2", name: "riot.im.conf"} + - {src: "{{ role_path }}/templates/riot-web/config.json.j2", name: "config.json"} + - {src: "{{ matrix_riot_web_homepage_template }}", name: "home.html"} when: matrix_riot_web_enabled - name: Ensure matrix-riot-web.service installed diff --git a/roles/matrix-server/templates/riot-web/home.html.j2 b/roles/matrix-server/templates/riot-web/home.html.j2 new file mode 100644 index 00000000..8f191caa --- /dev/null +++ b/roles/matrix-server/templates/riot-web/home.html.j2 @@ -0,0 +1,308 @@ + + +
+
+ +
+

_t("Welcome to {{ hostname_riot }}")

+

_t("Decentralised, encrypted chat & collaboration powered by [matrix]")

+
+
+
+
+
+

_t("Search the room directory")

+ + + + + _t("Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!") + +
+
+{% if matrix_riot_web_welcome_user_id %} +
+
+

_t("Chat with Riot Bot")

+ + + + + _t("Get started with some tips from Riot Bot!") + +
+
+{% endif %} +
+{% if matrix_riot_web_homepage_template_general %} + +

_t("General discussion about Matrix and Riot")

+ +
+
+ + + Matrix HQ + + _t("Discussion of all things Matrix!") +
+
+ + + Riot + + _t("Riot/Web & Desktop chat") +
+
+ + + #riot-ios + + _t("Riot/iOS & matrix-ios-sdk chat") +
+
+ + + #riot-android + + _t("Riot/Android & matrix-android-sdk chat") +
+
+{% endif %} +{% if matrix_riot_web_homepage_template_technical %} + +

_t("Matrix technical discussions")

+

_t("Running Matrix services")

+ +
+
+ + + Matrix Docker Ansible Deploy + + _t("Support for Matrix Docker Ansible role") +
+
+ + + Synapse Support Community + + _t("Community-run support for Synapse") +
+
+ + + #dendrite:matrix.org + + _t("Admin support for Dendrite") +
+
+ + + Synapse Homeowners + + _t("Announcements about Synapse releases") +
+
+ + + IRC Matrix Bridges + + _t("Support for those using and running matrix-appservice-irc") +
+
+{% endif %} +{% if matrix_riot_web_homepage_template_building %} + +

_t("Building services on Matrix")

+ +
+
+ + + #matrix-dev:matrix.org + + _t("Support for those using the Matrix spec") +
+
+ + + End-to-end crypto in Matrix + + _t("Design and implementation of E2E in Matrix") +
+
+ + + #vr:matrix.org + + _t("Implementing VR services with Matrix") +
+
+ + + #webrtc:matrix.org + + _t("Implementing VoIP services with Matrix") +
+
+ + + Matrix Identity + + _t("Discussion of the Identity Service API") +
+
+ + + Matrix Bridging + + _t("Support for those using, running and writing other bridges") +
+
+{% endif %} +{% if matrix_riot_web_homepage_template_contributing %} +

_t("Contributing code to Matrix and Riot")

+ +
+
+ + + #riot-dev + + _t("Dev chat for the Riot/Web dev team") +
+
+ + + #dendrite-dev + + _t("Dev chat for the Dendrite dev team") +
+
+ + + Riot Translations + + _t("Co-ordination for Riot translators") +
+
+{% endif %} +
diff --git a/roles/matrix-server/templates/systemd/matrix-riot-web.service.j2 b/roles/matrix-server/templates/systemd/matrix-riot-web.service.j2 index 3573c0d5..806402d5 100644 --- a/roles/matrix-server/templates/systemd/matrix-riot-web.service.j2 +++ b/roles/matrix-server/templates/systemd/matrix-riot-web.service.j2 @@ -11,6 +11,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-riot-web \ --log-driver=none \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ -v {{ matrix_riot_web_data_path }}/config.json:/riot-web/webapp/config.json:ro \ + -v {{ matrix_riot_web_data_path }}/home.html:/riot-web/webapp/home.html:ro \ -v {{ matrix_riot_web_data_path }}/riot.im.conf:/data/riot.im.conf:ro \ --network={{ matrix_docker_network }} \ {% if not matrix_nginx_proxy_enabled %}