Post

Increasing Mastodons post size

Mastodon comes with a default post size of 500 characters. This is not set in stone, and can be increased fairly easily (last tested on Mastodon 4.2.0):

Edit live/app/javascript/mastodon/features/compose/components/compose_form.js (pre-v4.2.0) or live/app/javascript/mastodon/features/compose/components/compose_form.jsx (v4.2.0+), search for the number 500 and replace it (should pop up twice)

Edit live/app/validators/status_length_validator.rb, search for the number 500 again and replace it (should show up once)

Edit live/app/serializers/rest/instance_serializer.rb, search for the block

1
2
3
attributes :domain, :title, :version, :source_url, :description,
           :usage, :thumbnail, :languages, :configuration,
           :registrations

and add , :max_post_chars behind :registrations, so it becomes

1
2
3
attributes :domain, :title, :version, :source_url, :description,
           :usage, :thumbnail, :languages, :configuration,
           :registrations, :max_post_chars

At the bottom of that same file, before the keyword private, add the following block (replacing YOUR_POST_LENGTH with the number of chars you want):

1
2
3
def max_post_chars
  YOUR_POST_LENGTH
end

Now recompile Mastodon (as the Mastodon user):

1
2
cd live
RAILS_ENV=production bundle exec rails assets:precompile

Restart Mastodon (as root, or via sudo):

1
systemctl restart mastodon-sidekiq.service mastodon-streaming.service mastodon-web.service

Now your post length will be whatever you chose ;)

This post is licensed under CC BY 4.0 by the author.