About Smithereen

Federated, ActivityPub-compatible social network with friends, walls, and groups.

At last something written in a strongly typed language :slight_smile:

@grishka What’s about #activitypub:c2s support in your server? Is any running instance available for developers testing?

I’m an Android developer, too, and making sense of HTML/CSS/JS hurts my head. There is definitely logic to it but it’s all so different from what I’m used to.

To be honest, I don’t really believe in c2s. It is too generalized to make any semblance of a good UX possible. Sure, you can make an email-style client where you have your inbox with incoming activities and you can send outgoing activities to other places. It encourages duplicating complex server-side logic on the client — for example, all the capability detection associated with friend requests or wall posts. It prevents protocol optimizations because you can’t, for example, expose multiple sizes and formats for images. I have 5 sizes and 2 formats (jpeg and webp) for photos, but using ActivityPub objects directly forces the use of the biggest size and jpeg, even though Android supports webp natively since about forever.

There’s going to be a proper client API at some point. There’s my private instance but I’ll set up a couple of demo ones with open signups when I’ll have the option to have open signups lol

“Smart” server can add all necessary sizes and formats based on one size sent by a client app… And also a server can and should “enrich” what client app missed… I think there should be symbiosis here between a Sever and a Client :slight_smile:
Client app is really complex, you can check number of lines of code in my app (about 53k Java lines according to SonarCloud), but this is not a problem :slight_smile:

… So, no #activitypub:c2s as I got :frowning:

waves in Golang :slight_smile:

Go is also a statically typed language! I would be happy to help discuss the various pitfalls with trying to map ActivityStreams to statically typed languages and the different approaches (if that’s even a problem for the project).

I did have some weird questions related to that, because AP objects can theoretically have more than one type. Realistically though, you still need either reflection or a big honking switch statement to map AP types to your own classes, and from there you could as well treat those multiple-type objects as special cases.

JSON-LD processing algorithms on the other hand… I just gave up and made them use JSONObjects, JSONArrays, and simple Objects throughout. In the spec, there are many places where something accepts an input that could be a number, a string, a JSON object, or an array — clearly written with something like JavaScript in mind. This was nightmarish to deal with.

I made special general purpose class that helps parsing exactly such cases: when value is either a string, an object or an array, or doesn’t exist at all.
Using this “parser” main parsing flow is quite compact, see the class: https://github.com/andstatus/andstatus/blob/91514e994bd51b2a2edfff9954f36ef4ec1f5a47/app/src/main/java/org/andstatus/app/util/ObjectOrId.java

Smithereen is now available as a docker container! See readme for details.