1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_facebook_ynh.git synced 2024-09-03 19:36:33 +02:00

Merge pull request #7 from YunoHost-Apps/testing

Update to v 0.3.3
This commit is contained in:
yalh76 2022-08-03 17:13:39 +02:00 committed by GitHub
commit c6e2069e6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 24 deletions

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
A Facebook puppeting bridge for Matrix/Synapse. A Facebook puppeting bridge for Matrix/Synapse.
**Shipped version:** 0.3.0~ynh1 **Shipped version:** 0.3.3~ynh1

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Passerelle Facebook pour Matrix/Synapse. Passerelle Facebook pour Matrix/Synapse.
**Version incluse :** 0.3.0~ynh1 **Version incluse :** 0.3.3~ynh1

View file

@ -21,7 +21,7 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
upgrade=1 from_commit=01514cf02f52773a8164d512d59687c121852152 upgrade=1 from_commit=c11342a1f14fe8b287dfcb025f8f8196b9097175
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=1 port_already_use=1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/mautrix/facebook/archive/v0.3.0.tar.gz SOURCE_URL=https://github.com/mautrix/facebook/archive/v0.3.3.tar.gz
SOURCE_SUM=0b31c0a865d71bc76bed541ee8e57dd790a67197f62883032a7ae05b9658642b SOURCE_SUM=5a312a45b26277b5e52b13236520c731d4cd8dc524942f95ba1eb846c0900efe
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -12,6 +12,14 @@ homeserver:
# updating m.direct. # updating m.direct.
# asmux: false # asmux: false
asmux: __MATRIX_SERVER_SUPPORTS_ASMUX__ asmux: __MATRIX_SERVER_SUPPORTS_ASMUX__
# Number of retries for all HTTP requests if the homeserver isn't reachable.
http_retry_count: 4
# The URL to push real-time bridge status to.
# If set, the bridge will make POST requests to this URL whenever a user's Facebook MQTT connection state changes.
# The bridge will use the appservice as_token to authorize requests.
status_endpoint: null
# Endpoint for reporting per-message status.
message_send_checkpoint_endpoint: null
# Application service host/registration related details # Application service host/registration related details
# Changing these values requires regeneration of the registration. # Changing these values requires regeneration of the registration.
@ -29,15 +37,19 @@ appservice:
# Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
max_body_size: 1 max_body_size: 1
# The full URI to the database. Only Postgres is currently supported. # The full URI to the database. SQLite and Postgres are supported.
# Format examples:
# SQLite: sqlite:///filename.db
# Postgres: postgres://username:password@hostname/dbname
database: postgres://__MAUTRIX_BRIDGE_USER__:__MAUTRIX_BRIDGE_DB_PWD__@localhost:5432/__MAUTRIX_BRIDGE_DB_NAME__ database: postgres://__MAUTRIX_BRIDGE_USER__:__MAUTRIX_BRIDGE_DB_PWD__@localhost:5432/__MAUTRIX_BRIDGE_DB_NAME__
# Additional arguments for asyncpg.create_pool() # Additional arguments for asyncpg.create_pool() or sqlite3.connect
# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
# https://docs.python.org/3/library/sqlite3.html#sqlite3.connect
# For sqlite, min_size is used as the connection thread pool size and max_size is ignored.
database_opts: database_opts:
min_size: 5 min_size: 5
max_size: 10 max_size: 10
# 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:
# Whether or not the public-facing endpoints should be enabled. # Whether or not the public-facing endpoints should be enabled.
@ -51,6 +63,11 @@ appservice:
# If set to "generate", a random string will be generated on the next startup. # If set to "generate", a random string will be generated on the next startup.
# If null, integration manager access to the API will not be possible. # If null, integration manager access to the API will not be possible.
shared_secret: generate shared_secret: generate
# Allow logging in within Matrix. If false, users can only log in using the web interface.
allow_matrix_login: true
# Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
# Currently the only events are login start, success and fail.
segment_key: null
# The unique ID of this appservice. # The unique ID of this appservice.
id: __BOTNAME__ id: __BOTNAME__
@ -58,7 +75,7 @@ appservice:
bot_username: __BOTNAME__ bot_username: __BOTNAME__
# 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: FB bridge bot bot_displayname: Facebook 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,18 +98,22 @@ metrics:
enabled: false enabled: false
listen_port: 8000 listen_port: 8000
# Manhole config.
manhole:
# Whether or not opening the manhole is allowed.
enabled: false
# The path for the unix socket.
path: /var/tmp/mautrix-facebook.manhole
# The list of UIDs who can be added to the whitelist.
# If empty, any UIDs can be specified in the open-manhole command.
whitelist:
- 0
# Bridge config # Bridge config
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: "fb_{userid}" username_template: "fb_{userid}"
# 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.
# {localpart} is the MXID localpart and {server} is the MXID server part of the user.
# (Note that, by default, non-admins might not have your homeserver's permission to create
# communities. You should set `enable_group_creation: true` in homeserver.yaml to fix this.)
# `facebook_{localpart}={server}` is a good value.
community_template: 'facebook_{localpart}={server}'
# Displayname template for Facebook users. # Displayname template for Facebook users.
# {displayname} is replaced with the display name of the Facebook user # {displayname} is replaced with the display name of the Facebook user
# as defined below in displayname_preference. # as defined below in displayname_preference.
@ -138,9 +159,9 @@ bridge:
# you must also set the URL in the double_puppet_server_map. # you must also set the URL in the double_puppet_server_map.
login_shared_secret_map: login_shared_secret_map:
example.com: foobar example.com: foobar
# Whether or not to bridge presence in both directions. Facebook allows users not to broadcast # Should presence from Facebook be bridged? This doesn't use the same API as the Android app,
# presence, but then it won't send other users' presence to the client. # so it might be more suspicious to Facebook.
presence: true presence_from_facebook: true
# Whether or not to update avatars when syncing all contacts at startup. # Whether or not to update avatars when syncing all contacts at startup.
update_avatar_initial_sync: true update_avatar_initial_sync: true
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip # End-to-bridge encryption support options. These require matrix-nio to be installed with pip
@ -171,6 +192,9 @@ bridge:
delivery_receipts: false delivery_receipts: false
# Whether to allow inviting arbitrary mxids to portal rooms # Whether to allow inviting arbitrary mxids to portal rooms
allow_invites: false allow_invites: false
# Whether or not created rooms should have federation enabled.
# If false, created portal rooms will never be federated.
federate_rooms: true
# Settings for backfilling messages from Facebook. # Settings for backfilling messages from Facebook.
backfill: backfill:
# Whether or not the Facebook users of logged in Matrix users should be # Whether or not the Facebook users of logged in Matrix users should be
@ -191,29 +215,47 @@ bridge:
# Interval in seconds in which to automatically reconnect all users. # Interval in seconds in which to automatically reconnect all users.
# This can be used to automatically mitigate the bug where Facebook stops sending messages. # This can be used to automatically mitigate the bug where Facebook stops sending messages.
# Set to -1 to disable periodic reconnections entirely. # Set to -1 to disable periodic reconnections entirely.
# Set to a list of two items to randomize the interval (min, max).
interval: -1 interval: -1
# What to do in periodic reconnects. Either "refresh" or "reconnect" # What to do in periodic reconnects. Either "refresh" or "reconnect"
mode: refresh mode: refresh
# Should even disconnected users be reconnected? # Should even disconnected users be reconnected?
always: false always: false
# Only reconnect if the user has been connected for longer than this value
min_connected_time: 0
# The number of seconds that a disconnection can last without triggering an automatic re-sync # The number of seconds that a disconnection can last without triggering an automatic re-sync
# and missed message backfilling when reconnecting. # and missed message backfilling when reconnecting.
# Set to 0 to always re-sync, or -1 to never re-sync automatically. # Set to 0 to always re-sync, or -1 to never re-sync automatically.
resync_max_disconnected_time: 5 resync_max_disconnected_time: 5
# Should the bridge do a resync on startup?
sync_on_startup: true
# Whether or not temporary disconnections should send notices to the notice room. # Whether or not temporary disconnections should send notices to the notice room.
# If this is false, disconnections will never send messages and connections will only send # If this is false, disconnections will never send messages and connections will only send
# messages if it was disconnected for more than resync_max_disconnected_time seconds. # messages if it was disconnected for more than resync_max_disconnected_time seconds.
temporary_disconnect_notices: true temporary_disconnect_notices: true
# Whether or not the bridge should try to "refresh" the connection if a normal reconnection # Disable bridge notices entirely
# attempt fails. disable_bridge_notices: false
refresh_on_reconnection_fail: false on_reconnection_fail:
# What to do if a reconnection attempt fails? Options: reconnect, refresh, null
action: reconnect
# Seconds to wait before attempting to refresh the connection, set a list of two items to
# to randomize the interval (min, max).
wait_for: 0
# Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
# This field will automatically be changed back to false after it, # This field will automatically be changed back to false after it,
# except if the config file is not writable. # except if the config file is not writable.
resend_bridge_info: false resend_bridge_info: false
# When using double puppeting, should muted chats be muted in Matrix?
mute_bridging: false
# Whether or not mute status and tags should only be bridged when the portal room is created.
tag_only_on_create: true
# If set to true, downloading media from the CDN will use a plain aiohttp client without the usual headers or
# other configuration. This may be useful if you don't want to use the default proxy for large files.
sandbox_media_download: false
# Permissions for using the bridge. # Permissions for using the bridge.
# Permitted values: # Permitted values:
# relay - Allowed to be relayed through the bridge, no access to commands.
# user - Use the bridge with puppeting. # user - Use the bridge with puppeting.
# admin - Use and administrate the bridge. # admin - Use and administrate the bridge.
# Permitted keys: # Permitted keys:
@ -221,9 +263,38 @@ bridge:
# domain - All users on that homeserver # domain - All users on that homeserver
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": "relay"
"__BOTUSERS__": "user" "__BOTUSERS__": "user"
"__BOTADMIN__": "admin" "__BOTADMIN__": "admin"
relay:
# Whether relay mode should be allowed. If allowed, `!fb set-relay` can be used to turn any
# authenticated user into a relaybot for that chat.
enabled: true
# The formats to use when sending messages to Messenger via a relay user.
#
# Available variables:
# $sender_displayname - The display name of the sender (e.g. Example User)
# $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
# $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
# $message - The message content
message_formats:
m.text: '<b>$sender_displayname</b>: $message'
m.notice: '<b>$sender_displayname<b>: $message'
m.emote: '* <b>$sender_displayname<b> $message'
m.file: '<b>$sender_displayname</b> sent a file'
m.image: '<b>$sender_displayname</b> sent an image'
m.audio: '<b>$sender_displayname</b> sent an audio file'
m.video: '<b>$sender_displayname</b> sent a video'
m.location: '<b>$sender_displayname</b> sent a location'
facebook:
device_seed: generate
default_region_hint: ODN
connection_type: WIFI
carrier: Verizon
hni: 311390
# Python logging configuration. # Python logging configuration.
# #
# See section 16.7.2 of the Python documentation for more info: # See section 16.7.2 of the Python documentation for more info:

View file

@ -6,7 +6,7 @@
"en": "A Facebook puppeting bridge for Matrix/Synapse.", "en": "A Facebook puppeting bridge for Matrix/Synapse.",
"fr": "Passerelle Facebook pour Matrix/Synapse." "fr": "Passerelle Facebook pour Matrix/Synapse."
}, },
"version": "0.3.0~ynh1", "version": "0.3.3~ynh1",
"url": "https://github.com/tulir/mautrix-facebook", "url": "https://github.com/tulir/mautrix-facebook",
"upstream": { "upstream": {
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",

View file

@ -192,6 +192,7 @@ ynh_add_config --template="../conf/config.yaml" --destination="$mautrix_config_p
mkdir -p /var/log/$app mkdir -p /var/log/$app
# Configure Mautrix-Bridge # Configure Mautrix-Bridge
python3 -m venv $final_path python3 -m venv $final_path
export HOME=$final_path
$final_path/bin/pip3 install --upgrade pip setuptools wheel $final_path/bin/pip3 install --upgrade pip setuptools wheel
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-facebook.tar.gz $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-facebook.tar.gz
$final_path/bin/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml $final_path/bin/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml

View file

@ -110,7 +110,8 @@ ynh_psql_execute_file_as_root --file="${YNH_CWD}/dump.sql" --database="$mautrix_
ynh_restore_file --origin_path="/var/log/$app" ynh_restore_file --origin_path="/var/log/$app"
python3 -m venv $final_path python3 -m venv $final_path
export HOME=$final_path
$final_path/bin/pip3 install --upgrade pip setuptools wheel
#================================================= #=================================================
# REGISTER SYNAPSE APP-SERVICE # REGISTER SYNAPSE APP-SERVICE

View file

@ -175,6 +175,7 @@ ynh_script_progression --message="Upgrading Mautrix-Bridge..." --weight=2
mkdir -p /var/log/$app mkdir -p /var/log/$app
# Configure Mautrix-Bridge # Configure Mautrix-Bridge
python3 -m venv $final_path python3 -m venv $final_path
export HOME=$final_path
$final_path/bin/pip3 install --upgrade pip setuptools wheel $final_path/bin/pip3 install --upgrade pip setuptools wheel
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-facebook.tar.gz $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-facebook.tar.gz
$final_path/bin/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml $final_path/bin/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml