mirror of
https://github.com/YunoHost-Apps/mautrix_telegram_ynh.git
synced 2024-09-03 19:45:55 +02:00
Prevent collision by reusing botname to appservice name
This commit is contained in:
parent
87f2abd29f
commit
9f8db3fa23
8 changed files with 16 additions and 4 deletions
|
@ -18,7 +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.2~ynh1
|
||||
**Shipped version:** 0.12.2~ynh2
|
||||
## Disclaimers / important information
|
||||
|
||||
## List of known public services
|
||||
|
|
|
@ -21,7 +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.2~ynh1
|
||||
**Version incluse :** 0.12.2~ynh2
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Liste de passerelles publiques
|
||||
|
|
|
@ -74,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
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Telegram puppeting bridge for Matrix/Synapse",
|
||||
"fr": "Passerelle Telegram pour Matrix/Synapse"
|
||||
},
|
||||
"version": "0.12.2~ynh1",
|
||||
"version": "0.12.2~ynh2",
|
||||
"url": "https://docs.mau.fi/bridges/python/telegram/index.html",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,13 @@ 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
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue