userid redirect for Mastodon

I thought it would be convenient to have a automatic redirect to the mastodon url on your own server so that following another user direct via link could work instead of copying the profile url and pasting it into your own mastodon instance search field (remote follow)

This is currently a small PHP script that asks for the homeserver name and sets a cookie so that you only have to do that once

It is running on the URL https://m.lehmann.cx/ and works by adding the userid or profile link to the end of it

e.g. https://m.lehmann.cx/@[email protected], https://m.lehmann.cx/@[email protected]

or https://m.lehmann.cx/https://pixelfed.sdf.org/@alexlehm

Parsing of the URL relies on the @ chars, so the short form of Pixelfed does not work (https://m.lehmann.cx/https://pixelfed.sdf.org/alexlehm, also other formats will fail)

The script is currently a quick first shot, it has not much error handling and will likely fail for some, also there is no way to delete the cookie, so this has to be done manually.

I should mention that I came up with the idea when I used the matrix.to redirect for a matrix group

If you like you can PM me as @[email protected]