3 ms·
I've had a go at doing it in Go and the ActivityPub spec is so loosely defined that it's just a real challenge if you intend to actually unmarshal the JSON you
by knjllppppp 3y ago
I've had a go at doing it in Go and the ActivityPub spec is so loosely defined that it's just a real challenge if you intend to actually unmarshal the JSON you receive
It's not completely impossible but you have to be okay with discarding a lot of unknown options or essentially reverse engineering the objects used by the servers you are federated with
That's not to say it's impossible, I was able to crawl the network successfully, but it hints at the reason that Mastodon and Pleroma use dynamic languages
I'd be very interested to see a flexible/complete AP implementation in any statically typed language
Fwiw WriteFreely is implemented in Go with go-fed but -- correct me if I'm wrong -- that library seemed more limited to me than what Pleroma and Mastodon support
- zimpenfish 3y ago> I'd be very interested to see a flexible/complete AP implementation in any statically typed language Try Honk[1] or GotoSocial[2]? [1] https://humungus.tedunangst.com/r/honk https://humungus.tedunangst.com/r/honk [2] https://github.com/superseriousbusiness/gotosocial https://github.com/superseriousbusiness/gotosocial
- mariusor 3y agoNeither is flexible, nor strives for completion. They are both implementations that try to map the ActivityPub vocabulary on an existing web-application domain. They are not ActivityPub servers, but web-apps that use the ActivityPub vocabulary to federate, which is what I meant in the grandparent post when I mentioned the classic mistake of ActivityPub implementers. :D
- yawaramin 3y agoHere's the implementation described in OP: https://github.com/Gopiandcode/ocamlot https://github.com/Gopiandcode/ocamlot OCaml is a statically-typed language. It falls somewhere between Go and Haskell on the spectrum of type 'strength'.
- mariusor 3y agoI'm surprised you didn't find my library because I managed to create a statically typed vocabulary library for Go that maps the specification verbatim: https://pkg.go.dev/github.com/go-ap/activitypub#Object https://pkg.go.dev/github.com/go-ap/activitypub#Object It wasn't easy indeed, and it locked me out of some options to support execution time vocabulary extensions, but hey, it works and it's relatively easy to use.
- knjllppppp 3y agoI'm surprised I didn't find it, too! My google-fu must be getting rusty. Thanks for the link, I'll have to have a deep dive when I get the time :)
- mariusor 3y agoI hope you get to it. The library itself contains more than just the vocabulary part and I would be glad of more eyeballs on the problem. :D