Giter VIP home page Giter VIP logo

Comments (10)

janboddez avatar janboddez commented on July 20, 2024

Since it's rather unlikely we have an application/activity+json response stored in cache anywhere, we should probably always perform a new request. Good thing is, it can be a HEAD request only.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

So, turns out it can't be a GET request, at least not for WordPress posts ...

Still, see 42a9e1f.

This requires a change to IndieBlocks, though, because it doesn't store a linked URL for replies. And if a reply is a bookmark, too, the linked URL would be the bookmarked URL ...

So we have to extract the in-reply-to URL another way.

Worst case, we'd have to bundle php-mf. In fact, because the u-in-reply-to class can be set on various elements, it's best to stay away from regexes ... So we either use IndieBlocks' Reply block, check for its URL attribute. Or use php-mf indirectly, by letting IndieBlocks do the parsing. Or drop the IndieBlocks requirement and ourselves also include php-mf.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

Or drop the IndieBlocks requirement and ourselves also include php-mf.

While this would mean we have 3 or so (scoped) instances of php-mf running (dang non-existent WordPress dependency management), it'd also be the most robust.

I think this is the way to go.

This requires a change to IndieBlocks, though, because it doesn't store a linked URL for replies. And if a reply is a bookmark, too, the linked URL would be the bookmarked URL ...

Reason for that was that the _indieblocks_linked_url was meant to be used for optionally including titles for certain notes (likes and bookmarks, namely), should an author want that. (It is updated with each save in order to not have to parse posts on render.) Replies were never the target.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

Having a copy of php-mf on board would also help get rid of this here regex:

if ( preg_match( '~<div class="e-content">.+?</div>~s', $post_or_comment->post_content, $content ) ) {

Rather than look for a div, we should just parse the post and look for the "mf2 content" property. Should also not start off the post_content but instead use the "filtered" content, to accommodate plugins that add mf2 dynamically.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

If there's no explicit @-handle in the post, we can perhaps fetch the remote object's actor in order to ensure proper mentions.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

If there's no explicit @-handle in the post, we can perhaps fetch the remote object's actor in order to ensure proper mentions.

Way I used to do it, it'd look for such a handle explicitly. Causing the AP plugin to add the correct tag and cc properties.

  "tag": [
    {
      "type": "Mention",
      "href": "https://indieweb.social/users/janboddez",
      "name": "@[email protected]"
    }
  ],
  "updated": "2024-05-01T19:11:44Z",
  "url": "https://jan.boddez.net/notes/9cd1e6db34",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public",
    "https://jan.boddez.net/wp-json/activitypub/1.0/users/3/followers"
  ],
  "cc": [
    "https://indieweb.social/users/janboddez"
  ]

Can probably try and look for the attributedTo property on the remote object. Not sure if we need the handle, too.

To get the handle, we might be able to use webfinger with the attributedTo URL and look for a subject in the form of acct:[email protected], then swap the acct for @.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

Rather than look for a div, we should just parse the post and look for the "mf2 content" property.

That's what we do now. And we store the resulting inReplyTo URL in a custom field, in order not to have to parse the content and fetch the remote page each and every time the page is viewed.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

It's now possible to add the mention. Except it won't actually send the post to the other party's inbox, because all this happens too late in the cycle.

Maybe we can hack the activitypub_send_activity_to_followers filter, as $activity is passed to it as an argument (by reference, normally, so we should be able to update its cc prop).

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

Maybe we can hack the activitypub_send_activity_to_followers filter, as $activity is passed to it as an argument (by reference, normally, so we should be able to update its cc prop).

Whoops, guess not.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

Mentions should now work: 7ab06ef.

from addon-for-activitypub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.