Use Activity Streams API for GNU Social #378

Open
yvolk opened this Issue Apr 30, 2016 · 8 comments

Projects

None yet

2 participants

@yvolk
Member
yvolk commented Apr 30, 2016 edited

We had a lot of discussions on why "Twitter Compatible API" is bad and doesn't support federative nature of the GNU Social.
See https://loadaverage.org/conversation/7583424 and https://loadaverage.org/conversation/7740640#notice-7982542

Meanwhile:

  1. GNU Social declares support of Activity Streams in Atompub and JSON formats. See https://gnusocial.net/doc/api
  2. The Activity Streams format specification ( JSON format !) got a follow up, which we may become confirming to in order to ease integration with other systems: https://www.w3.org/TR/activitystreams-core/

It looks like no GNU Social client application uses Activity Streams JSON format to connect to GNU Social yet. So maybe this doesn't work at all now, or is implemented wrong...
Anyway we should try, uncover what is good and what should be done by GNU Social developers to allow AndStatus migration from "Twitter compatible API" to "Activity Streams".

@yvolk yvolk added the New feature label Apr 30, 2016
@VeriusLambda

One problem with the current JSON activity stream support in GNU Social is that it doesn't have an equivalent of <atom:link rel="mentioned" href="uri_of_user_profile">. This is how the XML ATOM feed communicates who should be tagged in in a reply-all.

@VeriusLambda

Also, I don't believe ActivityStreams 2.0 is supported by GNU Social. That standard is still very much under development by the W3C Social WG.

For the short term solution it may be better to, as you said, figure out what would be needed to support AndStatus. I get the feeling looking at the existing code that the use cases considered are mostly GS Classic and Qvitter, both of which can be assumed to operate with permanent and reasonably fast internet access. AndStatus and other mobile clients cannot make that assumption.

@VeriusLambda

I've been reading the code of GNU Social and it looks like it does pass the information needed to reconstruct the mentions, just not where I initially looked for it. The to key of an item contains a list like:

      "to": [
        {
          "objectType": "http://activitystrea.ms/schema/1.0/person",
          "id": "https://community.highlandarrow.com/user/500"
        },
        {
          "objectType": "http://activitystrea.ms/schema/1.0/person",
          "id": "https://social.umeahackerspace.se/user/2"
        },
        {
          "objectType": "http://activitystrea.ms/schema/1.0/person",
          "id": "https://loadaverage.org/user/339282"
        },
        {
          "objectType": "http://activitystrea.ms/schema/1.0/collection",
          "id": "http://activityschema.org/collection/public"
        }
      ],

Together with the sender of the message the persons in that list seem to be the ones who should be mentioned. I believe groups can be in the list as well. This still leaves a need to correlate uri's with account names, but at least the raw info is there.

@VeriusLambda

For reference here's an activity stream file with single but modestly complex entry:

