example-config.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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. Only Postgres is currently supported.
  37. database: postgres://username:password@hostname/db
  38. # Additional arguments for asyncpg.create_pool()
  39. # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
  40. database_opts:
  41. min_size: 5
  42. max_size: 10
  43. # The unique ID of this appservice.
  44. id: instagram
  45. # Username of the appservice bot.
  46. bot_username: instagrambot
  47. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  48. # to leave display name/avatar as-is.
  49. bot_displayname: Instagram bridge bot
  50. bot_avatar: mxc://maunium.net/JxjlbZUlCPULEeHZSwleUXQv
  51. # Whether or not to receive ephemeral events via appservice transactions.
  52. # Requires MSC2409 support (i.e. Synapse 1.22+).
  53. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
  54. ephemeral_events: false
  55. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  56. as_token: "This value is generated when generating the registration"
  57. hs_token: "This value is generated when generating the registration"
  58. # Prometheus telemetry config. Requires prometheus-client to be installed.
  59. metrics:
  60. enabled: false
  61. listen_port: 8000
  62. # Manhole config.
  63. manhole:
  64. # Whether or not opening the manhole is allowed.
  65. enabled: false
  66. # The path for the unix socket.
  67. path: /var/tmp/mautrix-instagram.manhole
  68. # The list of UIDs who can be added to the whitelist.
  69. # If empty, any UIDs can be specified in the open-manhole command.
  70. whitelist:
  71. - 0
  72. instagram:
  73. # Seed for generating devices. This is secret because the seed is used to generate
  74. # device IDs, which can apparently be used to bypass two-factor authentication after
  75. # logging out, because Instagram is insecure.
  76. device_seed: generate
  77. # Bridge config
  78. bridge:
  79. # Localpart template of MXIDs for Instagram users.
  80. # {userid} is replaced with the user ID of the Instagram user.
  81. username_template: "instagram_{userid}"
  82. # Displayname template for Instagram users.
  83. # {displayname} is replaced with the display name of the Instagram user.
  84. # {username} is replaced with the username of the Instagram user.
  85. displayname_template: "{displayname} (Instagram)"
  86. # Displayname template for 1:1 chat portals. Same variables as displayname_template.
  87. private_chat_name_template: "{displayname}"
  88. # Displayname template for group chat portals. Only {name} is available.
  89. group_chat_name_template: "{name}"
  90. # Maximum length of displayname
  91. displayname_max_length: 100
  92. # Maximum number of seconds since the last activity in a chat to automatically create portals.
  93. portal_create_max_age: 259200
  94. # Maximum number of chats to fetch for startup sync
  95. chat_sync_limit: 20
  96. # Maximum number of chats to create during startup sync
  97. chat_create_limit: 10
  98. # Should the chat list be synced on startup?
  99. # If false, the bridge will try to reconnect to MQTT directly and ask the server to send missed events.
  100. resync_on_startup: true
  101. # Whether or not to use /sync to get read receipts and typing notifications
  102. # when double puppeting is enabled
  103. sync_with_custom_puppets: true
  104. # Whether or not to update the m.direct account data event when double puppeting is enabled.
  105. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  106. # and is therefore prone to race conditions.
  107. sync_direct_chat_list: false
  108. # Allow using double puppeting from any server with a valid client .well-known file.
  109. double_puppet_allow_discovery: false
  110. # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
  111. double_puppet_server_map:
  112. example.com: https://example.com
  113. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  114. #
  115. # If set, custom puppets will be enabled automatically for local users
  116. # instead of users having to find an access token and run `login-matrix`
  117. # manually.
  118. # If using this for other servers than the bridge's server,
  119. # you must also set the URL in the double_puppet_server_map.
  120. login_shared_secret_map:
  121. example.com: foo
  122. # Whether or not created rooms should have federation enabled.
  123. # If false, created portal rooms will never be federated.
  124. federate_rooms: true
  125. # Settings for backfilling messages from Instagram.
  126. backfill:
  127. # Whether or not the Instagram users of logged in Matrix users should be
  128. # invited to private chats when backfilling history from Instagram. This is
  129. # usually needed to prevent rate limits and to allow timestamp massaging.
  130. invite_own_puppet: true
  131. # Maximum number of messages to backfill initially.
  132. # Set to 0 to disable backfilling when creating portal.
  133. initial_limit: 0
  134. # Maximum number of messages to backfill if messages were missed while
  135. # the bridge was disconnected.
  136. # Set to 0 to disable backfilling missed messages.
  137. missed_limit: 1000
  138. # If using double puppeting, should notifications be disabled
  139. # while the initial backfill is in progress?
  140. disable_notifications: false
  141. periodic_reconnect:
  142. # Interval in seconds in which to automatically reconnect all users.
  143. # This can be used to automatically mitigate the bug where Instagram stops sending messages.
  144. # Set to -1 to disable periodic reconnections entirely.
  145. interval: -1
  146. # Whether or not the bridge should backfill chats when reconnecting.
  147. resync: true
  148. # Should even disconnected users be reconnected?
  149. always: false
  150. # End-to-bridge encryption support options.
  151. #
  152. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  153. encryption:
  154. # Allow encryption, work in group chat rooms with e2ee enabled
  155. allow: false
  156. # Default to encryption, force-enable encryption in all portals the bridge creates
  157. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  158. default: false
  159. # Options for automatic key sharing.
  160. key_sharing:
  161. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  162. # You must use a client that supports requesting keys from other users to use this feature.
  163. allow: false
  164. # Require the requesting device to have a valid cross-signing signature?
  165. # This doesn't require that the bridge has verified the device, only that the user has verified it.
  166. # Not yet implemented.
  167. require_cross_signing: false
  168. # Require devices to be verified by the bridge?
  169. # Verification by the bridge is not yet implemented.
  170. require_verification: true
  171. # Whether or not to explicitly set the avatar and room name for private
  172. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  173. private_chat_portal_meta: false
  174. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  175. # been sent to Instagram.
  176. delivery_receipts: false
  177. # Whether or not delivery errors should be reported as messages in the Matrix room.
  178. delivery_error_reports: false
  179. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  180. message_status_events: false
  181. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  182. # This field will automatically be changed back to false after it,
  183. # except if the config file is not writable.
  184. resend_bridge_info: false
  185. # Whether or not unimportant bridge notices should be sent to the user.
  186. # (e.g. connected, disconnected but will retry)
  187. unimportant_bridge_notices: true
  188. # Disable bridge notices entirely
  189. disable_bridge_notices: false
  190. # Provisioning API part of the web server for automated portal creation and fetching information.
  191. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  192. provisioning:
  193. # Whether or not the provisioning API should be enabled.
  194. enabled: true
  195. # The prefix to use in the provisioning API endpoints.
  196. prefix: /_matrix/provision/v1
  197. # The shared secret to authorize users of the API.
  198. # Set to "generate" to generate and save a new token.
  199. shared_secret: generate
  200. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  201. segment_key: null
  202. # The prefix for commands. Only required in non-management rooms.
  203. command_prefix: "!ig"
  204. # Permissions for using the bridge.
  205. # Permitted values:
  206. # relay - Allowed to be relayed through the bridge, no access to commands.
  207. # user - Use the bridge with puppeting.
  208. # admin - Use and administrate the bridge.
  209. # Permitted keys:
  210. # * - All Matrix users
  211. # domain - All users on that homeserver
  212. # mxid - Specific user
  213. permissions:
  214. "*": "relay"
  215. "example.com": "user"
  216. "@admin:example.com": "admin"
  217. relay:
  218. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  219. # authenticated user into a relaybot for that chat.
  220. enabled: false
  221. # The formats to use when sending messages to Instagram via a relay user.
  222. #
  223. # Available variables:
  224. # $sender_displayname - The display name of the sender (e.g. Example User)
  225. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  226. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  227. # $message - The message content
  228. #
  229. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  230. message_formats:
  231. m.text: '$sender_displayname: $message'
  232. m.notice: '$sender_displayname: $message'
  233. m.emote: '* $sender_displayname $message'
  234. # Python logging configuration.
  235. #
  236. # See section 16.7.2 of the Python documentation for more info:
  237. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  238. logging:
  239. version: 1
  240. formatters:
  241. colored:
  242. (): mautrix_instagram.util.ColorFormatter
  243. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  244. normal:
  245. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  246. handlers:
  247. file:
  248. class: logging.handlers.RotatingFileHandler
  249. formatter: normal
  250. filename: ./mautrix-instagram.log
  251. maxBytes: 10485760
  252. backupCount: 10
  253. console:
  254. class: logging.StreamHandler
  255. formatter: colored
  256. loggers:
  257. mau:
  258. level: DEBUG
  259. mauigpapi:
  260. level: DEBUG
  261. aiohttp:
  262. level: INFO
  263. paho.mqtt:
  264. level: INFO
  265. root:
  266. level: DEBUG
  267. handlers: [file, console]