Skip to content
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

Federated Create->Image activities do not render the image inline #19357

Open
wmurphyrd opened this issue Oct 14, 2022 · 4 comments
Open

Federated Create->Image activities do not render the image inline #19357

wmurphyrd opened this issue Oct 14, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@wmurphyrd
Copy link

Steps to reproduce the problem

I would like to see the image content of an Image ActivityPub object render in my Mastodon timeline. I see in the Mastodon documentation that Image type payloads are listed as supported.

However, I only see the following in my mastodon.social Web client:

image

It seems Mastodon does understand the object and is able to discover the url to the actual png file, so why doesn't it render inline? Is there something different I could be doing with the activity structure? This is coming from an immers server using activitypub-express library

This post is publicly available as HTML or application/activity+json at https://immers.space/s/6340840eb21e584a50095cbf

JSON content below:

{
   "@context" : [
      "https://www.w3.org/ns/activitystreams",
      "https://w3id.org/security/v1",
      {
         "@context" : {
            "Model" : "is:Model",
            "avatar" : {
               "@id" : "is:avatar",
               "@type" : "@id"
            },
            "is" : "https://immers.space/ns/v1#"
         }
      }
   ],
   "actor" : "https://immers.space/u/datatitian",
   "id" : "https://immers.space/s/6340840eb21e584a50095cbf",
   "likes" : {
      "first" : "https://immers.space/likes/6340840eb21e584a50095cbe/?page=true",
      "id" : "https://immers.space/likes/6340840eb21e584a50095cbe/",
      "totalItems" : 0,
      "type" : "OrderedCollection"
   },
   "object" : {
      "attributedTo" : "https://immers.space/u/datatitian",
      "context" : {
         "audience" : [],
         "name" : "Infinite Worlds - Volcano #284 - from Immers Space",
         "type" : "Place",
         "url" : "https://infinite-worlds.glitch.me/?preset=egypt&seed=35"
      },
      "id" : "https://immers.space/o/6340840eb21e584a50095cbd",
      "to" : [
         "https://immers.space/followers/datatitian",
         "as:Public"
      ],
      "type" : "Image",
      "url" : {
         "href" : "https://immers.space/media/7c081125d7d83dcc10a268962059a80d",
         "mediaType" : "image/png",
         "type" : "Link"
      }
   },
   "published" : "2022-10-07T19:54:54.511Z",
   "shares" : {
      "first" : "https://immers.space/shares/6340840eb21e584a50095cbe/?page=true",
      "id" : "https://immers.space/shares/6340840eb21e584a50095cbe/",
      "totalItems" : 0,
      "type" : "OrderedCollection"
   },
   "to" : [
      "https://immers.space/followers/datatitian",
      "as:Public"
   ],
   "type" : "Create"
}

Expected behaviour

See the png image rendered in the timeline

Actual behaviour

See only its url

Specifications

Mastodon Web Client in Firefox on mastodon.social at v3.5.3

@wmurphyrd wmurphyrd added the bug Something isn't working label Oct 14, 2022
@trwnh
Copy link
Member

trwnh commented Oct 14, 2022

It is true that Create Image is understood, but it is a second-class activity and will be transformed per the rules listed in the linked docs:

Some other Object types are converted as best as possible. The transformer uses content if available, or name if not, in order to generate status text. The url will be appended. [...]

Yes, it would be better to have a special transformer for Create Image. It just hasn't been done yet, probably because you would end up needing to a new transformer for each media type (Audio, Video, Image)

@wmurphyrd
Copy link
Author

wmurphyrd commented Oct 17, 2022

Would Mastodon accept a PR that transformed the url to be read as an attachment for the supported media object types?

@trwnh
Copy link
Member

trwnh commented Oct 17, 2022 via email

@wmurphyrd
Copy link
Author

wmurphyrd commented Oct 17, 2022

Is it possible to get a maintainer to weigh in before committing the time to it?

Looks like it would be pretty simple, just have ActivityPub::Activity::Create.process_attachments check @object['url'] for attachments when converted_object_type is true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants