diff --git a/README.md b/README.md
index 3989bef..0b76ca1 100644
--- a/README.md
+++ b/README.md
@@ -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.
-**Shipped version:** 0.3.0~ynh1
+**Shipped version:** 0.3.3~ynh1
diff --git a/README_fr.md b/README_fr.md
index 1ef4dd0..b2a6b12 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Passerelle Facebook pour Matrix/Synapse.
-**Version incluse :** 0.3.0~ynh1
+**Version incluse :** 0.3.3~ynh1
diff --git a/check_process b/check_process
index e41f11a..114ff6f 100644
--- a/check_process
+++ b/check_process
@@ -21,7 +21,7 @@
setup_private=0
setup_public=0
upgrade=1
- upgrade=1 from_commit=01514cf02f52773a8164d512d59687c121852152
+ upgrade=1 from_commit=c11342a1f14fe8b287dfcb025f8f8196b9097175
backup_restore=1
multi_instance=1
port_already_use=1
diff --git a/conf/app.src b/conf/app.src
index 051b687..5735319 100644
--- a/conf/app.src
+++ b/conf/app.src
@@ -1,5 +1,5 @@
-SOURCE_URL=https://github.com/mautrix/facebook/archive/v0.3.0.tar.gz
-SOURCE_SUM=0b31c0a865d71bc76bed541ee8e57dd790a67197f62883032a7ae05b9658642b
+SOURCE_URL=https://github.com/mautrix/facebook/archive/v0.3.3.tar.gz
+SOURCE_SUM=5a312a45b26277b5e52b13236520c731d4cd8dc524942f95ba1eb846c0900efe
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
diff --git a/conf/config.yaml b/conf/config.yaml
index ca95704..780f69c 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -12,6 +12,14 @@ homeserver:
# updating m.direct.
# asmux: false
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
# 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
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__
- # 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://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:
min_size: 5
max_size: 10
-
# Public part of web server for out-of-Matrix interaction with the bridge.
public:
# 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 null, integration manager access to the API will not be possible.
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.
id: __BOTNAME__
@@ -58,7 +75,7 @@ appservice:
bot_username: __BOTNAME__
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
# to leave display name/avatar as-is.
- bot_displayname: FB bridge bot
+ bot_displayname: Facebook bridge bot
bot_avatar: mxc://maunium.net/ygtkteZsXnGJLJHRchUwYWak
# Community ID for bridged users (changes registration file) and rooms.
@@ -81,18 +98,22 @@ metrics:
enabled: false
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:
# Localpart template of MXIDs for Facebook users.
# {userid} is replaced with the user ID of the Facebook user.
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} is replaced with the display name of the Facebook user
# as defined below in displayname_preference.
@@ -138,9 +159,9 @@ bridge:
# you must also set the URL in the double_puppet_server_map.
login_shared_secret_map:
example.com: foobar
- # Whether or not to bridge presence in both directions. Facebook allows users not to broadcast
- # presence, but then it won't send other users' presence to the client.
- presence: true
+ # Should presence from Facebook be bridged? This doesn't use the same API as the Android app,
+ # so it might be more suspicious to Facebook.
+ presence_from_facebook: true
# Whether or not to update avatars when syncing all contacts at startup.
update_avatar_initial_sync: true
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
@@ -171,6 +192,9 @@ bridge:
delivery_receipts: false
# Whether to allow inviting arbitrary mxids to portal rooms
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.
backfill:
# 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.
# This can be used to automatically mitigate the bug where Facebook stops sending messages.
# Set to -1 to disable periodic reconnections entirely.
+ # Set to a list of two items to randomize the interval (min, max).
interval: -1
# What to do in periodic reconnects. Either "refresh" or "reconnect"
mode: refresh
# Should even disconnected users be reconnected?
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
# and missed message backfilling when reconnecting.
# Set to 0 to always re-sync, or -1 to never re-sync automatically.
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.
# 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.
temporary_disconnect_notices: true
- # Whether or not the bridge should try to "refresh" the connection if a normal reconnection
- # attempt fails.
- refresh_on_reconnection_fail: false
+ # Disable bridge notices entirely
+ disable_bridge_notices: 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.
# This field will automatically be changed back to false after it,
# except if the config file is not writable.
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.
# Permitted values:
+ # relay - Allowed to be relayed through the bridge, no access to commands.
# user - Use the bridge with puppeting.
# admin - Use and administrate the bridge.
# Permitted keys:
@@ -221,9 +263,38 @@ bridge:
# domain - All users on that homeserver
# mxid - Specific user
permissions:
+ "*": "relay"
"__BOTUSERS__": "user"
"__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: '$sender_displayname: $message'
+ m.notice: '$sender_displayname: $message'
+ m.emote: '* $sender_displayname $message'
+ m.file: '$sender_displayname sent a file'
+ m.image: '$sender_displayname sent an image'
+ m.audio: '$sender_displayname sent an audio file'
+ m.video: '$sender_displayname sent a video'
+ m.location: '$sender_displayname sent a location'
+
+facebook:
+ device_seed: generate
+ default_region_hint: ODN
+ connection_type: WIFI
+ carrier: Verizon
+ hni: 311390
+
# Python logging configuration.
#
# See section 16.7.2 of the Python documentation for more info:
diff --git a/manifest.json b/manifest.json
index 4afa942..c186c58 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "A Facebook puppeting bridge for 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",
"upstream": {
"license": "AGPL-3.0-or-later",
diff --git a/scripts/install b/scripts/install
index 63c815a..067835c 100755
--- a/scripts/install
+++ b/scripts/install
@@ -192,6 +192,7 @@ ynh_add_config --template="../conf/config.yaml" --destination="$mautrix_config_p
mkdir -p /var/log/$app
# Configure Mautrix-Bridge
python3 -m venv $final_path
+export HOME=$final_path
$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/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml
diff --git a/scripts/restore b/scripts/restore
index ca83d90..68052d4 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -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"
python3 -m venv $final_path
-
+export HOME=$final_path
+$final_path/bin/pip3 install --upgrade pip setuptools wheel
#=================================================
# REGISTER SYNAPSE APP-SERVICE
diff --git a/scripts/upgrade b/scripts/upgrade
index 7fbfa21..87125d0 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -175,6 +175,7 @@ ynh_script_progression --message="Upgrading Mautrix-Bridge..." --weight=2
mkdir -p /var/log/$app
# Configure Mautrix-Bridge
python3 -m venv $final_path
+export HOME=$final_path
$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/python3 -m mautrix_facebook -g -c $mautrix_config_path -r $app_service_registration_path/$app.yaml