Update version 0.11.3

This commit is contained in:
Dante 2022-08-08 19:21:34 +01:00
parent 709f315269
commit a16eff7d39
7 changed files with 84 additions and 73 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 * see https://docs.mau.fi/bridges/python/telegram/relay-bot.html
**Shipped version:** 0.10.2~ynh4 **Shipped version:** 0.11.3~ynh1
## Disclaimers / important information ## Disclaimers / important information
### Configuration of the bridge ### Configuration of the bridge

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 * see https://docs.mau.fi/bridges/python/telegram/relay-bot.html
**Version incluse :** 0.10.2~ynh4 **Version incluse :** 0.11.3~ynh1
## Avertissements / informations importantes ## Avertissements / informations importantes
### Configuration of the bridge ### Configuration of the bridge

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/mautrix/telegram/archive/refs/tags/v0.10.2.tar.gz SOURCE_URL=https://github.com/mautrix/telegram/archive/refs/tags/v0.11.3.tar.gz
SOURCE_SUM=6c55dd22d71dc8c78a3069acabcd66d8c181c795688f37bfc88fc461e99f5e25 SOURCE_SUM=5ce51e8265316e1ac706c7f70c446d28b9728cb26e63b6afc48412d12ccd9a97
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

@ -8,6 +8,17 @@ homeserver:
# Only applies if address starts with https:// # Only applies if address starts with https://
verify_ssl: __VERIFY_SERVER_SSL_CERTIFICATES__ verify_ssl: __VERIFY_SERVER_SSL_CERTIFICATES__
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 Telegram 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
# Whether asynchronous uploads via MSC2246 should be enabled for media.
# Requires a media repo that supports MSC2246.
async_media: false
# 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.
@ -25,14 +36,18 @@ 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. SQLite and Postgres are fully supported. # The full URI to the database. SQLite and Postgres are supported.
# Other DBMSes supported by SQLAlchemy may or may not work.
# Format examples: # Format examples:
# SQLite: sqlite:///filename.db # SQLite: sqlite:///filename.db
# Postgres: postgres://username:password@hostname/dbname # 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__
# Optional extra arguments for SQLAlchemy's create_engine # Additional arguments for asyncpg.create_pool() or sqlite3.connect()
database_opts: {} # 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: 1
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.
# Used for things like login if the user wants to make sure the 2FA password isn't stored in # Used for things like login if the user wants to make sure the 2FA password isn't stored in
@ -47,12 +62,12 @@ appservice:
external: https://example.com/public external: https://example.com/public
# Provisioning API part of the web server for automated portal creation and fetching information. # Provisioning API part of the web server for automated portal creation and fetching information.
# Used by things like mautrix-manager (https://github.com/mautrix/manager). # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
provisioning: provisioning:
# Whether or not the provisioning API should be enabled. # Whether or not the provisioning API should be enabled.
enabled: false enabled: false
# The prefix to use in the provisioning API endpoints. # The prefix to use in the provisioning API endpoints.
prefix: /_matrix/provision/v1 prefix: /_matrix/provision
# The shared secret to authorize users of the API. # The shared secret to authorize users of the API.
# Set to "generate" to generate and save a new token. # Set to "generate" to generate and save a new token.
shared_secret: generate shared_secret: generate
@ -66,12 +81,6 @@ appservice:
bot_displayname: Telegram bridge bot bot_displayname: Telegram bridge bot
bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
# Community ID for bridged users (changes registration file) and rooms.
# Must be created manually.
#
# Example: "+telegram:example.com". Set to false to disable.
community_id: +telegram:__SERVER_NAME__
# Whether or not to receive ephemeral events via appservice transactions. # Whether or not to receive ephemeral events via appservice transactions.
# Requires MSC2409 support (i.e. Synapse 1.22+). # Requires MSC2409 support (i.e. Synapse 1.22+).
# You should disable bridge -> sync_with_custom_puppets when this is enabled. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
@ -202,11 +211,12 @@ bridge:
inline_images: false inline_images: false
# Maximum size of image in megabytes before sending to Telegram as a document. # Maximum size of image in megabytes before sending to Telegram as a document.
image_as_file_size: 10 image_as_file_size: 10
# Maximum size of Telegram documents in megabytes to bridge. # Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 1280x1280 = 1638400.
max_document_size: 100 image_as_file_pixels: 1638400
# Enable experimental parallel file transfer, which makes uploads/downloads much faster by # Enable experimental parallel file transfer, which makes uploads/downloads much faster by
# streaming from/to Matrix and using many connections for Telegram. # streaming from/to Matrix and using many connections for Telegram.
# Note that generating HQ thumbnails for videos is not possible with streamed transfers. # Note that generating HQ thumbnails for videos is not possible with streamed transfers.
# This option uses internal Telethon implementation details and may break with minor updates.
parallel_file_transfer: false parallel_file_transfer: false
# Whether or not created rooms should have federation enabled. # Whether or not created rooms should have federation enabled.
# If false, created portal rooms will never be federated. # If false, created portal rooms will never be federated.
@ -216,35 +226,24 @@ bridge:
# Format to which animated stickers should be converted. # Format to which animated stickers should be converted.
# disable - No conversion, send as-is (gzipped lottie) # disable - No conversion, send as-is (gzipped lottie)
# png - converts to non-animated png (fastest), # png - converts to non-animated png (fastest),
# gif - converts to animated gif, but loses transparency # gif - converts to animated gif
# webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
target: gif target: gif
# Arguments for converter. All converters take width and height. # Arguments for converter. All converters take width and height.
# GIF converter takes background as a hex color.
args: args:
width: 256 width: 256
height: 256 height: 256
background: "020202" # only for gif fps: 25 # only for webm and gif (2, 5, 10, 20 or 25 recommended)
fps: 30 # only for webm # End-to-bridge encryption support options.
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
# and login_shared_secret to be configured in order to get a device for the bridge bot.
# #
# Additionally, https://github.com/matrix-org/synapse/pull/5758 is required if using a normal # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
# application service.
encryption: encryption:
# Allow encryption, work in group chat rooms with e2ee enabled # Allow encryption, work in group chat rooms with e2ee enabled
allow: false allow: false
# Default to encryption, force-enable encryption in all portals the bridge creates # 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. # This will cause the bridge bot to be in private chats for the encryption to work properly.
default: false default: false
# Database for the encryption data. Currently only supports Postgres and an in-memory # Database for the encryption data. If set to `default`, will use the appservice database.
# store that's persisted as a pickle.
# If set to `default`, will use the appservice postgres database
# or a pickle file if the appservice database is sqlite.
#
# Format examples:
# Pickle: pickle:///filename.pickle
# Postgres: postgres://username:password@hostname/dbname
database: default database: default
# Options for automatic key sharing. # Options for automatic key sharing.
key_sharing: key_sharing:
@ -270,6 +269,21 @@ bridge:
# 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
# When using double puppeting, should pinned chats be moved to a specific tag in Matrix?
# The favorites tag is `m.favourite`.
pinned_tag: null
# Same as above for archived chats, the low priority tag is `m.lowpriority`.
archive_tag: null
# Whether or not mute status and tags should only be bridged when the portal room is created.
tag_only_on_create: true
# Should leaving the room on Matrix make the user leave on Telegram?
bridge_matrix_leave: true
# Should the user be kicked out of all portals when logging out of the bridge?
kick_on_logout: true
# Should the "* user joined Telegram" notice always be marked as read automatically?
always_read_joined_telegram_notice: true
# Settings for backfilling messages from Telegram. # Settings for backfilling messages from Telegram.
backfill: backfill:
# Whether or not the Telegram ghosts of logged in Matrix users should be # Whether or not the Telegram ghosts of logged in Matrix users should be
@ -316,16 +330,10 @@ bridge:
exceptions: exceptions:
- "@importantbot:example.com" - "@importantbot:example.com"
# Some config options related to Telegram message deduplication. # An array of possible values for the $distinguisher variable in message formats.
# The default values are usually fine, but some debug messages/warnings might recommend you # Each user gets one of the values here, based on a hash of their user ID.
# change these. # If the array is empty, the $distinguisher variable will also be empty.
deduplication: relay_user_distinguishers: ["🟦", "🟣", "🟩", "⭕️", "🔶", "⬛️", "🔵", "🟢"]
# Whether or not to check the database if the message about to be sent is a duplicate.
pre_db_check: false
# The number of latest events to keep when checking for duplicates.
# You might need to increase this on high-traffic bridge instances.
cache_queue_length: 20
# The formats to use when sending messages to Telegram via the relay bot. # The formats to use when sending messages to Telegram via the relay bot.
# Text msgtypes (m.text, m.notice and m.emote) support HTML, media msgtypes don't. # Text msgtypes (m.text, m.notice and m.emote) support HTML, media msgtypes don't.
# #
@ -333,16 +341,17 @@ bridge:
# $sender_displayname - The display name of the sender (e.g. Example User) # $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_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) # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
# $distinguisher - A random string from the options in the relay_user_distinguishers array.
# $message - The message content # $message - The message content
message_formats: message_formats:
m.text: "<b>$sender_displayname</b>: $message" m.text: "$distinguisher <b>$sender_displayname</b>: $message"
m.notice: "<b>$sender_displayname</b>: $message" m.notice: "$distinguisher <b>$sender_displayname</b>: $message"
m.emote: "* <b>$sender_displayname</b> $message" m.emote: "* $distinguisher <b>$sender_displayname</b> $message"
m.file: "<b>$sender_displayname</b> sent a file: $message" m.file: "$distinguisher <b>$sender_displayname</b> sent a file: $message"
m.image: "<b>$sender_displayname</b> sent an image: $message" m.image: "$distinguisher <b>$sender_displayname</b> sent an image: $message"
m.audio: "<b>$sender_displayname</b> sent an audio file: $message" m.audio: "$distinguisher <b>$sender_displayname</b> sent an audio file: $message"
m.video: "<b>$sender_displayname</b> sent a video: $message" m.video: "$distinguisher <b>$sender_displayname</b> sent a video: $message"
m.location: "<b>$sender_displayname</b> sent a location: $message" m.location: "$distinguisher <b>$sender_displayname</b> sent a location: $message"
# Telegram doesn't have built-in emotes, this field specifies how m.emote's from authenticated # Telegram doesn't have built-in emotes, this field specifies how m.emote's from authenticated
# users are sent to telegram. All fields in message_formats are supported. Additionally, the # users are sent to telegram. All fields in message_formats are supported. Additionally, the
# Telegram user info is available in the following variables: # Telegram user info is available in the following variables:
@ -358,9 +367,9 @@ bridge:
# #
# Set format to an empty string to disable the messages for that event. # Set format to an empty string to disable the messages for that event.
state_event_formats: state_event_formats:
join: "<b>$displayname</b> joined the room." join: "$distinguisher <b>$displayname</b> joined the room."
leave: "<b>$displayname</b> left the room." leave: "$distinguisher <b>$displayname</b> left the room."
name_change: "<b>$prev_displayname</b> changed their name to <b>$displayname</b>" name_change: "$distinguisher <b>$prev_displayname</b> changed their name to $distinguisher <b>$displayname</b>"
# Filter rooms that can/can't be bridged. Can also be managed using the `filter` and # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
# `filter-mode` management commands. # `filter-mode` management commands.
@ -378,6 +387,21 @@ bridge:
# The prefix for commands. Only required in non-management rooms. # The prefix for commands. Only required in non-management rooms.
command_prefix: "!tg" command_prefix: "!tg"
# Messages sent upon joining a management room.
# Markdown is supported. The defaults are listed below.
management_room_text:
# Sent when joining a room.
welcome: "Hello, I'm a Telegram bridge bot."
# Sent when joining a management room and the user is already logged in.
welcome_connected: "Use `help` for help."
# Sent when joining a management room and the user is not logged in.
welcome_unconnected: "Use `help` for help or `login` to log in."
# Optional extra text sent when joining a management room.
additional_help: ""
# Send each message separately (for readability in some clients)
management_room_multiple_messages: false
# Permissions for using the bridge. # Permissions for using the bridge.
# Permitted values: # Permitted values:
# relaybot - Only use the bridge via the relaybot, no access to commands. # relaybot - Only use the bridge via the relaybot, no access to commands.

View file

@ -6,7 +6,7 @@
"en": "Telegram puppeting bridge for Matrix/Synapse", "en": "Telegram puppeting bridge for Matrix/Synapse",
"fr": "Passerelle Telegram pour Matrix/Synapse" "fr": "Passerelle Telegram pour Matrix/Synapse"
}, },
"version": "0.10.2~ynh4", "version": "0.11.3~ynh1",
"url": "https://docs.mau.fi/bridges/python/telegram/index.html", "url": "https://docs.mau.fi/bridges/python/telegram/index.html",
"upstream": { "upstream": {
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",

View file

@ -173,11 +173,6 @@ $final_path/bin/pip3 install --upgrade pip setuptools wheel
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[postgres,speedups,qr_login] # metrics,hq_thumbnails,e2be $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 # -r optional-requirements.txt
$final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml" $final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml"
# initialize the database
# HACK alembic won't find its script dir using a relative path unless when started from $final_path
# therefore we replace the script_location
ynh_replace_string --match_string="script_location = alembic" --replace_string="script_location = $final_path/alembic" --target_file="$final_path/alembic.ini"
ynh_exec_warn_less $final_path/bin/alembic -c "$final_path/alembic.ini" -x config="$mautrix_config_path" upgrade head
# 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
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die --message="Synapse can't restart with the appservice configuration" /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die --message="Synapse can't restart with the appservice configuration"
@ -189,7 +184,6 @@ ynh_exec_warn_less $final_path/bin/alembic -c "$final_path/alembic.ini" -x conf
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$mautrix_config_path" ynh_store_file_checksum --file="$mautrix_config_path"
ynh_store_file_checksum --file="$app_service_registration_path/$app.yaml" ynh_store_file_checksum --file="$app_service_registration_path/$app.yaml"
ynh_store_file_checksum --file="$final_path/alembic.ini"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD

View file

@ -132,16 +132,9 @@ write_bridge_config
ynh_backup_if_checksum_is_different --file="$app_service_registration_path/$app.yaml" ynh_backup_if_checksum_is_different --file="$app_service_registration_path/$app.yaml"
$final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml" $final_path/bin/python3 -m mautrix_telegram -g -c "$mautrix_config_path" -r "$app_service_registration_path/$app.yaml"
# upgrade the alembic database
# TODO remove on next upgrade
# ynh_backup_if_checksum_is_different --file="$final_path/alembic.ini"
ynh_replace_string --match_string="script_location = alembic" --replace_string="script_location = $final_path/alembic" --target_file="$final_path/alembic.ini"
ynh_exec_warn_less $final_path/bin/alembic -c "$final_path/alembic.ini" -x config="$mautrix_config_path" upgrade head
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$mautrix_config_path" ynh_store_file_checksum --file="$mautrix_config_path"
ynh_store_file_checksum --file="$app_service_registration_path/$app.yaml" ynh_store_file_checksum --file="$app_service_registration_path/$app.yaml"
ynh_store_file_checksum --file="$final_path/alembic.ini"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD