diff --git a/README.md b/README.md index e0ad5d5..ca6a0d8 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ See also [upstream wiki Authentication page](https://docs.mau.fi/bridges/python/ * see https://docs.mau.fi/bridges/python/telegram/relay-bot.html -**Shipped version:** 0.11.3~ynh1 +**Shipped version:** 0.11.3~ynh2 ## Disclaimers / important information diff --git a/README_fr.md b/README_fr.md index 351e1c4..19decaf 100644 --- a/README_fr.md +++ b/README_fr.md @@ -50,7 +50,7 @@ See also [upstream wiki Authentication page](https://docs.mau.fi/bridges/python/ * see https://docs.mau.fi/bridges/python/telegram/relay-bot.html -**Version incluse :** 0.11.3~ynh1 +**Version incluse :** 0.11.3~ynh2 ## Avertissements / informations importantes diff --git a/conf/config.yaml b/conf/config.yaml index a25d383..d8af4c6 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -237,10 +237,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: false + allow: __IS_ENCRYPTION_ENABLED__ # 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: false + default: __IS_ENCRYPTION_ENABLED__ # Database for the encryption data. If set to `default`, will use the appservice database. database: default # Options for automatic key sharing. diff --git a/manifest.json b/manifest.json index 4b3c417..b70bde8 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Telegram puppeting bridge for Matrix/Synapse", "fr": "Passerelle Telegram pour Matrix/Synapse" }, - "version": "0.11.3~ynh1", + "version": "0.11.3~ynh2", "url": "https://docs.mau.fi/bridges/python/telegram/index.html", "upstream": { "license": "AGPL-3.0-or-later", @@ -64,8 +64,8 @@ "fr": "Activer le chiffrement entre Synapse et le bridge ?" }, "help": { - "en": "Only activate if you know the prerequisites and constraints related to e2b.", - "fr": "N'activer que si vous connaissez les prérequis et constraintes liées à e2b." + "en": "Only activate if you know the prerequisites and constraints related to e2b. See more: https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html", + "fr": "N'activer que si vous connaissez les prérequis et constraintes liées à e2b. Voir aussi : https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html" }, "default": false }, diff --git a/scripts/_common.sh b/scripts/_common.sh index 1254db4..8296088 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,6 +7,7 @@ # dependencies used by the app # HACK zlib1g-dev libjpeg-dev (libwebp-dev optional but necessary for stickers) are necessary to compile / install pillow pkg_dependencies="postgresql python3 zlib1g-dev libjpeg-dev libwebp-dev python3-venv libpq-dev libffi-dev" +pkg_dependencies_e2be="libolm-dev" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index d91b3be..0362dc4 100755 --- a/scripts/install +++ b/scripts/install @@ -107,6 +107,11 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=97 +if [ $encryption -eq 1 ]; then + # Install libolm-dev to be able to use encryption + ynh_install_extra_app_dependencies $pkg_dependencies_e2be +fi + ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -159,6 +164,12 @@ ynh_script_progression --message="Configuring Mautrix-Bridge..." --weight=2 mautrix_config_path="$final_path/config.yaml" as_token="\"This value is generated when generating the registration\"" hs_token="\"This value is generated when generating the registration\"" +is_encryption_enabled=$encryption + +if [ $encryption -eq 1 ]; then + is_encryption_enabled=true +fi + write_bridge_config #================================================= @@ -171,6 +182,11 @@ python3 -m venv $final_path export HOME=$final_path # HACK see https://github.com/mautrix/telegram/issues/661 $final_path/bin/pip3 install --upgrade pip setuptools wheel $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[speedups,qr_login] # metrics,e2be,hq_thumbnails,sqlite,formattednumbers + +if [ $encryption -eq 1 ]; then + $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be] +fi + # -r optional-requirements.txt $final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml" diff --git a/scripts/upgrade b/scripts/upgrade index 1cdc4c9..170d407 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -97,6 +97,11 @@ fi #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=1 +if [ $encryption -eq 1 ]; then + # Install libolm-dev to be able to use encryption + ynh_install_extra_app_dependencies $pkg_dependencies_e2be +fi + ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -111,6 +116,10 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then export HOME=$final_path $final_path/bin/pip3 install --upgrade pip setuptools wheel $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[speedups,qr_login] # metrics,e2be,hq_thumbnails,sqlite,formattednumbers + + if [ $encryption -eq 1 ]; then + $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be] + fi fi #================================================= @@ -126,6 +135,12 @@ as_token=$(grep "as_token:" "$mautrix_config_path" | sed -r "s/ *as_token: *//") hs_token=$(grep "hs_token:" "$mautrix_config_path" | sed -r "s/ *hs_token: *//") # ynh_replace_string --match_string=__AS_TOKEN__ --replace_string="$as_token" --target_file="$mautrix_config_path" # ynh_replace_string --match_string=__HS_TOKEN__ --replace_string="$hs_token" --target_file="$mautrix_config_path" +is_encryption_enabled=$encryption + +if [ $encryption -eq 1 ]; then + is_encryption_enabled=true +fi + write_bridge_config # upgrade the app-service-registration