| @@ -489,8 +489,6 @@ matrix_mautrix_wsproxy_appservice_token: "{{ matrix_synapse_macaroon_secret_key | |||||
| matrix_mautrix_wsproxy_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_mautrix_wsproxy_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" | ||||
| # Postgres is the default, except if not using `matrix_postgres` (internal postgres) | # Postgres is the default, except if not using `matrix_postgres` (internal postgres) | ||||
| matrix_mautrix_wsproxy_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}" | |||||
| matrix_mautrix_wsproxy_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mauwsproxy.db') | to_uuid }}" | |||||
| ###################################################################### | ###################################################################### | ||||
| # | # | ||||
| @@ -1411,12 +1409,6 @@ matrix_postgres_additional_databases: | | |||||
| 'password': matrix_mautrix_whatsapp_database_password, | 'password': matrix_mautrix_whatsapp_database_password, | ||||
| }] if (matrix_mautrix_whatsapp_enabled and matrix_mautrix_whatsapp_database_engine == 'postgres' and matrix_mautrix_whatsapp_database_hostname == 'matrix-postgres') else []) | }] if (matrix_mautrix_whatsapp_enabled and matrix_mautrix_whatsapp_database_engine == 'postgres' and matrix_mautrix_whatsapp_database_hostname == 'matrix-postgres') else []) | ||||
| + | + | ||||
| ([{ | |||||
| 'name': matrix_mautrix_wsproxy_database_name, | |||||
| 'username': matrix_mautrix_wsproxy_database_username, | |||||
| 'password': matrix_mautrix_wsproxy_database_password, | |||||
| }] if (matrix_mautrix_wsproxy_enabled and matrix_mautrix_wsproxy_database_engine == 'postgres' and matrix_mautrix_wsproxy_database_hostname == 'matrix-postgres') else []) | |||||
| + | |||||
| ([{ | ([{ | ||||
| 'name': matrix_mx_puppet_skype_database_name, | 'name': matrix_mx_puppet_skype_database_name, | ||||
| 'username': matrix_mx_puppet_skype_database_username, | 'username': matrix_mx_puppet_skype_database_username, | ||||
| @@ -52,23 +52,19 @@ matrix_mautrix_wsproxy_configuration_extension: "{{ matrix_mautrix_wsproxy_confi | |||||
| matrix_mautrix_wsproxy_configuration: "{{ matrix_mautrix_wsproxy_configuration_yaml|from_yaml|combine(matrix_mautrix_wsproxy_configuration_extension, recursive=True) }}" | matrix_mautrix_wsproxy_configuration: "{{ matrix_mautrix_wsproxy_configuration_yaml|from_yaml|combine(matrix_mautrix_wsproxy_configuration_extension, recursive=True) }}" | ||||
| matrix_mautrix_wsproxy_registration_yaml: | | matrix_mautrix_wsproxy_registration_yaml: | | ||||
| # appservice -> id from the config | |||||
| id: wsproxy | id: wsproxy | ||||
| # appservice -> as_token and hs_token from the config | |||||
| as_token: random string | |||||
| hs_token: random string | |||||
| namespaces: | |||||
| users: | |||||
| # The localpart here is username_template from the config, but .+ instead of {{.}} | |||||
| - regex: '@imessage_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$' | |||||
| exclusive: true | |||||
| # Localpart here is appservice -> bot -> username from the config | |||||
| - regex: '@imessagebot:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$' | |||||
| exclusive: true | |||||
| # Address that Synapse uses to contact mautrix-wsproxy | |||||
| url: {{ matrix_mautrix_wsproxy_appservice_address }} | url: {{ matrix_mautrix_wsproxy_appservice_address }} | ||||
| # Put a new random string here, it doesn't affect anything else | |||||
| sender_localpart: random string | |||||
| as_token: "{{ matrix_mautrix_wsproxy_appservice_token }}" | |||||
| hs_token: "{{ matrix_mautrix_wsproxy_homeserver_token }}" | |||||
| # See https://github.com/tulir/mautrix-signal/issues/43 | |||||
| sender_localpart: _bot_{{ matrix_mautrix_wsproxy_appservice_bot_username }} | |||||
| rate_limited: false | rate_limited: false | ||||
| namespaces: | |||||
| users: | |||||
| - regex: '^@wsproxy_[0-9]+:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | |||||
| exclusive: true | |||||
| - exclusive: true | |||||
| regex: '^@{{ matrix_mautrix_wsproxy_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | |||||
| de.sorunome.msc2409.push_ephemeral: true | |||||
| matrix_mautrix_wsproxy_registration: "{{ matrix_mautrix_wsproxy_registration_yaml|from_yaml }}" | matrix_mautrix_wsproxy_registration: "{{ matrix_mautrix_wsproxy_registration_yaml|from_yaml }}" | ||||
| @@ -1,16 +1,16 @@ | |||||
| - set_fact: | - set_fact: | ||||
| matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-whatsapp.service'] }}" | |||||
| when: matrix_mautrix_whatsapp_enabled|bool | |||||
| matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-wsproxy.service'] }}" | |||||
| when: matrix_mautrix_wsproxy_enabled|bool | |||||
| # If the matrix-synapse role is not used, these variables may not exist. | # If the matrix-synapse role is not used, these variables may not exist. | ||||
| - set_fact: | - set_fact: | ||||
| matrix_synapse_container_extra_arguments: > | matrix_synapse_container_extra_arguments: > | ||||
| {{ matrix_synapse_container_extra_arguments|default([]) }} | {{ matrix_synapse_container_extra_arguments|default([]) }} | ||||
| + | + | ||||
| ["--mount type=bind,src={{ matrix_mautrix_whatsapp_config_path }}/registration.yaml,dst=/matrix-mautrix-whatsapp-registration.yaml,ro"] | |||||
| ["--mount type=bind,src={{ matrix_mautrix_wsproxy_config_path }}/registration.yaml,dst=/matrix-mautrix-wsproxy-registration.yaml,ro"] | |||||
| matrix_synapse_app_service_config_files: > | matrix_synapse_app_service_config_files: > | ||||
| {{ matrix_synapse_app_service_config_files|default([]) }} | {{ matrix_synapse_app_service_config_files|default([]) }} | ||||
| + | + | ||||
| {{ ["/matrix-mautrix-whatsapp-registration.yaml"] }} | |||||
| when: matrix_mautrix_whatsapp_enabled|bool | |||||
| {{ ["/matrix-mautrix-wsproxy-registration.yaml"] }} | |||||
| when: matrix_mautrix_wsproxy_enabled|bool | |||||
| @@ -28,21 +28,12 @@ | |||||
| with_items: | with_items: | ||||
| - "{{ matrix_mautrix_wsproxy_base_path }}" | - "{{ matrix_mautrix_wsproxy_base_path }}" | ||||
| - "{{ matrix_mautrix_wsproxy_config_path }}" | - "{{ matrix_mautrix_wsproxy_config_path }}" | ||||
| - "{{ matrix_mautrix_wsproxy_data_path }}" | |||||
| - name: Check if an old matrix state file exists | - name: Check if an old matrix state file exists | ||||
| stat: | stat: | ||||
| path: "{{ matrix_mautrix_wsproxy_base_path }}/mx-state.json" | path: "{{ matrix_mautrix_wsproxy_base_path }}/mx-state.json" | ||||
| register: matrix_mautrix_wsproxy_stat_mx_state | register: matrix_mautrix_wsproxy_stat_mx_state | ||||
| - name: (Data relocation) Move mautrix-wsproxy database file to ./data directory | |||||
| command: "mv {{ matrix_mautrix_wsproxy_base_path }}/mautrix-wsproxy.db {{ matrix_mautrix_wsproxy_data_path }}/mautrix-wsproxy.db" | |||||
| when: "matrix_mautrix_wsproxy_stat_database.stat.exists" | |||||
| - name: (Data relocation) Move mautrix-wsproxy mx-state file to ./data directory | |||||
| command: "mv {{ matrix_mautrix_wsproxy_base_path }}/mx-state.json {{ matrix_mautrix_wsproxy_data_path }}/mx-state.json" | |||||
| when: "matrix_mautrix_wsproxy_stat_mx_state.stat.exists" | |||||
| - name: Ensure mautrix-wsproxy config.yaml installed | - name: Ensure mautrix-wsproxy config.yaml installed | ||||
| copy: | copy: | ||||
| content: "{{ matrix_mautrix_wsproxy_configuration|to_nice_yaml }}" | content: "{{ matrix_mautrix_wsproxy_configuration|to_nice_yaml }}" | ||||
| @@ -24,9 +24,6 @@ appservice: | |||||
| # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s | # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s | ||||
| max_body_size: 1 | max_body_size: 1 | ||||
| # The full URI to the database. Only Postgres is currently supported. | |||||
| database: {{ matrix_mautrix_wsproxy_database_connection_string }} | |||||
| # Provisioning API part of the web server for automated portal creation and fetching information. | # Provisioning API part of the web server for automated portal creation and fetching information. | ||||
| # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager). | # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager). | ||||
| provisioning: | provisioning: | ||||
| @@ -44,7 +41,7 @@ appservice: | |||||
| bot_username: {{ matrix_mautrix_wsproxy_appservice_bot_username|to_json }} | bot_username: {{ matrix_mautrix_wsproxy_appservice_bot_username|to_json }} | ||||
| # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty | # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty | ||||
| # to leave display name/avatar as-is. | # to leave display name/avatar as-is. | ||||
| bot_displayname: Android Messages bridge bot | |||||
| bot_displayname: iMessage bridge bot | |||||
| bot_avatar: mxc://maunium.net/VuvevQiMRlOxuBVMBNEZZrxi | bot_avatar: mxc://maunium.net/VuvevQiMRlOxuBVMBNEZZrxi | ||||
| # Community ID for bridged users (changes registration file) and rooms. | # Community ID for bridged users (changes registration file) and rooms. | ||||
| @@ -131,9 +128,6 @@ bridge: | |||||
| # The prefix for commands. Only required in non-management rooms. | # The prefix for commands. Only required in non-management rooms. | ||||
| command_prefix: "!im" | command_prefix: "!im" | ||||
| # This bridge only supports a single user | |||||
| user: "{{ matrix_mautrix_wsproxy_bridge_user }}" | |||||
| logging: | logging: | ||||
| # The directory for log files. Will be created if not found. | # The directory for log files. Will be created if not found. | ||||
| directory: ./logs | directory: ./logs | ||||
| @@ -25,8 +25,6 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-wsprox | |||||
| --cap-drop=ALL \ | --cap-drop=ALL \ | ||||
| --network={{ matrix_docker_network }} \ | --network={{ matrix_docker_network }} \ | ||||
| -v {{ matrix_mautrix_wsproxy_config_path }}:/config:z \ | -v {{ matrix_mautrix_wsproxy_config_path }}:/config:z \ | ||||
| -v {{ matrix_mautrix_wsproxy_data_path }}:/data:z \ | |||||
| --workdir=/data \ | |||||
| {% for arg in matrix_mautrix_wsproxy_container_extra_arguments %} | {% for arg in matrix_mautrix_wsproxy_container_extra_arguments %} | ||||
| {{ arg }} \ | {{ arg }} \ | ||||
| {% endfor %} | {% endfor %} | ||||