example-config.yaml 12 KB

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