-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSC3896: Appservice media #3896
base: main
Are you sure you want to change the base?
Changes from 3 commits
1cfbd09
b2973bf
4e14b5b
5454061
6e79d15
af67a41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# MSC3896: Appservice media | ||
|
||
Appservices often need to bridge media, and do so by reuploading files to the homeserver. This | ||
can cause a lot of storage usage. This MSC proposes a way for appservices to register media | ||
(`mxc://`) namespaces. | ||
|
||
## Proposal | ||
|
||
This proposal adds a new key (`media`) to the namespaces block of appservice registration. | ||
|
||
Whenever the homeserver gets a request that matches the regex, it should make a http GET request | ||
to `/_matrix/app/v1/media/{mediaId}`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the server expected to always follow redirects, or should it use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that this was added after the fact to ensure compatibility, I think this should be assumed for new endpoints. |
||
|
||
For example: | ||
|
||
```yaml | ||
namespaces: | ||
media: | ||
- exclusive: true | ||
regex: "foobar-.*" | ||
``` | ||
|
||
In this case, fetching `mxc://server.tld/foobar-bazqux` leads to a request to | ||
`/_matrix/app/v1/media/foobar-bazqux`. | ||
|
||
Appservices may set `Cache-Control` on their response. Homeservers should cache the response, though | ||
they may remove cached remote media to save space. | ||
|
||
## Potential issues | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since currently media ids are largely generated at random, it is very possible that existing media could collide with new namespaced media. Because of this, there needs to be some sort of way to disambiguate this media, either by adding some sort of prefix to media by appservices that homeservers cannot use, vice versa, or something completely different. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not to sure how much of an issue this is, considering:
So perhaps something should be added to the spec stating that for automatically generated media IDs, only alphanumeric characters should be used, so that appservices can use other characters to not collide. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like a similar problem to users: if users already exist under the appservice namespace when the appservice is introduced, they are adopted into the namespace as well. For media, we'd do the same: media which matches the namespace is adopted by the appservice, regardless of when it was created. The grammar concern is best handled by another MSC (#1597, primarily) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I will bring this up in the aforementioned MSC then, thanks! |
||
|
||
Media may not be able to load if the appservice is unable to reach wherever remote media is stored. | ||
|
||
## Alternatives | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mautrix-discord sets up what is essentially a homeserver which only serves media, so perhaps that could be mentioned, and then explain how that is sub-optimal. In the past it also intercepted requests to your homeserver with regex in a reverse proxy, so that can also be mentioned. |
||
|
||
*none* | ||
|
||
## Security considerations | ||
|
||
*none* | ||
|
||
## Unstable prefix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably specify that for the endpoint, the unstable prefix is |
||
|
||
`org.eu.celery.msc3896.media` should be used instead of `media` | ||
|
||
## Dependencies | ||
|
||
*none* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the
timeout_ms
parameter from the client request be forwarded to the appservice?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't really make sense in this context, since this is for async uploads, which doesn't apply for media appservices. Not sure why I even asked this (this can be marked as resolved).