aaronpk / webmention.io

Easily enable webmentions on any web site
https://webmention.io/
Other
770 stars 38 forks source link

Bookmarks/likes not rendering correctly when post has multiple `u-url`s #140

Open jamietanna opened 4 years ago

jamietanna commented 4 years ago

I've recently been noticing some weirdness around the Webmentions I receive for certain posts, primarily likes/bookmarks.

Within my posts I have both the post's u-url, and a child p-author h-card which has its own u-url.

I'll receive a Webmention with the URL of the interaction being my profile URL (from my author information) rather than it being the URL of the post itself.

Example 1

Post: https://www.jvt.me/mf2/c0139cf9-10db-4d1e-9635-c746f305e195/ Parsed MF2:

Parsed MF2 as JSON ```json { "items": [ { "type": [ "h-entry" ], "properties": { "name": [ "Blog service workers and the chicken and the egg" ], "category": [ "service-workers" ], "bookmark-of": [ "https://remysharp.com/2019/10/01/blog-service-workers-and-the-chicken-and-the-egg" ], "uid": [ "https://www.jvt.me/mf2/c0139cf9-10db-4d1e-9635-c746f305e195/" ], "url": [ "https://www.jvt.me/mf2/c0139cf9-10db-4d1e-9635-c746f305e195/" ], "published": [ "2019-10-03T14:13:00+0100" ], "author": [ { "type": [ "h-card" ], "properties": { "name": [ "Jamie Tanna" ], "photo": [ "https://www.jvt.me/img/profile.png" ], "url": [ "https://www.jvt.me" ] }, "lang": "en-GB", "value": "Jamie Tanna" } ] }, "lang": "en-GB" } ], "rels": { snipped for brevity }, "rel-urls": { snipped for brevity }, "debug": { "package": "https://packagist.org/packages/mf2/mf2", "source": "https://github.com/indieweb/php-mf2", "version": "0.4.6", "note": [ "This output was generated from the php-mf2 library available at https://github.com/indieweb/php-mf2", "Please file any issues with the parser at https://github.com/indieweb/php-mf2/issues", "Using the Masterminds HTML5 parser" ] } } ```

Webmention:

{
    "type": "entry",
    "author": {
        "type": "card",
        "name": "Jamie Tanna",
        "photo": "https://webmention.io/avatar/www.jvt.me/1a30a04da8e03ed78b17bd01777f3892c95de2a05f974eaa739b858aaa1749d4.png",
        "url": "https://www.jvt.me"
    },
    "url": "https://www.jvt.me/mf2/c0139cf9-10db-4d1e-9635-c746f305e195/",
    "published": "2019-10-03T14:13:00+01:00",
    "wm-received": "2019-10-04T23:53:16Z",
    "wm-id": 704890,
    "wm-source": "https://www.jvt.me/mf2/c0139cf9-10db-4d1e-9635-c746f305e195/",
    "wm-target": "https://www.jvt.me",
    "name": "Blog service workers and the chicken and the egg",
    "bookmark-of": "https://www.jvt.me",
    "wm-property": "bookmark-of",
    "wm-private": false
},

Example 2

Post: https://www.jvt.me/posts/2019/10/03/indiewebcamp-amsterdam-2019/ Parsed MF2:

Parsed MF2 as JSON ```json { "items": [ { "type": [ "h-entry" ], "properties": { "name": [ "IndieWebCamp Amsterdam 2019" ], "summary": [ "Recapping my time at IndieWebCamp Amsterdam, my first 'official' IndieWeb event, and meeting some of the big names in the community." ], "category": [ "indiewebcamp-amsterdam-2019", "indieweb", "indiewebcamp", "webmention", "micropub", "syndication", "privacy" ], "url": [ "https://www.jvt.me/posts/2019/10/03/indiewebcamp-amsterdam-2019/" ], "uid": [ "https://www.jvt.me/posts/2019/10/03/indiewebcamp-amsterdam-2019/" ], "featured": [ "https://www.jvt.me/img/indiewebcamp-amsterdam-2019/group-aaronpk.jpg" ], "syndication": [ "https://news.indieweb.org/en", "https://indieweb.xyz/en/indieweb" ], "published": [ "2019-10-03 19:14:04 +0100 BST" ], "updated": [ "2019-10-03 19:14:06 +0100 BST" ], "content": [ { "html": "snipped for brevity", "value": "snipped for brevity", "lang": "en-GB" } ], "author": [ { "type": [ "h-card" ], "properties": { "name": [ "Jamie Tanna" ], "photo": [ "https://www.jvt.me/img/profile.png" ], "url": [ "https://www.jvt.me" ] }, "lang": "en-GB", "value": "Jamie Tanna" } ] }, "lang": "en-GB", "children": [ snipped for brevity ] } ], "rels": { snipped for brevity }, "rel-urls": { snipped for brevity }, "debug": { "package": "https://packagist.org/packages/mf2/mf2", "source": "https://github.com/indieweb/php-mf2", "version": "0.4.6", "note": [ "This output was generated from the php-mf2 library available at https://github.com/indieweb/php-mf2", "Please file any issues with the parser at https://github.com/indieweb/php-mf2/issues", "Using the Masterminds HTML5 parser" ] } } ```

