Mastodon Redirector – A browser extension to rewrite external Mastodon URLs to your own instance

By admin

One
CARDINAL

thing that’s a bit of a hassle with

Mastodon
ORG

is that you can’t immediately follow people on other instances: you have to copy the username and search for it on the instance that hosts your account. Same story with favoriting and boosting their posts, when viewed on their instance’s URL. To make things easier, I’ve created a browser extension that can rewrite external

Mastodon
PERSON

URLs to URLs as seen on your

Mastodon
PERSON

instance.

~

This demo shows

Chrome
ORG

with the extension running. My

Mastodon
PERSON

host is

front-end.social
ORG

. After configuring the extension, I can quickly jump from other

Mastodon
ORG

instances to the instance that hosts my account. From there, I can follow/favorite/boost the profile/post I was visiting before.

For example,

Zach Leatherman
PERSON

’s profile is reachable at https://fediverse.zachleat.com/@zachleat . Because I have an account on the

front-end.social
ORG

instance, the URL that I can use to interact with him is https://front-end.social/@[email protected] . The extension takes care of this for me by injecting a link in the modal that is shown.

Alternatively I can press the extension button itself – or use the SHIFT + ALT/OPT + M shortcut – to get redirected.

~

# Get the extension

The extension is available on

the Chrome Web Store
ORG

and

Mozilla Add-Ons Website
ORG

. If you can’t or don’t want to run this as an extension, you can also use the bookmarklets.

The source code of the extension is available on GitHub. If you like the extension, please leave a review on the relevant extension store.

Bugs
PERSON

can be filed in the repo.

~

When I joined

Mastodon
PERSON

back in

November 2023
DATE

, this almost immediately was one of the things that nagged me: whenever I visited someone’s profile or a link to a post on a different instance I could not follow them nor favorite/boost their posts. Instead, I needed to go to my instance, look up their name, and then find back the post that way.

(It was only later that I discovered that you can search for a remote URL on your local instance and it’ll redirect to the local version when doing so)

To not have to rewrite these URLs manually, I rather quickly created a bookmarklet to rewrite profile URLs. As an experiment

a few days later
DATE

– to get myself acquainted with

Extensions
ORG

Manifest v3 – I turned that into a browser extension for use with

Google Chrome
ORG

(+ other

Chromium
ORG

derivatives) and

Mozilla Firefox
ORG

.

The extension was released under the name “

Mastodon Profile Redirector
WORK_OF_ART

”, as that what the extension only did back then: upon pressing the extension button, it would redirect you to the profile page served by your instance.

Later on in

December 2022
DATE

, I added a Content Script to the extension which monitors follow dialogs on

Mastodon
PERSON

pages. Whenever such a dialog got shown, the extension injects a button that directly links to the profile on your own instance. This feature got released in version

0.3.0
CARDINAL

.


Zach
PERSON

’s profile on his origin URL, after having pressed the “Follow” button. The extension has automatically injected a link to his profile on my

front-end.social
ORG

instance.

A feature that was long missing was the ability to rewrite individual posts. Even though I knew how to build it, I never got round to implementing this.

Last week
DATE

, I finally made some time to do so and released version 0.4.0 which includes this feature. Also new is a shortcut to invoke the redirection. Hit SHIFT + ALT/OPT + M on a

Mastodon
ORG

profile page or

Mastodon
ORG

post detail page, and you’ll be redirected. Because of this expanded scope of the extension, it also got renamed to “

Mastodon Redirector
WORK_OF_ART

”.

~

# Spread the word

To help spread the contents of this post, feel free to retweet its announcement tweet post / toot post :

I made something to make my browsing experience on

That Other Social Network
ORG

much better. Maybe it’ll be of good use for you as well. Available on

the Chrome Web Store
ORG

and the Firefox

AMO
PRODUCT

website. In non-supported browsers you can use the provided bookmarklets. Source on GitHub. https://t.co/7Yv5RDpun0 —

Bramus
PRODUCT

(

@bramus
ORG

)

September 11
DATE

, 2023

~