grishka / Smithereen

Federated, ActivityPub-compatible social network server with friends, walls, and groups.
The Unlicense
393 stars 31 forks source link

Groups: add membership URL to Group actor #25

Closed alexgleason closed 3 years ago

alexgleason commented 3 years ago

I'm developing a groups implementation based around Joins and membership. Based on what I understand, Smithereen uses Follow to join, and its followers are considered its members.

I added a "members" key to the Group actor, pointing to its followers URI so they can interoperate. Hopefully I did this correctly.

grishka commented 3 years ago

"members" isn't defined in the ActivityStreams schema, so this way it'd end up without a namespace 🤔

grishka commented 3 years ago

If you're okay with it being in the sm: namespace (referenced in @context), I'll merge this and add that after I'm done with polls.

alexgleason commented 3 years ago

I added it but I'm struggling to make Docker rebuild it so I'm not certain that it builds.

Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.619 s
[INFO] Finished at: 2021-08-19T17:34:57Z
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'dependency' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/root/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
ERROR: Service 'web' failed to build: The command '/bin/sh -c mvn dependency:go-offline' returned a non-zero code: 1
grishka commented 3 years ago

That's not supposed to happen ;) Also something I'll look into. Probably this mvn dependency:go-offline command needs to go away. Maybe remove that line from dockerfile and try again?

It does look like perfectly valid java to me tho, so it should build.

alexgleason commented 3 years ago

It was just a classic Docker networking issue. Confirmed now this works:

➜  ~ curl -H 'Accept: application/activity+json' https://smithereen.ngrok.io/soapbox-dev | jq            
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1390    0  1390    0     0   4587      0 --:--:-- --:--:-- --:--:--  4587
{
  "type": "Group",
  "id": "https://smithereen.ngrok.io/groups/1",
  "name": "Soapbox Dev",
  "url": "https://smithereen.ngrok.io/soapbox-dev",
  "preferredUsername": "soapbox-dev",
  "inbox": "https://smithereen.ngrok.io/groups/1/inbox",
  "outbox": "https://smithereen.ngrok.io/groups/1/outbox",
  "followers": "https://smithereen.ngrok.io/groups/1/followers",
  "endpoints": {
    "sharedInbox": "https://smithereen.ngrok.io/activitypub/sharedInbox"
  },
  "publicKey": {
    "id": "https://smithereen.ngrok.io/groups/1#main-key",
    "owner": "https://smithereen.ngrok.io/groups/1",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg6NI5j0mpOYKsHMUF0UhnbicGTqvlvmWKa3NHqCNhjeknOwufSVc5pslUWjUZ2dDEDciw3GBWlY+Yq5GpTcZVIiOqIO7dAxPbwvR4TaOnkjZeBjKoS+wm3aO2OvhUpzU4eNwERwEL/aAVNiQ81a1S7l3YyMkzsv0iR317PAojbnyAeXOjO7AjsYSRCzaqfmCdvlDtElSvFhY7ShDnfJ8UPITGvwNlfBJab1JRRxnyv06Uy+uy9j5uFYDUZLl0HqVR2gygnPSYdW9EcoLl33oKQc2wOlhl1wdgnQgpToVRWJxjCLUVmBMzEMHSHOiv6rRDrhysqSHMgxrjrpnVS7/KwIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "wall": "https://smithereen.ngrok.io/groups/1/wall",
  "attributedTo": [
    {
      "type": "Person",
      "id": "https://smithereen.ngrok.io/users/1"
    }
  ],
  "members": "https://smithereen.ngrok.io/groups/1/followers",
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "wall": {
        "@id": "sm:wall",
        "@type": "@id"
      },
      "sm": "http://smithereen.software/ns#",
      "members": {
        "@id": "sm:members",
        "@type": "@id"
      }
    },
    "https://w3id.org/security/v1"
  ]
}
grishka commented 3 years ago

It's now live on friends.grishka.me, you can use this group for testing.

alexgleason commented 3 years ago

Sweet, thanks :smile: