| @@ -5581,6 +5581,15 @@ matrix_static_files_file_matrix_client_property_m_tile_server_map_style_url: "{{ | |||||
| matrix_static_files_file_matrix_server_property_m_server: "{{ matrix_server_fqn_matrix_federation }}:{{ matrix_federation_public_port }}" | matrix_static_files_file_matrix_server_property_m_server: "{{ matrix_server_fqn_matrix_federation }}:{{ matrix_federation_public_port }}" | ||||
| # mautrix-manager auto-configuration disabled by default | |||||
| matrix_static_files_file_matrix_mautrix_enabled: false | |||||
| matrix_static_files_file_matrix_mautrix_property_fi_mau_bridges: | |||||
| - "https://bridges.example.com/signal" | |||||
| # TODO populate with enabled bridges | |||||
| matrix_static_files_file_matrix_mautrix_property_fi_mau_external_bridge_servers: | |||||
| [] | |||||
| matrix_static_files_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}" | matrix_static_files_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}" | ||||
| matrix_static_files_self_check_hostname_matrix: "{{ matrix_server_fqn_matrix }}" | matrix_static_files_self_check_hostname_matrix: "{{ matrix_server_fqn_matrix }}" | ||||
| @@ -332,6 +332,65 @@ matrix_static_files_file_matrix_support_configuration: "{{ matrix_static_files_f | |||||
| # # | # # | ||||
| ######################################################################## | ######################################################################## | ||||
| ######################################################################## | |||||
| # # | |||||
| # Related to /.well-known/matrix/mautrix # | |||||
| # # | |||||
| ######################################################################## | |||||
| # Controls whether a `/.well-known/matrix/mautrix` file is generated and used at all. | |||||
| # For details about this file, see mautrix/manager auto-configuration section : https://github.com/mautrix/manager#auto-configuration | |||||
| # | |||||
| # This is not enabled by default, as for it to be useful, other information is necessary. | |||||
| # See `matrix_static_files_file_matrix_mautrix_property_fi_mau_bridges`, `matrix_static_files_file_matrix_mautrix_property_fi_mau_external_bridge_servers`, etc. | |||||
| matrix_static_files_file_matrix_mautrix_enabled: false | |||||
| # Controls the fi.mau.bridges property in the /.well-known/matrix/mautrix file | |||||
| # It indexes local bridges implementing the bridgev2 API | |||||
| # Example entry : https://bridges.example.com/signal | |||||
| matrix_static_files_file_matrix_mautrix_property_fi_mau_bridges: [] | |||||
| # Controls the fi.mau.external_bridge_servers property in the /.well-known/matrix/mautrix file | |||||
| # It indexes remote servers with bridges implementing the bridgev2 API | |||||
| # Example entry : anotherserver.example.org | |||||
| matrix_static_files_file_matrix_mautrix_property_fi_mau_external_bridge_servers: | |||||
| [] | |||||
| # Default /.well-known/matrix/mautrix configuration template which covers the generic use case. | |||||
| # You can customize it by controlling the various variables inside it. | |||||
| # | |||||
| # For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_mautrix_configuration_extension_json`) | |||||
| # or completely replace this variable with your own template. | |||||
| matrix_static_files_file_matrix_mautrix_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/mautrix.j2') }}" | |||||
| # Your custom JSON configuration for /.well-known/matrix/mautrix should go to `matrix_static_files_file_matrix_mautrix_configuration_extension_json`. | |||||
| # This configuration extends the default starting configuration (`matrix_static_files_file_matrix_mautrix_configuration_extension_json`). | |||||
| # | |||||
| # You can override individual variables from the default configuration, or introduce new ones. | |||||
| # | |||||
| # If you need something more special, you can take full control by | |||||
| # completely redefining `matrix_static_files_file_matrix_mautrix_configuration_json`. | |||||
| # | |||||
| # Example configuration extension follows: | |||||
| # | |||||
| # matrix_static_files_file_matrix_mautrix_configuration_extension_json: | | |||||
| # { | |||||
| # "m.another": "value", | |||||
| # "m.yet_another": 3 | |||||
| # } | |||||
| matrix_static_files_file_matrix_mautrix_configuration_extension_json: "{}" | |||||
| matrix_static_files_file_matrix_mautrix_configuration_extension: "{{ matrix_static_files_file_matrix_mautrix_configuration_extension_json | from_json if matrix_static_files_file_matrix_mautrix_configuration_extension_json | from_json is mapping else {} }}" | |||||
| # Holds the final /.well-known/matrix/mautrix configuration (a combination of the default and its extension). | |||||
| # You most likely don't need to touch this variable. Instead, see `matrix_static_files_file_matrix_mautrix_configuration_json` or `matrix_static_files_file_matrix_mautrix_configuration_extension_json`. | |||||
| matrix_static_files_file_matrix_mautrix_configuration: "{{ matrix_static_files_file_matrix_mautrix_configuration_json | combine(matrix_static_files_file_matrix_mautrix_configuration_extension, recursive=True) }}" | |||||
| ######################################################################## | |||||
| # # | |||||
| # /Related to /.well-known/matrix/mautrix # | |||||
| # # | |||||
| ######################################################################## | |||||
| ######################################################################## | ######################################################################## | ||||
| # # | # # | ||||
| @@ -52,6 +52,10 @@ | |||||
| dest: "{{ matrix_static_files_public_well_known_matrix_path }}/support" | dest: "{{ matrix_static_files_public_well_known_matrix_path }}/support" | ||||
| when: "{{ matrix_static_files_file_matrix_support_enabled }}" | when: "{{ matrix_static_files_file_matrix_support_enabled }}" | ||||
| - content: "{{ matrix_static_files_file_matrix_mautrix_configuration | to_nice_json }}" | |||||
| dest: "{{ matrix_static_files_public_well_known_matrix_path }}/mautrix" | |||||
| when: "{{ matrix_static_files_file_matrix_mautrix_enabled }}" | |||||
| # This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`. | # This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`. | ||||
| # See the comment for `matrix_static_files_file_index_html_enabled` to learn why. | # See the comment for `matrix_static_files_file_index_html_enabled` to learn why. | ||||
| - content: "{{ matrix_static_files_file_index_html_template }}" | - content: "{{ matrix_static_files_file_index_html_template }}" | ||||
| @@ -70,6 +74,12 @@ | |||||
| state: absent | state: absent | ||||
| when: "not matrix_static_files_file_matrix_support_enabled | bool" | when: "not matrix_static_files_file_matrix_support_enabled | bool" | ||||
| - name: Ensure /.well-known/matrix/mautrix file deleted if not enabled | |||||
| ansible.builtin.file: | |||||
| path: "{{ matrix_static_files_public_well_known_matrix_path }}/mautrix" | |||||
| state: absent | |||||
| when: "not matrix_static_files_file_matrix_mautrix_enabled | bool" | |||||
| - name: Ensure matrix-static-files container image is pulled | - name: Ensure matrix-static-files container image is pulled | ||||
| community.docker.docker_image: | community.docker.docker_image: | ||||
| name: "{{ matrix_static_files_container_image }}" | name: "{{ matrix_static_files_container_image }}" | ||||
| @@ -24,6 +24,21 @@ | |||||
| ansible.builtin.set_fact: | ansible.builtin.set_fact: | ||||
| well_known_file_checks: "{{ well_known_file_checks + [well_known_file_check_matrix_server] }}" | well_known_file_checks: "{{ well_known_file_checks + [well_known_file_check_matrix_server] }}" | ||||
| - when: matrix_static_files_file_matrix_mautrix_enabled | bool | |||||
| block: | |||||
| - name: Prepare /.well-known/matrix/mautrix to well-known files to check, if enabled | |||||
| ansible.builtin.set_fact: | |||||
| well_known_file_check_matrix_mautrix: | |||||
| path: /.well-known/matrix/mautrix | |||||
| purpose: Mautrix bridge discovery | |||||
| cors: true | |||||
| follow_redirects: safe | |||||
| validate_certs: "{{ matrix_static_files_self_check_validate_certificates }}" | |||||
| - name: Inject /.well-known/matrix/mautrix to well-known files to check, if enabled | |||||
| ansible.builtin.set_fact: | |||||
| well_known_file_checks: "{{ well_known_file_checks + [well_known_file_check_matrix_mautrix] }}" | |||||
| - name: Perform well-known checks | - name: Perform well-known checks | ||||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/self_check_well_known_file.yml" | ansible.builtin.include_tasks: "{{ role_path }}/tasks/self_check_well_known_file.yml" | ||||
| with_items: "{{ well_known_file_checks }}" | with_items: "{{ well_known_file_checks }}" | ||||
| @@ -0,0 +1,4 @@ | |||||
| { | |||||
| "fi.mau.bridges": {{ matrix_static_files_file_matrix_mautrix_property_fi_mau_bridges|to_json }}, | |||||
| "fi.mau.external_bridge_servers": {{ matrix_static_files_file_matrix_mautrix_property_fi_mau_external_bridge_servers|to_json }} | |||||
| } | |||||