mirror of
https://github.com/YunoHost-Apps/mautrix_telegram_ynh.git
synced 2024-09-03 19:45:55 +02:00
add bot_synapse_adm option
This commit is contained in:
parent
cf85ebfbfb
commit
fe51aea704
3 changed files with 27 additions and 11 deletions
|
@ -70,7 +70,20 @@
|
|||
"fr": "N'activer que si vous connaissez les prérequis et constraintes liées à e2b."
|
||||
},
|
||||
"default": false
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "bot_synapse_adm",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Give the Telegram bot administrator rights to the synapse instance?",
|
||||
"fr": "Donner au robot Telegram des droits administrateur à l'instance synapse ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "If true, the bot can group Telegram chats in a Matrix community. Not required if you set up synapse so that non-admins are authorized to create communities.",
|
||||
"fr": "Si true, le robot groupera les conversations Telegram dans une communauté Matrix. Pas nécessaire si vous avez réglé synapse pour qu'il autorise les non-admin à créer des communautés."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "botadmin",
|
||||
"type": "string",
|
||||
|
|
|
@ -29,6 +29,7 @@ botname=$YNH_APP_ARG_BOTNAME
|
|||
encryption=$YNH_APP_ARG_ENCRYPTION
|
||||
botadmin=$YNH_APP_ARG_BOTADMIN
|
||||
botusers=$YNH_APP_ARG_BOTUSERS
|
||||
bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM
|
||||
|
||||
# TODO new settings specific to telegram
|
||||
apiid=$YNH_APP_ARG_APIID
|
||||
|
@ -90,6 +91,7 @@ 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=botname --value=$botname
|
||||
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
|
||||
ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm
|
||||
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_bridge_db_name --value=$mautrix_bridge_db_name
|
||||
|
@ -256,12 +258,12 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
ynh_systemd_action --service_name=$app --action="start"
|
||||
# Wait until the synapse user is created
|
||||
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
|
||||
# (Note that, by default, non-admins might not have your homeserver's permission to create communities.)
|
||||
if [ "$bot_synapse_adm" = true ]
|
||||
then
|
||||
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
|
||||
#yunohost app action run $synapse_instance set_admin_user -a username=$botname
|
||||
fi
|
||||
ynh_systemd_action --service_name=$app --action="restart"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -53,11 +53,12 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|||
# some legacy installs and you therefore want to initiaze stuff during upgrade)
|
||||
#
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
#if [ -z "$db_name" ]; then
|
||||
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#fi
|
||||
bot_synapse_adm=$(ynh_app_setting_get --app=$app --key=bot_synapse_adm)
|
||||
# If bot_synapse_adm doesn't exist, create it
|
||||
if [ -z "$bot_synapse_adm" ]; then
|
||||
bot_synapse_adm=true
|
||||
ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
#if [ -z "$final_path" ]; then
|
||||
|
|
Loading…
Reference in a new issue