Skip to content

Instantly share code, notes, and snippets.

@chrisgrieser
Last active November 23, 2024 19:13
Show Gist options
  • Save chrisgrieser/80bb19a28b2da156b15900e635de6fd3 to your computer and use it in GitHub Desktop.
Save chrisgrieser/80bb19a28b2da156b15900e635de6fd3 to your computer and use it in GitHub Desktop.
Userscript for [Violent|Tamper|Grease]monkey.
// ==UserScript==
// @name Redirect to Mastodon home instance
// @namespace Violentmonkey Scripts
// @match https://*/@*/*
// @version 1.0
// @author pseudometa
// @description 2024-11-22
// @icon https://mastodon.social/packs/media/icons/favicon-48x48-c1197e9664ee6476d2715a1c4293bf61.png
// ==/UserScript==
// CONFIG
const HOME_INSTANCE = "pkm.social";
//======================================================================================================
const url = window.location.href;
// GUARD ensure it's a mastodon URL, since glob-matching is less precise
if (!url.match(/\/@\w+\/\d+#\./)) return;
window.location.href = `https://${HOME_INSTANCE}/authorize_interaction?uri=${encodeURIComponent(url)}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment