From e3faabf12567d96dc98d5d872b1df9ca7bf00a35 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 16 Jul 2026 15:01:57 +0300 Subject: [PATCH] Rename matrix_wechat_* variables to matrix_bridge_wechat_* Part of adopting a uniform naming policy for bridge variables, where the variable prefix matches the role directory name. Co-Authored-By: Claude Fable 5 --- docs/configuring-playbook-bridge-wechat.md | 6 +- group_vars/matrix_servers | 62 +++---- .../matrix-bridge-wechat/defaults/main.yml | 166 +++++++++--------- .../matrix-bridge-wechat/tasks/install.yml | 108 ++++++------ .../matrix-bridge-wechat/tasks/main.yml | 6 +- .../matrix-bridge-wechat/tasks/uninstall.yml | 8 +- .../tasks/validate_config.yml | 20 +-- .../templates/agent-config.yaml.j2 | 2 +- .../templates/config.yaml.j2 | 32 ++-- .../systemd/matrix-wechat-agent.service.j2 | 18 +- .../systemd/matrix-wechat.service.j2 | 18 +- 11 files changed, 223 insertions(+), 223 deletions(-) diff --git a/docs/configuring-playbook-bridge-wechat.md b/docs/configuring-playbook-bridge-wechat.md index 2c7590b40..f53c74b73 100644 --- a/docs/configuring-playbook-bridge-wechat.md +++ b/docs/configuring-playbook-bridge-wechat.md @@ -19,7 +19,7 @@ See the project's [documentation](https://github.com/duo/matrix-wechat/blob/mast To enable the bridge, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file: ```yaml -matrix_wechat_enabled: true +matrix_bridge_wechat_enabled: true ``` ### Extending the configuration @@ -29,7 +29,7 @@ There are some additional things you may wish to configure about the bridge. Take a look at: - `roles/custom/matrix-bridge-wechat/defaults/main.yml` for some variables that you can customize via your `vars.yml` file -- `roles/custom/matrix-bridge-wechat/templates/config.yaml.j2` for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the `matrix_wechat_configuration_extension_yaml` variable +- `roles/custom/matrix-bridge-wechat/templates/config.yaml.j2` for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the `matrix_bridge_wechat_configuration_extension_yaml` variable ## Installing @@ -62,5 +62,5 @@ The default logging level for this component is `warn`. If you want to increase ```yaml # Valid values: fatal, error, warn, info, debug -matrix_wechat_log_level: 'debug' +matrix_bridge_wechat_log_level: 'debug' ``` diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index f19162802..c070bd500 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -104,7 +104,7 @@ matrix_homeserver_container_extra_arguments_auto: | + (['--mount type=bind,src=' + matrix_bridge_beeper_linkedin_config_path + '/registration.yaml,dst=/matrix-beeper-linkedin-registration.yaml,ro'] if matrix_bridge_beeper_linkedin_enabled else []) + - (['--mount type=bind,src=' + matrix_wechat_config_path + '/registration.yaml,dst=/matrix-wechat-registration.yaml,ro'] if matrix_wechat_enabled else []) + (['--mount type=bind,src=' + matrix_bridge_wechat_config_path + '/registration.yaml,dst=/matrix-wechat-registration.yaml,ro'] if matrix_bridge_wechat_enabled else []) + (['--mount type=bind,src=' + matrix_bridge_heisenbridge_base_path + '/registration.yaml,dst=/heisenbridge-registration.yaml,ro'] if matrix_bridge_heisenbridge_enabled else []) + @@ -163,7 +163,7 @@ matrix_homeserver_app_service_config_files_auto: | + (['/matrix-beeper-linkedin-registration.yaml'] if matrix_bridge_beeper_linkedin_enabled else []) + - (['/matrix-wechat-registration.yaml'] if matrix_wechat_enabled else []) + (['/matrix-wechat-registration.yaml'] if matrix_bridge_wechat_enabled else []) + (['/heisenbridge-registration.yaml'] if matrix_bridge_heisenbridge_enabled else []) + @@ -380,16 +380,16 @@ devture_systemd_service_manager_services_list_auto: | ([{ 'name': 'matrix-wechat.service', 'priority': 2000, - 'restart_necessary': (matrix_wechat_restart_necessary | bool), + 'restart_necessary': (matrix_bridge_wechat_restart_necessary | bool), 'groups': ['matrix', 'bridges', 'wechat'], - }] if matrix_wechat_enabled else []) + }] if matrix_bridge_wechat_enabled else []) + ([{ 'name': 'matrix-wechat-agent.service', 'priority': 2000, - 'restart_necessary': (matrix_wechat_restart_necessary | bool), + 'restart_necessary': (matrix_bridge_wechat_restart_necessary | bool), 'groups': ['matrix', 'bridges', 'wechat'], - }] if matrix_wechat_enabled else []) + }] if matrix_bridge_wechat_enabled else []) + ([{ 'name': 'matrix-heisenbridge.service', @@ -2349,49 +2349,49 @@ matrix_bridge_mautrix_wsproxy_syncproxy_database_password: "{{ (matrix_homeserve ###################################################################### # We don't enable bridges by default. -matrix_wechat_enabled: false +matrix_bridge_wechat_enabled: false -matrix_wechat_systemd_required_services_list_auto: | +matrix_bridge_wechat_systemd_required_services_list_auto: | {{ matrix_addons_homeserver_systemd_services_list + - ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_wechat_database_hostname == postgres_connection_hostname) else []) + ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_bridge_wechat_database_hostname == postgres_connection_hostname) else []) }} -matrix_wechat_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_wechat_container_image_registry_prefix_upstream_default }}" +matrix_bridge_wechat_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bridge_wechat_container_image_registry_prefix_upstream_default }}" -matrix_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_wechat_agent_container_image_registry_prefix_upstream_default }}" +matrix_bridge_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bridge_wechat_agent_container_image_registry_prefix_upstream_default }}" -matrix_wechat_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}" +matrix_bridge_wechat_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}" -matrix_wechat_agent_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}" +matrix_bridge_wechat_agent_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}" -matrix_wechat_container_network: "{{ matrix_addons_container_network }}" +matrix_bridge_wechat_container_network: "{{ matrix_addons_container_network }}" -matrix_wechat_container_additional_networks_auto: |- +matrix_bridge_wechat_container_additional_networks_auto: |- {{ ( ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) + - ([postgres_container_network] if (postgres_enabled and matrix_wechat_database_hostname == postgres_connection_hostname and matrix_wechat_container_network != postgres_container_network) else []) + ([postgres_container_network] if (postgres_enabled and matrix_bridge_wechat_database_hostname == postgres_connection_hostname and matrix_bridge_wechat_container_network != postgres_container_network) else []) ) | unique }} -matrix_wechat_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.as.token') | hash('sha512') | to_uuid }}" +matrix_bridge_wechat_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.as.token') | hash('sha512') | to_uuid }}" -matrix_wechat_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" -matrix_wechat_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.hs.token') | hash('sha512') | to_uuid }}" +matrix_bridge_wechat_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" +matrix_bridge_wechat_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.hs.token') | hash('sha512') | to_uuid }}" -matrix_wechat_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}" +matrix_bridge_wechat_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}" -matrix_wechat_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" +matrix_bridge_wechat_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" -matrix_wechat_bridge_listen_secret: "{{ (matrix_homeserver_generic_secret_key + ':wechat.lstn') | hash('sha512') | to_uuid }}" +matrix_bridge_wechat_bridge_listen_secret: "{{ (matrix_homeserver_generic_secret_key + ':wechat.lstn') | hash('sha512') | to_uuid }}" # Postgres is the default, except if not using internal Postgres server -matrix_wechat_database_engine: "{{ 'postgres' if postgres_enabled else 'sqlite' }}" -matrix_wechat_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" -matrix_wechat_database_password: "{{ (matrix_homeserver_generic_secret_key + ':gowechat.db') | hash('sha512') | to_uuid }}" +matrix_bridge_wechat_database_engine: "{{ 'postgres' if postgres_enabled else 'sqlite' }}" +matrix_bridge_wechat_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" +matrix_bridge_wechat_database_password: "{{ (matrix_homeserver_generic_secret_key + ':gowechat.db') | hash('sha512') | to_uuid }}" ###################################################################### # @@ -4165,10 +4165,10 @@ postgres_managed_databases_auto: | }] if (matrix_bridge_beeper_linkedin_enabled and matrix_bridge_beeper_linkedin_database_engine == 'postgres' and matrix_bridge_beeper_linkedin_database_hostname == postgres_connection_hostname) else []) + ([{ - 'name': matrix_wechat_database_name, - 'username': matrix_wechat_database_username, - 'password': matrix_wechat_database_password, - }] if (matrix_wechat_enabled and matrix_wechat_database_engine == 'postgres' and matrix_wechat_database_hostname == postgres_connection_hostname) else []) + 'name': matrix_bridge_wechat_database_name, + 'username': matrix_bridge_wechat_database_username, + 'password': matrix_bridge_wechat_database_password, + }] if (matrix_bridge_wechat_enabled and matrix_bridge_wechat_database_engine == 'postgres' and matrix_bridge_wechat_database_hostname == postgres_connection_hostname) else []) + ([{ 'name': matrix_bridge_mautrix_bluesky_database_name, @@ -5204,9 +5204,9 @@ matrix_ketesa_config_asManagedUsers_auto: | ] if matrix_bridge_sms_enabled else []) + ([ - '^@'+(matrix_wechat_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', + '^@'+(matrix_bridge_wechat_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', '^@_wechat_[a-zA-Z0-9]+:'+(matrix_domain | regex_escape)+'$', - ] if matrix_wechat_enabled else []) + ] if matrix_bridge_wechat_enabled else []) + ([ '^@'+(matrix_bridge_steam_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', diff --git a/roles/custom/matrix-bridge-wechat/defaults/main.yml b/roles/custom/matrix-bridge-wechat/defaults/main.yml index 9c1a19615..b947a9bb5 100644 --- a/roles/custom/matrix-bridge-wechat/defaults/main.yml +++ b/roles/custom/matrix-bridge-wechat/defaults/main.yml @@ -8,161 +8,161 @@ # WeChat Bridge is a Matrix <-> WeChat bridge # Project source code URL: https://github.com/duo/matrix-wechat -matrix_wechat_enabled: true +matrix_bridge_wechat_enabled: true # renovate: datasource=docker depName=lxduo/matrix-wechat -matrix_wechat_version: 0.2.4 -matrix_wechat_container_image: "{{ matrix_wechat_container_image_registry_prefix }}lxduo/matrix-wechat:{{ matrix_wechat_version }}" -matrix_wechat_container_image_registry_prefix: "{{ 'localhost/' if matrix_wechat_container_image_self_build else matrix_wechat_container_image_registry_prefix_upstream }}" -matrix_wechat_container_image_registry_prefix_upstream: "{{ matrix_wechat_container_image_registry_prefix_upstream_default }}" -matrix_wechat_container_image_registry_prefix_upstream_default: "docker.io/" +matrix_bridge_wechat_version: 0.2.4 +matrix_bridge_wechat_container_image: "{{ matrix_bridge_wechat_container_image_registry_prefix }}lxduo/matrix-wechat:{{ matrix_bridge_wechat_version }}" +matrix_bridge_wechat_container_image_registry_prefix: "{{ 'localhost/' if matrix_bridge_wechat_container_image_self_build else matrix_bridge_wechat_container_image_registry_prefix_upstream }}" +matrix_bridge_wechat_container_image_registry_prefix_upstream: "{{ matrix_bridge_wechat_container_image_registry_prefix_upstream_default }}" +matrix_bridge_wechat_container_image_registry_prefix_upstream_default: "docker.io/" -matrix_wechat_container_image_self_build: false -matrix_wechat_container_image_self_build_repo: "https://github.com/duo/matrix-wechat.git" -matrix_wechat_container_image_self_build_branch: "{{ 'master' if matrix_wechat_version == 'latest' else matrix_wechat_version }}" +matrix_bridge_wechat_container_image_self_build: false +matrix_bridge_wechat_container_image_self_build_repo: "https://github.com/duo/matrix-wechat.git" +matrix_bridge_wechat_container_image_self_build_branch: "{{ 'master' if matrix_bridge_wechat_version == 'latest' else matrix_bridge_wechat_version }}" # renovate: datasource=docker depName=lxduo/matrix-wechat-agent -matrix_wechat_agent_version: 0.0.1 -matrix_wechat_agent_container_image: "{{ matrix_wechat_agent_container_image_registry_prefix }}lxduo/matrix-wechat-agent:{{ matrix_wechat_agent_version }}" -matrix_wechat_agent_container_image_registry_prefix: "{{ 'localhost/' if matrix_wechat_agent_container_image_self_build else matrix_wechat_agent_container_image_registry_prefix_upstream }}" -matrix_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_wechat_agent_container_image_registry_prefix_upstream_default }}" -matrix_wechat_agent_container_image_registry_prefix_upstream_default: "docker.io/" +matrix_bridge_wechat_agent_version: 0.0.1 +matrix_bridge_wechat_agent_container_image: "{{ matrix_bridge_wechat_agent_container_image_registry_prefix }}lxduo/matrix-wechat-agent:{{ matrix_bridge_wechat_agent_version }}" +matrix_bridge_wechat_agent_container_image_registry_prefix: "{{ 'localhost/' if matrix_bridge_wechat_agent_container_image_self_build else matrix_bridge_wechat_agent_container_image_registry_prefix_upstream }}" +matrix_bridge_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_bridge_wechat_agent_container_image_registry_prefix_upstream_default }}" +matrix_bridge_wechat_agent_container_image_registry_prefix_upstream_default: "docker.io/" # The agent needs to write to /home/user/.vnc. # `/home/user` is owned by `user:group` (`1000:1000`), so it needs to run with that user/group. -matrix_wechat_agent_container_user_uid: 1000 -matrix_wechat_agent_container_user_gid: 1000 +matrix_bridge_wechat_agent_container_user_uid: 1000 +matrix_bridge_wechat_agent_container_user_gid: 1000 -matrix_wechat_agent_container_image_self_build: false -matrix_wechat_agent_container_image_self_build_repo: "https://github.com/duo/matrix-wechat-agent.git" -matrix_wechat_agent_container_image_self_build_branch: "{{ 'master' if matrix_wechat_agent_version == 'latest' else matrix_wechat_agent_version }}" +matrix_bridge_wechat_agent_container_image_self_build: false +matrix_bridge_wechat_agent_container_image_self_build_repo: "https://github.com/duo/matrix-wechat-agent.git" +matrix_bridge_wechat_agent_container_image_self_build_branch: "{{ 'master' if matrix_bridge_wechat_agent_version == 'latest' else matrix_bridge_wechat_agent_version }}" -matrix_wechat_base_path: "{{ matrix_base_data_path }}/wechat" -matrix_wechat_config_path: "{{ matrix_wechat_base_path }}/config" -matrix_wechat_data_path: "{{ matrix_wechat_base_path }}/data" -matrix_wechat_container_src_files_path: "{{ matrix_wechat_base_path }}/container-src" -matrix_wechat_agent_container_src_files_path: "{{ matrix_wechat_base_path }}/agent-container-src" +matrix_bridge_wechat_base_path: "{{ matrix_base_data_path }}/wechat" +matrix_bridge_wechat_config_path: "{{ matrix_bridge_wechat_base_path }}/config" +matrix_bridge_wechat_data_path: "{{ matrix_bridge_wechat_base_path }}/data" +matrix_bridge_wechat_container_src_files_path: "{{ matrix_bridge_wechat_base_path }}/container-src" +matrix_bridge_wechat_agent_container_src_files_path: "{{ matrix_bridge_wechat_base_path }}/agent-container-src" -matrix_wechat_homeserver_address: "" -matrix_wechat_homeserver_domain: "{{ matrix_domain }}" +matrix_bridge_wechat_homeserver_address: "" +matrix_bridge_wechat_homeserver_domain: "{{ matrix_domain }}" # Whether asynchronous uploads via MSC2246 should be enabled for media. # Requires a homeserver that supports MSC2246 (https://github.com/matrix-org/matrix-spec-proposals/pull/2246). -matrix_wechat_homeserver_async_media: false -matrix_wechat_appservice_address: 'http://matrix-wechat:8080' +matrix_bridge_wechat_homeserver_async_media: false +matrix_bridge_wechat_appservice_address: 'http://matrix-wechat:8080' -matrix_wechat_container_network: "" +matrix_bridge_wechat_container_network: "" -matrix_wechat_container_additional_networks: "{{ matrix_wechat_container_additional_networks_auto + matrix_wechat_container_additional_networks_custom }}" -matrix_wechat_container_additional_networks_auto: [] -matrix_wechat_container_additional_networks_custom: [] +matrix_bridge_wechat_container_additional_networks: "{{ matrix_bridge_wechat_container_additional_networks_auto + matrix_bridge_wechat_container_additional_networks_custom }}" +matrix_bridge_wechat_container_additional_networks_auto: [] +matrix_bridge_wechat_container_additional_networks_custom: [] # A list of extra arguments to pass to the container -matrix_wechat_container_extra_arguments: [] +matrix_bridge_wechat_container_extra_arguments: [] # List of systemd services that matrix-wechat.service depends on. -matrix_wechat_systemd_required_services_list: "{{ matrix_wechat_systemd_required_services_list_default + matrix_wechat_systemd_required_services_list_auto + matrix_wechat_systemd_required_services_list_custom }}" -matrix_wechat_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" -matrix_wechat_systemd_required_services_list_auto: [] -matrix_wechat_systemd_required_services_list_custom: [] +matrix_bridge_wechat_systemd_required_services_list: "{{ matrix_bridge_wechat_systemd_required_services_list_default + matrix_bridge_wechat_systemd_required_services_list_auto + matrix_bridge_wechat_systemd_required_services_list_custom }}" +matrix_bridge_wechat_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" +matrix_bridge_wechat_systemd_required_services_list_auto: [] +matrix_bridge_wechat_systemd_required_services_list_custom: [] # List of systemd services that matrix-wechat.service wants -matrix_wechat_systemd_wanted_services_list: [] +matrix_bridge_wechat_systemd_wanted_services_list: [] -matrix_wechat_appservice_token: '' -matrix_wechat_homeserver_token: '' +matrix_bridge_wechat_appservice_token: '' +matrix_bridge_wechat_homeserver_token: '' -matrix_wechat_appservice_bot_username: wechatbot +matrix_bridge_wechat_appservice_bot_username: wechatbot -matrix_wechat_command_prefix: "!wechat" +matrix_bridge_wechat_command_prefix: "!wechat" # Whether or not created rooms should have federation enabled. # If false, created portal rooms will never be federated. -matrix_wechat_federate_rooms: true +matrix_bridge_wechat_federate_rooms: true # Database-related configuration fields. -matrix_wechat_database_engine: 'postgres' -matrix_wechat_database_username: 'matrix_wechat' -matrix_wechat_database_password: 'some-password' -matrix_wechat_database_hostname: '' -matrix_wechat_database_port: 5432 -matrix_wechat_database_name: 'matrix_wechat' -matrix_wechat_database_sslmode: disable -matrix_wechat_database_connection_string: 'postgresql://{{ matrix_wechat_database_username }}:{{ matrix_wechat_database_password }}@{{ matrix_wechat_database_hostname }}:{{ matrix_wechat_database_port }}/{{ matrix_wechat_database_name }}?sslmode={{ matrix_wechat_database_sslmode }}' +matrix_bridge_wechat_database_engine: 'postgres' +matrix_bridge_wechat_database_username: 'matrix_wechat' +matrix_bridge_wechat_database_password: 'some-password' +matrix_bridge_wechat_database_hostname: '' +matrix_bridge_wechat_database_port: 5432 +matrix_bridge_wechat_database_name: 'matrix_wechat' +matrix_bridge_wechat_database_sslmode: disable +matrix_bridge_wechat_database_connection_string: 'postgresql://{{ matrix_bridge_wechat_database_username }}:{{ matrix_bridge_wechat_database_password }}@{{ matrix_bridge_wechat_database_hostname }}:{{ matrix_bridge_wechat_database_port }}/{{ matrix_bridge_wechat_database_name }}?sslmode={{ matrix_bridge_wechat_database_sslmode }}' -matrix_wechat_bridge_listen_secret: '' +matrix_bridge_wechat_bridge_listen_secret: '' # Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth). -matrix_wechat_login_shared_secret: '' -matrix_wechat_login_shared_secret_map: - "{{ {matrix_wechat_homeserver_domain: matrix_wechat_login_shared_secret} if matrix_wechat_login_shared_secret else {} }}" +matrix_bridge_wechat_login_shared_secret: '' +matrix_bridge_wechat_login_shared_secret_map: + "{{ {matrix_bridge_wechat_homeserver_domain: matrix_bridge_wechat_login_shared_secret} if matrix_bridge_wechat_login_shared_secret else {} }}" # Servers to always allow double puppeting from -matrix_wechat_double_puppet_server_map: - "{{ matrix_wechat_homeserver_domain: matrix_wechat_homeserver_address }}" +matrix_bridge_wechat_double_puppet_server_map: + "{{ matrix_bridge_wechat_homeserver_domain: matrix_bridge_wechat_homeserver_address }}" # Enable End-to-bridge encryption -matrix_wechat_encryption_allow: "{{ matrix_bridges_encryption_enabled }}" -matrix_wechat_encryption_default: "{{ matrix_wechat_encryption_allow }}" +matrix_bridge_wechat_encryption_allow: "{{ matrix_bridges_encryption_enabled }}" +matrix_bridge_wechat_encryption_default: "{{ matrix_bridge_wechat_encryption_allow }}" # Minimum severity of journal log messages. # Valid values: fatal, error, warn, info, debug -matrix_wechat_log_level: 'warn' +matrix_bridge_wechat_log_level: 'warn' -matrix_wechat_permissions: | +matrix_bridge_wechat_permissions: | {{ - {matrix_wechat_homeserver_domain: 'user'} + {matrix_bridge_wechat_homeserver_domain: 'user'} | combine({matrix_admin: 'admin'} if matrix_admin else {}) }} # Default Wechat 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_wechat_configuration_extension_yaml`) +# For a more advanced customization, you can extend the default (see `matrix_bridge_wechat_configuration_extension_yaml`) # or completely replace this variable with your own template. -matrix_wechat_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" +matrix_bridge_wechat_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" -matrix_wechat_configuration_extension_yaml: | +matrix_bridge_wechat_configuration_extension_yaml: | # Your custom YAML configuration goes here. - # This configuration extends the default starting configuration (`matrix_wechat_configuration_yaml`). + # This configuration extends the default starting configuration (`matrix_bridge_wechat_configuration_yaml`). # # 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_wechat_configuration_yaml`. + # completely redefining `matrix_bridge_wechat_configuration_yaml`. -matrix_wechat_configuration_extension: "{{ matrix_wechat_configuration_extension_yaml | from_yaml if matrix_wechat_configuration_extension_yaml | from_yaml is mapping else {} }}" +matrix_bridge_wechat_configuration_extension: "{{ matrix_bridge_wechat_configuration_extension_yaml | from_yaml if matrix_bridge_wechat_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). -# You most likely don't need to touch this variable. Instead, see `matrix_wechat_configuration_yaml`. -matrix_wechat_configuration: "{{ matrix_wechat_configuration_yaml | from_yaml | combine(matrix_wechat_configuration_extension, recursive=True) }}" +# You most likely don't need to touch this variable. Instead, see `matrix_bridge_wechat_configuration_yaml`. +matrix_bridge_wechat_configuration: "{{ matrix_bridge_wechat_configuration_yaml | from_yaml | combine(matrix_bridge_wechat_configuration_extension, recursive=True) }}" -matrix_wechat_registration_yaml: | +matrix_bridge_wechat_registration_yaml: | id: wechat - url: {{ matrix_wechat_appservice_address }} - as_token: "{{ matrix_wechat_appservice_token }}" - hs_token: "{{ matrix_wechat_homeserver_token }}" + url: {{ matrix_bridge_wechat_appservice_address }} + as_token: "{{ matrix_bridge_wechat_appservice_token }}" + hs_token: "{{ matrix_bridge_wechat_homeserver_token }}" # See https://github.com/mautrix/signal/issues/43 - sender_localpart: _bot_{{ matrix_wechat_appservice_bot_username }} + sender_localpart: _bot_{{ matrix_bridge_wechat_appservice_bot_username }} rate_limited: false namespaces: users: - - regex: '^@_wechat_(.*):{{ matrix_wechat_homeserver_domain | regex_escape }}$' + - regex: '^@_wechat_(.*):{{ matrix_bridge_wechat_homeserver_domain | regex_escape }}$' exclusive: true - exclusive: true - regex: '^@{{ matrix_wechat_appservice_bot_username | regex_escape }}:{{ matrix_wechat_homeserver_domain | regex_escape }}$' + regex: '^@{{ matrix_bridge_wechat_appservice_bot_username | regex_escape }}:{{ matrix_bridge_wechat_homeserver_domain | regex_escape }}$' de.sorunome.msc2409.push_ephemeral: true receive_ephemeral: true -matrix_wechat_registration: "{{ matrix_wechat_registration_yaml | from_yaml }}" +matrix_bridge_wechat_registration: "{{ matrix_bridge_wechat_registration_yaml | from_yaml }}" -matrix_wechat_agent_service_secret: "{{ matrix_wechat_bridge_listen_secret }}" +matrix_bridge_wechat_agent_service_secret: "{{ matrix_bridge_wechat_bridge_listen_secret }}" -matrix_wechat_agent_configuration_yaml: "{{ lookup('template', 'templates/agent-config.yaml.j2') }}" +matrix_bridge_wechat_agent_configuration_yaml: "{{ lookup('template', 'templates/agent-config.yaml.j2') }}" -matrix_wechat_agent_configuration: "{{ matrix_wechat_agent_configuration_yaml | from_yaml }}" +matrix_bridge_wechat_agent_configuration: "{{ matrix_bridge_wechat_agent_configuration_yaml | from_yaml }}" -# matrix_wechat_restart_necessary controls whether the service +# matrix_bridge_wechat_restart_necessary controls whether the service # will be restarted (when true) or merely started (when false) by the # systemd service manager role (when conditional restart is enabled). # @@ -170,4 +170,4 @@ matrix_wechat_agent_configuration: "{{ matrix_wechat_agent_configuration_yaml | # any configuration files, the systemd service file, or the container image changed. # The default of `false` means "no restart needed" — appropriate when the role's # installation tasks haven't run (e.g., due to --tags skipping them). -matrix_wechat_restart_necessary: false +matrix_bridge_wechat_restart_necessary: false diff --git a/roles/custom/matrix-bridge-wechat/tasks/install.yml b/roles/custom/matrix-bridge-wechat/tasks/install.yml index 8ef3ae136..48840f1de 100644 --- a/roles/custom/matrix-bridge-wechat/tasks/install.yml +++ b/roles/custom/matrix-bridge-wechat/tasks/install.yml @@ -13,107 +13,107 @@ owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" with_items: - - {path: "{{ matrix_wechat_base_path }}", when: true} - - {path: "{{ matrix_wechat_config_path }}", when: true} - - {path: "{{ matrix_wechat_data_path }}", when: true} - - {path: "{{ matrix_wechat_container_src_files_path }}", when: "{{ matrix_wechat_container_image_self_build }}"} - - {path: "{{ matrix_wechat_agent_container_src_files_path }}", when: "{{ matrix_wechat_agent_container_image_self_build }}"} + - {path: "{{ matrix_bridge_wechat_base_path }}", when: true} + - {path: "{{ matrix_bridge_wechat_config_path }}", when: true} + - {path: "{{ matrix_bridge_wechat_data_path }}", when: true} + - {path: "{{ matrix_bridge_wechat_container_src_files_path }}", when: "{{ matrix_bridge_wechat_container_image_self_build }}"} + - {path: "{{ matrix_bridge_wechat_agent_container_src_files_path }}", when: "{{ matrix_bridge_wechat_agent_container_image_self_build }}"} when: item.when | bool - name: Ensure WeChat Bridge image is pulled community.docker.docker_image_pull: - name: "{{ matrix_wechat_container_image }}" + name: "{{ matrix_bridge_wechat_container_image }}" pull: always - when: not matrix_wechat_container_image_self_build - register: matrix_wechat_container_image_pull_result + when: not matrix_bridge_wechat_container_image_self_build + register: matrix_bridge_wechat_container_image_pull_result retries: "{{ devture_playbook_help_container_retries_count }}" delay: "{{ devture_playbook_help_container_retries_delay }}" - until: matrix_wechat_container_image_pull_result is not failed + until: matrix_bridge_wechat_container_image_pull_result is not failed -- when: matrix_wechat_container_image_self_build | bool +- when: matrix_bridge_wechat_container_image_self_build | bool block: - name: Ensure WeChat Bridge repository is present on self-build ansible.builtin.git: - repo: "{{ matrix_wechat_container_image_self_build_repo }}" - dest: "{{ matrix_wechat_container_src_files_path }}" - version: "{{ matrix_wechat_container_image_self_build_branch }}" + repo: "{{ matrix_bridge_wechat_container_image_self_build_repo }}" + dest: "{{ matrix_bridge_wechat_container_src_files_path }}" + version: "{{ matrix_bridge_wechat_container_image_self_build_branch }}" force: "yes" become: true become_user: "{{ matrix_user_name }}" - register: matrix_wechat_git_pull_results + register: matrix_bridge_wechat_git_pull_results - name: Ensure WeChat Bridge container image is built community.docker.docker_image_build: - name: "{{ matrix_wechat_container_image }}" + name: "{{ matrix_bridge_wechat_container_image }}" dockerfile: Dockerfile - path: "{{ matrix_wechat_container_src_files_path }}" + path: "{{ matrix_bridge_wechat_container_src_files_path }}" pull: true - rebuild: "{{ 'always' if matrix_wechat_git_pull_results.changed | bool else 'never' }}" - register: matrix_wechat_container_image_build_result + rebuild: "{{ 'always' if matrix_bridge_wechat_git_pull_results.changed | bool else 'never' }}" + register: matrix_bridge_wechat_container_image_build_result - name: Ensure WeChat Agent image is pulled community.docker.docker_image_pull: - name: "{{ matrix_wechat_agent_container_image }}" + name: "{{ matrix_bridge_wechat_agent_container_image }}" pull: always - when: not matrix_wechat_agent_container_image_self_build - register: matrix_wechat_agent_container_image_pull_result + when: not matrix_bridge_wechat_agent_container_image_self_build + register: matrix_bridge_wechat_agent_container_image_pull_result retries: "{{ devture_playbook_help_container_retries_count }}" delay: "{{ devture_playbook_help_container_retries_delay }}" - until: matrix_wechat_agent_container_image_pull_result is not failed + until: matrix_bridge_wechat_agent_container_image_pull_result is not failed -- when: matrix_wechat_agent_container_image_self_build | bool +- when: matrix_bridge_wechat_agent_container_image_self_build | bool block: - name: Ensure WeChat Agent repository is present on self-build ansible.builtin.git: - repo: "{{ matrix_wechat_agent_container_image_self_build_repo }}" - dest: "{{ matrix_wechat_agent_container_src_files_path }}" - version: "{{ matrix_wechat_agent_container_image_self_build_branch }}" + repo: "{{ matrix_bridge_wechat_agent_container_image_self_build_repo }}" + dest: "{{ matrix_bridge_wechat_agent_container_src_files_path }}" + version: "{{ matrix_bridge_wechat_agent_container_image_self_build_branch }}" force: "yes" become: true become_user: "{{ matrix_user_name }}" - register: matrix_wechat_agent_git_pull_results + register: matrix_bridge_wechat_agent_git_pull_results - name: Ensure WeChat Agent container image is built community.docker.docker_image_build: - name: "{{ matrix_wechat_agent_container_image }}" + name: "{{ matrix_bridge_wechat_agent_container_image }}" dockerfile: Dockerfile - path: "{{ matrix_wechat_agent_container_src_files_path }}" + path: "{{ matrix_bridge_wechat_agent_container_src_files_path }}" pull: true - rebuild: "{{ 'always' if matrix_wechat_agent_git_pull_results.changed | bool else 'never' }}" - register: matrix_wechat_agent_container_image_build_result + rebuild: "{{ 'always' if matrix_bridge_wechat_agent_git_pull_results.changed | bool else 'never' }}" + register: matrix_bridge_wechat_agent_container_image_build_result - name: Ensure WeChat configuration installed ansible.builtin.copy: - content: "{{ matrix_wechat_configuration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_wechat_config_path }}/config.yaml" + content: "{{ matrix_bridge_wechat_configuration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_bridge_wechat_config_path }}/config.yaml" mode: '0644' owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" - register: matrix_wechat_config_result + register: matrix_bridge_wechat_config_result - name: Ensure WeChat registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_wechat_registration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_wechat_config_path }}/registration.yaml" + content: "{{ matrix_bridge_wechat_registration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_bridge_wechat_config_path }}/registration.yaml" mode: '0644' owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" - register: matrix_wechat_registration_result + register: matrix_bridge_wechat_registration_result - name: Ensure Wechat Agent configuration installed ansible.builtin.copy: - content: "{{ matrix_wechat_agent_configuration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_wechat_config_path }}/agent-config.yaml" + content: "{{ matrix_bridge_wechat_agent_configuration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_bridge_wechat_config_path }}/agent-config.yaml" mode: '0644' owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" - register: matrix_wechat_agent_config_result + register: matrix_bridge_wechat_agent_config_result - name: Ensure matrix-wechat container network is created - when: matrix_wechat_container_network != 'host' + when: matrix_bridge_wechat_container_network != 'host' community.general.docker_network: enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" - name: "{{ matrix_wechat_container_network }}" + name: "{{ matrix_bridge_wechat_container_network }}" driver: bridge driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" @@ -122,26 +122,26 @@ src: "{{ role_path }}/templates/systemd/matrix-wechat.service.j2" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-wechat.service" mode: '0644' - register: matrix_wechat_systemd_service_result + register: matrix_bridge_wechat_systemd_service_result - name: Ensure matrix-wechat-agent.service installed ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-wechat-agent.service.j2" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-wechat-agent.service" mode: '0644' - register: matrix_wechat_agent_systemd_service_result + register: matrix_bridge_wechat_agent_systemd_service_result - name: Determine whether WeChat Bridge needs a restart ansible.builtin.set_fact: - matrix_wechat_restart_necessary: >- + matrix_bridge_wechat_restart_necessary: >- {{ - matrix_wechat_config_result.changed | default(false) - or matrix_wechat_registration_result.changed | default(false) - or matrix_wechat_agent_config_result.changed | default(false) - or matrix_wechat_systemd_service_result.changed | default(false) - or matrix_wechat_agent_systemd_service_result.changed | default(false) - or matrix_wechat_container_image_pull_result.changed | default(false) - or matrix_wechat_agent_container_image_pull_result.changed | default(false) - or matrix_wechat_container_image_build_result.changed | default(false) - or matrix_wechat_agent_container_image_build_result.changed | default(false) + matrix_bridge_wechat_config_result.changed | default(false) + or matrix_bridge_wechat_registration_result.changed | default(false) + or matrix_bridge_wechat_agent_config_result.changed | default(false) + or matrix_bridge_wechat_systemd_service_result.changed | default(false) + or matrix_bridge_wechat_agent_systemd_service_result.changed | default(false) + or matrix_bridge_wechat_container_image_pull_result.changed | default(false) + or matrix_bridge_wechat_agent_container_image_pull_result.changed | default(false) + or matrix_bridge_wechat_container_image_build_result.changed | default(false) + or matrix_bridge_wechat_agent_container_image_build_result.changed | default(false) }} diff --git a/roles/custom/matrix-bridge-wechat/tasks/main.yml b/roles/custom/matrix-bridge-wechat/tasks/main.yml index bcad351ab..8ed084797 100644 --- a/roles/custom/matrix-bridge-wechat/tasks/main.yml +++ b/roles/custom/matrix-bridge-wechat/tasks/main.yml @@ -10,15 +10,15 @@ - install-all - install-wechat block: - - when: matrix_wechat_enabled | bool + - when: matrix_bridge_wechat_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" - - when: matrix_wechat_enabled | bool + - when: matrix_bridge_wechat_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml" - tags: - setup-all - setup-wechat block: - - when: not matrix_wechat_enabled | bool + - when: not matrix_bridge_wechat_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml" diff --git a/roles/custom/matrix-bridge-wechat/tasks/uninstall.yml b/roles/custom/matrix-bridge-wechat/tasks/uninstall.yml index 7972bd7df..8cc746eb9 100644 --- a/roles/custom/matrix-bridge-wechat/tasks/uninstall.yml +++ b/roles/custom/matrix-bridge-wechat/tasks/uninstall.yml @@ -7,9 +7,9 @@ - name: Check existence of matrix-wechat service ansible.builtin.stat: path: "/etc/systemd/system/matrix-wechat.service" - register: matrix_wechat_service_stat + register: matrix_bridge_wechat_service_stat -- when: matrix_wechat_service_stat.stat.exists | bool +- when: matrix_bridge_wechat_service_stat.stat.exists | bool block: - name: Ensure matrix-wechat is stopped ansible.builtin.service: @@ -26,9 +26,9 @@ - name: Check existence of matrix-wechat-agent service ansible.builtin.stat: path: "/etc/systemd/system/matrix-wechat-agent.service" - register: matrix_wechat_agent_service_stat + register: matrix_bridge_wechat_agent_service_stat -- when: matrix_wechat_agent_service_stat.stat.exists | bool +- when: matrix_bridge_wechat_agent_service_stat.stat.exists | bool block: - name: Ensure matrix-wechat-agent is stopped ansible.builtin.service: diff --git a/roles/custom/matrix-bridge-wechat/tasks/validate_config.yml b/roles/custom/matrix-bridge-wechat/tasks/validate_config.yml index 138124bba..86ffa70a8 100644 --- a/roles/custom/matrix-bridge-wechat/tasks/validate_config.yml +++ b/roles/custom/matrix-bridge-wechat/tasks/validate_config.yml @@ -10,12 +10,12 @@ You need to define a required configuration setting (`{{ item.name }}`). when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - - {'name': 'matrix_wechat_appservice_token', when: true} - - {'name': 'matrix_wechat_homeserver_address', when: true} - - {'name': 'matrix_wechat_homeserver_token', when: true} - - {'name': 'matrix_wechat_database_hostname', when: "{{ matrix_wechat_database_engine == 'postgres' }}"} - - {'name': 'matrix_wechat_container_network', when: true} - - {'name': 'matrix_wechat_bridge_listen_secret', when: true} + - {'name': 'matrix_bridge_wechat_appservice_token', when: true} + - {'name': 'matrix_bridge_wechat_homeserver_address', when: true} + - {'name': 'matrix_bridge_wechat_homeserver_token', when: true} + - {'name': 'matrix_bridge_wechat_database_hostname', when: "{{ matrix_bridge_wechat_database_engine == 'postgres' }}"} + - {'name': 'matrix_bridge_wechat_container_network', when: true} + - {'name': 'matrix_bridge_wechat_bridge_listen_secret', when: true} - name: Fail if WeChat enabled on ARM64 (not supported by the wechat agent, even with self-building) when: matrix_architecture not in ['amd64'] @@ -28,7 +28,7 @@ The variable `{{ item.old }}` is deprecated. Please use `{{ item.new }}` instead. when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" with_items: - - {'old': 'matrix_wechat_container_image_name_prefix', 'new': 'matrix_wechat_container_image_registry_prefix'} - - {'old': 'matrix_wechat_agent_container_image_name_prefix', 'new': 'matrix_wechat_agent_container_image_registry_prefix'} - - {'old': 'matrix_wechat_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'} - - {'old': 'matrix_wechat_agent_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'} + - {'old': 'matrix_bridge_wechat_container_image_name_prefix', 'new': 'matrix_bridge_wechat_container_image_registry_prefix'} + - {'old': 'matrix_bridge_wechat_agent_container_image_name_prefix', 'new': 'matrix_bridge_wechat_agent_container_image_registry_prefix'} + - {'old': 'matrix_bridge_wechat_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'} + - {'old': 'matrix_bridge_wechat_agent_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'} diff --git a/roles/custom/matrix-bridge-wechat/templates/agent-config.yaml.j2 b/roles/custom/matrix-bridge-wechat/templates/agent-config.yaml.j2 index 6b30c6345..cd2d05d50 100644 --- a/roles/custom/matrix-bridge-wechat/templates/agent-config.yaml.j2 +++ b/roles/custom/matrix-bridge-wechat/templates/agent-config.yaml.j2 @@ -12,7 +12,7 @@ wechat: service: addr: ws://matrix-wechat:20002 - secret: {{ matrix_wechat_bridge_listen_secret | to_json }} + secret: {{ matrix_bridge_wechat_bridge_listen_secret | to_json }} ping_interval: 30s log: diff --git a/roles/custom/matrix-bridge-wechat/templates/config.yaml.j2 b/roles/custom/matrix-bridge-wechat/templates/config.yaml.j2 index 86330ed48..694ab341f 100644 --- a/roles/custom/matrix-bridge-wechat/templates/config.yaml.j2 +++ b/roles/custom/matrix-bridge-wechat/templates/config.yaml.j2 @@ -2,9 +2,9 @@ # Homeserver details. homeserver: # The address that this appservice can use to connect to the homeserver. - address: {{ matrix_wechat_homeserver_address | to_json }} + address: {{ matrix_bridge_wechat_homeserver_address | to_json }} # The domain of the homeserver (for MXIDs, etc). - domain: {{ matrix_wechat_homeserver_domain | to_json }} + domain: {{ matrix_bridge_wechat_homeserver_domain | to_json }} # What software is the homeserver running? # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. @@ -16,7 +16,7 @@ homeserver: # Endpoint for reporting per-message status. message_send_checkpoint_endpoint: null # Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246? - async_media: {{ matrix_wechat_homeserver_async_media | to_json }} + async_media: {{ matrix_bridge_wechat_homeserver_async_media | to_json }} # Should the bridge use a websocket for connecting to the homeserver? # The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy, @@ -29,7 +29,7 @@ homeserver: # Changing these values requires regeneration of the registration. appservice: # The address that the homeserver can use to connect to this appservice. - address: {{ matrix_wechat_appservice_address | to_json }} + address: {{ matrix_bridge_wechat_appservice_address | to_json }} # The hostname and port where this appservice should listen. hostname: 0.0.0.0 @@ -43,7 +43,7 @@ appservice: # SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string # Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable # To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql - uri: {{ matrix_wechat_database_connection_string | to_json }} + uri: {{ matrix_bridge_wechat_database_connection_string | to_json }} # Maximum number of connections. Mostly relevant for Postgres. max_open_conns: 20 max_idle_conns: 2 @@ -57,7 +57,7 @@ appservice: # Appservice bot details. bot: # Username of the appservice bot. - username: {{ matrix_wechat_appservice_bot_username | to_json }} + username: {{ matrix_bridge_wechat_appservice_bot_username | to_json }} # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty # to leave display name/avatar as-is. displayname: WeChat bridge bot @@ -73,8 +73,8 @@ appservice: async_transactions: false # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify. - as_token: {{ matrix_wechat_appservice_token | to_json }} - hs_token: {{ matrix_wechat_homeserver_token | to_json }} + as_token: {{ matrix_bridge_wechat_appservice_token | to_json }} + hs_token: {{ matrix_bridge_wechat_homeserver_token | to_json }} # Bridge config bridge: @@ -85,7 +85,7 @@ bridge: displayname_template: "{% raw %}{{if .Name}}{{.Name}}{{else}}{{.Uin}}{{end}} (WeChat){% endraw %}" # WeChat listen address (for agent connection) listen_address: "0.0.0.0:20002" - listen_secret: {{ matrix_wechat_bridge_listen_secret | to_json }} + listen_secret: {{ matrix_bridge_wechat_bridge_listen_secret | to_json }} # Should the bridge create a space for each logged-in user and add bridged rooms to it? # Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time. personal_filtering_spaces: true @@ -112,7 +112,7 @@ bridge: send_presence_on_typing: false # Servers to always allow double puppeting from double_puppet_server_map: - "{{ matrix_wechat_homeserver_domain }}": {{ matrix_wechat_homeserver_address }} + "{{ matrix_bridge_wechat_homeserver_domain }}": {{ matrix_bridge_wechat_homeserver_address }} # Allow using double puppeting from any server with a valid client .well-known file. double_puppet_allow_discovery: false # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth @@ -120,7 +120,7 @@ bridge: # If set, double puppeting will be enabled automatically for local users # instead of users having to find an access token and run `login-matrix` # manually. - login_shared_secret_map: {{ matrix_wechat_login_shared_secret_map | to_json }} + login_shared_secret_map: {{ matrix_bridge_wechat_login_shared_secret_map | to_json }} # Whether to explicitly set the avatar and room name for private chat portal rooms. # If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms. # If set to `always`, all DM rooms will have explicit names and avatars set. @@ -154,7 +154,7 @@ bridge: deadline: 120s # The prefix for commands. Only required in non-management rooms. - command_prefix: {{ matrix_wechat_command_prefix | to_json }} + command_prefix: {{ matrix_bridge_wechat_command_prefix | to_json }} # Messages sent upon joining a management room. # Markdown is supported. The defaults are listed below. @@ -173,10 +173,10 @@ bridge: # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info. encryption: # Allow encryption, work in group chat rooms with e2ee enabled - allow: {{ matrix_wechat_encryption_allow | to_json }} + allow: {{ matrix_bridge_wechat_encryption_allow | to_json }} # Default to encryption, force-enable encryption in all portals the bridge creates # This will cause the bridge bot to be in private chats for the encryption to work properly. - default: {{ matrix_wechat_encryption_default | to_json }} + default: {{ matrix_bridge_wechat_encryption_default | to_json }} # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data. appservice: false # Require encryption, drop any unencrypted messages. @@ -255,11 +255,11 @@ bridge: # * - All Matrix users # domain - All users on that homeserver # mxid - Specific user - permissions: {{ matrix_wechat_permissions | to_json }} + permissions: {{ matrix_bridge_wechat_permissions | to_json }} # Logging config. See https://github.com/tulir/zeroconfig for details. logging: - min_level: {{ matrix_wechat_log_level }} + min_level: {{ matrix_bridge_wechat_log_level }} writers: - type: stdout format: pretty-colored diff --git a/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat-agent.service.j2 b/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat-agent.service.j2 index 4d51bdcec..ed0975140 100644 --- a/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat-agent.service.j2 +++ b/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat-agent.service.j2 @@ -1,11 +1,11 @@ #jinja2: lstrip_blocks: True [Unit] Description=Matrix WeChat Agent -{% for service in matrix_wechat_systemd_required_services_list %} +{% for service in matrix_bridge_wechat_systemd_required_services_list %} Requires={{ service }} After={{ service }} {% endfor %} -{% for service in matrix_wechat_systemd_wanted_services_list %} +{% for service in matrix_bridge_wechat_systemd_wanted_services_list %} Wants={{ service }} {% endfor %} DefaultDependencies=no @@ -24,17 +24,17 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ --rm \ --name=matrix-wechat-agent \ --log-driver=none \ - --user={{ matrix_wechat_agent_container_user_uid }}:{{ matrix_wechat_agent_container_user_gid }} \ + --user={{ matrix_bridge_wechat_agent_container_user_uid }}:{{ matrix_bridge_wechat_agent_container_user_gid }} \ --cap-drop=ALL \ - --network={{ matrix_wechat_container_network }} \ - --mount type=bind,src={{ matrix_wechat_config_path }}/agent-config.yaml,dst=/home/user/matrix-wechat-agent/configure.yaml,ro \ - {% for arg in matrix_wechat_container_extra_arguments %} + --network={{ matrix_bridge_wechat_container_network }} \ + --mount type=bind,src={{ matrix_bridge_wechat_config_path }}/agent-config.yaml,dst=/home/user/matrix-wechat-agent/configure.yaml,ro \ + {% for arg in matrix_bridge_wechat_container_extra_arguments %} {{ arg }} \ {% endfor %} - {{ matrix_wechat_agent_container_image }} + {{ matrix_bridge_wechat_agent_container_image }} -{% if matrix_wechat_container_network != 'host' %} -{% for network in matrix_wechat_container_additional_networks %} +{% if matrix_bridge_wechat_container_network != 'host' %} +{% for network in matrix_bridge_wechat_container_additional_networks %} ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-wechat-agent {% endfor %} {% endif %} diff --git a/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat.service.j2 b/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat.service.j2 index d3e6b972d..b748402df 100644 --- a/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat.service.j2 +++ b/roles/custom/matrix-bridge-wechat/templates/systemd/matrix-wechat.service.j2 @@ -1,11 +1,11 @@ #jinja2: lstrip_blocks: True [Unit] Description=Matrix WeChat Bridge -{% for service in matrix_wechat_systemd_required_services_list %} +{% for service in matrix_bridge_wechat_systemd_required_services_list %} Requires={{ service }} After={{ service }} {% endfor %} -{% for service in matrix_wechat_systemd_wanted_services_list %} +{% for service in matrix_bridge_wechat_systemd_wanted_services_list %} Wants={{ service }} {% endfor %} DefaultDependencies=no @@ -22,17 +22,17 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ --log-driver=none \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ - --network={{ matrix_wechat_container_network }} \ - --mount type=bind,src={{ matrix_wechat_config_path }},dst=/config,ro \ - --mount type=bind,src={{ matrix_wechat_data_path }},dst=/data \ + --network={{ matrix_bridge_wechat_container_network }} \ + --mount type=bind,src={{ matrix_bridge_wechat_config_path }},dst=/config,ro \ + --mount type=bind,src={{ matrix_bridge_wechat_data_path }},dst=/data \ --workdir=/data \ - {% for arg in matrix_wechat_container_extra_arguments %} + {% for arg in matrix_bridge_wechat_container_extra_arguments %} {{ arg }} \ {% endfor %} - {{ matrix_wechat_container_image }} \ + {{ matrix_bridge_wechat_container_image }} \ /usr/bin/matrix-wechat -c /config/config.yaml -r /config/registration.yaml --no-update -{% if matrix_wechat_container_network != 'host' %} -{% for network in matrix_wechat_container_additional_networks %} +{% if matrix_bridge_wechat_container_network != 'host' %} +{% for network in matrix_bridge_wechat_container_additional_networks %} ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-wechat {% endfor %} {% endif %}