Webmention:

{
    "type": "entry",
    "author": {
        "type": "card",
        "name": "Aaron Parecki",
        "photo": "https://webmention.io/avatar/aaronparecki.com/41061f9de825966faa22e9c42830e1d4a614a321213b4575b9488aa93f89817a.jpg",
        "url": "https://aaronparecki.com/"
    },
    "url": "https://aaronparecki.com/2019/10/03/40/",
    "published": "2019-10-03T19:14:04+01:00",
    "wm-received": "2019-10-03T19:13:53Z",
    "wm-id": 704122,
    "wm-source": "https://aaronparecki.com/2019/10/03/40/",
    "wm-target": "https://www.jvt.me",
    "like-of": "https://www.jvt.me",
    "wm-property": "like-of",
    "wm-private": false
},
jamietanna commented 4 years ago

This appears to affect both the JSON format:

{
    "type": "entry",
    "author": {
        "type": "card",
        "name": "Jamie Tanna",
        "photo": "https://webmention.io/avatar/www.jvt.me/1a30a04da8e03ed78b17bd01777f3892c95de2a05f974eaa739b858aaa1749d4.png",
        "url": "https://www.jvt.me"
    },
    "url": "https://www.jvt.me/mf2/2019/12/jmtk9/",
    "published": "2019-12-05T17:25:00",
    "wm-received": "2019-12-11T10:57:10Z",
    "wm-id": 732974,
    "wm-source": "https://www.jvt.me/mf2/2019/12/jmtk9/",
    "wm-target": "https://www.jvt.me",
    "name": "Improving CLIs with isatty",
    "bookmark-of": "https://www.jvt.me",
    "wm-property": "bookmark-of",
    "wm-private": false,
    "rels": {
        "canonical": "https://www.jvt.me/mf2/2019/12/jmtk9/"
    }
},

And the Atom format:

<entry>
  <title>www.jvt.me bookmarked /</title>
  <id>https://webmention.io/api/mention/732974</id>
  <summary>https://www.jvt.me/mf2/2019/12/jmtk9/ bookmarked https://www.jvt.me/</summary>
  <updated>2019-12-11T10:57:11+00:00</updated>
  <content type="xhtml" xml:lang="en">
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p><a href="https://www.jvt.me/mf2/2019/12/jmtk9/">https://www.jvt.me/mf2/2019/12/jmtk9/</a> bookmarked <a href="https://www.jvt.me/">https://www.jvt.me/</a></p>
    </div>
  </content>
</entry>

Despite the post not being a bookmark of that page:

Parsed MF2 as JSON ``` { "items": [ { "type": [ "h-entry" ], "properties": { "name": [ "Improving CLIs with isatty" ], "category": [ "command-line" ], "bookmark-of": [ "https://blog.jez.io/cli-tty/" ], "uid": [ "https://www.jvt.me/mf2/2019/12/jmtk9/" ], "url": [ "https://www.jvt.me/mf2/2019/12/jmtk9/" ], "published": [ "2019-12-05T17:25:00Z" ], "author": [ { "type": [ "h-card" ], "properties": { "name": [ "Jamie Tanna" ], "photo": [ "https://www.jvt.me/img/profile.png" ], "url": [ "https://www.jvt.me" ] }, "lang": "en-gb", "value": "Jamie Tanna" } ] }, "lang": "en-gb" } ], "rels": { "canonical": [ "https://www.jvt.me/mf2/2019/12/jmtk9/" ], "stylesheet": [ "https://www.jvt.me/css/style.css", "https://www.jvt.me/css/font-awesome.min.css", "https://www.jvt.me/css/asciinema-player.css", "https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700" ], "shortcut": [ "https://www.jvt.me/favicon.png" ], "icon": [ "https://www.jvt.me/favicon.png" ], "alternate": [ "https://www.jvt.me/mf2/2019/12/jmtk9/index.ics" ], "webmention": [ "https://webmention.io/www.jvt.me/webmention" ], "pingback": [ "https://webmention.io/www.jvt.me/xmlrpc" ], "authorization_endpoint": [ "https://indieauth.com/auth" ], "token_endpoint": [ "https://tokens.indieauth.com/token" ], "micropub": [ "https://www-api.jvt.me/micropub" ], "microsub": [ "https://aperture.p3k.io/microsub/262" ], "me": [ "https://gitlab.com/jamietanna", "https://github.com/jamietanna", "https://twitter.com/jamietanna", "https://linkedin.com/in/jamietanna" ] }, "rel-urls": { "https://www.jvt.me/mf2/2019/12/jmtk9/": { "rels": [ "canonical" ] }, "https://www.jvt.me/css/style.css": { "rels": [ "stylesheet" ] }, "https://www.jvt.me/css/font-awesome.min.css": { "rels": [ "stylesheet" ] }, "https://www.jvt.me/css/asciinema-player.css": { "rels": [ "stylesheet" ] }, "https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700": { "rels": [ "stylesheet" ] }, "https://www.jvt.me/favicon.png": { "type": "image/png", "rels": [ "icon", "shortcut" ] }, "https://www.jvt.me/mf2/2019/12/jmtk9/index.ics": { "title": "Jamie Tanna | Software (Quality) Engineer", "type": "text/calendar", "rels": [ "alternate" ] }, "https://webmention.io/www.jvt.me/webmention": { "rels": [ "webmention" ] }, "https://webmention.io/www.jvt.me/xmlrpc": { "rels": [ "pingback" ] }, "https://indieauth.com/auth": { "rels": [ "authorization_endpoint" ] }, "https://tokens.indieauth.com/token": { "rels": [ "token_endpoint" ] }, "https://www-api.jvt.me/micropub": { "rels": [ "micropub" ] }, "https://aperture.p3k.io/microsub/262": { "rels": [ "microsub" ] }, "https://gitlab.com/jamietanna": { "text": "\u00a0@jamietanna", "rels": [ "me" ] }, "https://github.com/jamietanna": { "text": "\u00a0@jamietanna", "rels": [ "me" ] }, "https://twitter.com/jamietanna": { "text": "\u00a0@jamietanna", "rels": [ "me" ] }, "https://linkedin.com/in/jamietanna": { "text": "\u00a0Jamie Tanna", "rels": [ "me" ] } }, "debug": { "package": "https://packagist.org/packages/mf2/mf2", "source": "https://github.com/indieweb/php-mf2", "version": "0.4.6", "note": [ "This output was generated from the php-mf2 library available at https://github.com/indieweb/php-mf2", "Please file any issues with the parser at https://github.com/indieweb/php-mf2/issues", "Using the Masterminds HTML5 parser" ] } } ```
jamietanna commented 4 years ago

And XRay responds with:

{
  "data": {
    "type": "entry",
    "published": "2019-12-05T17:25:00Z",
    "url": "https://www.jvt.me/mf2/2019/12/jmtk9/",
    "category": [
      "command-line"
    ],
    "bookmark-of": [
      "https://blog.jez.io/cli-tty/"
    ],
    "name": "Improving CLIs with isatty",
    "author": {
      "type": "card",
      "name": "Jamie Tanna",
      "url": "https://www.jvt.me",
      "photo": "https://www.jvt.me/img/profile.png"
    },
    "post-type": "bookmark",
    "rels": {
      "canonical": "https://www.jvt.me/mf2/2019/12/jmtk9/"
    }
  },
  "url": "https://www.jvt.me/mf2/2019/12/jmtk9/",
  "code": 200,
  "source-format": "mf2+html"
}
jamietanna commented 4 years ago

@aaronpk is this something that you'd maybe be able to investigate in the debug logs? I'm having quite a bit of difficulty getting the project set up locally to validate myself

jamietanna commented 4 years ago

Aaron's responses on chat can be found at https://chat.indieweb.org/meta/2020-03-06