pfefferle / wordpress-webmention

A Webmention plugin for WordPress
https://wordpress.org/plugins/webmention/
MIT License
117 stars 31 forks source link

Add images from WebMention? #365

Open edent opened 1 year ago

edent commented 1 year ago

I've received a pingback from https://brid.gy/comment/mastodon/@edent@mastodon.social/110151657347210229/110151774995722710

The plugin gets the author's name, URL, avatar, and text content. It doesn't include the image along with the post.

Sometimes, people reply with only an image. Or their reply references an attached image. It would be useful to include this as part of the webmention.

The HTML code is:

<span class="p-author h-card">
   <a class="p-name u-url" href="https://mastodon.social/@Edent">Terence Eden</a>
   <a class="u-url" href="https://edent.tel/"></a>
   <a class="u-url" href="https://shkspr.mobi/blog"></a>
   <span class="p-nickname">Edent</span>
   <img class="u-photo" src="https://files.mastodon.social/accounts/avatars/000/007/112/original/37df032a5951b96c.jpg" alt="" />
</span>
<a title="mastodon.social/@Edent/110151774995722710" class="u-url" href="https://mastodon.social/@Edent/110151774995722710">mastodon.social/@Edent/1101517...</a>
<div class="e-content p-name">
   <p>Incidentally, this was my favourite comment when I announced I was doing an MSc.</p><p>The rage it induced powered me through many a tutorial!</p>
</div>
<img class="u-photo" src="https://files.mastodon.social/media_attachments/files/110/151/771/251/554/330/original/a80cc6cfe970ec56.png" alt="" />

pfefferle commented 1 year ago

It is because WordPress Core does not allow Images in Posts. We should discuss if we should overrule this for Webmentions.

dshanske commented 1 year ago

I'm also a bit worried about automatically doing this. Might need to pair it with some new moderation settings. I wanted to revisit moderation anyway.

edent commented 1 year ago

Just a bump on this. If I want images to appear in webmentions, do I just need to tell my theme to allow <img> in comments - or is there also something in the plugin filtering them out?

Background

Some of my mentions contain images. Without those images, the comments look really weird.

Example:

<article class="h-entry">
  <span class="p-uid">at://did:plc:5jl75t6lnqg2h5ciuglcwca6/app.bsky.feed.post/3kfcirl4jqv2g</span>

  <time class="dt-published" datetime="2023-11-29T05:19:48.073000+00:00">2023-11-29T05:19:48.073000+00:00</time>

  <span class="p-author h-card">
    <data class="p-uid" value="did:plc:5jl75t6lnqg2h5ciuglcwca6"></data>
    <a class="p-name u-url" href="https://bsky.app/profile/anniecrab.bsky.social">Annie</a>
    <span class="p-nickname">anniecrab.bsky.social</span>
    <img class="u-photo" src="https://cdn.bsky.app/img/avatar/plain/did:plc:5jl75t6lnqg2h5ciuglcwca6/bafkreibf2yo6gjqyouc7ynr2rogbqdeoxk5rue4hpzn2eyjwodmpahxpoa@jpeg" alt="" />
  </span>

  <a title="bsky.app/profile/anniecrab.bsky.social/post/3kfcirl4jqv2g" class="u-url" href="https://bsky.app/profile/anniecrab.bsky.social/post/3kfcirl4jqv2g">bsky.app/profile/anniec...</a>
  <div class="e-content p-name">

  Except now they’ve started doing really absurd things like this.
  </div>
<img class="u-photo" src="https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:5jl75t6lnqg2h5ciuglcwca6/bafkreihq5g3khh6cncnjtwskpxuh52t5x2gw4vru4wjb22sfi3aeblpfwm@jpeg" alt="A captcha challenge. ‘Please select all images of one type that appear colder in comparison to other images.’ The images are variously of snowmen, living room sofas and conference rooms." />

  <a class="u-in-reply-to" href="https://bsky.app/profile/did:plc:dip7ueksh627fxacagfrdyz2/post/3kf5rgltyst2h"></a>
  <a class="u-in-reply-to" href="https://shkspr.mobi/blog/2017/11/captchas-dont-prove-youre-human-they-prove-youre-american/"></a>

</article>

Without the img and alt, the comment looks weird.