How to increase the character limit for toots in Mastodon

The default character limit for new toots is 500. But what if you want to increase or decrease it?

We will edit three different files, two which set the character limit on your instance, and one which tells other clients or apps what your custom character limit is (for those that support it).

1. Switch to the mastodon user

su - mastodon

2. Edit the file live/app/javascript/mastodon/features/compose/components/compose_form.js in your favourite text editor,

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

find the number 500 (it should be written in two different locations). Change both of them to whatever you like.

3. Edit live/app/validators/status_length_validator.rb,

nano live/app/validators/status_length_validator.rb

and once again find the number 500 (should exist only once) and change it to the same number as you wrote in the previous file.

4. Edit live/app/serializers/rest/instance_serializer.rb,

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

and find the row starting with
:languages, :registrations,
(should be the ~8th row), and change it so it includes ”:max_toot_chars” after ”:registrations”, such as
:languages, :registrations, :max_toot_chars,
where the full row now looks something like
:languages, :registrations, :max_toot_chars, :approval_required, :invites_enabled

5. At the end of the same file, above where it says private, add the following code:

def max_toot_chars 
   <your value here> 
end

and change <your value here> to the same value you wrote previously.

6. Enter the live directory and recompile Mastodon,

RAILS_ENV=production bundle exec rails assets:precompile

7. Switch to the root user (with exit), and restart the Mastodon services,

systemctl restart mastodon-sidekiq
systemctl reload mastodon-web

and optionally restart the streaming API server,

systemctl restart mastodon-streaming

And you’re done! You should now be able to see the new character limit on your Mastodon instance.

 

Sources:
https://github.com/mastodon/mastodon/issues/12265
https://github.com/kamysheblid/mastodon_max_characters
https://old.reddit.com/r/Mastodon/comments/hozl70/
https://docs.joinmastodon.org/admin/

 

1 reaktion på ”How to increase the character limit for toots in Mastodon”

Lämna en kommentar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *