Просмотр исходного кода

Rename location sharing vars to be consistent with other vars

pull/2276/head
Edgars Voroboks 3 лет назад
Родитель
Сommit
5c80ce613d
6 измененных файлов: 67 добавлений и 18 удалений
  1. +57
    -8
      roles/custom/matrix-client-element/defaults/main.yml
  2. +2
    -2
      roles/custom/matrix-client-element/tasks/setup_install.yml
  3. +4
    -4
      roles/custom/matrix-client-element/tasks/validate_config.yml
  4. +1
    -1
      roles/custom/matrix-client-element/templates/config.json.j2
  5. +2
    -2
      roles/custom/matrix-client-element/templates/style.json.j2
  6. +1
    -1
      roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2

+ 57
- 8
roles/custom/matrix-client-element/defaults/main.yml Просмотреть файл

@@ -136,20 +136,69 @@ matrix_client_element_configuration_extension: "{{ matrix_client_element_configu
# 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
# Element Location sharing functionality
# More info: https://element.io/blog/element-launches-e2ee-location-sharing/ # 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 # 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') }}"
matrix_client_element_location_sharing_enabled: false

# Default Element location sharing map style 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_client_element_location_sharing_map_style_extension_json`)
# or completely replace this variable with your own template.
#
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_element_location_sharing_map_style_default: "{{ lookup('template', 'templates/style.json.j2') }}"

# Your custom JSON configuration for Element location sharing map style should go to `matrix_client_element_location_sharing_map_style_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_element_location_sharing_map_style_default`).
#
# 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_client_element_location_sharing_map_style_default`.
#
# Example configuration override follows:
#
# matrix_client_element_location_sharing_map_style_extension_json: |
# {
# "sources": {
# "localsource": {
# "tileSize": 512
# }
# }
# }
#
# Example configuration extension follows:
#
# matrix_client_element_location_sharing_map_style_extension_json: |
# {
# "sources": {
# "anothersource": {
# "attribution": "",
# "tileSize": 256,
# "tiles": ["https://anothertile.example.com/{z}/{x}/{y}.png"],
# "type": "raster"
# }
# }
# }
matrix_client_element_location_sharing_map_style_extension_json: '{}'

matrix_client_element_location_sharing_map_style_extension: "{{ matrix_client_element_location_sharing_map_style_extension_json | from_json if matrix_client_element_location_sharing_map_style_extension_json | from_json is mapping else {} }}"

# Holds the final Element location sharing map style configuration (a combination of the default and its extension).
# You most likely don't need to touch this variable. Instead, see `matrix_client_element_location_sharing_map_style_default`.
matrix_client_element_location_sharing_map_style: "{{ matrix_client_element_location_sharing_map_style_default | combine(matrix_client_element_location_sharing_map_style_extension, recursive=True) }}"


# Example tile servers configuration # Example tile servers configuration
# matrix_client_element_location_map_tile_servers: ["https://tile.example.com/{z}/{x}/{y}.png"]
# matrix_client_element_location_sharing_map_style_content_sources_localsource_tiles: ["https://tile.example.com/{z}/{x}/{y}.png"]
# or # 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: []
# matrix_client_element_location_sharing_map_style_content_sources_localsource_tiles: ["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_sharing_map_style_content_sources_localsource_tiles: []


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

+ 2
- 2
roles/custom/matrix-client-element/tasks/setup_install.yml Просмотреть файл

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


- name: Ensure Element map style installed
- name: Ensure Element location sharing map style installed
when: matrix_client_element_location_sharing_enabled | bool when: matrix_client_element_location_sharing_enabled | bool
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ matrix_client_element_location_map_style | to_nice_json }}"
content: "{{ matrix_client_element_location_sharing_map_style | to_nice_json }}"
dest: "{{ matrix_client_element_data_path }}/style.json" dest: "{{ matrix_client_element_data_path }}/style.json"
mode: 0644 mode: 0644
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"


+ 4
- 4
roles/custom/matrix-client-element/tasks/validate_config.yml Просмотреть файл

@@ -8,13 +8,13 @@
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
- name: Fail if Element location sharing enabled, but no tile server defined
ansible.builtin.fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define at least one map tile server.
You need to define at least one map tile server in matrix_client_element_location_sharing_map_style_content_sources_localsource_tiles list
when: when:
- matrix_client_element_location_sharing | bool
- matrix_client_element_location_map_tile_servers | length == 0
- matrix_client_element_location_sharing_enabled | bool
- matrix_client_element_location_sharing_map_style_content_sources_localsource_tiles | length == 0


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


+ 1
- 1
roles/custom/matrix-client-element/templates/config.json.j2 Просмотреть файл

@@ -37,7 +37,7 @@
"preferredDomain": {{ matrix_client_element_jitsi_preferredDomain|to_json }} "preferredDomain": {{ matrix_client_element_jitsi_preferredDomain|to_json }}
}, },
{% endif %} {% endif %}
{% if matrix_client_element_location_sharing %}
{% if matrix_client_element_location_sharing_enabled %}
"map_style_url": "https://{{ matrix_server_fqn_element }}/style.json", "map_style_url": "https://{{ matrix_server_fqn_element }}/style.json",
{% endif %} {% endif %}
"branding": { "branding": {


+ 2
- 2
roles/custom/matrix-client-element/templates/style.json.j2 Просмотреть файл

@@ -8,9 +8,9 @@
], ],
"sources": { "sources": {
"localsource": { "localsource": {
"attribution": {{ matrix_client_element_location_map_attribution|to_json }},
"attribution": {{ matrix_client_element_location_sharing_map_style_content_sources_localsource_attribution|to_json }},
"tileSize": 256, "tileSize": 256,
"tiles": {{ matrix_client_element_location_map_tile_servers|to_json }},
"tiles": {{ matrix_client_element_location_sharing_map_style_content_sources_localsource_tiles|to_json }},
"type": "raster" "type": "raster"
} }
}, },


+ 1
- 1
roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2 Просмотреть файл

@@ -26,7 +26,7 @@ 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 %}
{% if matrix_client_element_location_sharing_enabled %}
--mount type=bind,src={{ matrix_client_element_data_path }}/style.json,dst=/app/style.json,ro \ --mount type=bind,src={{ matrix_client_element_data_path }}/style.json,dst=/app/style.json,ro \
{% endif %} {% endif %}
{% if matrix_client_element_embedded_pages_home_path is not none %} {% if matrix_client_element_embedded_pages_home_path is not none %}


Загрузка…
Отмена
Сохранить