A (very) rough demonstration of the feasability of a "subfederation" ("neighborhood") timeline for Mastodon (https://github.com/mastodon/mastodon/issues/13256).

pezcurrel 93b42201c5 Fixed two typos 2 weeks ago
imgs 0e18e051de First commit 2 weeks ago
sec 0e18e051de First commit 2 weeks ago
README.md 93b42201c5 Fixed two typos 2 weeks ago
auth.php 1459807f54 Added , http on http and https on https; minor change 2 weeks ago
common.php 0e18e051de First commit 2 weeks ago
getinsts.php 0e18e051de First commit 2 weeks ago
helper.php 0e18e051de First commit 2 weeks ago
index.php 4153341b81 Added some infos, removed many others 2 weeks ago
neighborhood.css 81eed63cc2 Minor changes 2 weeks ago
neighborhood.js 0e18e051de First commit 2 weeks ago
neighborhood.php f4b8a58e5a Modified a bit the “help” text 2 weeks ago
todo.txt 0e18e051de First commit 2 weeks ago
vercred.php 0e18e051de First commit 2 weeks ago

README.md

What’s this?

This is a very rough demonstration of the feasability of a “subfederation” timeline for Mastodon like the one I proposed here.

A working example can be found here (it is currently only accessible by the users of these instances: nebbia.fail, mastodon.bida.im, mastodon.cisti.org, puntarella.party).

The “subfederation” (or “neighborhood”) timeline implemented here shows to the user all the public toots from a configurable set of instances, except - as usual within Mastodon clients and frontends - those toots which are coming from an account that is blocking the user or that the user is blocking or muting, or from an account whose instance the user is blocking.

It “picks” the toots by querying https://{instance domain}/api/v1/timelines/public?local=1&limit=10 for each considered instance, filters out those coming from blocking, blocked, muted accounts, and from accounts whose instance the user is blocking, by querying https://{user’s instance domain}/api/v1/accounts/relationships?id[]={first toot id}&id[]={second toot id}{...}, and sorts the remaining toots in the usual chronological order, most recent first.

It makes it possible to interact (reply to, boost, favourite, so far) with each shown toot. Toots which are not already known by the user’s instance get “fetched” by it only when necessary (on faving, boosting and on sending replies to them), by querying https://{user’s instance domain}/api/v2/search?q=https://{other user’s domain}/@{other user’s username}/{other user’s toot id}&type=statuses&limit=1&resolve=true.

The only necessary condition for this to work is that each considered instance has its “public preview” active.

So, the “subfederation” or “neighborhood” timeline just makes much more accessible and, at the same time, respectful of relationships (blocks and so on) what a user can already do by scrolling the “public preview” of an instance, visiting a public toot from there and interacting with it.

I think it would be great if it was implented into Mastodon “official” web frontend, as an option that admins could configure: by adding at least one instance to a list of “subfederated” instances, the admins would activate a “subfederation” (or “neighborhood”) timeline that would then be shown between the local and the federate ones (there may be a limit, like 6, to the amount of instances which can be added) and would show public toots from the user’s local timeline plus the local timelines of specified instances.

The only “not frontend only” feature that it would require, in order to give other clients and frontends developers the possibility to implement it, would be a simple new API endpoint listing the “subfederated” istances, if any; or maybe just a new entry (an array) in https://{instance domain}/api/v1/instance.

It would help a lot the little and new instances, it would benefit a lot the decentralization of the fediverse and the possibility for users of different instances to get to know each other; more so if it was matched by another feature that I think Mastodon would benefit from, and that this “demo” demonstrates as feasable too: the possibility for a user to visit, right from within her-his instance, the local timeline - if public - of another user from a different instance, by choosing an entry in the “More” (“three dots”, “...”) menu of each toot.

How does this “demonstration” work?

It can be setup on any web server with php support (it uses the “mbstring” extension). It just requires a «neighborhood.conf» file to exist in the «sec/» subdirectory. This file should list the “subfederated” instances’ domains, one for each line.

Note that this demo does not record any user’s sensitive data on the server.