Merge branch 'master' into patch-1

This commit is contained in:
Dante 2023-02-23 17:49:22 +00:00 committed by GitHub
commit ccccebd209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 286 additions and 45 deletions

57
.githooks/pre-commit Executable file
View file

@ -0,0 +1,57 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# Check if config.yaml has been modified and add a message
git diff --cached --name-only | if grep -q "conf/config.yaml"
then
cat <<\EOF
It seems that you have modified the config.yaml file, consider checking 'SPECIFIC UPDATE STEPS' section of .github/workflows/updater.sh and update there as well if needed"
EOF
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View file

@ -64,9 +64,6 @@ filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
@ -93,6 +90,44 @@ echo "... conf/$src.src updated"
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
echo "Update latest version of conf/config.yaml"
# Update the config.yaml with the latest version of it and add vars that will be replaced
configFilePath="conf/config.yaml"
newConfigFilePath=$(tar -tf "$tempdir/$filename" | grep 'example-config.yaml')
tar -xf "$tempdir/$filename" --directory "$tempdir" "$newConfigFilePath"
mv "$tempdir/$newConfigFilePath" "$configFilePath"
# Replace default values with vars that will be replaced on the install script
yq -i '.homeserver.address = "https://__DOMAIN__"' $configFilePath
yq -i '.homeserver.domain = "__SERVER_NAME__"' $configFilePath
yq -i '.appservice.address = "http://localhost:__PORT__"' $configFilePath
yq -i '.appservice.port = "__PORT__"' $configFilePath
yq -i '.appservice.database = "postgres://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__"' $configFilePath
yq -i '.appservice.id = "__APPSERVICEID__"' $configFilePath
yq -i '.appservice.bot_username = "__BOTNAME__"' $configFilePath
yq -i '.appservice.as_token = "__AS_TOKEN__" | .appservice.as_token style=""' $configFilePath
yq -i '.appservice.hs_token = "__HS_TOKEN__" | .appservice.hs_token style=""' $configFilePath
yq -i '.bridge.encryption.allow = "__IS_ENCRYPTION_ENABLED__"' $configFilePath
yq -i '.bridge.encryption.default = "__IS_ENCRYPTION_ENABLED__"' $configFilePath
yq -i '.bridge.encryption.require = "__IS_ENCRYPTION_ENABLED__"' $configFilePath
yq -i 'with(.bridge.permissions ; . = { "*": "relaybot", "__BOTUSERS__": "puppeting", "__BOTADMIN__": "admin" } | ... style="double")' $configFilePath
yq -i '.telegram.api_id = "__APIID__"' $configFilePath
yq -i '.telegram.api_hash = "__APIHASH__"' $configFilePath
yq -i '.telegram.bot_token = "__BOTTOKEN__"' $configFilePath
yq -i '.logging.handlers.file.filename = "/var/log/__APP__/__APP__.log"' $configFilePath
# Keep some default options turned off
yq -i '.appservice.database_opts = {}' $configFilePath
yq -i '.appservice.provisioning.enabled = false' $configFilePath
yq -i '.appservice.ephemeral_events = false' $configFilePath
yq -i '.bridge.sync_channel_members = true' $configFilePath
yq -i '.bridge.startup_sync = true' $configFilePath
yq -i '.bridge.public_portals = true' $configFilePath
yq -i '.bridge.sync_with_custom_puppets = true' $configFilePath
yq -i '.bridge.relaybot.whitelist = {}' $configFilePath
yq -i '.logging.loggers.mau.level = "INFO"' $configFilePath
yq -i '.logging.root.level = "INFO"' $configFilePath
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -100,6 +135,9 @@ echo "... conf/$src.src updated"
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# Delete temporary directory
rm -rf $tempdir
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true

View file

@ -18,8 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
A puppeting bridge between Matrix and Telegram packaged as a YunoHost service. Messages, notifications (and sometimes media) are bridged between a Telegram user and a Matrix user. Currently the Matrix user can NOT invite other Matrix user in a bridged Telegram room, so only someone with a Telegram account can participate to Telegram group conversations. The ["Mautrix-Telegram"](https://docs.mau.fi/bridges/python/telegram/index.html) bridge is a Synapse App Service and relies on postgresql. Therefore, [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) should be installed beforehand.
**Shipped version:** 0.12.0~ynh1
**Shipped version:** 0.12.2~ynh4
## Disclaimers / important information
## List of known public services
@ -62,6 +61,13 @@ following configuration file with SSH:
```/opt/yunohost/mautrix_telegram/config.yaml```
and then restarting the mautrix_telegram service.
#### End-to-bridge encryption
The bridge can optionally encrypt messages between Matrix users and the bridge to hide messages from the homeserver. Using Postgres is strongly recommended when using end-to-bridge encryption.
If you want to enable it, look for the option ```bridge → encryption``` in the config file. If you only set ```allow: true```, the bridge won't enable encryption on its own, but will work in encrypted rooms. If you set ```default: true```, the bridge will automatically enable encryption in new portals.
There is also the possibility to set ```require: true``` to enforce encryption on any of the messages that you send (this will drop any unencrypted messages).
## Documentation
* Official "Mautrix-Telegram" documentation: https://docs.mau.fi/bridges/python/telegram/index.html
@ -98,6 +104,16 @@ ExecStartPre=/bin/sleep 90
such that it is ensured that synapse is running before the bridge tries to connect.
(If it worked after installation but broke after a restart this probably is it.)
## Development code quality
The `.github/workflows/updater.sh` script needs to be synced with changes in `conf/config.yaml` therefore a `pre-commit`
hook is used to display a reminder to update `.github/workflows/updater.sh` (if needed) when `conf/config.yaml` has been modified.
Please enable Git hooks using following command to ensure code quality and stability.
``` bash
git config --local core.hooksPath .githooks
```
## Documentation and resources
* Official app website: <https://docs.mau.fi/bridges/python/telegram/index.html>

View file

@ -21,8 +21,7 @@ La passerelle ["Mautrix-Telegram"](https://docs.mau.fi/bridges/python/telegram/i
** Attention : sauvegardez et restaurez toujours les deux applications Yunohost matrix-synapse et mautrix_telegram en même temps!**
**Version incluse :** 0.12.0~ynh1
**Version incluse :** 0.12.2~ynh4
## Avertissements / informations importantes
## Liste de passerelles publiques
@ -58,6 +57,20 @@ See also [upstream wiki Authentication page](https://docs.mau.fi/bridges/python/
### Relaybot: Bridge a group for several Matrix and several Telegram users to chat together
* see https://docs.mau.fi/bridges/python/telegram/relay-bot.html
### Configuration de la passerelle
La passerelle est [configurée avec les paramètres standards adaptés pour votre YunoHost et l'instance Matrix-Synapse sélectionnée](https://github.com/YunoHost-Apps/mautrix_telegram_ynh/blob/master/conf/config.yaml). Vous pouvez par exemple ajouter des administrateur.ice.s et utilisateur.ice.s du Robot autorisés en modifiant le fichier de configuration par liaison SSH:
``` sudo nano /opt/yunohost/mautrix_whatsapp/config.yaml```
puis en redémarrant le service:
``` sudo yunohost service restart mautrix_whatsapp```
#### End-to-bridge encryption
Le robot peut éventuellement chiffrer les messages entre les utilisateurs de Matrix et la passarelle pour cacher les messages du serveur domestique. L'utilisation de Postgres est fortement recommandée lors de l'utilisation du chiffrement end-to-bridge.
Si vous voulez l'activer, cherchez l'option ```bridge → encryption``` dans le fichier de configuration. Si vous définissez uniquement l'option ``allow: true``, le robot n'activera pas le chiffrement de lui-même, mais travaillera dans les portails chiffrés. Si vous définissez ```default: true```, la passerelle activera automatiquement le chiffrement dans les nouveaux portails.
Il y a également la possibilité de définir ```require: true``` pour imposer le chiffrement sur tous les messages que vous envoyez (cela interdira tous les messages non chiffrés).
## Documentation
* Official "Mautrix-Telegram" documentation: https://docs.mau.fi/bridges/python/telegram/index.html
@ -93,6 +106,17 @@ ExecStartPre=/bin/sleep 90
such that it is ensured that synapse is running before the bridge tries to connect.
(If it worked after installation but broke after a restart this probably is it.)
## Development code quality
Le script `.github/workflows/updater.sh` doit être synchronisé avec les changements dans `conf/config.yaml`,
donc un hook `pre-commit` est utilisé pour afficher un rappel pour mettre à jour
`.github/workflows/updater.sh` (si nécessaire) lorsque `conf/config.yaml` a été modifié.
Veuillez activer les hooks Git en utilisant la commande suivante pour assurer la qualité et la stabilité du code.
``` bash
git config --local core.hooksPath .githooks
```
## Documentations et ressources
* Site officiel de l'app : <https://docs.mau.fi/bridges/python/telegram/index.html>

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/mautrix/telegram/archive/refs/tags/v0.12.0.tar.gz
SOURCE_SUM=bcc971d638a985d5196c1986f8f332b0f8236b6f34da712bec8662ab38523434
SOURCE_URL=https://github.com/mautrix/telegram/archive/refs/tags/v0.12.2.tar.gz
SOURCE_SUM=a25e298db1d0de7113eb6f047e2862fc737c5ee8545473cb7e4fe8b8260eaab9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -7,7 +7,9 @@ homeserver:
# Whether or not to verify the SSL certificate of the homeserver.
# Only applies if address starts with https://
verify_ssl: true
asmux: false
# What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
software: standard
# Number of retries for all HTTP requests if the homeserver isn't reachable.
http_retry_count: 4
# The URL to push real-time bridge status to.
@ -45,6 +47,7 @@ appservice:
# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
# https://docs.python.org/3/library/sqlite3.html#sqlite3.connect
# For sqlite, min_size is used as the connection thread pool size and max_size is ignored.
# Additionally, SQLite supports init_commands as an array of SQL queries to run on connect (e.g. to set PRAGMAs).
database_opts: {}
# Public part of web server for out-of-Matrix interaction with the bridge.
@ -71,7 +74,7 @@ appservice:
shared_secret: generate
# The unique ID of this appservice.
id: __BOTNAME__
id: __APPSERVICEID__
# Username of the appservice bot.
bot_username: __BOTNAME__
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
@ -164,7 +167,10 @@ bridge:
sync_update_limit: 0
# Number of most recently active dialogs to create portals for when syncing chats.
# Set to 0 to remove limit.
sync_create_limit: 30
sync_create_limit: 15
# Should all chats be scheduled to be created later?
# This is best used in combination with MSC2716 infinite backfill.
sync_deferred_create_all: false
# Whether or not to sync and create portals for direct chats at startup.
sync_direct_chats: false
# The maximum number of simultaneous Telegram deletions to handle.
@ -219,6 +225,9 @@ bridge:
# Whether or not created rooms should have federation enabled.
# If false, created portal rooms will never be federated.
federate_rooms: true
# Should the bridge send all unicode reactions as custom emoji reactions to Telegram?
# By default, the bridge only uses custom emojis for unicode emojis that aren't allowed in reactions.
always_custom_emoji_reaction: false
# Settings for converting animated stickers.
animated_sticker:
# Format to which animated stickers should be converted.
@ -253,6 +262,8 @@ bridge:
# 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: __IS_ENCRYPTION_ENABLED__
# Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
appservice: false
# Require encryption, drop any unencrypted messages.
require: __IS_ENCRYPTION_ENABLED__
# Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
@ -327,34 +338,60 @@ bridge:
create_group_on_invite: true
# Settings for backfilling messages from Telegram.
backfill:
# Whether or not the Telegram ghosts of logged in Matrix users should be
# invited to private chats when backfilling history from Telegram. This is
# usually needed to prevent rate limits and to allow timestamp massaging.
invite_own_puppet: true
# Maximum number of messages to backfill without using a takeout.
# The first time a takeout is used, the user has to manually approve it from a different
# device. If initial_limit or missed_limit are higher than this value, the bridge will ask
# the user to accept the takeout after logging in before syncing any chats.
takeout_limit: 100
# Maximum number of messages to backfill initially.
# Set to 0 to disable backfilling when creating portal, or -1 to disable the limit.
# Allow backfilling at all?
enable: true
# Use MSC2716 for backfilling?
#
# N.B. Initial backfill will only start after member sync. Make sure your
# max_initial_member_sync is set to a low enough value so it doesn't take forever.
initial_limit: 0
# Maximum number of messages to backfill if messages were missed while the bridge was
# disconnected. Note that this only works for logged in users and only if the chat isn't
# older than sync_update_limit
# Set to 0 to disable backfilling missed messages.
missed_limit: 50
# If using double puppeting, should notifications be disabled
# while the initial backfill is in progress?
disable_notifications: false
# This requires a server with MSC2716 support, which is currently an experimental feature in Synapse.
# It can be enabled by setting experimental_features -> msc2716_enabled to true in homeserver.yaml.
msc2716: false
# Use double puppets for backfilling?
#
# If using MSC2716, the double puppets must be in the appservice's user ID namespace
# (because the bridge can't use the double puppet access token with batch sending).
#
# Even without MSC2716, bridging old messages with correct timestamps requires the double
# puppets to be in an appservice namespace, or the server to be modified to allow
# overriding timestamps anyway.
double_puppet_backfill: false
# Whether or not to enable backfilling in normal groups.
# Normal groups have numerous technical problems in Telegram, and backfilling normal groups
# will likely cause problems if there are multiple Matrix users in the group.
normal_groups: false
# If a backfilled chat is older than this number of hours, mark it as read even if it's unread on Telegram.
# Set to -1 to let any chat be unread.
unread_hours_threshold: 720
# Forward backfilling limits. These apply to both MSC2716 and legacy backfill.
#
# Using a negative initial limit is not recommended, as it would try to backfill everything in a single batch.
# MSC2716 and the incremental settings are meant for backfilling everything incrementally rather than at once.
forward:
# Number of messages to backfill immediately after creating a portal.
initial_limit: 10
# Number of messages to backfill when syncing chats.
sync_limit: 100
# Settings for incremental backfill of history. These only apply when using MSC2716.
incremental:
# Maximum number of messages to backfill per batch.
messages_per_batch: 100
# The number of seconds to wait after backfilling the batch of messages.
post_batch_delay: 20
# The maximum number of batches to backfill per portal, split by the chat type.
# If set to -1, all messages in the chat will eventually be backfilled.
max_batches:
# Direct chats
user: -1
# Normal groups. Note that the normal_groups option above must be enabled
# for these to be backfilled.
normal_group: -1
# Supergroups
supergroup: 10
# Broadcast channels
channel: -1
# Overrides for base power levels.
initial_power_level_overrides:
user: {}

View file

@ -38,6 +38,13 @@ following configuration file with SSH:
```/opt/yunohost/mautrix_telegram/config.yaml```
and then restarting the mautrix_telegram service.
#### End-to-bridge encryption
The bridge can optionally encrypt messages between Matrix users and the bridge to hide messages from the homeserver. Using Postgres is strongly recommended when using end-to-bridge encryption.
If you want to enable it, look for the option ```bridge → encryption``` in the config file. If you only set ```allow: true```, the bridge won't enable encryption on its own, but will work in encrypted rooms. If you set ```default: true```, the bridge will automatically enable encryption in new portals.
There is also the possibility to set ```require: true``` to enforce encryption on any of the messages that you send (this will drop any unencrypted messages).
## Documentation
* Official "Mautrix-Telegram" documentation: https://docs.mau.fi/bridges/python/telegram/index.html
@ -73,3 +80,13 @@ ExecStartPre=/bin/sleep 90
```
such that it is ensured that synapse is running before the bridge tries to connect.
(If it worked after installation but broke after a restart this probably is it.)
## Development code quality
The `.github/workflows/updater.sh` script needs to be synced with changes in `conf/config.yaml` therefore a `pre-commit`
hook is used to display a reminder to update `.github/workflows/updater.sh` (if needed) when `conf/config.yaml` has been modified.
Please enable Git hooks using following command to ensure code quality and stability.
``` bash
git config --local core.hooksPath .githooks
```

View file

@ -31,6 +31,20 @@ See also [upstream wiki Authentication page](https://docs.mau.fi/bridges/python/
### Relaybot: Bridge a group for several Matrix and several Telegram users to chat together
* see https://docs.mau.fi/bridges/python/telegram/relay-bot.html
### Configuration de la passerelle
La passerelle est [configurée avec les paramètres standards adaptés pour votre YunoHost et l'instance Matrix-Synapse sélectionnée](https://github.com/YunoHost-Apps/mautrix_telegram_ynh/blob/master/conf/config.yaml). Vous pouvez par exemple ajouter des administrateur.ice.s et utilisateur.ice.s du Robot autorisés en modifiant le fichier de configuration par liaison SSH:
``` sudo nano /opt/yunohost/mautrix_whatsapp/config.yaml```
puis en redémarrant le service:
``` sudo yunohost service restart mautrix_whatsapp```
#### End-to-bridge encryption
Le robot peut éventuellement chiffrer les messages entre les utilisateurs de Matrix et la passarelle pour cacher les messages du serveur domestique. L'utilisation de Postgres est fortement recommandée lors de l'utilisation du chiffrement end-to-bridge.
Si vous voulez l'activer, cherchez l'option ```bridge → encryption``` dans le fichier de configuration. Si vous définissez uniquement l'option ``allow: true``, le robot n'activera pas le chiffrement de lui-même, mais travaillera dans les portails chiffrés. Si vous définissez ```default: true```, la passerelle activera automatiquement le chiffrement dans les nouveaux portails.
Il y a également la possibilité de définir ```require: true``` pour imposer le chiffrement sur tous les messages que vous envoyez (cela interdira tous les messages non chiffrés).
## Documentation
* Official "Mautrix-Telegram" documentation: https://docs.mau.fi/bridges/python/telegram/index.html
@ -65,3 +79,14 @@ ExecStartPre=/bin/sleep 90
```
such that it is ensured that synapse is running before the bridge tries to connect.
(If it worked after installation but broke after a restart this probably is it.)
## Development code quality
Le script `.github/workflows/updater.sh` doit être synchronisé avec les changements dans `conf/config.yaml`,
donc un hook `pre-commit` est utilisé pour afficher un rappel pour mettre à jour
`.github/workflows/updater.sh` (si nécessaire) lorsque `conf/config.yaml` a été modifié.
Veuillez activer les hooks Git en utilisant la commande suivante pour assurer la qualité et la stabilité du code.
``` bash
git config --local core.hooksPath .githooks
```

View file

@ -6,7 +6,7 @@
"en": "Telegram puppeting bridge for Matrix/Synapse",
"fr": "Passerelle Telegram pour Matrix/Synapse"
},
"version": "0.12.0~ynh1",
"version": "0.12.2~ynh4",
"url": "https://docs.mau.fi/bridges/python/telegram/index.html",
"upstream": {
"license": "AGPL-3.0-or-later",

View file

@ -23,6 +23,7 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
appserviceid=$YNH_APP_INSTANCE_NAME
synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER
botname=$YNH_APP_ARG_BOTNAME
encryption=$YNH_APP_ARG_ENCRYPTION
@ -58,6 +59,7 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=7
ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid
ynh_app_setting_set --app=$app --key=botname --value=$botname
ynh_app_setting_set --app=$app --key=encryption --value=$encryption
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
@ -167,11 +169,7 @@ 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
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be,speedups,qr_login] # metrics,hq_thumbnails,sqlite,formattednumbers
#=================================================
# REGISTER SYNAPSE APP-SERVICE

View file

@ -16,6 +16,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=5
app=$YNH_APP_INSTANCE_NAME
appserviceid=$(ynh_app_setting_get --app=$app --key=appserviceid)
botname=$(ynh_app_setting_get --app=$app --key=botname)
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
server_name=$(ynh_app_setting_get --app=$app --key=server_name)

View file

@ -32,6 +32,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
synapse_registration_path=$(ynh_app_setting_get --app=$app --key=synapse_registration_path)
appserviceid=$(ynh_app_setting_get --app=$app --key=appserviceid)
#=================================================
# CHECK IF THE APP CAN BE RESTORED

View file

@ -16,6 +16,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
appserviceid=$(ynh_app_setting_get --app=$app --key=appserviceid)
botname=$(ynh_app_setting_get --app=$app --key=botname)
encryption=$(ynh_app_setting_get --app=$app --key=encryption)
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
@ -68,6 +69,36 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If appserviceid doesn't exist, create it
if [ -z "$appserviceid" ]
then
appserviceid=$app
ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]
then
db_name=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_name)
# db_name and db_user share the same value
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If db_pwd doesn't exist, create it
if [ -z "$db_pwd" ]
then
db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd
fi
# If synapse_registration_path doesn't exist, create it
if [ -z "$synapse_registration_path" ]
then
synapse_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path)
ynh_app_setting_set --app=$app --key=synapse_registration_path --value=$synapse_registration_path
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -151,12 +182,8 @@ source $final_path/bin/activate
set -$u_arg;
$final_path/bin/pip3 install --upgrade pip setuptools wheel
chown $app:root -R $final_path
$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
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be,speedups,qr_login] # metrics,hq_thumbnails,sqlite,formattednumbers
# This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does
set +$u_arg;