Increase the post and bio character limit in Mastodon.
Table of Contents
Join our open fedi relay!
Related Documentation
Add more profile metadata fields to Mastodon
Introduction
I run the disobey.net and nautical.social Mastodon instances and I very much dislike the max character limitations in posts (toots) and in my profile bio(s). I've documented the changes i've made to increase the limits from 500 to 4096. I self-host Mastodon on a standalone server built from source, not Docker.
Directions for Mastodon v4.3.2
All file editing below is from my Mastodon root directory, "~/live".
Post increase, from 500 to 4096
vim app/validators/status_length_validator.rb
class StatusLengthValidator < ActiveModel::Validator
#MAX_CHARS = 500
MAX_CHARS = 4096
URL_PLACEHOLDER_CHARS = 23
URL_PLACEHOLDER = 'x' * 23
Note length increase, from 500 to 4096
vim app/models/account.rb
USERNAME_RE = /[a-z0-9_]+([.-]+[a-z0-9_]+)*/i
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]]+([.-]+[[:word:]]+)*)?)}
URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
USERNAME_LENGTH_LIMIT = 30
DISPLAY_NAME_LENGTH_LIMIT = 30
#NOTE_LENGTH_LIMIT = 500
NOTE_LENGTH_LIMIT = 4096
Finally
As the mastodon user:
RAILS_ENV=production bundle exec rails assets:precompile
As root user:
systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming