-
Notifications
You must be signed in to change notification settings - Fork 435
MSC4459: Image pack references #4459
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
Open
tulir
wants to merge
1
commit into
matrix-org:main
Choose a base branch
from
beeper:image-pack-references
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+153
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| # MSC4459: Image pack references | ||
| [MSC2545](https://github.com/matrix-org/matrix-spec-proposals/pull/2545) | ||
| introduced image packs, which can be used as stickers and custom emojis. | ||
| However, it did not specify an easy way to share packs other than manually | ||
| linking to the room that contains the pack. Other networks like Telegram, | ||
| WhatsApp and Signal allow sharing packs by simply sending a sticker or custom | ||
| emoji, which allows the recipient to click the image to view the pack. | ||
|
|
||
| ## Proposal | ||
| This proposal introduces an image pack sharing mechanism similar to other | ||
| networks by adding metadata about the origin of the image to sticker events. | ||
|
|
||
| A `m.image_source_packs` field is added to `m.sticker` events. The field | ||
| contains a map from `mxc://` URI to an image pack reference. The reference | ||
| object contains: | ||
|
|
||
| * `room_id` with the ID of the room where the image pack is located. | ||
| * `via` (optional) with an array of server names that can be used to join the room. | ||
| * `state_key` with the state key of the image pack state event. | ||
| * `shortcode` with the short code of the particular image that was used | ||
| (the shortcode is the key in the `images` map inside the state event). | ||
|
|
||
| The field can be used in any event that contains images from an image pack. It | ||
| is a map to allow use in contexts where one event contains multiple images. | ||
| The primary use cases are: | ||
|
|
||
| * `m.sticker` events | ||
| * `m.reaction` events using [MSC4027](https://github.com/matrix-org/matrix-spec-proposals/pull/4027) or similar proposals | ||
| * `m.room.message` events containing custom emojis in `formatted_body` | ||
|
|
||
| To avoid leaking information about private packs, clients SHOULD only reference | ||
| packs that are in a public or knockable room. | ||
|
|
||
| ### Examples | ||
|
|
||
| <details> | ||
| <summary>Sticker</summary> | ||
|
|
||
| ```json | ||
| { | ||
| "type": "m.sticker", | ||
| "content": { | ||
| "body": "Blobcat threatens you with cactus", | ||
| "url": "mxc://tastytea.de/glmVmTfoMPqAYETjWCGreuag" | ||
| "info": { | ||
| "mimetype": "image/png", | ||
| "size": 17198, | ||
| "w": 64, | ||
| "h": 64 | ||
| }, | ||
| "m.mentions": {}, | ||
| "m.image_source_packs": { | ||
| "mxc://tastytea.de/glmVmTfoMPqAYETjWCGreuag": { | ||
| "room_id": "!mxZlZeHjtbkmpqofEQ:tastytea.de", | ||
| "via": ["fairydust.space", "matrix.org", "maunium.net"], | ||
| "state_key": "Unhappy Blobcats", | ||
| "shortcode": "blobcat_cactus" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>Reaction using MSC4027</summary> | ||
|
|
||
| ```json | ||
| { | ||
| "type": "m.reaction", | ||
| "content": { | ||
| "m.relates_to": { | ||
| "rel_type": "m.annotation", | ||
| "event_id": "$0KG--Cf1Xi3qpVgudjBrLRdr6nYCP4rqZXo867esl5I", | ||
| "key": "mxc://tastytea.de/glmVmTfoMPqAYETjWCGreuag" | ||
| }, | ||
| "com.beeper.reaction.shortcode": ":blobcat_cactus:", | ||
| "m.image_source_packs": { | ||
| "mxc://tastytea.de/glmVmTfoMPqAYETjWCGreuag": { | ||
| "room_id": "!mxZlZeHjtbkmpqofEQ:tastytea.de", | ||
| "via": ["fairydust.space", "matrix.org", "maunium.net"], | ||
| "state_key": "Unhappy Blobcats", | ||
| "shortcode": "blobcat_cactus" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>Text message with custom emojis</summary> | ||
|
|
||
| ```json | ||
| { | ||
| "type": "m.room.message", | ||
| "content": { | ||
| "msgtype": "m.text" | ||
| "body": "meow :blobcat_cactus: :blobcat_thinking:", | ||
| "format": "org.matrix.custom.html", | ||
| "formatted_body": "meow <img src=\"mxc://tastytea.de/glmVmTfoMPqAYETjWCGreuag\" alt=\":blobcat_cactus:\" title=\"Blobcat threatens you with cactus\" data-mx-emoticon=\"\" height=\"32\"> <img src=\"mxc://tastytea.de/uBWzDiNIwAEKvZuisqCdMNIH\" alt=\":blobcat_thinking:\" title=\"Thinking Blobcat\" data-mx-emoticon=\"\" height=\"32\">", | ||
| "m.mentions": {}, | ||
| "m.image_source_packs": { | ||
| "mxc://tastytea.de/glmVmTfoMPqAYETjWCGreuag": { | ||
| "room_id": "!mxZlZeHjtbkmpqofEQ:tastytea.de", | ||
| "via": ["fairydust.space", "matrix.org", "maunium.net"], | ||
| "state_key": "Unhappy Blobcats", | ||
| "shortcode": "blobcat_cactus" | ||
| }, | ||
| "mxc://tastytea.de/uBWzDiNIwAEKvZuisqCdMNIH": { | ||
| "room_id": "!mxZlZeHjtbkmpqofEQ:tastytea.de", | ||
| "via": ["fairydust.space", "matrix.org", "maunium.net"], | ||
| "state_key": "Misc Blobcats", | ||
| "shortcode": "blobcat_thinking" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
|
|
||
| ## Potential issues | ||
| If an image is present in multiple packs, the client will have to pick one to | ||
| use as the source. This is likely not an issue, as sticker and emoji pickers are | ||
| usually grouped by pack. Clients can also always omit the source if they can't | ||
| pick one. | ||
|
|
||
| ## Alternatives | ||
| The source could be expressed as some kind of a `matrix:` URI instead of an | ||
| object, e.g. `matrix:roomid/mxZlZeHjtbkmpqofEQ:tastytea.de?via=fairydust.space&via=matrix.org&via=maunium.net&action=show_image_pack&image_pack_key=Unhappy%20Blobcats&image_shortcode=blobcat_cactus`. | ||
| This would allow sharing links outside of Matrix, but it's much less readable | ||
| than a JSON object. A future MSC can still define a URI format for external | ||
| linking if needed. | ||
|
|
||
| Packs could have a new flag to indicate whether they want to be referenced | ||
| instead of only relying on room join rules. | ||
|
|
||
| ## Security considerations | ||
| Some information about image packs and rooms may be leaked if clients aren't | ||
| careful with what they include references to. | ||
|
|
||
| ## Unstable prefix | ||
| `com.beeper.msc4459.image_source_packs` can be used instead of `m.image_source_packs` | ||
|
|
||
| ## Dependencies | ||
| This MSC builds on MSC2545, which is in final comment period as of writing and | ||
| will presumably be accepted. | ||
|
|
||
| This MSC can also be used together with MSC4027, but there is no hard dependency. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Implementation requirements: