Skip to content

Instantly share code, notes, and snippets.

@rauschma
Last active December 1, 2022 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rauschma/677544618b73dc4e3d11611e298cbe3a to your computer and use it in GitHub Desktop.
Save rauschma/677544618b73dc4e3d11611e298cbe3a to your computer and use it in GitHub Desktop.

Instructions

This bookmarklet shows a profile or a post on another Mastodon server in your server’s web app.

Installation

  • Change the value of HOST to the domain of your Mastodon server.
  • Create a bookmark and paste the lines in show-in-mastodon-web-app.js into its address (browsers are OK with pasting multiple lines).

Usage

  • Go to a profile or a post on another Mastodon server.
  • Click the bookmarklet.

If you are on your Mastodon server, the bookmarklet does nothing.

Acknowledgement: Thanks to @michael@thms.uk for telling me the authorize_interaction trick.

javascript:{
const HOST = 'fosstodon.org';
if (location.host !== HOST) {
const parts = location.pathname.split('/');
if (parts.length === 2) {
/* Profile */
const userName = parts[1];
location.href = `https://${HOST}/${userName}@${location.host}`;
} else {
/* Post */
location.href = `https://${HOST}/authorize_interaction?uri=${location.href}`;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment