remote_instance_actions/index.html

67 lines
4.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Remote Instance Actions</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="install_form.js"></script>
</head>
<body>
<h1>Remote Instance Actions</h1>
<figure><img src="ria.png" alt="The userscript in action, suspending badfaith.instance." /><figcaption>Quickly suspend or silence remote instances from the Mastodon frontend</figure>
<h2>Installation Form</h2>
<h5 id="whyformlink"><a href="#whyform">Why?</a></h5>
<form id="install-form" action="remote_instance_actions.user.js" method="get">
<p>Enter each instance you wish to use the script on. This should be just "domain.tld", no extra formatting. One domain per line.</p>
<textarea id="instance-input" placeholder="glaceon.social"></textarea><br>
<input id="install-button" type="submit" value="Install">
</form>
<hr>
<h2>FAQ</h2>
<h3>What's this?</h2>
<p>Remote Instance Actions is a userscript I've written to aid in Mastodon moderation.</p>
<p>(That really is just "Mastodon", not "fediverse". Sorry, Misskey admins).</p>
<p>It's as simple as the image at the top makes it look! Just highlight the URL of an instance you want to silence or suspend, and select the new context option. It does a little bit of simple sanitizing and validation to make sure you highlighted what you wanted to highlight. Then, it checks to see if the instance is already limited. Finally, it opens a new tab to your instance's "New Domain Block" form.</p>
<h3>What is a userscript?</h3>
<p>A userscript is sort of like a browser extension, but smaller! Just a little bit of Javascript code that gets run on certain pages to enhance the experience.</p>
<p>If you're asking this question, you should probably know that you do actually need a browser extension to run userscripts. The most popular and feature-complete one by far (as well as the one this userscript was tested with!) is Tampermonkey.</p>
<p><a href="https://www.tampermonkey.net/">Tampermonkey Home Page</a> <a href="https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo">Chrome Extension</a> <s><a href="https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/">Firefox Add-On</a></s></p>
<p>At time of writing, the script doesn't work in Firefox and I haven't the foggiest idea why. Working on it.</p>
<div id="whyform"><h3>It's just a userscript? Why the complex installation process?</h3>
<p>When writing a userscript, you have to hardcode in the URL of websites it will work on. That's fine for, say, Twitter, where it's always found at "twitter.com" (for the time being, anyway). Mastodon instances are a lot harder to write for. If I wrote it to, for example, check if the current page is a Mastodon instance and conditionally add the context menu item, it would have to run on <em>every page you visit</em> to make that check.</p>
<p>The usual way to solve this problem is to just tell the user to modify the userscript to add the pages you'd like it to run on. That sucks for a number of reasons. The most obvious are that users don't want to have to go in and mess with the code, and that it breaks with Tampermonkey's update functionality. This page here is my overengineered solution.</p>
<p>The userscript itself, in a usable state, isn't <em>exactly</em> stored anywhere on my server. There is a version that's very similar, but with a little bit of PHP where you would expect the @match directives to be. That PHP code fills in the match directives with domains provided via GET parameters before sending it to your browser. Since the script was installed from a URL with those parameters in it, Tampermonkey will include those same parameters when checking for updates.</p>
<p>The slightly less technical answer is that using this install page generates the userscript with the proper domains set on the fly, and does so in a way such that Tampermonkey will fetch updates that are generated with the same domains.</p></div>
<h3>Can I see the source code?</h3>
<p>Well, your browser will show you the code before installing, but if you want to inspect it beforehand it's available on <a href="https://git.hollymcfarland.com/monorail/remote_instance_actions">my gitea instance</a>.
<h3>How can I contact you?</h3>
<p>If you're on the fediverse, I can be found at <a href="https://glaceon.social/@monorail">@monorail@glaceon.social</a>.</p>
<p>If you aren't... How exactly did you get here?</p>
</body>
</html>