Increase maximum post characters limit for Mastodon server V4.3.0
[Mastodon] Change your maximum character count, newest guide for V4.3.0 Mastodon server admins self hosted instances.
In the newest Mastodon V4.3.0, you only need to modify one file in order for the maximum character count to be changed.
If you search for the max_characters
keyword in the Mastodon Github repository, you will see that it all points to the value within the StatusLengthValidator
and a variable called MAX_CHARS
To modify it, first, ssh into your Mastodon server, and switch to the root shell:
sudo -s
Then, switch to the Mastodon user
su - mastodon
Now, modify the validator file:
nano -w live/app/validators/status_length_validator.rb
At the very top of the file, you will see the MAX_CHARS
variable, which was by default 500, you can modify it to another integer, for example 3000 to allow a maximum of 3000 characters within each post.
# frozen_string_literal: true
class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = 3000
URL_PLACEHOLDER_CHARS = 23
URL_PLACEHOLDER = 'x' * 23
That's how you do it! Now, exit to root shell and restart the Mastodon processes, or simply reboot.
mastodon@Mastodon:~$ exit
logout
root@Mastodon:/home/ubuntu# systemctl restart mastodon*
root@Mastodon:/home/ubuntu#
Bonus: Reading maximum character count
You can read the custom character count from the /api/v1/instance
endpoint, and find the character count in the Root/configuration/statuses/max_chatacters as an integer.