Explorar o código

Update mautrix-python and add manhole to example config

Tulir Asokan %!s(int64=3) %!d(string=hai) anos
pai
achega
91cc6683a6
Modificáronse 3 ficheiros con 20 adicións e 2 borrados
  1. 8 1
      mautrix_instagram/__main__.py
  2. 11 0
      mautrix_instagram/example-config.yaml
  3. 1 1
      requirements.txt

+ 8 - 1
mautrix_instagram/__main__.py

@@ -13,7 +13,7 @@
 #
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
-from typing import Optional
+from typing import Optional, Dict, Any
 import logging
 import asyncio
 
@@ -155,5 +155,12 @@ class InstagramBridge(Bridge):
     async def count_logged_in_users(self) -> int:
         return len([user for user in User.by_igpk.values() if user.igpk])
 
+    async def manhole_global_namespace(self, user_id: UserID) -> Dict[str, Any]:
+        return {
+            **await super().manhole_global_namespace(user_id),
+            "User": User,
+            "Portal": Portal,
+            "Puppet": Puppet,
+        }
 
 InstagramBridge().run()

+ 11 - 0
mautrix_instagram/example-config.yaml

@@ -68,6 +68,17 @@ metrics:
     enabled: false
     listen_port: 8000
 
+# Manhole config.
+manhole:
+    # Whether or not opening the manhole is allowed.
+    enabled: false
+    # The path for the unix socket.
+    path: /var/tmp/mautrix-instagram.manhole
+    # The list of UIDs who can be added to the whitelist.
+    # If empty, any UIDs can be specified in the open-manhole command.
+    whitelist:
+    - 0
+
 instagram:
     # Seed for generating devices. This is secret because the seed is used to generate
     # device IDs, which can apparently be used to bypass two-factor authentication after

+ 1 - 1
requirements.txt

@@ -4,7 +4,7 @@ commonmark>=0.8,<0.10
 aiohttp>=3,<4
 yarl>=1,<2
 attrs>=20.1
-mautrix>=0.10.2,<0.11
+mautrix>=0.10.3,<0.11
 asyncpg>=0.20,<0.25
 pycryptodome>=3,<4
 paho-mqtt>=1.5,<2