julian

joined 11 years ago
 

tl;dr — category actors in NodeBB now have better avatars/pictures! They're generated from the icon, color, and bgColor settings for each category.

Did you know that categories in NodeBB can also be followed on the social web/fediverse? Categories, as they are known here, are also actors on the fediverse, so you can find them just like any other account.

e.g. @general-discussion @support @nodebb-development @activitypub

@[email protected] opened an issue back in April (!!) pointing out that the avatar/picture served by NodeBB for category actors was not as good as it could be.

It's definitely possible to do something like this, although it is usually rather resource intensive. For example, when you paste a GitHub URL somewhere (e.g. Slack), it may try to unfurl the URL and display an image. GitHub blogged about how they did this using Puppeteer to generate the images.

I knew right away I didn't want to bundle what was basically an entire browser runtime into NodeBB's dependencies, so I needed a more lightweight solution.

I attempted to build my own SVG string and send that through as a data-uri, but not surprisingly, it was not handled by the implementations I tested.

Some more research this week led me to Vercel's OG Image Generation, which allows you to create images on the fly using Vercel Edge Functions. Since NodeBB is neither a Vercel app, nor do any people running NodeBB use Vercel, that ruled out this product.

However, more research into Vercel's implementation led me to Satori and resvg, a pair of programs that can generate an SVG from HTML, and a PNG from SVG.

From there, it was a fairly standard technical exercise to combine these with our font-awesome libraries in order to output our own implementation of this to generate colourful category avatars for its category actors.

For now, they are only generated on-demand when a category actor is requested, but if there are applications for the icons to be used elsewhere, then we could look into having them generated on direct file request.

Enjoy!

0ff837a6-8f76-4c81-a81f-d4ad6d24660e-image.png

0
Update(Note) quirk (community.nodebb.org)
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/[email protected]
 

Today I tagged the v4.0.0-beta.2 release purely to fix a single issue — Update(Note) federation.

It turns out that just sending the Update(Note) activity was not enough, the underlying object needed to also have the updated field set in order to Mastodon to process the update. My guess is Mastodon checks that field and only processes the note if the value is greater than the last known value.

I'd write it off as a Mastodon-ism, but it's actually better to have that property present, so now it is.

Edit — does anyone know if Mastodon handles Update(Tombstone)? I sent one and Mastodon didn't do anything, which is technically ok. NodeBB handles it like a soft delete and removes it from public view.

0
NodeBB v4.0.0 Beta (community.nodebb.org)
 

Last friday I quietly tagged a commit on the activitypub branch with v4.0.0-beta.1, which signals that the ActivityPub integration is now ready for beta testing.

For the most complete (yet readable) list of new functionality from the alpha, check out the "Road to Beta" project page.

tl;dr — some new features and a lot of fixes

  • Editing a category now issues an Update(Actor)
  • replies is now populated and responds with an OrderedCollection of direct replies (see the post about that)
  • Proper sharedInbox support
  • Better indicators for content that comes from non-local (aka "remote") users
  • Conversational context synchronization mechanic (corresponding post for that)
  • Moving a topic out of the "uncategorized" category will now federate out an Announce

By and large most incompatibilties have been resolved, although if you do find some issues, please do let me know in the corresponding bug report thread.

I'm looking to wrap up the year with some of the more difficult projects I've put off

  • Object Integrity Proofs, which will also enable Inbox Forwarding
  • Better handling of "Open in App" signals from third-party instances
  • Post visibility support (or at least better handling so non-public messages aren'y unceremoniously dropped!)
  • Ongoing integration with FEPs 400e and 7888
 

Now that the alpha version of NodeBB v4 has been released, it means that people are starting to look into using NodeBB for testing (or if they're really looking to have fun, production.)

The first step in enabling those intrepid individuals is providing documentation!

While a little bare-bones at the moment, I've written up a brief summary of what NodeBB brings to the ActivityPub landscape, as well as a run-down of various settings/toggles/switches, and how to switch over to the code branch that enables ActivityPub integration.

What I don't know is what's missing. There's a lot about NodeBB's integration that's very obvious to me, since I built it, but what don't you see that you'd like me to write about? Let me know.

Thanks!

 

An update from last night brings some additional logic to the title generation of topics from the fediverse.

Previously if a title was provided in the name property, that was used as the topic title.

While that hasn't changed (and is the strongest signal for a topic title), not all fediverse content contains titles. Specifically, Mastodon posts do not require or even have a space to put a title in.

For those cases, we fall back to generating one based on the content. We literally grabbed the first 128 characters or so, and added an ellipsis to the end.

While that worked okay as a stopgap, it meant that a lot of topics ended up with really long titles — not ideal.

The new logic tries to grab the first line of text (either the first <p> or line), and from there, the first sentence, using some naive regular expressions.

While still not a proper alternative to... you know... specifying a title, it's better than nothing I suppose!

I wonder if other fediverse softwares implement title generation logic like this...

 

I may regret creating this topic but here goes.

If you experience a bug or other unexpected behavior while using NodeBB and its related ActivityPub integration, please post it here so it can be tracked and resolved.

No formal process as of yet, and we're still at pre-alpha so expect many things to be broken or unavailable 😅