Browse Source

Update mautrix-python and add manhole to example config

Tulir Asokan 3 years ago
parent
commit
e3b57c17ca
3 changed files with 21 additions and 1 deletions
  1. 9 0
      mautrix_signal/__main__.py
  2. 11 0
      mautrix_signal/example-config.yaml
  3. 1 1
      requirements.txt

+ 9 - 0
mautrix_signal/__main__.py

@@ -13,6 +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 Dict, Any
 import asyncio
 import logging
 
@@ -139,5 +140,13 @@ class SignalBridge(Bridge):
     async def count_logged_in_users(self) -> int:
         return len([user for user in User.by_username.values() if user.username])
 
+    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,
+        }
+
 
 SignalBridge().run()

+ 11 - 0
mautrix_signal/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-signal.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
+
 signal:
     # Path to signald unix socket
     socket_path: /var/run/signald/signald.sock

+ 1 - 1
requirements.txt

@@ -4,5 +4,5 @@ commonmark>=0.8,<0.10
 aiohttp>=3,<4
 yarl>=1,<2
 attrs>=19.1
-mautrix>=0.10.2,<0.11
+mautrix>=0.10.3,<0.11
 asyncpg>=0.20,<0.25