libQuotient icon indicating copy to clipboard operation
libQuotient copied to clipboard

NAM: Implement direct media requests fallback

Open KitsuneRal opened this issue 2 years ago • 2 comments

(From the commit message:) This is behind a configuration switch because direct unauthenticated requests are at odds with the Matrix model where clients stick to their homeservers and only homeservers talk to each other. The implementation is also quite inefficient atm, causing a .well-known resolution roundtrip every single time a direct media request is made.

KitsuneRal avatar Oct 10 '22 13:10 KitsuneRal

Upon some more testing - this really needs a cache/registry of homeservers, otherwise each direct request becomes a sequence of three (not two, as would be optimal): .well-known resolution, requesting login flows (there's no way in Connection to perform a homeserver resolution without getting login flows for now), and the request for media itself - and besides, creation and destruction of a Connection object for that. In fact, it would be great to disassociate resolving a homeserver from Connection since the latter is intended to be a long-lived user session but has to be created early in the login process just for the sake of keeping the information about the target homeserver. ConnectionData might be a good candidate for repurposing in that direction. That change is rather significant for the API though so probably better left for 0.8.

KitsuneRal avatar Oct 12 '22 10:10 KitsuneRal