example-config.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. # Homeserver details
  2. homeserver:
  3. # The address that this appservice can use to connect to the homeserver.
  4. address: https://example.com
  5. # The domain of the homeserver (for MXIDs, etc).
  6. domain: example.com
  7. # Whether or not to verify the SSL certificate of the homeserver.
  8. # Only applies if address starts with https://
  9. verify_ssl: true
  10. asmux: false
  11. # Number of retries for all HTTP requests if the homeserver isn't reachable.
  12. http_retry_count: 4
  13. # The URL to push real-time bridge status to.
  14. # If set, the bridge will make POST requests to this URL whenever a user's Instagram MQTT connection state changes.
  15. # The bridge will use the appservice as_token to authorize requests.
  16. status_endpoint: null
  17. # Endpoint for reporting per-message status.
  18. message_send_checkpoint_endpoint: null
  19. # Whether asynchronous uploads via MSC2246 should be enabled for media.
  20. # Requires a media repo that supports MSC2246.
  21. async_media: false
  22. # Application service host/registration related details
  23. # Changing these values requires regeneration of the registration.
  24. appservice:
  25. # The address that the homeserver can use to connect to this appservice.
  26. address: http://localhost:29330
  27. # When using https:// the TLS certificate and key files for the address.
  28. tls_cert: false
  29. tls_key: false
  30. # The hostname and port where this appservice should listen.
  31. hostname: 0.0.0.0
  32. port: 29330
  33. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  34. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  35. max_body_size: 1
  36. # The full URI to the database. SQLite and Postgres are supported.
  37. # Format examples:
  38. # SQLite: sqlite:///filename.db
  39. # Postgres: postgres://username:password@hostname/dbname
  40. database: postgres://username:password@hostname/db
  41. # Additional arguments for asyncpg.create_pool() or sqlite3.connect()
  42. # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
  43. # https://docs.python.org/3/library/sqlite3.html#sqlite3.connect
  44. # For sqlite, min_size is used as the connection thread pool size and max_size is ignored.
  45. # Additionally, SQLite supports init_commands as an array of SQL queries to run on connect (e.g. to set PRAGMAs).
  46. database_opts:
  47. min_size: 1
  48. max_size: 10
  49. # The unique ID of this appservice.
  50. id: instagram
  51. # Username of the appservice bot.
  52. bot_username: instagrambot
  53. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  54. # to leave display name/avatar as-is.
  55. bot_displayname: Instagram bridge bot
  56. bot_avatar: mxc://maunium.net/JxjlbZUlCPULEeHZSwleUXQv
  57. # Whether or not to receive ephemeral events via appservice transactions.
  58. # Requires MSC2409 support (i.e. Synapse 1.22+).
  59. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
  60. ephemeral_events: true
  61. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  62. as_token: "This value is generated when generating the registration"
  63. hs_token: "This value is generated when generating the registration"
  64. # Prometheus telemetry config. Requires prometheus-client to be installed.
  65. metrics:
  66. enabled: false
  67. listen_port: 8000
  68. # Manhole config.
  69. manhole:
  70. # Whether or not opening the manhole is allowed.
  71. enabled: false
  72. # The path for the unix socket.
  73. path: /var/tmp/mautrix-instagram.manhole
  74. # The list of UIDs who can be added to the whitelist.
  75. # If empty, any UIDs can be specified in the open-manhole command.
  76. whitelist:
  77. - 0
  78. instagram:
  79. # Seed for generating devices. This is secret because the seed is used to generate
  80. # device IDs, which can apparently be used to bypass two-factor authentication after
  81. # logging out, because Instagram is insecure.
  82. device_seed: generate
  83. # Bridge config
  84. bridge:
  85. # Localpart template of MXIDs for Instagram users.
  86. # {userid} is replaced with the user ID of the Instagram user.
  87. username_template: "instagram_{userid}"
  88. # Displayname template for Instagram users.
  89. # {displayname} is replaced with the display name of the Instagram user.
  90. # {username} is replaced with the username of the Instagram user.
  91. displayname_template: "{displayname} (Instagram)"
  92. # Displayname template for 1:1 chat portals. Same variables as displayname_template.
  93. private_chat_name_template: "{displayname}"
  94. # Displayname template for group chat portals. Only {name} is available.
  95. group_chat_name_template: "{name}"
  96. # Maximum length of displayname
  97. displayname_max_length: 100
  98. # Maximum number of seconds since the last activity in a chat to automatically create portals.
  99. portal_create_max_age: 259200
  100. # Maximum number of chats to fetch for startup sync
  101. chat_sync_limit: 20
  102. # Maximum number of chats to create during startup sync
  103. chat_create_limit: 10
  104. # Should the chat list be synced on startup?
  105. # If false, the bridge will try to reconnect to MQTT directly and ask the server to send missed events.
  106. resync_on_startup: true
  107. # Whether or not to use /sync to get read receipts and typing notifications
  108. # when double puppeting is enabled
  109. sync_with_custom_puppets: false
  110. # Whether or not to update the m.direct account data event when double puppeting is enabled.
  111. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  112. # and is therefore prone to race conditions.
  113. sync_direct_chat_list: false
  114. # Allow using double puppeting from any server with a valid client .well-known file.
  115. double_puppet_allow_discovery: false
  116. # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
  117. double_puppet_server_map:
  118. example.com: https://example.com
  119. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  120. #
  121. # If set, custom puppets will be enabled automatically for local users
  122. # instead of users having to find an access token and run `login-matrix`
  123. # manually.
  124. # If using this for other servers than the bridge's server,
  125. # you must also set the URL in the double_puppet_server_map.
  126. login_shared_secret_map:
  127. example.com: foo
  128. # Whether or not created rooms should have federation enabled.
  129. # If false, created portal rooms will never be federated.
  130. federate_rooms: true
  131. # Settings for backfilling messages from Instagram.
  132. backfill:
  133. # Whether or not the Instagram users of logged in Matrix users should be
  134. # invited to private chats when backfilling history from Instagram. This is
  135. # usually needed to prevent rate limits and to allow timestamp massaging.
  136. invite_own_puppet: true
  137. # Maximum number of messages to backfill initially.
  138. # Set to 0 to disable backfilling when creating portal.
  139. initial_limit: 0
  140. # Maximum number of messages to backfill if messages were missed while
  141. # the bridge was disconnected.
  142. # Set to 0 to disable backfilling missed messages.
  143. missed_limit: 1000
  144. # If using double puppeting, should notifications be disabled
  145. # while the initial backfill is in progress?
  146. disable_notifications: false
  147. periodic_reconnect:
  148. # Interval in seconds in which to automatically reconnect all users.
  149. # This can be used to automatically mitigate the bug where Instagram stops sending messages.
  150. # Set to -1 to disable periodic reconnections entirely.
  151. interval: -1
  152. # Whether or not the bridge should backfill chats when reconnecting.
  153. resync: true
  154. # Should even disconnected users be reconnected?
  155. always: false
  156. # End-to-bridge encryption support options.
  157. #
  158. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  159. encryption:
  160. # Allow encryption, work in group chat rooms with e2ee enabled
  161. allow: false
  162. # Default to encryption, force-enable encryption in all portals the bridge creates
  163. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  164. default: false
  165. # Require encryption, drop any unencrypted messages.
  166. require: false
  167. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  168. # You must use a client that supports requesting keys from other users to use this feature.
  169. allow_key_sharing: false
  170. # What level of device verification should be required from users?
  171. #
  172. # Valid levels:
  173. # unverified - Send keys to all device in the room.
  174. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  175. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  176. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  177. # Note that creating user signatures from the bridge bot is not currently possible.
  178. # verified - Require manual per-device verification
  179. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  180. verification_levels:
  181. # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
  182. receive: unverified
  183. # Minimum level that the bridge should accept for incoming Matrix messages.
  184. send: unverified
  185. # Minimum level that the bridge should require for accepting key requests.
  186. share: cross-signed-tofu
  187. # Options for Megolm room key rotation. These options allow you to
  188. # configure the m.room.encryption event content. See:
  189. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  190. # more information about that event.
  191. rotation:
  192. # Enable custom Megolm room key rotation settings. Note that these
  193. # settings will only apply to rooms created after this option is
  194. # set.
  195. enable_custom: false
  196. # The maximum number of milliseconds a session should be used
  197. # before changing it. The Matrix spec recommends 604800000 (a week)
  198. # as the default.
  199. milliseconds: 604800000
  200. # The maximum number of messages that should be sent with a given a
  201. # session before changing it. The Matrix spec recommends 100 as the
  202. # default.
  203. messages: 100
  204. # Whether or not to explicitly set the avatar and room name for private
  205. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  206. private_chat_portal_meta: false
  207. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  208. # been sent to Instagram.
  209. delivery_receipts: false
  210. # Whether or not delivery errors should be reported as messages in the Matrix room.
  211. delivery_error_reports: false
  212. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  213. message_status_events: false
  214. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  215. # This field will automatically be changed back to false after it,
  216. # except if the config file is not writable.
  217. resend_bridge_info: false
  218. # Whether or not unimportant bridge notices should be sent to the user.
  219. # (e.g. connected, disconnected but will retry)
  220. unimportant_bridge_notices: true
  221. # Disable bridge notices entirely
  222. disable_bridge_notices: false
  223. # Should Matrix m.notice-type messages be bridged?
  224. bridge_notices: true
  225. # Provisioning API part of the web server for automated portal creation and fetching information.
  226. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  227. provisioning:
  228. # Whether or not the provisioning API should be enabled.
  229. enabled: true
  230. # The prefix to use in the provisioning API endpoints.
  231. prefix: /_matrix/provision/v1
  232. # The shared secret to authorize users of the API.
  233. # Set to "generate" to generate and save a new token.
  234. shared_secret: generate
  235. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  236. segment_key: null
  237. # The prefix for commands. Only required in non-management rooms.
  238. command_prefix: "!ig"
  239. # Permissions for using the bridge.
  240. # Permitted values:
  241. # relay - Allowed to be relayed through the bridge, no access to commands.
  242. # user - Use the bridge with puppeting.
  243. # admin - Use and administrate the bridge.
  244. # Permitted keys:
  245. # * - All Matrix users
  246. # domain - All users on that homeserver
  247. # mxid - Specific user
  248. permissions:
  249. "*": "relay"
  250. "example.com": "user"
  251. "@admin:example.com": "admin"
  252. relay:
  253. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  254. # authenticated user into a relaybot for that chat.
  255. enabled: false
  256. # The formats to use when sending messages to Instagram via a relay user.
  257. #
  258. # Available variables:
  259. # $sender_displayname - The display name of the sender (e.g. Example User)
  260. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  261. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  262. # $message - The message content
  263. #
  264. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  265. message_formats:
  266. m.text: '$sender_displayname: $message'
  267. m.notice: '$sender_displayname: $message'
  268. m.emote: '* $sender_displayname $message'
  269. # Python logging configuration.
  270. #
  271. # See section 16.7.2 of the Python documentation for more info:
  272. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  273. logging:
  274. version: 1
  275. formatters:
  276. colored:
  277. (): mautrix_instagram.util.ColorFormatter
  278. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  279. normal:
  280. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  281. handlers:
  282. file:
  283. class: logging.handlers.RotatingFileHandler
  284. formatter: normal
  285. filename: ./mautrix-instagram.log
  286. maxBytes: 10485760
  287. backupCount: 10
  288. console:
  289. class: logging.StreamHandler
  290. formatter: colored
  291. loggers:
  292. mau:
  293. level: DEBUG
  294. mauigpapi:
  295. level: DEBUG
  296. aiohttp:
  297. level: INFO
  298. paho.mqtt:
  299. level: INFO
  300. root:
  301. level: DEBUG
  302. handlers: [file, console]