{
  "generator": "GNU social 1.2.0-beta4",
  "title": "verius and friends",
  "totalItems": 20,
  "items": [
    {
      "actor": {
        "id": "https://loadaverage.org/user/5263",
        "displayName": "AndStatus",
        "status_net": {
          "avatarLinks": [
            {
              "url": "https://community.highlandarrow.com/avatar/501-original-20160301063016.png",
              "rel": "avatar",
              "type": "image/png",
              "width": 96,
              "height": 96
            },
            {
              "url": "https://community.highlandarrow.com/avatar/501-original-20160301063016.png",
              "rel": "avatar",
              "type": "image/png",
              "width": 96,
              "height": 96
            },
            {
              "url": "https://community.highlandarrow.com/avatar/501-48-20160301070109.png",
              "rel": "avatar",
              "type": "image/png",
              "width": 48,
              "height": 48
            },
            {
              "url": "https://community.highlandarrow.com/avatar/501-24-20160301170752.png",
              "rel": "avatar",
              "type": "image/png",
              "width": 24,
              "height": 24
            }
          ],
          "profile_info": {
            "local_id": "501"
          }
        },
        "image": {
          "url": "https://community.highlandarrow.com/avatar/501-original-20160301063016.png",
          "rel": "avatar",
          "type": "image/png",
          "width": 96,
          "height": 96
        },
        "objectType": "person",
        "summary": "This is the main posting account of AndStatus - an Open Source low traffic social networking client for Android with tree-like threaded conversations. It supports multiple protocols, including GNU social (\"StatusNet\". e.g. Quitter, LoadAverage, Vinilox, etc.), Twitter and Pump.io. AndStatus can combine your accounts from all networks into one Timeline, and it allows you to read and post even when you are offline.",
        "url": "https://loadaverage.org/andstatus",
        "location": {
          "objectType": "place",
          "position": "+25.09538+55.16171/",
          "lat": "25.09538",
          "lon": "55.16171"
        },
        "portablecontacts_net": {
          "preferredUsername": "andstatus",
          "displayName": "AndStatus",
          "note": "This is the main posting account of AndStatus - an Open Source low traffic social networking client for Android with tree-like threaded conversations. It supports multiple protocols, including GNU social (\"StatusNet\". e.g. Quitter, LoadAverage, Vinilox, etc.), Twitter and Pump.io. AndStatus can combine your accounts from all networks into one Timeline, and it allows you to read and post even when you are offline.",
          "addresses": {
            "formatted": "Internet"
          },
          "urls": [
            {
              "type": "homepage",
              "value": "https://github.com/andstatus/andstatus/wiki",
              "primary": "true"
            }
          ]
        }
      },
      "content": "@<a href=\"https://community.highlandarrow.com/user/500\" class=\"h-card mention\">verius</a> Thank you for investigation, could you for transparency and deeper analysis post the json file (in Activity Streams format) under discussion to this new ticket: <br /><a href=\"https://github.com/andstatus/andstatus/issues/359\" title=\"https://github.com/andstatus/andstatus/issues/359\" class=\"attachment\" rel=\"nofollow\">https://github.com/andstatus/andstatus/issues/359</a> \"Use Activity Streams API for GNU Social\" - I created it for us in order to have a common place for discussion and stop going in circles with the same questions...<br /><br /> @<a href=\"https://social.umeahackerspace.se/user/2\" class=\"h-card mention\">mmn</a>",
      "generator": {
        "id": "tag:status.net,2009:notice-source:ostatus",
        "objectType": "application",
        "status_net": {
          "source_code": "ostatus"
        }
      },
      "id": "tag:loadaverage.org,2016-04-30:noticeId=7985640:objectType=comment",
      "object": {
        "id": "tag:loadaverage.org,2016-04-30:noticeId=7985640:objectType=comment",
        "objectType": "comment",
        "content": "@<a href=\"https://community.highlandarrow.com/user/500\" class=\"h-card mention\">verius</a> Thank you for investigation, could you for transparency and deeper analysis post the json file (in Activity Streams format) under discussion to this new ticket: <br /><a href=\"https://github.com/andstatus/andstatus/issues/359\" title=\"https://github.com/andstatus/andstatus/issues/359\" class=\"attachment\" rel=\"nofollow\">https://github.com/andstatus/andstatus/issues/359</a> \"Use Activity Streams API for GNU Social\" - I created it for us in order to have a common place for discussion and stop going in circles with the same questions...<br /><br /> @<a href=\"https://social.umeahackerspace.se/user/2\" class=\"h-card mention\">mmn</a>",
        "url": "https://loadaverage.org/notice/7985640",
        "status_net": {
          "notice_id": 101888
        },
        "inReplyTo": {
          "objectType": "note",
          "id": "tag:community.highlandarrow.com,2016-04-30:noticeId=101854:objectType=note",
          "url": "https://community.highlandarrow.com/notice/101854"
        }
      },
      "location": {
        "objectType": "place",
        "position": "+25.09538+55.16171/",
        "lat": "25.0953800",
        "lon": "55.1617100"
      },
      "to": [
        {
          "objectType": "http://activitystrea.ms/schema/1.0/person",
          "id": "https://community.highlandarrow.com/user/500"
        },
        {
          "objectType": "http://activitystrea.ms/schema/1.0/person",
          "id": "https://social.umeahackerspace.se/user/2"
        },
        {
          "objectType": "http://activitystrea.ms/schema/1.0/person",
          "id": "https://loadaverage.org/user/339282"
        },
        {
          "objectType": "http://activitystrea.ms/schema/1.0/collection",
          "id": "http://activityschema.org/collection/public"
        }
      ],
      "status_net": {
        "conversation": "tag:gs.kawa-kun.com,2016-04-28:objectType=thread:nonce=812f03a7bf6a375a",
        "notice_info": {
          "local_id": "101888",
          "source": "ostatus"
        }
      },
      "published": "2016-04-30T10:02:03+00:00",
      "provider": {
        "objectType": "service",
        "displayName": "Highland Arrow Community",
        "url": "https://community.highlandarrow.com/"
      },
      "verb": "post",
      "url": "https://loadaverage.org/notice/7985640"
    }
  ]
}
@yvolk
Member
yvolk commented Apr 30, 2016 edited

