Skip to content

Instantly share code, notes, and snippets.

@sebilasse
Last active January 31, 2023 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebilasse/17e52461d500f4c97f2d34edeb12c2ad to your computer and use it in GitHub Desktop.
Save sebilasse/17e52461d500f4c97f2d34edeb12c2ad to your computer and use it in GitHub Desktop.
Summing up ideas from initial AS vocab discussion and for ActivityPub C2S

Let us DISCUSS this proposal and the inReplyToPolicy proposal and make C2S a better place.

redaktor C2S

ActivityHandler


attributedTo

Identifies one or more entities to which this object is attributed. The attributed entities might not be Actors. For instance, an object might be attributed to the completion of another activity.

result

Describes the result of the activity. For instance, if a particular action results in the creation of a new resource, the result property can be used to describe that new resource.

inReplyTo

...

Based on Example 3 and discussion by the Vocabulary inventors about Potential Actions attached to objects // ActivityHandler is a subClassOf Profile which is Object


Just the scope covered by the example but it goes to infinity and beyond: User story Alyssa wants to create an awesome Event in her ActivityPub Client. She directly would like to offer some tickets which people can accept or reject. Alyssa needs to know what food the attendees prefer and if they have requirements. Attendees should get the ability to RSVP, check-in or propose talks for the CFP.

Since Alyssa expects around 20.000 visitors to the event, the ticket system is based on vouchers. Different audiences can redeem vouchers in different time periods and get a ticket. This should be done by a human interaction to make the process fair.


Alyssa CREATES (Event) Client to Server Interactions

If an Activity is submitted with a value in the id property, servers MUST ignore this and generate a new id for the Activity. Servers MUST return a 201 Created HTTP code, and unless the activity is transient, MUST include the new id in the Location header. [ff.] For non-transient objects, the server MUST attach an id to both the wrapping Create and its wrapped Object.

server

  • A redaktor server MUST recursively loop the result property of an Activity: If the entry has type BrowserView or EmbeddedView then this id MUST also be added to the context property of the handlers described object otherwise it MUST also be added to the context property of the object and this object must be Created as if it would come from a Client. If an Activity is submitted with a value in the id property of the entry, servers MUST ignore this and generate a new id for the Activity. The parent id MUST be copied to the inReplyTo property. If a transitive Activity is submitted in a result without an object property, the parent object MUST be copied to the result. Finally the server MUST trigger the result and replace its object by the id … TODO - capabilities, e.g. https://github.com/gobengo/activitypub-lab

A redaktor server MUST recursively loop the objectOf property of an Activity: The nameMap (or name for single-language-implementations) property of the Activity supplies the label to use for the button, the icon property supplies an icon and the summaryMap/summary supplies a description. If any of these Actions appear without an object property, the parent object is the value for the object property: Add, Announce, Follow, Join, Like, Listen, Offer, Read, View If any of these Actions appear without a target property, the parent object is the value for the target property: Invite, Travel

client

  • A redaktor client MUST include “Potential Actions attached to objects” as possible responses to the Object with the common semantics of ActivityPub and semantics described in Potential Actions attached to objects. NOTE: using is now instrument. If a redaktor client sees any Action with the instrument property and it has type BrowserView or EmbeddedView or HttpRequest or HtmlForm, the client MUST trigger it. So, if any other client or system decides to offer the same reactions as an inReplyTo it will not matter.

Example

  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "actor": "https://social.example/u/alyssa/",

  "object": {
    "type": "Event",
    "id": "https://social.example/u/alyssa/events/1",
    "attributedTo": "https://social.example/u/alyssa/",
    "to": ["https://www.w3.org/ns/activitystreams#Public"],
    "name": "37F3",
    "content": "The annual four-day conference on the Fediverse organised by volunteers.",
    "objectOf": [
      "https://www.w3.org/ns/activitystreams#Like",
      "https://www.w3.org/ns/activitystreams#Announce",
      "https://www.w3.org/ns/activitystreams#Arrive",
      {
        "type": "Offer",
        "name": "Ticket Vouchers",
        "icon": {
          "type": "Image",
          "name": "Voucher Icon",
          "url": "http://example.org/voucher.png",
          "width": 16,
          "height": 16
        },
        "instrument": {
          "type": "BrowserView",   
          "href": "http://www.example.org/37F3/ticket",
          "browserContext": "_new"
        }
      }
    ]
  },

  "result": [
    {
      "type": "Invite",
      "name": "37F3: Free Ticket from “monopolies give back”-campaign",
      "summary": "Hey Ben, please accept your reward for the Fediverse Freedom Freaks 2022 :)",
      "content": "You will also get a nice Gin at the bar for free.",
      "objectOf": [
        {
          "type": "Accept",
          "name": "Want it",
          "icon": {
            "type": "Image",
            "name": "OK",
            "url": "http://example.org/accept.png",
            "width": 16,
            "height": 16
          },
          "result": [
            {
              "type": ["Note", "f3:Voucher"],
              "name": "ANGELXXXXXXXXXX",
              "to": "https://chatty.example/ben/",
              "result": "https://www.w3.org/ns/activitystreams#Announce"
            },
            {
              "type": "Note",
              "to": "@monopoly@hyper.com",
              "name": "Reward accepted by volunteer",
              "content": "Hey monopoly with an annual revenue of $100,000,000,000, your 1 voucher was accepted and you made 1 person happy.",
              "result": "https://www.w3.org/ns/activitystreams#Announce"
            }
          ]
        },
        {
          "type": "Reject",
          "name": "Sorry, no.",
          "icon": {
            "type": "Image",
            "name": "No",
            "url": "http://example.org/reject.png",
            "width": 16,
            "height": 16
          },
          "result": [
            {
              "type": "Question",
              "name": "Optional excuse",
              "content": "Hey Ben, I guess it is cause family Christmas but feel free to justify yourself ;)"
              "icon": {
                "type": "Image",
                "url": "http://example.org/question.png",
                "width": 16,
                "height": 16
              },
              "result": "https://www.w3.org/ns/activitystreams#Announce"
            }
          ]
        },
      ],
      "result": [
        "https://www.w3.org/ns/activitystreams#Announce",
        {
          "type": "Note",
          "to": "@monopoly@hyper.com",
          "name": "Reward offered to F3 volunteer",
          "content": "Hey monopoly with an annual revenue of $100,000,000,000, your 1 voucher was offered."
          "result": "https://www.w3.org/ns/activitystreams#Announce"
        }
      ]
    }
  ]
}

TODO Assign Template, ActivityHandler Template - Draft - Work Event-Offer-Accept/Reject-Question Example + RSVP + ask organizer

red:Template

  • serves as a default Object “to describe that new resource”.
  • SHOULD be presented to the user as a “post interface”
  • If it is presented to the user it MUST accept ActivityPub conformant editing of “the entirety of the protocol” and it SHOULD provide form components for extensions: If no @type is defined (by looking up the JSON-LD @context) provide a text input otherwise provide the best matching form component or widget, webcomponent etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment