diff --git a/.gitignore b/.gitignore index d373e258..e3f61b55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /inventory/* !/inventory/.gitkeep !/inventory/host_vars/.gitkeep +/roles/*/files/scratchpad diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f5f62f4..32153869 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +# 2020-02-26 + +## Riot-web themes are here + +The playbook now makes it easy to install custom riot-web themes. + +To learn more, take a look at our [riot-web documentation on Themes](docs/configuring-playbook-riot-web.md#themes). + + +# 2020-02-24 + +## Customize the server name in Riot's login page + +You can now customize the server name string that Riot-web displays in its login page. + +These playbook variables, with these default values, have been added: + +``` +matrix_riot_web_default_server_name: "{{ matrix_domain }}" +``` + +The login page previously said "Sign in to your Matrix account on matrix.example.org" (the homeserver's domain name). It will now say "Sign in ... on example.org" (the server name) by default, or "Sign in ... on Our Server" if you set the variable to "Our Server". + +To support this, the config.json template is changed to use the configuration key `default_server_config` for setting the default HS/IS, and the new configuration key `server_name` is added in there. + + # 2020-01-30 ## Disabling TLSv1.1 diff --git a/docs/configuring-playbook-bridge-appservice-webhooks.md b/docs/configuring-playbook-bridge-appservice-webhooks.md index 0e355359..a4851146 100644 --- a/docs/configuring-playbook-bridge-appservice-webhooks.md +++ b/docs/configuring-playbook-bridge-appservice-webhooks.md @@ -28,18 +28,18 @@ matrix_appservice_webhooks_log_level: '' 4. If you're using the [Dimension Integration Manager](configuring-playbook-dimension.md), you can configure the Webhooks bridge by opening the Dimension integration manager -> Settings -> Bridges and selecting edit action for "Webhook Bridge". Press "Add self-hosted Bridge" button and populate "Provisioning URL" & "Shared Secret" values from `/matrix/appservice-webhooks/config/config.yaml` file's homeserver URL value and provisioning secret value, respectively. -4. Invite the bridge bot user to your room: +5. Invite the bridge bot user to your room: - either with `/invite @_webhook:` (*Note*: Make sure you have administration permissions in your room) - or simply add the bridge bot to a private channel (personal channels imply you being an administrator) -5. Send a message to the bridge bot in order to receive a private message including the webhook link. +6. Send a message to the bridge bot in order to receive a private message including the webhook link. ``` !webhook ``` -6. The JSON body for posting messages will have to look like this: +7. The JSON body for posting messages will have to look like this: ```json { "text": "Hello world!", diff --git a/docs/configuring-playbook-riot-web.md b/docs/configuring-playbook-riot-web.md index af8e2175..11907308 100644 --- a/docs/configuring-playbook-riot-web.md +++ b/docs/configuring-playbook-riot-web.md @@ -27,3 +27,14 @@ Alternatively, **if there is no pre-defined variable** for a riot-web setting yo - or, you can **extend and override the default configuration** ([`config.json.j2`](../roles/matrix-riot-web/templates/config.json.j2)) by making use of the `matrix_riot_web_configuration_extension_json_` variable. You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml). - or, if extending the configuration is still not powerful enough for your needs, you can **override the configuration completely** using `matrix_riot_web_configuration_default` (or `matrix_riot_web_configuration`). You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml). + + +## Themes + +To change the look of riot-web, you can define your own themes manually by using the `matrix_riot_web_settingDefaults_custom_themes` setting. + +Or better yet, you can automatically pull it all themes provided by the [aaronraimist/riot-web-themes](https://github.com/aaronraimist/riot-web-themes) project by simply flipping a flag (`matrix_riot_web_themes_enabled: true`). + +If you make your own theme, we encourage you to submit it to the **aaronraimist/riot-web-themes** project, so that the whole community could easily enjoy it. + +Note that for a custom theme to work well, all riot-web/riot-desktop instances that you use must have the same theme installed. diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 148382fa..51365d74 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -72,7 +72,7 @@ matrix_appservice_webhooks_enabled: false # Normally, matrix-nginx-proxy is enabled and nginx can reach matrix-appservice-webhooks over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose # matrix-appservice-webhooks' client-server port to the local host. -matrix_appservice_webhooks_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:{{ matrix_appservice_webhooks_webhooks_port }}' }}" +matrix_appservice_webhooks_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:{{ matrix_appservice_webhooks_matrix_port }}' }}" matrix_appservice_webhooks_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'webhook.as.token') | to_uuid }}" @@ -106,7 +106,7 @@ matrix_appservice_slack_enabled: false # Normally, matrix-nginx-proxy is enabled and nginx can reach matrix-appservice-slack over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose # matrix-appservice-slack's client-server port to the local host. -matrix_appservice_slack_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:{{ matrix_appservice_slack_slack_port }}' }}" +matrix_appservice_slack_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else ('127.0.0.1:' ~ matrix_appservice_slack_slack_port) }}" matrix_appservice_slack_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'slack.as.token') | to_uuid }}" diff --git a/roles/matrix-bridge-appservice-webhooks/defaults/main.yml b/roles/matrix-bridge-appservice-webhooks/defaults/main.yml index 09daa22b..1b2c9940 100644 --- a/roles/matrix-bridge-appservice-webhooks/defaults/main.yml +++ b/roles/matrix-bridge-appservice-webhooks/defaults/main.yml @@ -21,9 +21,8 @@ matrix_appservice_webhooks_user_prefix: '_webhook' # Controls the webhooks_PORT and MATRIX_PORT of the installation matrix_appservice_webhooks_matrix_port: 6789 -matrix_appservice_webhooks_webhooks_port: 6788 -# Controls whether the appservice-webhooks container exposes its HTTP port (tcp/6788 in the container). +# Controls whether the appservice-webhooks container exposes its HTTP port (tcp/6789 in the container). # # Takes an ":" or "" value (e.g. "127.0.0.1:9999"), or empty string to not expose. matrix_appservice_webhooks_container_http_host_bind_port: '' diff --git a/roles/matrix-bridge-appservice-webhooks/templates/systemd/matrix-appservice-webhooks.service.j2 b/roles/matrix-bridge-appservice-webhooks/templates/systemd/matrix-appservice-webhooks.service.j2 index f83e7346..cde798df 100644 --- a/roles/matrix-bridge-appservice-webhooks/templates/systemd/matrix-appservice-webhooks.service.j2 +++ b/roles/matrix-bridge-appservice-webhooks/templates/systemd/matrix-appservice-webhooks.service.j2 @@ -23,7 +23,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-appservice-webhooks \ --cap-drop=ALL \ --network={{ matrix_docker_network }} \ {% if matrix_appservice_webhooks_container_http_host_bind_port %} - -p {{ matrix_appservice_webhooks_container_http_host_bind_port }}:{{matrix_appservice_webhooks_webhooks_port}} \ + -p {{ matrix_appservice_webhooks_container_http_host_bind_port }}:{{matrix_appservice_webhooks_matrix_port}} \ {% endif %} -v {{ matrix_appservice_webhooks_config_path }}:/config:z \ -v {{ matrix_appservice_webhooks_data_path }}:/data:z \ diff --git a/roles/matrix-postgres/defaults/main.yml b/roles/matrix-postgres/defaults/main.yml index 961aa081..91656ff6 100644 --- a/roles/matrix-postgres/defaults/main.yml +++ b/roles/matrix-postgres/defaults/main.yml @@ -30,4 +30,4 @@ matrix_postgres_container_extra_arguments: [] # Takes an ":" or "" value (e.g. "127.0.0.1:5432"), or empty string to not expose. matrix_postgres_container_postgres_bind_port: "" -matrix_postgres_tool_synapse_janitor: "https://raw.githubusercontent.com/xwiki-labs/synapse_scripts/0b3f035951932ceb396631de3fc701043b9723bc/synapse_janitor.sql" +matrix_postgres_tool_synapse_janitor: "https://raw.githubusercontent.com/xwiki-labs/synapse_scripts/a9188ff175ae581610f92d58ea6eac9a114d854b/synapse_janitor.sql" diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index 05f6b796..e707a61a 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -1,6 +1,6 @@ matrix_riot_web_enabled: true -matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.10" +matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.12" matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}" matrix_riot_web_data_path: "{{ matrix_base_data_path }}/riot-web" @@ -17,6 +17,7 @@ matrix_riot_web_container_extra_arguments: [] matrix_riot_web_systemd_required_services_list: ['docker.service'] # Riot config.json customizations +matrix_riot_web_default_server_name: "{{ matrix_domain }}" matrix_riot_web_default_hs_url: "" matrix_riot_web_default_is_url: ~ matrix_riot_web_disable_custom_urls: true @@ -31,6 +32,25 @@ matrix_riot_web_welcome_user_id: "@riot-bot:matrix.org" # Branding of riot web matrix_riot_web_brand: "Riot" +# URL to Logo on welcome page +matrix_riot_web_welcome_logo: "welcome/images/logo.svg" + +# URL of link on welcome image +matrix_riot_web_welcome_logo_link: "https://riot.im" + +matrix_riot_web_welcome_headline: "_t('Welcome to Riot.im')" +matrix_riot_web_welcome_text: "_t('Decentralised, encrypted chat & collaboration powered by [matrix]')" + +# Links, shown in footer of welcome page: +# [{"text": "Link text", "url": "https://link.target"}, {"text": "Other link"}] +matrix_riot_web_branding_authFooterLinks: ~ + +# URL to image, shown during Login +matrix_riot_web_branding_authHeaderLogoUrl: "{{ matrix_riot_web_welcome_logo }}" + +# URL to Wallpaper, shown in background of welcome page +matrix_riot_web_branding_welcomeBackgroundUrl: ~ + # By default, there's no Riot homepage (when logged in). If you wish to have one, # point this to a `home.html` template file on your local filesystem. matrix_riot_web_embedded_pages_home_path: ~ @@ -44,6 +64,21 @@ matrix_riot_web_registration_enabled: false # Controls whether Riot shows the presence features matrix_riot_web_enable_presence_by_hs_url: ~ +# Controls whether custom riot-web themes will be installed. +# When enabled, all themes found in the `matrix_riot_web_themes_repository_url` repository +# will be installed and enabled automatically. +matrix_riot_web_themes_enabled: false +matrix_riot_web_themes_repository_url: https://github.com/aaronraimist/riot-web-themes + +# Controls the `settingsDefault.custom_themes` setting of the riot-web configuration. +# You can use this setting to define custom themes. +# +# Also, look at `matrix_riot_web_themes_enabled` for a way to pull in a bunch of custom themes automatically. +# If you define your own themes here and set `matrix_riot_web_themes_enabled: true`, your themes will be preserved as well. +# +# Note that for a custom theme to work well, all riot-web/riot-desktop instances that you use must have the same theme installed. +matrix_riot_web_settingDefaults_custom_themes: [] + # Default riot-web configuration template which covers the generic use case. # You can customize it by controlling the various variables inside it. # diff --git a/roles/matrix-riot-web/tasks/main.yml b/roles/matrix-riot-web/tasks/main.yml index 5792517e..a5b4aff5 100644 --- a/roles/matrix-riot-web/tasks/main.yml +++ b/roles/matrix-riot-web/tasks/main.yml @@ -8,6 +8,12 @@ - setup-all - setup-riot-web +- import_tasks: "{{ role_path }}/tasks/prepare_riot_web_themes.yml" + when: run_setup|bool + tags: + - setup-all + - setup-riot-web + - import_tasks: "{{ role_path }}/tasks/setup_riot_web.yml" when: run_setup|bool tags: diff --git a/roles/matrix-riot-web/tasks/prepare_riot_web_themes.yml b/roles/matrix-riot-web/tasks/prepare_riot_web_themes.yml new file mode 100644 index 00000000..4171db3a --- /dev/null +++ b/roles/matrix-riot-web/tasks/prepare_riot_web_themes.yml @@ -0,0 +1,48 @@ +--- + +# +# Tasks related to setting up riot-web themes +# + +- block: + - name: Ensure riot-web themes repository is pulled + git: + repo: "{{ matrix_riot_web_themes_repository_url }}" + dest: "{{ role_path }}/files/scratchpad/riot-web-themes" + + - name: Find all riot-web theme files + find: + paths: "{{ role_path }}/files/scratchpad/riot-web-themes" + patterns: "*.json" + recurse: true + register: matrix_riot_web_theme_file_list + + - name: Read riot-web theme + slurp: + path: "{{ item.path }}" + register: "matrix_riot_web_theme_file_contents" + with_items: "{{ matrix_riot_web_theme_file_list.files }}" + + - name: Load riot-web theme + set_fact: + matrix_riot_web_settingDefaults_custom_themes: "{{ matrix_riot_web_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}" + with_items: "{{ matrix_riot_web_theme_file_contents.results }}" + + run_once: true + delegate_to: 127.0.0.1 + become: false + when: matrix_riot_web_themes_enabled|bool + + +# # +# # Tasks related to getting rid of riot-web themes (if it was previously enabled) +# # + +- name: Ensure riot-web themes repository is removed + file: + path: "{{ role_path }}/files/scratchpad/riot-web-themes" + state: absent + run_once: true + delegate_to: 127.0.0.1 + become: false + when: "not matrix_riot_web_themes_enabled|bool" diff --git a/roles/matrix-riot-web/templates/config.json.j2 b/roles/matrix-riot-web/templates/config.json.j2 index 69fb1393..b82d53e0 100644 --- a/roles/matrix-riot-web/templates/config.json.j2 +++ b/roles/matrix-riot-web/templates/config.json.j2 @@ -1,6 +1,16 @@ { - "default_hs_url": {{ matrix_riot_web_default_hs_url|string|to_json }}, - "default_is_url": {{ matrix_riot_web_default_is_url|string|to_json }}, + "default_server_config": { + "m.homeserver": { + "base_url": {{ matrix_riot_web_default_hs_url|string|to_json }}, + "server_name": {{ matrix_riot_web_default_server_name|string|to_json }} + }, + "m.identity_server": { + "base_url": {{ matrix_riot_web_default_is_url|string|to_json }} + } + }, + "settingDefaults": { + "custom_themes": {{ matrix_riot_web_settingDefaults_custom_themes|to_json }} + }, "disable_custom_urls": {{ matrix_riot_web_disable_custom_urls|to_json }}, "disable_guests": {{ matrix_riot_web_disable_guests|to_json }}, "brand": {{ matrix_riot_web_brand|to_json }}, @@ -19,5 +29,10 @@ {% endif %} "embeddedPages": { "homeUrl": {{ matrix_riot_web_embedded_pages_home_url|string|to_json }} + }, + "branding": { + "authFooterLinks": {{ matrix_riot_web_branding_authFooterLinks|to_json }}, + "authHeaderLogoUrl": {{ matrix_riot_web_branding_authHeaderLogoUrl|to_json }}, + "welcomeBackgroundUrl": {{ matrix_riot_web_branding_welcomeBackgroundUrl|to_json }} } } diff --git a/roles/matrix-riot-web/templates/welcome.html.j2 b/roles/matrix-riot-web/templates/welcome.html.j2 index 319f9795..48a0f532 100644 --- a/roles/matrix-riot-web/templates/welcome.html.j2 +++ b/roles/matrix-riot-web/templates/welcome.html.j2 @@ -153,11 +153,11 @@ h1::after {