1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_signal_ynh.git synced 2024-09-03 19:46:07 +02:00

adapt install and config files

This commit is contained in:
Gredin 67 2021-01-23 01:00:48 +01:00
parent dc29b565ac
commit 03b279dd91
3 changed files with 22 additions and 37 deletions

View file

@ -1,7 +1,7 @@
SOURCE_URL=url of app's source SOURCE_URL=https://github.com/tulir/mautrix-facebook/tarball/7b2246099d3d6ac52061f82315460415eb22219b
SOURCE_SUM=sha256 checksum SOURCE_SUM=fd9d4f2b2feec390fb35b56f3a5e4a26234f9ed5029eb3950bea4b7dc55bef49
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=mautrix-facebook
SOURCE_EXTRACT=true SOURCE_EXTRACT=false

View file

@ -34,7 +34,7 @@ appservice:
# The full URI to the database. Only Postgres is currently supported. # The full URI to the database. Only Postgres is currently supported.
# database: postgres://username:password@hostname/db # database: postgres://username:password@hostname/db
database: postgres://__MAUTRIX_FACEBOOK_DB_USER__:__MAUTRIX_FACEBOOK_DB_PWD__@localhost:5432/__MAUTRIX_FACEBOOK_DB_NAME__ database: postgres://__MAUTRIX_FACEBOOK_USER__:__MAUTRIX_FACEBOOK_DB_PWD__@localhost:5432/__MAUTRIX_FACEBOOK_DB_NAME__
# Public part of web server for out-of-Matrix interaction with the bridge. # Public part of web server for out-of-Matrix interaction with the bridge.
public: public:
@ -51,12 +51,12 @@ appservice:
shared_secret: generate shared_secret: generate
# The unique ID of this appservice. # The unique ID of this appservice.
id: facebook id: __FACEBOOKBOT__
# Username of the appservice bot. # Username of the appservice bot.
bot_username: facebookbot bot_username: __FACEBOOKBOT__
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
# to leave display name/avatar as-is. # to leave display name/avatar as-is.
bot_displayname: Facebook bridge bot bot_displayname: FB bridge bot
bot_avatar: mxc://maunium.net/ygtkteZsXnGJLJHRchUwYWak bot_avatar: mxc://maunium.net/ygtkteZsXnGJLJHRchUwYWak
# Community ID for bridged users (changes registration file) and rooms. # Community ID for bridged users (changes registration file) and rooms.
@ -81,7 +81,7 @@ metrics:
bridge: bridge:
# Localpart template of MXIDs for Facebook users. # Localpart template of MXIDs for Facebook users.
# {userid} is replaced with the user ID of the Facebook user. # {userid} is replaced with the user ID of the Facebook user.
username_template: "facebook_{userid}" username_template: "fb_{userid}"
# Localpart template for per-user room grouping community IDs. # Localpart template for per-user room grouping community IDs.
# The bridge will create these communities and add all of the specific user's portals to the community. # The bridge will create these communities and add all of the specific user's portals to the community.
# {localpart} is the MXID localpart and {server} is the MXID server part of the user. # {localpart} is the MXID localpart and {server} is the MXID server part of the user.
@ -122,7 +122,7 @@ bridge:
sync_direct_chat_list: false sync_direct_chat_list: false
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
example.com: https://example.com example.com: https://__BOTUSERS__
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@ -217,8 +217,8 @@ bridge:
# domain - All users on that homeserver # domain - All users on that homeserver
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"example.com": "user" "__BOTUSERS__": "user"
"@admin:example.com": "admin" "__BOTADMIN__": "admin"
# Python logging configuration. # Python logging configuration.
# #
@ -236,7 +236,7 @@ logging:
file: file:
class: logging.handlers.RotatingFileHandler class: logging.handlers.RotatingFileHandler
formatter: normal formatter: normal
filename: ./mautrix-facebook.log filename: __LOG_FILENAME__
maxBytes: 10485760 maxBytes: 10485760
backupCount: 10 backupCount: 10
console: console:

View file

