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

Got it to run and register

pull/1050/head
hanthor 4 лет назад
Родитель
Сommit
8494db19a6
6 измененных файлов: 17 добавлений и 46 удалений
  1. +0
    -8
      group_vars/matrix_servers
  2. +11
    -15
      roles/matrix-bridge-mautrix-wsproxy/defaults/main.yml
  3. +5
    -5
      roles/matrix-bridge-mautrix-wsproxy/tasks/init.yml
  4. +0
    -9
      roles/matrix-bridge-mautrix-wsproxy/tasks/setup_install.yml
  5. +1
    -7
      roles/matrix-bridge-mautrix-wsproxy/templates/config.yaml.j2
  6. +0
    -2
      roles/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy.service.j2

+ 0
- 8
group_vars/matrix_servers Просмотреть файл

@@ -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 '' }}"

# 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,
}] 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,
'username': matrix_mx_puppet_skype_database_username,


+ 11
- 15
roles/matrix-bridge-mautrix-wsproxy/defaults/main.yml Просмотреть файл

@@ -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_registration_yaml: |
# appservice -> id from the config
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 }}
# 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
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 }}"

+ 5
- 5
roles/matrix-bridge-mautrix-wsproxy/tasks/init.yml Просмотреть файл

@@ -1,16 +1,16 @@
- 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.
- set_fact:
matrix_synapse_container_extra_arguments: >
{{ 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|default([]) }}
+
{{ ["/matrix-mautrix-whatsapp-registration.yaml"] }}
when: matrix_mautrix_whatsapp_enabled|bool
{{ ["/matrix-mautrix-wsproxy-registration.yaml"] }}
when: matrix_mautrix_wsproxy_enabled|bool

+ 0
- 9
roles/matrix-bridge-mautrix-wsproxy/tasks/setup_install.yml Просмотреть файл

@@ -28,21 +28,12 @@
with_items:
- "{{ matrix_mautrix_wsproxy_base_path }}"
- "{{ matrix_mautrix_wsproxy_config_path }}"
- "{{ matrix_mautrix_wsproxy_data_path }}"

- name: Check if an old matrix state file exists
stat:
path: "{{ matrix_mautrix_wsproxy_base_path }}/mx-state.json"
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
copy:
content: "{{ matrix_mautrix_wsproxy_configuration|to_nice_yaml }}"


+ 1
- 7
roles/matrix-bridge-mautrix-wsproxy/templates/config.yaml.j2 Просмотреть файл

@@ -24,9 +24,6 @@ appservice:
# Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
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.
# Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
provisioning:
@@ -44,7 +41,7 @@ appservice:
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
# to leave display name/avatar as-is.
bot_displayname: Android Messages bridge bot
bot_displayname: iMessage bridge bot
bot_avatar: mxc://maunium.net/VuvevQiMRlOxuBVMBNEZZrxi

# 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.
command_prefix: "!im"

# This bridge only supports a single user
user: "{{ matrix_mautrix_wsproxy_bridge_user }}"

logging:
# The directory for log files. Will be created if not found.
directory: ./logs


+ 0
- 2
roles/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy.service.j2 Просмотреть файл

@@ -25,8 +25,6 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-wsprox
--cap-drop=ALL \
--network={{ matrix_docker_network }} \
-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 %}
{{ arg }} \
{% endfor %}


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