- Try the demo here
- Watch a demo of most of the features on YouTube
This repo contains a simple demo React application (a website, basically) for the (almost) pure javascript fedialgo
package, a customizable algorithm for the federated social media platform Mastodon that can free you from the tyranny of Mastodon's reverse chronological order timeline.
Each incoming toot in your recent timeline will be scored based on a variety of factors and resorted top to bottom based on what toots have the highest scores instead of just reverse chronological order. You can adjust in a very fine grained way how much weight you want to give to each of those factors in determining each toot's scores. There are also some easy to use presets, including reverting to the standard reverse chronological order.
None of your data ever leaves your browser. All computations and reorderings are done in client side javascript.
Both this repo and the fedialgo
package linked above were forked from pkreissel's original implementations.
- Click on the link to the demo (it's deployed on GitHub Pages).
- Specify the Mastodon server your account lives on and click "Login". If you're already logged in with that browser you won't have to enter a password. (Note: passwords and tokens are never sent to FediAlgo! Your login in strictly between you and your Mastodon server. Once authenticated your Mastodon server gives your browser a temporary token FediAlgo uses to read your timeline, the same as any other Mastodon client app.)
- After you've logged in to your Mastodon server (or if you're logged in in that browser) your browser will request that you give
fedialgo
permission to access your Mastodon account. If you don't accept this the app will not work. - Wait for the magic. The first time you load the page it can take a while because it has to collect a bunch of federated data: things like trending posts on other servers, toots from accounts you follow, your notifications, and your recent Mastodon history so it can tell which users you interact with the most (which is by default an important part of the algorithm).
- Have fun.
- Profit.
If you try out FediAlgo but don't plan on using it again you may want to revoke its permissions. This can be done by going to https://{YOUR_SERVER}/oauth/authorized_applications
and clicking the "revoke" button.
Once the initial load is complete you can adjust the way the algorithm weights various aspects of a toot when it decides what should be at or near the top of your feed. There's also a drop down for preconfigured settings (feedback appreciated!) Hopefully these are self explanatory:
One thing that's kind of a gotcha is the way the topPosts - Favor posts that are trending in the Fediverse
slider works. Because trending posts often have tons of engagement in the form of replies, favorites, and retoots they can easily drown out the toots from people you are actually following. As a result the impact of this slider gets increasingly drastic but only if the value is below 1.0. At 1.0 and above it behaves like all the other weighting sliders.
You can filter based on hashtag, source (accounts you follow, hashtags you follow, various kinds of trending toots), language, application, and various numerical metrics like minimum number of replies, minimum number of boosts, etc.
Clicking the ⚖️ in the GUI will bring up a popup that will show you the gorey details of how a toot measured up.
Here's an example of the elements that go into scoring a toot:
- You can retoot, bookmark, and favorite other people's toots through this app's web interface.
- Clicking the reply icon will take you to the standard Mastodon web app view of the toot you want to reply to on your home server.
- Clicking the timestamp in the top right corner will take you to the toot on that tooter's home server (you'll only be able to reply if that's also your home server).
Most (all?) browsers will allow you to clear all the "site data" (cookies and cache) for a single site. If you run into an issue try doing that and then reloading the app at https://localhost:3000
.
There's also all kinds of information logged to your browser's developer console. If you run into a problem maybe take a look in there for any errors.
Here's an example of what you might see:
- If you get an error about
GenerateSW() was called more than once
or whatever just ignore it. - Sometimes (always?) when starting the app after the first time you will find your Mastodon login has expired in which case you will be kicked back to the login screen for reauthorization.
- Infinite scroll isn't really infinite (yet). If you scroll far enough you will run out of toots to peruse.
node.js
:- On Linux use
apt
,yum
, or your favorite package manager. For example here's guide on how to installnode.js
on Ubuntu linux. - On macOS you can install
node.js
with Homebrew by runningbrew install node
.
- On Linux use
git
- Hopefully you have
git
installed already but if you're on a recent version of macOS you may need to use Homebrew:brew install git
- Hopefully you have
There's a script in this repo that will do all the steps for you if you're into that kind of thing, otherwise:
git clone https://github.com/michelcrypt4d4mus/fedialgo_demo_app_foryoufeed
cd fedialgo_demo_app_foryoufeed
npm install
(you can ignore the various warnings)npm run start
- It should automatically change focus to your default browser and prompt you to login to Mastodon but if that doesn't happen you can point your browser at
http://localhost:3000/
.
- It should automatically change focus to your default browser and prompt you to login to Mastodon but if that doesn't happen you can point your browser at
You can install the local fedialgo
package by running npm link
in the fedialgo
project dir and then npm link fedialgo
in this project's dir or you can do that kind of thing manually by running npm install path/to/local/fedialgo
in this repo's dir but either way in order to pick up any code changes from fedialgo
you will have to run npm run build
in the fedialgo
package dir.
Assuming you check both fedialgo
and this repo out to the same directory there's a helper script to link the local repo in link_local_fedialgo.sh
.
If you set the environment variable FEDIALGO_DEBUG=true
a lot more debugging info will be printed to the browser console. See .env.development
for other environment variables you can play with.
There's also an arrow icon at the top right of ecah toot that will open a display showing the raw JSON of the underlying toot.
Environment variables are managed by dotenv-flow
so there are files in this repo called .env.production
and .env.development
for the main two NODE_ENV
values. To override the values in those files you should be able to just create files named .env.production.local
and .env.development.local
, respectively.
Someone reported they were unable to build with npm run build
but using NODE_ENV=production npm run build --no-hmr
seemed to fix the issue.
- @[email protected]
- @[email protected]
- @[email protected]
- @[email protected]
- @[email protected]
- @[email protected]
- @[email protected]
- @[email protected]
#activitypub #algorithm #algorithmicFeed #algorithmicTimeline #Fedi #FediTips #FediTools #Fediverse #Feed #FOSS #MastoAdmin #Mastodon #mastohelp #nodejs #nod #opensource #SocialWeb #timeline #TL #webdev
- There's tons of info on how the scoring and weighting of toots is being done in your browser's javascript debug console logs.
- The interesting stuff that actually handles the feed is in the
Feed.tsx
file. - The bird UI of this app is based on the following repo: https://github.com/ronilaukkarinen/mastodon-bird-ui
- If you click on the score icon for a toot the
Toot
object will be logged to the javascript console. - Deploying to GitHub pages: https://gist.github.com/promto-c/e46ca197f324a2148af919e18c18b5e6