From 1cfbd09d991a87fb67c3a14f302590b82d6c91f9 Mon Sep 17 00:00:00 2001 From: tezlm Date: Fri, 23 Sep 2022 17:33:38 -0700 Subject: [PATCH 1/6] Propose appservice media --- proposals/xxxx-appservice-media.md | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 proposals/xxxx-appservice-media.md diff --git a/proposals/xxxx-appservice-media.md b/proposals/xxxx-appservice-media.md new file mode 100644 index 00000000000..ebe5d959f3a --- /dev/null +++ b/proposals/xxxx-appservice-media.md @@ -0,0 +1,45 @@ +# MSCxxxx: 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 to the namespaces block of appservice registration. For example: + +```yaml +namespaces: + media: + - exclusive: true + regex: "foobar-.*" +``` + +Whenever the homeserver gets a request that matches the regex, it should make a http GET request +to `/_matrix/app/v1/media/{mediaId}`. + +Example: using the example registration, fetching `mxc://server.tld/foobar-bazqux` should lead 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 + +Media may not be able to load if the appservice is unable to reach wherever remote media is stored. + +## Alternatives + +*none* + +## Security considerations + +*none* + +## Unstable prefix + +`org.eu.celery.mscxxxx.media` should be used instead of `media` + +## Dependencies + +*none* From b2973bfe326238d6f9d26cad3659ca5cc3d4a164 Mon Sep 17 00:00:00 2001 From: tezlm Date: Fri, 23 Sep 2022 17:47:16 -0700 Subject: [PATCH 2/6] Add msc number --- .../{xxxx-appservice-media.md => 3896-appservice-media.md} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename proposals/{xxxx-appservice-media.md => 3896-appservice-media.md} (92%) diff --git a/proposals/xxxx-appservice-media.md b/proposals/3896-appservice-media.md similarity index 92% rename from proposals/xxxx-appservice-media.md rename to proposals/3896-appservice-media.md index ebe5d959f3a..b4b8ce17879 100644 --- a/proposals/xxxx-appservice-media.md +++ b/proposals/3896-appservice-media.md @@ -1,4 +1,4 @@ -# MSCxxxx: Appservice media +# 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 @@ -38,7 +38,7 @@ Media may not be able to load if the appservice is unable to reach wherever remo ## Unstable prefix -`org.eu.celery.mscxxxx.media` should be used instead of `media` +`org.eu.celery.msc3896.media` should be used instead of `media` ## Dependencies From 4e14b5ba8ca56ab2ddbf465b9f18ceeca86a46e7 Mon Sep 17 00:00:00 2001 From: tezlm Date: Fri, 23 Sep 2022 17:51:39 -0700 Subject: [PATCH 3/6] Fix wording --- proposals/3896-appservice-media.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/proposals/3896-appservice-media.md b/proposals/3896-appservice-media.md index b4b8ce17879..e7643498bdc 100644 --- a/proposals/3896-appservice-media.md +++ b/proposals/3896-appservice-media.md @@ -6,7 +6,12 @@ can cause a lot of storage usage. This MSC proposes a way for appservices to reg ## Proposal -This proposal adds a new key to the namespaces block of appservice registration. For example: +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}`. + +For example: ```yaml namespaces: @@ -15,11 +20,8 @@ namespaces: regex: "foobar-.*" ``` -Whenever the homeserver gets a request that matches the regex, it should make a http GET request -to `/_matrix/app/v1/media/{mediaId}`. - -Example: using the example registration, fetching `mxc://server.tld/foobar-bazqux` should lead to a -request to `/_matrix/app/v1/media/foobar-bazqux`. +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. From 545406103d39e61a5c084bfce365a87f62cfbcc4 Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Thu, 13 Jun 2024 11:53:26 +0100 Subject: [PATCH 4/6] clarify unstable prefixes Signed-off-by: Matthias Ahouansou --- proposals/3896-appservice-media.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proposals/3896-appservice-media.md b/proposals/3896-appservice-media.md index e7643498bdc..08bc6e85446 100644 --- a/proposals/3896-appservice-media.md +++ b/proposals/3896-appservice-media.md @@ -40,7 +40,10 @@ Media may not be able to load if the appservice is unable to reach wherever remo ## Unstable prefix -`org.eu.celery.msc3896.media` should be used instead of `media` +While this MSC is not considered stable, implementations should use +`/_matrix/app/unstable/org.eu.celery.msc3896/media/{mediaId}` instead of `/_matrix/app/v1/media/{mediaId}` +to request media from the appservice, and `org.eu.celery.msc3896.media` instead of `media` in the +appservice registration file. ## Dependencies From 6e79d154835608e006c83b1e28154f657b36795a Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Thu, 13 Jun 2024 12:30:52 +0100 Subject: [PATCH 5/6] further clarify response and request format --- proposals/3896-appservice-media.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proposals/3896-appservice-media.md b/proposals/3896-appservice-media.md index 08bc6e85446..878c31821a6 100644 --- a/proposals/3896-appservice-media.md +++ b/proposals/3896-appservice-media.md @@ -11,6 +11,12 @@ This proposal adds a new key (`media`) to the namespaces block of appservice reg Whenever the homeserver gets a request that matches the regex, it should make a http GET request to `/_matrix/app/v1/media/{mediaId}`. +This request has no body nor query parameters. Servers MAY be redirected via HTTP 307/308 responses, +which they should follow to obtain the content. `Content-Disposition` and `Content-Type` headers +SHOULD be set in the response, so that the server is made aware of the file name and content type +of the media, although this is not always possible with the remote platform the appservice is +fetching the media from. + For example: ```yaml From af67a41b44d20d0b53dac9ac6b9619fb194d061c Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Thu, 13 Jun 2024 12:32:41 +0100 Subject: [PATCH 6/6] clarify that server_name must be own --- proposals/3896-appservice-media.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proposals/3896-appservice-media.md b/proposals/3896-appservice-media.md index 878c31821a6..67d5e91a430 100644 --- a/proposals/3896-appservice-media.md +++ b/proposals/3896-appservice-media.md @@ -8,8 +8,9 @@ can cause a lot of storage usage. This MSC proposes a way for appservices to reg 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}`. +Whenever the homeserver gets a request for a media ID that matches the regex and the requested +`server_name` of the media is it's own, it should make a HTTP GET request to +`/_matrix/app/v1/media/{mediaId}`. This request has no body nor query parameters. Servers MAY be redirected via HTTP 307/308 responses, which they should follow to obtain the content. `Content-Disposition` and `Content-Type` headers