Relocate org.matrix.msc4143.rtc_foci setup to /.well-known/matrix/client to matrix-static-files instead of ugly patching

This commit is contained in:
Slavi Pantaleev 2024-11-21 18:54:29 +02:00
parent f0466d5a99
commit 394fdca066
7 changed files with 24 additions and 28 deletions

View File

@ -5912,6 +5912,14 @@ matrix_static_files_file_matrix_client_property_m_tile_server_map_style_url: "{{
# See: https://github.com/etkecc/synapse-admin/pull/126
matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin_auto: "{{ matrix_synapse_admin_configuration if matrix_homeserver_implementation == 'synapse' else {} }}"
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_enabled: "{{ matrix_element_call_enabled }}"
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_auto: |-
{{
(
[{'type': 'livekit', 'livekit_service_url': matrix_jwt_service_url}] if matrix_jwt_service_enabled else []
)
}}
matrix_static_files_file_matrix_server_property_m_server: "{{ matrix_server_fqn_matrix_federation }}:{{ matrix_federation_public_port }}"
matrix_static_files_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}"

View File

@ -78,12 +78,6 @@
group: "{{ matrix_user_groupname }}"
when: matrix_element_call_enabled | bool
# Update the well-known client file for Element Call (adding RTC FOCI)
- name: Update the well-known client file for Element Call
ansible.builtin.include_tasks: "tasks/update_well_known_client.yml"
when: matrix_element_call_enabled | bool
# Create .well-known/element/element.json for Element Call
- name: Create the well-known element.json file
ansible.builtin.template:
@ -96,4 +90,4 @@
# Update Element Web config.json with Element Call settings
- name: Update Element Web config.json
ansible.builtin.include_tasks: "tasks/update_element_web_config.yml"
when: matrix_element_call_enabled | bool
when: matrix_element_call_enabled | bool

View File

@ -1,21 +0,0 @@
---
- name: Read the existing well-known client file
ansible.builtin.slurp:
path: "{{ matrix_base_data_path }}/static-files/public/.well-known/matrix/client"
register: client_file_content
- name: Load the existing JSON content
ansible.builtin.set_fact:
client_json: "{{ client_file_content['content'] | b64decode | from_json }}"
- name: Update the existing well-known client file for Element Call (RTC FOCI)
ansible.builtin.set_fact:
updated_client_json: "{{ client_json | combine({'org.matrix.msc4143.rtc_foci': [{'type': 'livekit', 'livekit_service_url': matrix_jwt_service_url}]}, recursive=True) }}"
- name: Write the updated well-known client file
ansible.builtin.copy:
content: "{{ updated_client_json | to_nice_json }}"
dest: "{{ matrix_base_data_path }}/static-files/public/.well-known/matrix/client"
mode: '0644'
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"

View File

@ -15,6 +15,7 @@ livekit_server_config_path: "{{ livekit_server_base_path }}/config"
# renovate: datasource=docker depName=livekit/livekit-server
livekit_server_version: v1.8.0
livekit_server_scheme: https
livekit_server_hostname: ""
livekit_server_path_prefix: /

View File

@ -0,0 +1 @@
livekit_server_public_url: "{{ livekit_server_scheme }}://{{ livekit_server_hostname }}{{ livekit_server_path_prefix }}"

View File

@ -203,6 +203,16 @@ matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin: "{{ matri
matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin_auto: {}
matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin_custom: {}
# Controls whether `org.matrix.msc4143.rtc_foci`-related entries should be added to the client well-known.
# By default, if there are entries in `matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci`, we show them (by enabling this).
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_enabled: "{{ matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci | default({}) | dict2items | length > 0 }}"
# Controls the org.matrix.msc4143.rtc_foci property in the /.well-known/matrix/client file.
# See `matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_enabled`
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci: "{{ matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_auto | combine(matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_custom, recursive=True) }}"
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_auto: {}
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_custom: {}
# Default /.well-known/matrix/client configuration template which covers the generic use case.
# You can customize it by controlling the various variables inside it.
#

View File

@ -57,4 +57,7 @@
{% if matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin_enabled %},
"cc.etke.synapse-admin": {{ matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin | to_json }}
{% endif %}
{% if matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_enabled %},
"org.matrix.msc4143.rtc_foci": {{ matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci | to_json }}
{% endif %}
}