Hello all!
It is clear that Lemmy being in its infancy as it is, it still is lacking in tools to protect ourselves inside the Fediverse, you can block users and communities, but not whole instances, which while drastic, might sometimes be for the best. While I do trust we all choose our instances with care and their admins do defederate from instances that could be harmful to us, it is always useful to know how to protect yourself on a user level.
So here is a quick and simple tutorial on blocking out posts and comments from any Lemmy instance as needed using uBlock Origin. (Note: While this certainly applies to Desktop, some Firefox Android ports do allow uBlock Origin installation, so this applies there too.)
First, go to your uBlock Origin Dashboard (the gears at the bottom corner when you click the extension), then head to My filters, and once there add the following:
!Block posts and comments from a certain instance
!Substitute my.instance and blocked.instance with each respective instance url
my.instance##.post-listing:has(*:matches-attr(href=/.*@blocked\.instance/))
my.instance##.comment:has(*:matches-attr(href=/.*@blocked\.instance/))
EDIT: You can also use a more efficient post and comment filter by @ShittyKopper here.
That is all, I hope this is helpful to some of you, stay safe out there!
I have a fair bit of uBO filter templates at https://lemmy.blahaj.zone/post/1633853.
While I haven’t done any benchmarking, *:matches-attr would likely be a lot less performant than a title check like I’m doing as it’s a procedural filter. That said, on Firefox :has is also a procedural filter, but as native CSS support gets enabled in future versions uBO will prefer that over it’s own “emulation” of it (like it does on Chrome AFAIK).
Of course this kinda micro-optimization likely won’t matter in this context, I just thought that’d be useful to know.
That does sound more efficient (and elegant), I’ll link your post as a useful alternative!