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
|
@ -71,6 +71,19 @@
|
||||||
},
|
},
|
||||||
"default": false
|
"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",
|
"name": "botadmin",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
|
@ -29,6 +29,7 @@ botname=$YNH_APP_ARG_BOTNAME
|
||||||
encryption=$YNH_APP_ARG_ENCRYPTION
|
encryption=$YNH_APP_ARG_ENCRYPTION
|
||||||
botadmin=$YNH_APP_ARG_BOTADMIN
|
botadmin=$YNH_APP_ARG_BOTADMIN
|
||||||
botusers=$YNH_APP_ARG_BOTUSERS
|
botusers=$YNH_APP_ARG_BOTUSERS
|
||||||
|
bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM
|
||||||
|
|
||||||
# TODO new settings specific to telegram
|
# TODO new settings specific to telegram
|
||||||
apiid=$YNH_APP_ARG_APIID
|
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=port --value=$port
|
||||||
ynh_app_setting_set --app=$app --key=botname --value=$botname
|
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=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=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=encryption --value=$encryption
|
||||||
ynh_app_setting_set --app=$app --key=mautrix_bridge_db_name --value=$mautrix_bridge_db_name
|
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"
|
ynh_systemd_action --service_name=$app --action="start"
|
||||||
# Wait until the synapse user is created
|
# Wait until the synapse user is created
|
||||||
sleep 30
|
sleep 30
|
||||||
# # (Note that, by default, non-admins might not have your homeserver's permission to create communities.)
|
# (Note that, by default, non-admins might not have your homeserver's permission to create communities.)
|
||||||
# if [ "$bot_is_synapse_admin" = true ]
|
if [ "$bot_synapse_adm" = true ]
|
||||||
# then
|
then
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$botname"";"
|
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
|
#yunohost app action run $synapse_instance set_admin_user -a username=$botname
|
||||||
# fi
|
fi
|
||||||
ynh_systemd_action --service_name=$app --action="restart"
|
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)
|
# some legacy installs and you therefore want to initiaze stuff during upgrade)
|
||||||
#
|
#
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
bot_synapse_adm=$(ynh_app_setting_get --app=$app --key=bot_synapse_adm)
|
||||||
#if [ -z "$db_name" ]; then
|
# If bot_synapse_adm doesn't exist, create it
|
||||||
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
if [ -z "$bot_synapse_adm" ]; then
|
||||||
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
bot_synapse_adm=true
|
||||||
#fi
|
ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm
|
||||||
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
#if [ -z "$final_path" ]; then
|
#if [ -z "$final_path" ]; then
|
||||||
|
|
Loading…
Reference in a new issue