From c9d302fa575fa2752db214f51ebbd252605d2d53 Mon Sep 17 00:00:00 2001 From: Dante Date: Sat, 27 Aug 2022 20:49:13 +0100 Subject: [PATCH] Update config from new version and fix encryption enabled value --- conf/config.yaml | 102 ++++++++++++++++++++++++++++++++++------------- scripts/install | 4 +- scripts/upgrade | 4 +- 3 files changed, 79 insertions(+), 31 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index d8af4c6..65ce02c 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -146,6 +146,10 @@ bridge: # will not send any more members. # -1 means no limit (which means it's limited to 10000 by the server) max_initial_member_sync: 100 + # Maximum number of participants in chats to bridge. Only applies when the portal is being created. + # If there are more members when trying to create a room, the room creation will be cancelled. + # -1 means no limit (which means all chats can be bridged) + max_member_count: -1 # Whether or not to sync the member list in channels. # If no channel admins have logged into the bridge, the bridge won't be able to sync the member # list regardless of this setting. @@ -172,10 +176,6 @@ bridge: # Allow logging in within Matrix. If false, users can only log in using login-qr or the # out-of-Matrix login website (see appservice.public config section) allow_matrix_login: true - # Whether or not to bridge plaintext highlights. - # Only enable this if your displayname_template has some static part that the bridge can use to - # reliably identify what is a plaintext highlight. - plaintext_highlights: false # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix. public_portals: true # Whether or not to use /sync to get presence, read receipts and typing notifications @@ -204,13 +204,13 @@ bridge: # Whether or not the !tg join command should do a HTTP request # to resolve redirects in invite links. invite_link_resolve: false - # Use inline images instead of a separate message for the caption. - # N.B. Inline images are not supported on all clients (e.g. Element iOS/Android). - inline_images: false + # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552. + # This is currently not supported in most clients. + caption_in_message: false # Maximum size of image in megabytes before sending to Telegram as a document. image_as_file_size: 10 - # Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 1280x1280 = 1638400. - image_as_file_pixels: 1638400 + # Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 4096x4096 = 16777216. + image_as_file_pixels: 16777216 # Enable experimental parallel file transfer, which makes uploads/downloads much faster by # streaming from/to Matrix and using many connections for Telegram. # Note that generating HQ thumbnails for videos is not possible with streamed transfers. @@ -226,12 +226,24 @@ bridge: # png - converts to non-animated png (fastest), # gif - converts to animated gif # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support + # webp - converts to animated webp, requires ffmpeg executable with webp codec/container support target: gif + # Should video stickers be converted to the specified format as well? + convert_from_webm: false # Arguments for converter. All converters take width and height. args: width: 256 height: 256 - fps: 25 # only for webm and gif (2, 5, 10, 20 or 25 recommended) + fps: 25 # only for webm, webp and gif (2, 5, 10, 20 or 25 recommended) + # Settings for converting animated emoji. + # Same as animated_sticker, but webm is not supported as the target + # (because inline images can only contain images, not videos). + animated_emoji: + target: webp + args: + width: 64 + height: 64 + fps: 25 # End-to-bridge encryption support options. # # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info. @@ -241,20 +253,46 @@ bridge: # Default to encryption, force-enable encryption in all portals the bridge creates # This will cause the bridge bot to be in private chats for the encryption to work properly. default: __IS_ENCRYPTION_ENABLED__ - # Database for the encryption data. If set to `default`, will use the appservice database. - database: default - # Options for automatic key sharing. - key_sharing: - # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled. - # You must use a client that supports requesting keys from other users to use this feature. - allow: false - # Require the requesting device to have a valid cross-signing signature? - # This doesn't require that the bridge has verified the device, only that the user has verified it. - # Not yet implemented. - require_cross_signing: false - # Require devices to be verified by the bridge? - # Verification by the bridge is not yet implemented. - require_verification: true + # Require encryption, drop any unencrypted messages. + require: __IS_ENCRYPTION_ENABLED__ + # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled. + # You must use a client that supports requesting keys from other users to use this feature. + allow_key_sharing: false + # What level of device verification should be required from users? + # + # Valid levels: + # unverified - Send keys to all device in the room. + # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys. + # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes). + # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot. + # Note that creating user signatures from the bridge bot is not currently possible. + # verified - Require manual per-device verification + # (currently only possible by modifying the `trust` column in the `crypto_device` database table). + verification_levels: + # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix. + receive: unverified + # Minimum level that the bridge should accept for incoming Matrix messages. + send: unverified + # Minimum level that the bridge should require for accepting key requests. + share: cross-signed-tofu + # Options for Megolm room key rotation. These options allow you to + # configure the m.room.encryption event content. See: + # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for + # more information about that event. + rotation: + # Enable custom Megolm room key rotation settings. Note that these + # settings will only apply to rooms created after this option is + # set. + enable_custom: false + # The maximum number of milliseconds a session should be used + # before changing it. The Matrix spec recommends 604800000 (a week) + # as the default. + milliseconds: 604800000 + # The maximum number of messages that should be sent with a given a + # session before changing it. The Matrix spec recommends 100 as the + # default. + messages: 100 + # Whether or not to explicitly set the avatar and room name for private # chat portal rooms. This will be implicitly enabled if encryption.default is true. private_chat_portal_meta: false @@ -263,6 +301,8 @@ bridge: delivery_receipts: false # Whether or not delivery errors should be reported as messages in the Matrix room. delivery_error_reports: false + # Whether the bridge should send the message status as a custom com.beeper.message_send_status event. + message_status_events: false # 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. @@ -282,6 +322,9 @@ bridge: kick_on_logout: true # Should the "* user joined Telegram" notice always be marked as read automatically? always_read_joined_telegram_notice: true + # Should the bridge auto-create a group chat on Telegram when a ghost is invited to a room? + # Requires the user to have sufficient power level and double puppeting enabled. + create_group_on_invite: true # Settings for backfilling messages from Telegram. backfill: # Whether or not the Telegram ghosts of logged in Matrix users should be @@ -325,8 +368,7 @@ bridge: # List of user IDs for whom the previous flag is flipped. # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but # notices from users listed here will be bridged. - exceptions: - - "@importantbot:example.com" + exceptions: [] # An array of possible values for the $distinguisher variable in message formats. # Each user gets one of the values here, based on a hash of their user ID. @@ -451,6 +493,12 @@ telegram: # (Optional) Create your own bot at https://t.me/BotFather bot_token: __BOTTOKEN__ + # Should the bridge request missed updates from Telegram when restarting? + catch_up: true + # Should incoming updates be handled sequentially to make sure order is preserved on Matrix? + sequential_updates: true + exit_on_update_error: false + # Telethon connection options. connection: # The timeout in seconds to be used when connecting. @@ -476,7 +524,7 @@ telegram: # Device info sent to Telegram. device_info: # "auto" = OS name+version. - device_model: auto + device_model: mautrix-telegram # "auto" = Telethon version. system_version: auto # "auto" = mautrix-telegram version. diff --git a/scripts/install b/scripts/install index 0362dc4..1e4c499 100755 --- a/scripts/install +++ b/scripts/install @@ -164,10 +164,10 @@ ynh_script_progression --message="Configuring Mautrix-Bridge..." --weight=2 mautrix_config_path="$final_path/config.yaml" as_token="\"This value is generated when generating the registration\"" hs_token="\"This value is generated when generating the registration\"" -is_encryption_enabled=$encryption +is_encryption_enabled="$encryption" if [ $encryption -eq 1 ]; then - is_encryption_enabled=true + is_encryption_enabled="true" fi write_bridge_config diff --git a/scripts/upgrade b/scripts/upgrade index 170d407..3694285 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -135,10 +135,10 @@ as_token=$(grep "as_token:" "$mautrix_config_path" | sed -r "s/ *as_token: *//") hs_token=$(grep "hs_token:" "$mautrix_config_path" | sed -r "s/ *hs_token: *//") # ynh_replace_string --match_string=__AS_TOKEN__ --replace_string="$as_token" --target_file="$mautrix_config_path" # ynh_replace_string --match_string=__HS_TOKEN__ --replace_string="$hs_token" --target_file="$mautrix_config_path" -is_encryption_enabled=$encryption +is_encryption_enabled="$encryption" if [ $encryption -eq 1 ]; then - is_encryption_enabled=true + is_encryption_enabled="true" fi write_bridge_config