@VeriusLambda See my comments/questions:

C1. What exactly URL did you use to get that response , and how did you authenticate to get it? - I want to capture the whole file (the whole conversation, if it's possible...) for the test case of our future implementation. I suppose you got it from your instance "provider/service" https://community.highlandarrow.com/ ?!
I will try to request the same conversation from several other instances in order to understand if we can really identify the same users and messages looking at different instances. But I expect that there will be differences in a number of users/messages, visible from different hosts...

Regarding implementation:

C2. I think we should implement this as ONE "GNU Social federation" Social Network for all possible accounts on different hosts (just like Pump.io is implemented). Thus we will avoid any duplicated users and messages, no matter from which GNU Social instance they were downloaded.

C3. Unlike Pump.io implementation in AndStatus we (possibly) will need to include additional configuration information for each host, when we have GNU Social account (because de facto today different GNU Social hosts are configured differently...). Or actually configuration is the same and WebfingerId like "andtatus@loadaverage.org" plus user's password give all information needed to connect to that host?

@VeriusLambda

URL: If you have a GNU Social instance you can click on the classic
interface. On the right hand side under feeds there's a link activity
streams. For me it was
https://community.highlandarrow.com/api/statuses/friends_timeline/verius.as

Configuration: In theory that's what webfinger is for. E.g.
https://community.highlandarrow.com/.well-known/webfinger?resource=verius@community.highlandarrow.com

I would say that the webfinger should point to enough information to get
you to a point where you can connect to an account. However I'm not sure
yet if it actually does. Will do some digging in that part of the GS
codebase.

On Sat, Apr 30, 2016 at 3:16 PM, Yuri Volkov notifications@github.com
wrote:

@VeriusLambda https://github.com/VeriusLambda See my comments/questions:

  1. What exactly URL did you use to get that response , and how did you
    authenticate to get it? - I want to capture the whole file (the whole
    conversation, if it's possible...) for the test case of our future
    implementation. I suppose you got it from your instance "provider/service"
    https://community.highlandarrow.com/ ?! I will try to request the same
    conversation from several other instances in order to understand if we can
    really identify the same users and messages looking at different instances.
    But I expect that there will be differences in a number of users/messages,
    visible from different hosts...

Regarding implementation:

I think we should implement this as ONE "GNU Social federation" Social
Network for all possible accounts on different hosts (just like Pump.io is
implemented). Thus we will avoid any duplicated users and messages, no
matter from which GNU Social instance they were downloaded.
2.

Unlike Pump.io implementation in AndStatus we (possibly) will need to
include additional configuration information for each host, when we have
GNU Social account (because de facto today different GNU Social hosts are
configured differently...). Or actually configuration is the same and
WebfingerId like "andtatus@loadaverage.org" plus user's password give
all information needed to connect to that host?

PS: I will not have access to my development PC and will not have reliable
Internet for the next 10 days...


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#378 (comment)

@yvolk
Member
yvolk commented Apr 30, 2016

Aha, got it. Do you know how to retrieve the whole Conversation?
See my notes on conversations #328

@VeriusLambda

It seems the activity streams output doesn't have that, even though the atom does. For example https://community.highlandarrow.com/api/statuses/friends_timeline/verius.atom has as child of an entry tag <ostatus:conversation href="https://community.highlandarrow.com/conversation/43587" local_id="43587" ref="tag:gs.kawa-kun.com,2016-04-28:objectType=thread:nonce=812f03a7bf6a375a">tag:gs.kawa-kun.com,2016-04-28:objectType=thread:nonce=812f03a7bf6a375a</ostatus:conversation>

Unfortunately that href goes to the HTML version, not to the JSON. Still, it means GNU Social has the information needed, it just doesn't pass it on to the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment