mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-09 14:39:34 -05:00
daemon: Load the media info when we start the daemon.
This commit is contained in:
parent
d25989cfd7
commit
af3b62dd7e
@ -33,7 +33,6 @@ from nio import (
|
|||||||
KeyVerificationMac,
|
KeyVerificationMac,
|
||||||
KeyVerificationStart,
|
KeyVerificationStart,
|
||||||
LocalProtocolError,
|
LocalProtocolError,
|
||||||
OlmEvent,
|
|
||||||
MegolmEvent,
|
MegolmEvent,
|
||||||
RoomContextError,
|
RoomContextError,
|
||||||
RoomEncryptedMedia,
|
RoomEncryptedMedia,
|
||||||
@ -156,6 +155,7 @@ class PanClient(AsyncClient):
|
|||||||
ssl=None,
|
ssl=None,
|
||||||
proxy=None,
|
proxy=None,
|
||||||
store_class=None,
|
store_class=None,
|
||||||
|
media_info=None,
|
||||||
):
|
):
|
||||||
config = config or AsyncClientConfig(
|
config = config or AsyncClientConfig(
|
||||||
store=store_class or SqliteStore, store_name="pan.db"
|
store=store_class or SqliteStore, store_name="pan.db"
|
||||||
@ -172,6 +172,7 @@ class PanClient(AsyncClient):
|
|||||||
self.server_name = server_name
|
self.server_name = server_name
|
||||||
self.pan_store = pan_store
|
self.pan_store = pan_store
|
||||||
self.pan_conf = pan_conf
|
self.pan_conf = pan_conf
|
||||||
|
self.media_info = media_info
|
||||||
|
|
||||||
if INDEXING_ENABLED:
|
if INDEXING_ENABLED:
|
||||||
logger.info("Indexing enabled.")
|
logger.info("Indexing enabled.")
|
||||||
|
@ -91,6 +91,7 @@ class ProxyDaemon:
|
|||||||
pan_clients = attr.ib(init=False, default=attr.Factory(dict))
|
pan_clients = attr.ib(init=False, default=attr.Factory(dict))
|
||||||
client_info = attr.ib(init=False, default=attr.Factory(dict), type=dict)
|
client_info = attr.ib(init=False, default=attr.Factory(dict), type=dict)
|
||||||
default_session = attr.ib(init=False, default=None)
|
default_session = attr.ib(init=False, default=None)
|
||||||
|
media_info = attr.ib(init=False, default=None)
|
||||||
database_name = "pan.db"
|
database_name = "pan.db"
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
@ -100,6 +101,7 @@ class ProxyDaemon:
|
|||||||
self.hostname = self.homeserver.hostname
|
self.hostname = self.homeserver.hostname
|
||||||
self.store = PanStore(self.data_dir)
|
self.store = PanStore(self.data_dir)
|
||||||
accounts = self.store.load_users(self.name)
|
accounts = self.store.load_users(self.name)
|
||||||
|
self.media_info = self.store.load_media(self.name)
|
||||||
|
|
||||||
for user_id, device_id in accounts:
|
for user_id, device_id in accounts:
|
||||||
if self.conf.keyring:
|
if self.conf.keyring:
|
||||||
@ -133,6 +135,7 @@ class ProxyDaemon:
|
|||||||
ssl=self.ssl,
|
ssl=self.ssl,
|
||||||
proxy=self.proxy,
|
proxy=self.proxy,
|
||||||
store_class=self.client_store_class,
|
store_class=self.client_store_class,
|
||||||
|
media_info=self.media_info,
|
||||||
)
|
)
|
||||||
pan_client.user_id = user_id
|
pan_client.user_id = user_id
|
||||||
pan_client.access_token = token
|
pan_client.access_token = token
|
||||||
@ -453,7 +456,9 @@ class ProxyDaemon:
|
|||||||
|
|
||||||
assert session
|
assert session
|
||||||
|
|
||||||
path = urllib.parse.quote(request.path) # re-encode path stuff like room aliases
|
path = urllib.parse.quote(
|
||||||
|
request.path
|
||||||
|
) # re-encode path stuff like room aliases
|
||||||
method = request.method
|
method = request.method
|
||||||
|
|
||||||
headers = CIMultiDict(request.headers)
|
headers = CIMultiDict(request.headers)
|
||||||
@ -556,6 +561,7 @@ class ProxyDaemon:
|
|||||||
ssl=self.ssl,
|
ssl=self.ssl,
|
||||||
proxy=self.proxy,
|
proxy=self.proxy,
|
||||||
store_class=self.client_store_class,
|
store_class=self.client_store_class,
|
||||||
|
media_info=self.media_info,
|
||||||
)
|
)
|
||||||
response = await pan_client.login(password, "pantalaimon")
|
response = await pan_client.login(password, "pantalaimon")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user