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

Fragment in Activity ID prevents it from being resolvable #1025

Open
mike182uk opened this issue Nov 28, 2024 · 3 comments
Open

Fragment in Activity ID prevents it from being resolvable #1025

mike182uk opened this issue Nov 28, 2024 · 3 comments

Comments

@mike182uk
Copy link

Whilst working with this plugin I was encountering an issue where I wanted to do a look up on an Activity sent to me by wordpress-activitypub, but the structure of URL makes this impossible due to a fragment being included in the ID (URL) for the Activity - The fragment gets stripped out before reaching the server so the request ends up being for the Object inside the Activity rather than the Activity itself

Example:

I receive Activity with ID: https://mattwiebe.blog/?p=370#activity-create-2024-11-27T15:30:10Z which looks like:

{
  "id": "https://mattwiebe.blog/?p=370#activity-create-2024-11-27T15:30:10Z",
  "type": "Create",
  "published": "2024-11-27T15:30:10Z",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "cc": [
    "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/actors/0/followers"
  ],
  "sensitive": false,
  "object": {
    "id": "https://mattwiebe.blog/?p=370",
    "type": "Note",
    "attachment": [],
    "attributedTo": "https://mattwiebe.blog/@mattwiebe.blog",
    "content": "<h2>ActivityPub Office Hours Day&nbsp;3</h2><p>Starting now!</p><p><a href=\"https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1\">https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1</a></p>",
    "contentMap": {
      "en": "<h2>ActivityPub Office Hours Day&nbsp;3</h2><p>Starting now!</p><p><a href=\"https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1\">https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1</a></p>"
    },
    "published": "2024-11-27T15:30:10Z",
    "tag": [],
    "url": "https://mattwiebe.blog/2024/11/27/activitypub-office-hours-day-3/",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public"
    ],
    "cc": [
      "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/actors/0/followers"
    ],
    "replies": {
      "id": "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/posts/370/replies",
      "type": "Collection",
      "first": {
        "id": "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/posts/370/replies?page=0",
        "type": "CollectionPage",
        "partOf": "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/posts/370/replies",
        "items": []
      }
    },
    "sensitive": false
  },
  "actor": "https://mattwiebe.blog/@mattwiebe.blog"
}

When I make a request to https://mattwiebe.blog/?p=370#activity-create-2024-11-27T15:30:10Z to retrieve the Create activity again, I get back the Note contained within the Activity:

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "id": "https://mattwiebe.blog/?p=370",
  "type": "Note",
  "attachment": [],
  "attributedTo": "https://mattwiebe.blog/@mattwiebe.blog",
  "content": "<h2>ActivityPub Office Hours Day&nbsp;3</h2><p>Starting now!</p><p><a href=\"https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1\">https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1</a></p>",
  "contentMap": {
    "en": "<h2>ActivityPub Office Hours Day&nbsp;3</h2><p>Starting now!</p><p><a href=\"https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1\">https://us02web.zoom.us/j/89230934907?pwd=9jPyy8IYhKeKjGf3qTWrzJ92Ta54Hr.1</a></p>"
  },
  "published": "2024-11-27T15:30:10Z",
  "tag": [],
  "url": "https://mattwiebe.blog/2024/11/27/activitypub-office-hours-day-3/",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "cc": [
    "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/actors/0/followers"
  ],
  "replies": {
    "id": "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/posts/370/replies",
    "type": "Collection",
    "first": {
      "id": "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/posts/370/replies?page=0",
      "type": "CollectionPage",
      "partOf": "https://public-api.wordpress.com/wpcom/activitypub-1.0/sites/219408313/posts/370/replies",
      "items": []
    }
  },
  "sensitive": false
}
@pfefferle
Copy link
Member

pfefferle commented Nov 28, 2024

Hey @mike182uk The plugin does not provide resolvable Activity-IDs (yet, this will come in one of the next updates). The fragment is currently only a hack, to have a unique ID.

However, we can change these IDs so that a correct error code is returned.

@obenland
Copy link
Member

obenland commented Dec 5, 2024

However, we can change these IDs so that a correct error code is returned.

@pfefferle Could I ask for some guidance on direction for this? Happy to take a stab at it

@pfefferle
Copy link
Member

@obenland we do not persist activities yet, so there is no id we can use. This will be possible when we have the outbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants