mirror of
https://github.com/YunoHost-Apps/mautrix_telegram_ynh.git
synced 2024-09-03 19:45:55 +02:00
Merge pull request #16 from thardev/add_e2be
Configure end-to-bridge encryption
This commit is contained in:
commit
c76b7a1550
7 changed files with 39 additions and 7 deletions
|
@ -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
|
* 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
|
## Disclaimers / important information
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
|
|
|
@ -237,10 +237,10 @@ bridge:
|
||||||
# See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
|
# See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
|
||||||
encryption:
|
encryption:
|
||||||
# Allow encryption, work in group chat rooms with e2ee enabled
|
# 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
|
# 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.
|
# 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 for the encryption data. If set to `default`, will use the appservice database.
|
||||||
database: default
|
database: default
|
||||||
# Options for automatic key sharing.
|
# Options for automatic key sharing.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Telegram puppeting bridge for Matrix/Synapse",
|
"en": "Telegram puppeting bridge for Matrix/Synapse",
|
||||||
"fr": "Passerelle Telegram pour 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",
|
"url": "https://docs.mau.fi/bridges/python/telegram/index.html",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
|
@ -64,8 +64,8 @@
|
||||||
"fr": "Activer le chiffrement entre Synapse et le bridge ?"
|
"fr": "Activer le chiffrement entre Synapse et le bridge ?"
|
||||||
},
|
},
|
||||||
"help": {
|
"help": {
|
||||||
"en": "Only activate if you know the prerequisites and constraints related to 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."
|
"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
|
"default": false
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
# HACK zlib1g-dev libjpeg-dev (libwebp-dev optional but necessary for stickers) are necessary to compile / install pillow
|
# 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="postgresql python3 zlib1g-dev libjpeg-dev libwebp-dev python3-venv libpq-dev libffi-dev"
|
||||||
|
pkg_dependencies_e2be="libolm-dev"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -107,6 +107,11 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=97
|
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
|
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"
|
mautrix_config_path="$final_path/config.yaml"
|
||||||
as_token="\"This value is generated when generating the registration\""
|
as_token="\"This value is generated when generating the registration\""
|
||||||
hs_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
|
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
|
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 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
|
$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
|
# -r optional-requirements.txt
|
||||||
$final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml"
|
$final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml"
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
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
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -111,6 +116,10 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||||
export HOME=$final_path
|
export HOME=$final_path
|
||||||
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
$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
|
$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
|
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: *//")
|
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=__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"
|
# 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
|
write_bridge_config
|
||||||
|
|
||||||
# upgrade the app-service-registration
|
# upgrade the app-service-registration
|
||||||
|
|
Loading…
Reference in a new issue