@ -172,13 +172,7 @@ ynh_add_systemd_config --service=$app
#================================================= #=================================================
# SET MAUTRIX-FACEBOOK CONFIG # SET MAUTRIX-FACEBOOK CONFIG
#================================================= #=================================================
ynh_script_progression --message="Configuring Mautrix-Facebook..." --weight=2 ynh_script_progression --message="Configuring Mautrix-FB..." --weight=2
# Configure Mautrix-Facebook
python3 -m venv $final_path
pip install --upgrade mautrix-facebook
# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times)
# For any update do it in all files # For any update do it in all files
@ -190,6 +184,8 @@ cp ../conf/config.yaml "$mautrix_config_path"
ynh_replace_string --match_string=__DOMAIN__ --replace_string="https://$domain" --target_file="$mautrix_config_path" ynh_replace_string --match_string=__DOMAIN__ --replace_string="https://$domain" --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__SERVER_NAME__ --replace_string=$server_name --target_file="$mautrix_config_path" ynh_replace_string --match_string=__SERVER_NAME__ --replace_string=$server_name --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__VERIFY_SERVER_SSL_CERTIFICATES__ --replace_string=true --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__MATRIX_SERVER_SUPPORTS_ASMUX__ --replace_string=false --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__PORT__ --replace_string=$port --target_file="$mautrix_config_path" ynh_replace_string --match_string=__PORT__ --replace_string=$port --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_USER__ --replace_string=$mautrix_facebook_user --target_file="$mautrix_config_path" ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_USER__ --replace_string=$mautrix_facebook_user --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_DB_PWD__ --replace_string=$mautrix_facebook_db_pwd --target_file="$mautrix_config_path" ynh_replace_string --match_string=__MAUTRIX_FACEBOOK_DB_PWD__ --replace_string=$mautrix_facebook_db_pwd --target_file="$mautrix_config_path"
@ -205,27 +201,16 @@ else
ynh_replace_string --match_string=__BOTUSERS__ --replace_string=$botusers --target_file="$mautrix_config_path" ynh_replace_string --match_string=__BOTUSERS__ --replace_string=$botusers --target_file="$mautrix_config_path"
fi fi
ynh_replace_string --match_string=__BOTADMIN__ --replace_string=$botadmin --target_file="$mautrix_config_path" ynh_replace_string --match_string=__BOTADMIN__ --replace_string=$botadmin --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__ENABLE_RELAYBOT__ --replace_string="true" --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__RELAYBOT_MANAGEMENT_ROOM__ --replace_string="highwaytohell" --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__RELAYBOT_INVITE__ --replace_string=$botadmin --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$mautrix_config_path" ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__LOG_FORMAT__ --replace_string="log.log" --target_file="$mautrix_config_path" ynh_replace_string --match_string=__LOG_FILENAME__ --replace_string="/var/log/$app/$app.log" --target_file="$mautrix_config_path"
# Options: debug, info, warn, error, fatal # Options: debug, info, warn, error, fatal
ynh_replace_string --match_string=__LOG_LEVEL__ --replace_string="error" --target_file="$mautrix_config_path" ynh_replace_string --match_string=__LOG_LEVEL__ --replace_string="error" --target_file="$mautrix_config_path"
#cd $final_path # Configure Mautrix-Facebook
#Generate the appservice registration file by running ./mautrix-facebook -g. python3 -m venv $final_path
#You can use the -c and -r flags to change the location of the config and registration files. They default to config.yaml and registration.yaml respectively. pip install --upgrade ./mautrix-facebook.tar.gz
#mkdir -p $app_service_registration_path
python -m $final_path/mautrix-facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml python -m $final_path/mautrix-facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml
#Add the path to the registration file (registration.yaml by default) to your synapse homeserver.yaml under app_service_config_files.
#cd $base_directory
#cp ../conf/$app.yaml $app_service_registration_path
#$as_token=;
#$hs_token=;
#ynh_replace_string --match_string=__AS_TOKEN__ --replace_string="$as_token" --target_file=$app_service_registration_path/$app.yaml
#ynh_replace_string --match_string=__HS_TOKEN__ --replace_string="$hs_token" --target_file=$app_service_registration_path/$app.yaml
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|| ynh_die "Synapse can't restart with the appservice configuration" || ynh_die "Synapse can't restart with the appservice configuration"
# Handled by synapse: synapse_ynh adds all registration files added in $app_service_registration_path to the app_service_config_files list # Handled by synapse: synapse_ynh adds all registration files added in $app_service_registration_path to the app_service_config_files list
@ -265,7 +250,7 @@ chown $mautrix_facebook_user:root -R $final_path
ynh_script_progression --message="Configuring log rotation..." --weight=3 ynh_script_progression --message="Configuring log rotation..." --weight=3
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile "/var/log/$app/log.log" ynh_use_logrotate --logfile "/var/log/$app/$app.log"
chown $mautrix_facebook_user:root -R /var/log/$app chown $mautrix_facebook_user:root -R /var/log/$app
#================================================= #=================================================
@ -273,7 +258,7 @@ chown $mautrix_facebook_user:root -R /var/log/$app
#================================================= #=================================================
#yunohost service add $app --log "/var/log/$app/log.log" #yunohost service add $app --log "/var/log/$app/log.log"
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
yunohost service add $app --description "$app daemon for bridging Facebook and Matrix messages" --log "/var/log/$app/log.log" yunohost service add $app --description "$app daemon for bridging FB and Matrix messages" --log "/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE