Sfoglia il codice sorgente

Enable location sharing in Element

pull/2276/head
Edgars Voroboks 3 anni fa
parent
commit
f95e0236b3
6 ha cambiato i file con 58 aggiunte e 0 eliminazioni
  1. +18
    -0
      roles/custom/matrix-client-element/defaults/main.yml
  2. +8
    -0
      roles/custom/matrix-client-element/tasks/setup_install.yml
  3. +8
    -0
      roles/custom/matrix-client-element/tasks/validate_config.yml
  4. +3
    -0
      roles/custom/matrix-client-element/templates/config.json.j2
  5. +18
    -0
      roles/custom/matrix-client-element/templates/style.json.j2
  6. +3
    -0
      roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2

+ 18
- 0
roles/custom/matrix-client-element/defaults/main.yml Vedi File

@@ -135,3 +135,21 @@ matrix_client_element_configuration_extension: "{{ matrix_client_element_configu
# Holds the final Element configuration (a combination of the default and its extension). # Holds the final Element configuration (a combination of the default and its extension).
# You most likely don't need to touch this variable. Instead, see `matrix_client_element_configuration_default`. # You most likely don't need to touch this variable. Instead, see `matrix_client_element_configuration_default`.
matrix_client_element_configuration: "{{ matrix_client_element_configuration_default | combine(matrix_client_element_configuration_extension, recursive=True) }}" matrix_client_element_configuration: "{{ matrix_client_element_configuration_default | combine(matrix_client_element_configuration_extension, recursive=True) }}"

# Enable Element Location sharing functionality
# More info: https://element.io/blog/element-launches-e2ee-location-sharing/
# How to host your own map tile server: https://matrix.org/docs/guides/map-tile-server
matrix_client_element_location_sharing: false
matrix_client_element_location_map_style: "{{ lookup('template', 'templates/style.json.j2') }}"

# Example tile servers configuration
# matrix_client_element_location_map_tile_servers: ["https://tile.example.com/{z}/{x}/{y}.png"]
# or
# matrix_client_element_location_map_tile_servers: ["https://s1.example.com/{z}/{x}/{y}.png", "https://s2.example.com/{z}/{x}/{y}.png", "https://s3.example.com/{z}/{x}/{y}.png"]
matrix_client_element_location_map_tile_servers: []

# Map attribution (optional):
# Attribution for OpenStreetMap would be like this:
# matrix_client_element_location_map_attribution: "&copy; <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors"
# Leave blank, if map does not require attribution.
matrix_client_element_location_map_attribution: ""

+ 8
- 0
roles/custom/matrix-client-element/tasks/setup_install.yml Vedi File

@@ -69,6 +69,14 @@
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"


- name: Ensure Element map style installed
ansible.builtin.copy:
content: "{{ matrix_client_element_location_map_style | to_nice_json }}"
dest: "{{ matrix_client_element_data_path }}/style.json"
mode: 0644
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"

- name: Ensure Element config files installed - name: Ensure Element config files installed
ansible.builtin.template: ansible.builtin.template:
src: "{{ item.src }}" src: "{{ item.src }}"


+ 8
- 0
roles/custom/matrix-client-element/tasks/validate_config.yml Vedi File

@@ -8,6 +8,14 @@
with_items: with_items:
- "matrix_client_element_default_hs_url" - "matrix_client_element_default_hs_url"


- name: Fail if matrix_client_element_location_sharing is enabled, but matrix_client_element_location_map_tile_servers not defined
ansible.builtin.fail:
msg: >-
You need to define at least one map tile server.
when:
- matrix_client_element_location_sharing | bool
- matrix_client_element_location_map_tile_servers == []

- name: (Deprecation) Catch and report riot-web variables - name: (Deprecation) Catch and report riot-web variables
ansible.builtin.fail: ansible.builtin.fail:
msg: >- msg: >-


+ 3
- 0
roles/custom/matrix-client-element/templates/config.json.j2 Vedi File

@@ -36,6 +36,9 @@
"jitsi": { "jitsi": {
"preferredDomain": {{ matrix_client_element_jitsi_preferredDomain|to_json }} "preferredDomain": {{ matrix_client_element_jitsi_preferredDomain|to_json }}
}, },
{% endif %}
{% if matrix_client_element_location_sharing %}
"map_style_url": "https://{{ matrix_server_fqn_element }}/style.json",
{% endif %} {% endif %}
"branding": { "branding": {
"authFooterLinks": {{ matrix_client_element_branding_authFooterLinks|to_json }}, "authFooterLinks": {{ matrix_client_element_branding_authFooterLinks|to_json }},


+ 18
- 0
roles/custom/matrix-client-element/templates/style.json.j2 Vedi File

@@ -0,0 +1,18 @@
{
"layers": [
{
"id": "locallayer",
"source": "localsource",
"type": "raster"
}
],
"sources": {
"localsource": {
"attribution": {{ matrix_client_element_location_map_attribution|to_json }},
"tileSize": 256,
"tiles": {{ matrix_client_element_location_map_tile_servers|to_json }},
"type": "raster"
}
},
"version": 8
}

+ 3
- 0
roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2 Vedi File

@@ -26,6 +26,9 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name
--mount type=bind,src={{ matrix_client_element_data_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \ --mount type=bind,src={{ matrix_client_element_data_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \
--mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.json,ro \ --mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.json,ro \
--mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.{{ matrix_server_fqn_element }}.json,ro \ --mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.{{ matrix_server_fqn_element }}.json,ro \
{% if matrix_client_element_location_sharing %}
--mount type=bind,src={{ matrix_client_element_data_path }}/style.json,dst=/app/style.json,ro \
{% endif %}
{% if matrix_client_element_embedded_pages_home_path is not none %} {% if matrix_client_element_embedded_pages_home_path is not none %}
--mount type=bind,src={{ matrix_client_element_data_path }}/home.html,dst=/app/home.html,ro \ --mount type=bind,src={{ matrix_client_element_data_path }}/home.html,dst=/app/home.html,ro \
{% endif %} {% endif %}


Caricamento…
Annulla
Salva