diff --git a/conf/config.yaml b/conf/config.yaml index d5cf6a7..40b0772 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -1,67 +1,52 @@ # Homeserver details homeserver: # The address that this appservice can use to connect to the homeserver. - # address: https://example.com address: __DOMAIN__ # The domain of the homeserver (for MXIDs, etc). - # domain: example.com domain: __SERVER_NAME__ # Whether or not to verify the SSL certificate of the homeserver. # Only applies if address starts with https:// - # verify_ssl: true verify_ssl: __VERIFY_SERVER_SSL_CERTIFICATES__ - # Whether or not the homeserver supports asmux-specific endpoints, - # such as /_matrix/client/unstable/net.maunium.asmux/dms for atomically - # updating m.direct. - # asmux: false asmux: __MATRIX_SERVER_SUPPORTS_ASMUX__ # Application service host/registration related details # Changing these values requires regeneration of the registration. appservice: # The address that the homeserver can use to connect to this appservice. - # address: http://localhost:29319 address: http://localhost:__PORT__ + # When using https:// the TLS certificate and key files for the address. + tls_cert: false + tls_key: false # The hostname and port where this appservice should listen. - # hostname: localhost hostname: 0.0.0.0 - # port: 29319 port: __PORT__ # The maximum body size of appservice API requests (from the homeserver) in mebibytes # 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: postgres://username:password@hostname/db - database: postgres://__MAUTRIX_FACEBOOK_USER__:__MAUTRIX_FACEBOOK_DB_PWD__@localhost:5432/__MAUTRIX_FACEBOOK_DB_NAME__ - - # Public part of web server for out-of-Matrix interaction with the bridge. - public: - # Whether or not the public-facing endpoints should be enabled. - enabled: false - # The prefix to use in the public-facing endpoints. - prefix: /public - # The base URL where the public-facing endpoints are available. The prefix is not added - # implicitly. - external: https://example.com/public - # Shared secret for integration managers such as mautrix-manager. - # If set to "generate", a random string will be generated on the next startup. - # If null, integration manager access to the API will not be possible. - shared_secret: generate + database: postgres://__MAUTRIX_BRIDGE_USER__:__MAUTRIX_BRIDGE_DB_PWD__@localhost:5432/__MAUTRIX_BRIDGE_DB_NAME__ + # Additional arguments for asyncpg.create_pool() + # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool + database_opts: + min_size: 5 + max_size: 10 # The unique ID of this appservice. - id: __FACEBOOKBOT__ + id: __BOTNAME__ # Username of the appservice bot. - bot_username: __FACEBOOKBOT__ + bot_username: __BOTNAME__ # 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: FB bridge bot - bot_avatar: mxc://maunium.net/ygtkteZsXnGJLJHRchUwYWak + bot_displayname: Signal bridge bot + bot_avatar: mxc://maunium.net/wPJgTQbZOtpBFmDNkiNEMDUp # Community ID for bridged users (changes registration file) and rooms. - # Must be created manually. Example: "+facebook:example.com" - community_id: null + # Must be created manually. + # + # Example: "+signal:example.com". Set to false to disable. + community_id: false # Whether or not to receive ephemeral events via appservice transactions. # Requires MSC2409 support (i.e. Synapse 1.22+). @@ -77,55 +62,58 @@ metrics: enabled: false listen_port: 8000 +signal: + # Path to signald unix socket + socket_path: /var/run/signald/signald.sock + # Directory for temp files when sending files to Signal. This should be an + # absolute path that signald can read. For attachments in the other direction, + # make sure signald is configured to use an absolute path as the data directory. + outgoing_attachment_dir: /tmp + # Directory where signald stores avatars for groups. + avatar_dir: ~/.config/signald/avatars + # Directory where signald stores auth data. Used to delete data when logging out. + data_dir: ~/.config/signald/data + # Whether or not message attachments should be removed from disk after they're bridged. + remove_file_after_handling: true + # Bridge config bridge: - # Localpart template of MXIDs for Facebook users. - # {userid} is replaced with the user ID of the Facebook user. - username_template: "fb_{userid}" - # Localpart template for per-user room grouping community IDs. - # The bridge will create these communities and add all of the specific user's portals to the community. - # {localpart} is the MXID localpart and {server} is the MXID server part of the user. - # (Note that, by default, non-admins might not have your homeserver's permission to create - # communities. You should set `enable_group_creation: true` in homeserver.yaml to fix this.) - # `facebook_{localpart}={server}` is a good value. - community_template: 'facebook_{localpart}={server}' - # Displayname template for Facebook users. - # {displayname} is replaced with the display name of the Facebook user - # as defined below in displayname_preference. - # Keys available for displayname_preference are also available here. - displayname_template: "{displayname} (FB)" - # Available keys: - # "name" (full name) - # "first_name" - # "last_name" - # "nickname" - # "own_nickname" (user-specific!) + # Localpart template of MXIDs for Signal users. + # {userid} is replaced with an identifier for the Signal user. + username_template: "signal_{userid}" + # Displayname template for Signal users. + # {displayname} is replaced with the displayname of the Signal user, which is the first + # available variable in displayname_preference. The variables in displayname_preference + # can also be used here directly. + displayname_template: "{displayname} (Signal)" + # Whether or not contact list displaynames should be used. + # Possible values: disallow, allow, prefer + # + # Multi-user instances are recommended to disallow contact list names, as otherwise there can + # be conflicts between names from different users' contact lists. + contact_list_names: disallow + # Available variables: full_name, first_name, last_name, phone, uuid displayname_preference: - - name - - first_name + - full_name + - phone - # The prefix for commands. Only required in non-management rooms. - command_prefix: "!fb" - - # Number of chats to sync (and create portals for) on startup/login. - # Set 0 to disable automatic syncing. - initial_chat_sync: 20 - # Whether or not the Facebook users of logged in Matrix users should be - # invited to private chats when the user sends a message from another client. - invite_own_puppet_to_pm: false - # Whether or not to use /sync to get presence, read receipts and typing notifications + # Whether or not to create portals for all groups on login/connect. + autocreate_group_portal: true + # Whether or not to create portals for all contacts on login/connect. + autocreate_contact_portal: false + # Whether or not to use /sync to get read receipts and typing notifications # when double puppeting is enabled sync_with_custom_puppets: true # Whether or not to update the m.direct account data event when double puppeting is enabled. # Note that updating the m.direct event is not atomic (except with mautrix-asmux) # and is therefore prone to race conditions. sync_direct_chat_list: false - # Servers to always allow double puppeting from - double_puppet_server_map: - example.com: https://__SERVER_NAME__ # 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 + # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false. + double_puppet_server_map: + example.com: https://__SERVER_NAME__ + # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth # # If set, custom puppets will be enabled automatically for local users # instead of users having to find an access token and run `login-matrix` @@ -133,17 +121,12 @@ bridge: # If using this for other servers than the bridge's server, # you must also set the URL in the double_puppet_server_map. login_shared_secret_map: - example.com: foobar - # Whether or not to bridge presence in both directions. Facebook allows users not to broadcast - # presence, but then it won't send other users' presence to the client. - presence: true - # Whether or not to update avatars when syncing all contacts at startup. - update_avatar_initial_sync: true - # End-to-bridge encryption support options. These require matrix-nio to be installed with pip - # and login_shared_secret to be configured in order to get a device for the bridge bot. - # - # Additionally, https://github.com/matrix-org/synapse/pull/5758 is required if using a normal - # application service. + example.com: foo + # Whether or not created rooms should have federation enabled. + # If false, created portal rooms will never be federated. + federate_rooms: true + # End-to-bridge encryption support options. You must install the e2be optional dependency for + # this to work. See https://github.com/tulir/mautrix-telegram/wiki/End‐to‐bridge-encryption encryption: # Allow encryption, work in group chat rooms with e2ee enabled allow: __ENCRYPTION__ @@ -162,52 +145,35 @@ bridge: # Require devices to be verified by the bridge? # Verification by the bridge is not yet implemented. require_verification: true + # Whether or not to explicitly set the avatar and room name for private + # chat portal rooms. This will be implicitly enabled if encryption.default is true. + private_chat_portal_meta: false # Whether or not the bridge should send a read receipt from the bridge bot when a message has - # been sent to Facebook. + # been sent to Signal. This let's you check manually whether the bridge is receiving your + # messages. + # Note that this is not related to Signal delivery receipts. delivery_receipts: false - # Whether to allow inviting arbitrary mxids to portal rooms - allow_invites: false - # Settings for backfilling messages from Facebook. - backfill: - # Whether or not the Facebook users of logged in Matrix users should be - # invited to private chats when backfilling history from Facebook. This is - # usually needed to prevent rate limits and to allow timestamp massaging. - invite_own_puppet: true - # Maximum number of messages to backfill initially. - # Set to 0 to disable backfilling when creating portal. - initial_limit: 0 - # Maximum number of messages to backfill if messages were missed while - # the bridge was disconnected. - # Set to 0 to disable backfilling missed messages. - missed_limit: 1000 - # If using double puppeting, should notifications be disabled - # while the initial backfill is in progress? - disable_notifications: false - periodic_reconnect: - # Interval in seconds in which to automatically reconnect all users. - # This can be used to automatically mitigate the bug where Facebook stops sending messages. - # Set to -1 to disable periodic reconnections entirely. - interval: -1 - # What to do in periodic reconnects. Either "refresh" or "reconnect" - mode: refresh - # Should even disconnected users be reconnected? - always: false - # The number of seconds that a disconnection can last without triggering an automatic re-sync - # and missed message backfilling when reconnecting. - # Set to 0 to always re-sync, or -1 to never re-sync automatically. - resync_max_disconnected_time: 5 - # Whether or not temporary disconnections should send notices to the notice room. - # If this is false, disconnections will never send messages and connections will only send - # messages if it was disconnected for more than resync_max_disconnected_time seconds. - temporary_disconnect_notices: true - # Whether or not the bridge should try to "refresh" the connection if a normal reconnection - # attempt fails. - refresh_on_reconnection_fail: false + # Whether or not delivery errors should be reported as messages in the Matrix room. (not yet implemented) + delivery_error_reports: false # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run. # This field will automatically be changed back to false after it, # except if the config file is not writable. resend_bridge_info: false + # 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: + # Whether or not the provisioning API should be enabled. + enabled: true + # The prefix to use in the provisioning API endpoints. + prefix: /_matrix/provision/v1 + # The shared secret to authorize users of the API. + # Set to "generate" to generate and save a new token. + shared_secret: generate + + # The prefix for commands. Only required in non-management rooms. + command_prefix: "!signal" + # Permissions for using the bridge. # Permitted values: # user - Use the bridge with puppeting. @@ -220,6 +186,7 @@ bridge: "__BOTUSERS__": "user" "__BOTADMIN__": "admin" + # Python logging configuration. # # See section 16.7.2 of the Python documentation for more info: @@ -228,7 +195,7 @@ logging: version: 1 formatters: colored: - (): mautrix_facebook.util.ColorFormatter + (): mautrix_signal.util.ColorFormatter format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s" normal: format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s" @@ -245,10 +212,8 @@ logging: loggers: mau: level: DEBUG - paho: - level: INFO aiohttp: level: INFO root: level: DEBUG - handlers: [file, console] + handlers: [file, console] \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index cd52f4f..994d859 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Matrix Facebook Bridge +Description=Matrix Signal Bridge After=matrix-synapse.service [Service] @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/bin/python3 -m mautrix_facebook >> /var/log/__APP__/__APP__.log 2>&1 +ExecStart=__FINALPATH__/bin/python3 -m mautrix_signal [Install] WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index e2558fb..75e6e77 100644 --- a/manifest.json +++ b/manifest.json @@ -1,18 +1,18 @@ { - "name": "Matrix-Facebook bridge", - "id": "mautrix_facebook", + "name": "Matrix-Signal bridge", + "id": "mautrix_signal", "packaging_format": 1, "description": { - "en": "A Facebook puppeting bridge for Matrix/Synapse.", - "fr": "Passerelle Facebook pour Matrix/Synapse." + "en": "A Signal puppeting bridge for Matrix/Synapse.", + "fr": "Passerelle Signal pour Matrix/Synapse." }, "version": "0.2.0~ynh1", - "url": "https://github.com/tulir/mautrix-facebook", + "url": "https://github.com/tulir/mautrix-signal", "license": "AGPL-3.0-or-later", "maintainer": { "name": "Gredin67", - "email": "mautrix_facebook_ynh@sans-nuage.fr", - "url": "https://github.com/YunoHost-Apps/mautrix_facebook_ynh" + "email": "mautrix_signal_ynh@sans-nuage.fr", + "url": "https://github.com/YunoHost-Apps/mautrix_signal_ynh" }, "requirements": { "yunohost": ">= 4.0" @@ -27,8 +27,8 @@ "name": "synapsenumber", "type": "string", "ask": { - "en": "Choose the local synapse instance number to communicate with mautrix_facebook", - "fr": "Choisissez le numéro de l'instance synapse qui doit communiquer avec mautrix_facebook" + "en": "Choose the local synapse instance number to communicate with mautrix_signal", + "fr": "Choisissez le numéro de l'instance synapse qui doit communiquer avec mautrix_signal" }, "example": "2 (for instance synapse__2)", "help": { @@ -38,18 +38,18 @@ "default": "1" }, { - "name": "facebookbot", + "name": "botname", "type": "string", "ask": { - "en": "Choose a local synapse user name for the Facebook bot", - "fr": "Choisissez un nom d'utilisateur synapse local pour le robot Facebook" + "en": "Choose a local synapse user name for the Signal bot", + "fr": "Choisissez un nom d'utilisateur synapse local pour le robot Signal" }, - "example": "facebookbot", + "example": "signalbot", "help": { - "en": "A system user will be created. Invite @facebookbot:localsynapse.servername from an authorized Matrix account to start bridging. Give the matrix server_name, not the full domain/url.", - "fr": "Un utilisateur système sera créé. Inviter @facebookbot:localsynapse.servername depuis un compte Matrix autorisé pour démarrer une passerelle. Donner le nom du serveur matrix, pas le domaine/url complet." + "en": "A system user will be created. Invite @signalbot:localsynapse.servername from an authorized Matrix account to start bridging. Give the matrix server_name, not the full domain/url.", + "fr": "Un utilisateur système sera créé. Inviter @signalbot:localsynapse.servername depuis un compte Matrix autorisé pour démarrer une passerelle. Donner le nom du serveur matrix, pas le domaine/url complet." }, - "default": "facebookbot" + "default": "signalbot" }, { "name": "encryption", @@ -69,13 +69,13 @@ "name": "botadmin", "type": "string", "ask": { - "en": "Choose the Matrix account administrator of the Facebook bot", - "fr": "Choisissez le compte Matrix administrateur du robot Facebook" + "en": "Choose the Matrix account administrator of the Signal bot", + "fr": "Choisissez le compte Matrix administrateur du robot Signal" }, "example": "@johndoe:localsynapse.servername or @johndoe:matrix.org", "help": { - "en": "The Facebook bot administrator does not need to be a local synapse account.", - "fr": "Le compte administrateur du robot Facebook peut ne pas être un compte local synapse." + "en": "The Signal bot administrator does not need to be a local synapse account.", + "fr": "Le compte administrateur du robot Signal peut ne pas être un compte local synapse." }, "default": "Your main Matrix account" }, @@ -83,8 +83,8 @@ "name": "botusers", "type": "string", "ask": { - "en": "Choose Matrix user(s) authorized to bridge with the Facebook bot", - "fr": "Choisissez le/les compte(s) Matrix autorisés à utiliser le robot Facebook" + "en": "Choose Matrix user(s) authorized to bridge with the Signal bot", + "fr": "Choisissez le/les compte(s) Matrix autorisés à utiliser le robot Signal" }, "example": "local or @johndoe:server.name or server.name or *", "default": "local", diff --git a/scripts/install b/scripts/install index c106c16..b4e3baf 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ ynh_abort_if_errors #================================================= synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER -facebookbot=$YNH_APP_ARG_FACEBOOKBOT +botname=$YNH_APP_ARG_BOTNAME encryption=$YNH_APP_ARG_ENCRYPTION botadmin=$YNH_APP_ARG_BOTADMIN botusers=$YNH_APP_ARG_BOTUSERS @@ -33,7 +33,7 @@ botusers=$YNH_APP_ARG_BOTUSERS app=$YNH_APP_INSTANCE_NAME final_path=/opt/yunohost/$app -# ToDo check (in manifest?) if the selected synapse instance is not already connected to a mautrix_facebook bridge +# ToDo check (in manifest?) if the selected synapse instance is not already connected to a mautrix_bridge bridge if [ $synapsenumber -eq "1" ] then synapse_instance="synapse" @@ -53,10 +53,10 @@ synapse_db_user="matrix_$synapse_instance" # SET CONSTANTS #================================================= -facebookbot_synapse_db_user="@$facebookbot:$server_name" -mautrix_facebook_user=$app -mautrix_facebook_db_name=$app -mautrix_facebook_db_user=$app +#botname_synapse_db_user="@$botname:$server_name" +mautrix_bridge_user=$app +mautrix_bridge_db_name=$app +mautrix_bridge_db_user=$app upstream_version=$(ynh_app_upstream_version) #================================================= @@ -73,7 +73,7 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde #================================================= ynh_script_progression --message="Configuring firewall..." --weight=1 -# Find a free port for communication between your local synapse instance (home server) and its app service mautrix_facebook. +# Find a free port for communication between your local synapse instance (home server) and its app service mautrix_bridge. port=$(ynh_find_port --port=8449) #================================================= @@ -84,11 +84,11 @@ ynh_script_progression --message="Storing installation settings..." --weight=7 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app=$app --key=port --value=$port -ynh_app_setting_set --app=$app --key=facebookbot --value=$facebookbot +ynh_app_setting_set --app=$app --key=botname --value=$botname ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance ynh_app_setting_set --app=$app --key=app_service_registration_path --value=$app_service_registration_path ynh_app_setting_set --app=$app --key=encryption --value=$encryption -ynh_app_setting_set --app=$app --key=mautrix_facebook_db_name --value=$mautrix_facebook_db_name +ynh_app_setting_set --app=$app --key=mautrix_bridge_db_name --value=$mautrix_bridge_db_name ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin ynh_app_setting_set --app=$app --key=botusers --value=$botusers ynh_app_setting_set --app=$app --key=mautrix_version --value=$upstream_version @@ -115,17 +115,17 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Creating a PostgreSQL database..." --weight=3 ynh_print_OFF -mautrix_facebook_db_pwd=$(ynh_string_random --length=30) -ynh_app_setting_set --app=$app --key=mautrix_facebook_db_pwd --value=$mautrix_facebook_db_pwd +mautrix_bridge_db_pwd=$(ynh_string_random --length=30) +ynh_app_setting_set --app=$app --key=mautrix_bridge_db_pwd --value=$mautrix_bridge_db_pwd ynh_print_ON # Create postgresql database ynh_psql_test_if_first_run ynh_print_OFF -ynh_psql_create_user $mautrix_facebook_db_user $mautrix_facebook_db_pwd +ynh_psql_create_user $mautrix_bridge_db_user $mautrix_bridge_db_pwd ynh_print_ON ynh_psql_execute_as_root \ ---sql="CREATE DATABASE ""$mautrix_facebook_db_name"" ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ""$mautrix_facebook_db_user"";" +--sql="CREATE DATABASE ""$mautrix_bridge_db_name"" ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ""$mautrix_bridge_db_user"";" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -154,23 +154,23 @@ ynh_setup_source --dest_dir="$final_path/src" ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$mautrix_facebook_user +ynh_system_user_create --username=$mautrix_bridge_user #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=20 -# Create systemd config for mautrix-facebook +# Create systemd config for Mautrix-Bridge #cp ../conf/default_mautrix-facebook /etc/default/$app ynh_add_systemd_config --service=$app #================================================= #================================================= -# SET MAUTRIX-FACEBOOK CONFIG +# SET MAUTRIX-BRIDGE CONFIG #================================================= -ynh_script_progression --message="Configuring Mautrix-FB..." --weight=2 +ynh_script_progression --message="Configuring Mautrix-Bridge..." --weight=2 # WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # For any update do it in all files @@ -185,10 +185,10 @@ ynh_replace_string --match_string=__SERVER_NAME__ --replace_string=$server_name ynh_replace_string --match_string=__VERIFY_SERVER_SSL_CERTIFICATES__ --replace_string=true --target_file="$mautrix_config_path" ynh_replace_string --match_string=__MATRIX_SERVER_SUPPORTS_ASMUX__ --replace_string=false --target_file="$mautrix_config_path" ynh_replace_string --match_string=__PORT__ --replace_string=$port --target_file="$mautrix_config_path" -ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_USER__ --replace_string=$mautrix_facebook_user --target_file="$mautrix_config_path" -ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_DB_PWD__ --replace_string=$mautrix_facebook_db_pwd --target_file="$mautrix_config_path" -ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_DB_NAME__ --replace_string=$mautrix_facebook_db_name --target_file="$mautrix_config_path" -ynh_replace_string --match_string=__FACEBOOKBOT__ --replace_string=$facebookbot --target_file="$mautrix_config_path" +ynh_replace_string --match_string=__MAUTRIX_BRIDGE_USER__ --replace_string=$mautrix_bridge_user --target_file="$mautrix_config_path" +ynh_replace_string --match_string=__MAUTRIX_BRIDGE_DB_PWD__ --replace_string=$mautrix_bridge_db_pwd --target_file="$mautrix_config_path" +ynh_replace_string --match_string=__MAUTRIX_BRIDGE_DB_NAME__ --replace_string=$mautrix_bridge_db_name --target_file="$mautrix_config_path" +ynh_replace_string --match_string=__BOTNAME__ --replace_string=$botname --target_file="$mautrix_config_path" ynh_replace_string --match_string=__ENCRYPTION__ --replace_string=$encryption --target_file="$mautrix_config_path" if [ "$botusers" = "local" ] then @@ -204,15 +204,15 @@ ynh_replace_string --match_string=__LOG_LEVEL__ --replace_string="error" --targe #================================================= -# INSTALL MAUTRIX-FACEBOOK PYTHON MODULE +# INSTALL MAUTRIX-BRIDGE PYTHON MODULE #================================================= mkdir -p /var/log/$app -# Configure Mautrix-Facebook +# Configure Mautrix-Bridge python3 -m venv $final_path $final_path/bin/pip3 install --upgrade setuptools wheel -$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-facebook.tar.gz -$final_path/bin/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml +$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-signal.tar.gz +$final_path/bin/python3 -m mautrix_signal -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ || ynh_die "Synapse can't restart with the appservice configuration" @@ -245,7 +245,7 @@ chown -R root: $final_path # WARNING : theses command are used in INSTALL, UPGRADE, RESTORE # For any update do it in all files -chown $mautrix_facebook_user:root -R $final_path +chown $mautrix_bridge_user:root -R $final_path #================================================= # SETUP LOGROTATE @@ -254,7 +254,7 @@ ynh_script_progression --message="Configuring log rotation..." --weight=3 # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile "/var/log/$app/$app.log" -chown $mautrix_facebook_user:root -R /var/log/$app +chown $mautrix_bridge_user:root -R /var/log/$app #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -275,8 +275,8 @@ sleep 30 # # (Note that, by default, non-admins might not have your homeserver's permission to create communities.) # if [ "$bot_is_synapse_admin" = true ] # then - ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$facebookbot"";" -# #yunohost app action run $synapse_instance set_admin_user -a username=$facebookbot + ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$botname"";" +# #yunohost app action run $synapse_instance set_admin_user -a username=$botname # fi ynh_systemd_action --service_name=$app --action="restart" diff --git a/scripts/remove b/scripts/remove index 57f86f1..9c80ef5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME server_name=$(ynh_app_setting_get --app=$app --key=server_name) synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance) app_service_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path) -facebookbot=$(ynh_app_setting_get --app=$app --key=facebookbot) +botname=$(ynh_app_setting_get --app=$app --key=botname) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -28,10 +28,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= synapse_db_name="matrix_$synapse_instance" -facebookbot_synapse_db_user="@$facebookbot:$server_name" -mautrix_facebook_user=$app -mautrix_facebook_db_name=$app -mautrix_facebook_db_user=$app +botname_synapse_db_user="@$botname:$server_name" +mautrix_bridge_user=$app +mautrix_bridge_db_name=$app +mautrix_bridge_db_user=$app #================================================= # STANDARD REMOVE @@ -60,10 +60,10 @@ ynh_remove_systemd_config ynh_script_progression --message="Removing the PostgreSQL database..." --weight=4 # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$mautrix_facebook_db_name --db_name=$mautrix_facebook_db_user -ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$facebookbot"";" -ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$facebookbot"";" -#yunohost app action run $synapse_instance drop_user -a username=$facebookbot +ynh_psql_remove_db --db_user=$mautrix_bridge_db_name --db_name=$mautrix_bridge_db_user +ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$botname"";" +ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$botname"";" +#yunohost app action run $synapse_instance drop_user -a username=$botname #================================================= # REMOVE DEPENDENCIES @@ -112,7 +112,7 @@ ynh_secure_remove --file="/var/log/$app" ynh_script_progression --message="Removing the dedicated system user..." --weight=5 # Delete a system user -ynh_system_user_delete --username=$mautrix_facebook_user +ynh_system_user_delete --username=$mautrix_bridge_user #================================================= # END OF SCRIPT