Merge pull request #9 from YunoHost-Apps/testing

some refactoring and fixes for edge cases
This commit is contained in:
benneti 2021-12-07 08:35:08 +01:00 committed by GitHub
commit 3271f8767f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 41 deletions

View file

@ -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
**Shipped version:** 0.10.1~ynh3
**Shipped version:** 0.10.2~ynh3

View file

@ -46,7 +46,7 @@ See also [upstream wiki Authentication page](https://docs.mau.fi/bridges/python/
* see https://docs.mau.fi/bridges/python/telegram/relay-bot.html
**Version incluse :** 0.10.1~ynh3
**Version incluse :** 0.10.2~ynh3

View file

@ -20,12 +20,11 @@
setup_private=0
setup_public=0
upgrade=1
#upgrade=1 from_commit=636be2f9f900e578d9aa26ee887dcec2ef8d4e71
#upgrade=1 from_commit=a95215f2ea5d1f34b1c804f776e78c4785477023
upgrade=1 from_commit=78e25377746ff6a488614c6ea00b8ce7c7e6d88a
backup_restore=1
multi_instance=1
port_already_use=1
change_url=0
;;; Upgrade options
# ; commit=e579544bf977e2b6b4221ecfaf1b1a5c6069560e
# name=0.10.1~ynh3
; commit=78e25377746ff6a488614c6ea00b8ce7c7e6d88a
name=0.10.1~ynh3

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/mautrix/telegram/archive/refs/tags/v0.10.1.tar.gz
SOURCE_SUM=81376427d454b6c99c01b244027cd7609d19ef84653625d4027ba92fd5de0466
SOURCE_URL=https://github.com/mautrix/telegram/archive/refs/tags/v0.10.2.tar.gz
SOURCE_SUM=6c55dd22d71dc8c78a3069acabcd66d8c181c795688f37bfc88fc461e99f5e25
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -424,10 +424,10 @@ bridge:
# Telegram config
telegram:
# Get your own API keys at https://my.telegram.org/apps
api_id: __TELEGRAM_API_ID__
api_hash: __TELEGRAM_API_HASH__
api_id: __APIID__
api_hash: __APIHASH__
# (Optional) Create your own bot at https://t.me/BotFather
bot_token: __TELEGRAM_BOT_TOKEN__
bot_token: __BOTTOKEN__
# Telethon connection options.
connection:

View file

@ -6,7 +6,7 @@
"en": "Telegram puppeting bridge for Matrix/Synapse",
"fr": "Passerelle Telegram pour Matrix/Synapse"
},
"version": "0.10.1~ynh3",
"version": "0.10.2~ynh3",
"url": "https://docs.mau.fi/bridges/python/telegram/index.html",
"upstream": {
"license": "free",
@ -17,8 +17,8 @@
},
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "Benedikt Tissot",
"email": "benedikt.tissot@googlemail.com",
"name": "",
"email": "",
"url": "https://github.com/YunoHost-Apps/mautrix_telegram_ynh"
},
"requirements": {

View file

@ -21,10 +21,6 @@ write_bridge_config () {
verify_server_ssl_certificates="true"
matrix_server_supports_asmux="false"
log_filename="/var/log/$app/$app.log"
# TODO rename these settings
telegram_api_id="$apiid"
telegram_api_hash="$apihash"
telegram_bot_token="$bottoken"
log_level="error"
ynh_add_config --template="config.yaml" --destination="$mautrix_config_path"
}

View file

@ -187,6 +187,7 @@ write_bridge_config
mkdir -p /var/log/$app
# Configure Mautrix-Bridge
python3 -m venv $final_path
export HOME=$final_path # HACK see https://github.com/mautrix/telegram/issues/661
$final_path/bin/pip3 install --upgrade setuptools wheel # HACK fixes "error: invalid command 'bdist_wheel'"
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[postgres,speedups,qr_login] # metrics,hq_thumbnails,e2be
# -r optional-requirements.txt
@ -254,15 +255,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
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
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
ynh_systemd_action --service_name=$app --action="restart"
#=================================================
# END OF SCRIPT

View file

@ -53,12 +53,6 @@ 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
# If final_path doesn't exist, create it
#if [ -z "$final_path" ]; then
# final_path=/var/www/$app
@ -121,11 +115,11 @@ ynh_system_user_create --username=$mautrix_bridge_user
# ...
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading python packages..." --weight=1
$final_path/bin/pip3 install --upgrade setuptools wheel # HACK fixes "error: invalid command 'bdist_wheel'"
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[postgres,speedups,qr_login] #,hq_thumbnails
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
ynh_script_progression --message="Upgrading python packages..." --weight=1
export HOME=$final_path # HACK see https://github.com/mautrix/telegram/issues/661
$final_path/bin/pip3 install --upgrade setuptools wheel # HACK fixes "error: invalid command 'bdist_wheel'"
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[postgres,speedups,qr_login] #,hq_thumbnails
fi
#=================================================