Increasing the character limit on Mastodon 4.1.x and 4.2.x

There is a very small difference between the two Git branches, so pay attention.

su - mastodon

Edit if your Mastodon instance is v4.1.x

nano live/app/javascript/mastodon/features/compose/components/compose_form.js

Edit if your Mastodon instance is v4.2.x

nano live/app/javascript/mastodon/features/compose/components/compose_form.jsx

In this file, you will find the number “500” twice. Replace that number with your desired character limit and save the file.

nano live/app/validators/status_length_validator.rb

In this file, you will find the number “500” once. Replace that number with your desired character limit and save the file.

nano live/app/serializers/rest/instance_serializer.rb

FIND the line that reads:

:languages, :registrations,

ADD the following to that line:

:max_toot_chars

Pay attention if a comma is used at the end or not.

Scroll down to the end of the file until you reach the “private” section.

ADD

def max_toot_chars 
[the number of your desired character limit without the brackets]
end

EXAMPLE

def max_toot_chars 
5000
end

Go back to the live directory and enter the following commands, one by one:

RAILS_ENV=production bundle exec rails assets:precompile
exit
systemctl restart mastodon-sidekiq
systemctl reload mastodon-web
[OPTIONAL] systemctl restart mastodon-streaming

Done.

Loading