From 32c27201d8d6e92d6cf248b03beffbd4f6f09022 Mon Sep 17 00:00:00 2001 From: Holly Date: Sun, 9 May 2021 06:37:46 +0000 Subject: [PATCH] clarify tampermonkey prerequisite --- index.html | 134 +++++++++++++++++++++++++++-------------------------- style.css | 4 ++ 2 files changed, 72 insertions(+), 66 deletions(-) diff --git a/index.html b/index.html index d581bb9..9d1ac38 100644 --- a/index.html +++ b/index.html @@ -1,66 +1,68 @@ - - - - - Remote Instance Actions - - - - -

Remote Instance Actions

- -
The userscript in action, suspending badfaith.instance.
Quickly suspend or silence remote instances from the Mastodon frontend
- -

Installation Form

- - -
-

Enter each instance you wish to use the script on. This should be just "domain.tld", no extra formatting. One domain per line.

-
- -
- -
- -

FAQ

- -

What's this?

- -

Remote Instance Actions is a userscript I've written to aid in Mastodon moderation.

- -

(That really is just "Mastodon", not "fediverse". Sorry, Misskey admins).

- -

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.

- -

What is a userscript?

- -

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.

- -

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.

- -

Tampermonkey Home Page Chrome Extension Firefox Add-On

- -

At time of writing, the script doesn't work in Firefox and I haven't the foggiest idea why. Working on it.

- -

It's just a userscript? Why the complex installation process?

- -

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 every page you visit to make that check.

- -

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.

- -

The userscript itself, in a usable state, isn't exactly 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.

- -

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.

- -

Can I see the source code?

- -

Well, your browser will show you the code before installing, but if you want to inspect it beforehand it's available on my gitea instance. - -

How can I contact you?

- -

If you're on the fediverse, I can be found at @monorail@glaceon.social.

- -

If you aren't... How exactly did you get here?

- - - + + + + + Remote Instance Actions + + + + +

Remote Instance Actions

+ +
The userscript in action, suspending badfaith.instance.
Quickly suspend or silence remote instances from the Mastodon frontend
+ +

Prerequisites

+ +

Ensure Tampermonkey is installed: Tampermonkey Home Page Chrome Extension Firefox Add-On

+ +

At time of writing, the script doesn't work in Firefox and I haven't the foggiest idea why. Working on it.

+ +

Installation Form

+ + +
+

Enter each instance you wish to use the script on. This should be just "domain.tld", no extra formatting. One domain per line.

+
+ +
+ +
+ +

FAQ

+ +

What's this?

+ +

Remote Instance Actions is a userscript I've written to aid in Mastodon moderation.

+ +

(That really is just "Mastodon", not "fediverse". Sorry, Misskey admins).

+ +

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.

+ +

What is a userscript?

+ +

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.

+ +

Of course, most browsers 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.

+ +

It's just a userscript? Why the complex installation process?

+ +

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 every page you visit to make that check.

+ +

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.

+ +

The userscript itself, in a usable state, isn't exactly 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.

+ +

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.

+ +

Can I see the source code?

+ +

Well, your browser will show you the code before installing, but if you want to inspect it it's available on my gitea instance. + +

How can I contact you?

+ +

If you're on the fediverse, I can be found at @monorail@glaceon.social.

+ +

If you aren't... How exactly did you get here?

+ + + diff --git a/style.css b/style.css index 35c864d..7f826d4 100644 --- a/style.css +++ b/style.css @@ -15,6 +15,10 @@ body { } */ +#prereqs { + text-align: center; +} + footer { padding: 0 4em; font-size: 10pt;