mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-03-11 08:49:30 -04:00
daemon: Use pan's token to perform client syncs.
The clients need to use pan's sync token so the transaction ids in the sync response don't get lost since sending happens using pan's device and token.
This commit is contained in:
parent
7a2ee980ff
commit
17a20195c0
@ -199,7 +199,8 @@ class ProxyDaemon:
|
||||
self,
|
||||
request, # type: aiohttp.web.BaseRequest
|
||||
params=None, # type: CIMultiDict
|
||||
session=None # type: aiohttp.ClientSession
|
||||
session=None, # type: aiohttp.ClientSession
|
||||
token=None # type: str
|
||||
):
|
||||
# type: (...) -> aiohttp.ClientResponse
|
||||
"""Forward the given request to our configured homeserver.
|
||||
@ -210,7 +211,6 @@ class ProxyDaemon:
|
||||
session (aiohttp.ClientSession): The client session that should be
|
||||
used to forward the request.
|
||||
"""
|
||||
|
||||
if not session:
|
||||
if not self.default_session:
|
||||
self.default_session = ClientSession()
|
||||
@ -226,6 +226,12 @@ class ProxyDaemon:
|
||||
|
||||
params = params or request.query
|
||||
|
||||
if token:
|
||||
if "Authorization" in headers:
|
||||
headers["Authorization"] = token
|
||||
if "access_token" in params:
|
||||
params["access_token"] = token
|
||||
|
||||
data = await request.text()
|
||||
|
||||
return await session.request(
|
||||
@ -388,7 +394,6 @@ class ProxyDaemon:
|
||||
return self._unknown_token
|
||||
|
||||
sync_filter = request.query.get("filter", None)
|
||||
# timeout = request.query.get("timeout", None)
|
||||
|
||||
try:
|
||||
sync_filter = json.loads(sync_filter)
|
||||
@ -411,7 +416,11 @@ class ProxyDaemon:
|
||||
query = CIMultiDict(request.query)
|
||||
query.pop("filter", None)
|
||||
|
||||
response = await self.forward_request(request, query)
|
||||
response = await self.forward_request(
|
||||
request,
|
||||
query,
|
||||
token=client.access_token
|
||||
)
|
||||
|
||||
if response.status == 200:
|
||||
json_response = await response.json()
|
||||
|
Loading…
x
Reference in New Issue
Block a user