New plugin to filter registrations and avoid spam account


Since this morning, I have some spammers that are creating account on one of my instance to sell w**d.

Usually, I protect myself from these annoying people with my georegister plugin, which allows me to block IPs according to their country. Except that this time, the IPs are not associated to a country that I can easily block.

So I present you a new plugin, coded in a hurry: filterregistrations.

The idea: you can configure forbidden text strings in the display name, username or email used during the registration process.

This is how the configuration screen of the plugin looks like:

There is one field per form entry (display name, username, email).
All these fields accept the same syntax:

  • a line starting with # is considered as a comment, and will be ignored
  • a line of the form /test/ or /test/i will be considered as a regular expression (with or without modifiers)
  • empty lines (or lines with only spaces) are ignored
  • for the other lines, we look if the value contains this line (we compare after having put in lower case, which means that the test is not case sensitive - at least for Latin characters)

Finally, we have a last field, in which we can choose the message to display to users whose registration has been blocked by the plugin.

This is a first shoot, done very quickly. I’m aware that I’ll have to:

  • clean up the code a bit, and switch it to typescript
  • add unit tests
  • translate the settings screens
  • add some documentation
  • validate the configuration to avoid typos, or to point out invalid regular expressions
  • allow filtering also on the name of the default string
  • a little more finesse in the displayed refusal messages
  • manage case sensitivity for non-Latin alphabets

In my case, to block the wave of spam I’m experiencing, I’ll add this as a rule for the username field: /weed.*delivery/i.

To install the plugin, you’ll have to wait a few hours until it is referenced by Peertube.

If you like the plugin, and want to tip a little, there are sponsoring links on the repository:

I just added an option to filter IP the same way.

There was a bug on NPM, the plugin was not listed. This is fixed, you can now find and install the plugin.