Skip to content

HowTo: Increasing the number of characters in posts in Mastodon 4.2.0

The Mastodon Logo
Das Mastodon Logo
The default character limit for new toots in Mastodon is 500. But what if you want to increase or decrease it? With Mastodon version 4.2.*, the previous instructions for adjusting or increasing the number of characters in posts are obsolete. Basically, the compose.js file is now called differently and must be edited in a different path. I show how, with a big thank you to drakfrid, whose instructions I have adapted accordingly:

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/component/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/statuslengthvalidator.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 ”:maxtootchars” after ”:registrations”, such as
:languages, :registrations, :maxtootchars,
where the full row now looks something like
:languages, :registrations, :maxtootchars, :approvalrequired, :invitesenabled

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.

5. Enter the live directory and recompile Mastodon,
RAILS_ENV=production bundle exec rails assets:precompile

6. 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.

Debian: add-apt-repository Fehlerbehebung

Bei der Verwendung des Softwareinstallationsscriptes add-apt-repository - das im Paket software-properties-common enthalten ist - auf Debian 12 kommt es zu folgender Fehlermeldung:

sudo add-apt-repository ppa:bashtop-monitor/bashtop
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 362, in
    sys.exit(0 if addaptrepo.main() else 1)
                  ^^^^^^^^^^^^^^^^^
  File "/usr/bin/add-apt-repository", line 345, in main
    shortcut = handler(source, *shortcut_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
    return handler(shortcut, *kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 86, in init
    if self.lpppa.publishdebugsymbols:
       ^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 126, in lpppa
    self.lpppa = self.lpteam.getPPAByName(name=self.ppaname)
                  ^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
    self.lpteam = self.lp.people(self.teamname)
                   ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'people'

Was ärgerlich ist, kann doch mit diesem Script eine Softwarequelle einfach zu den Systemquellen des Rechners hinzugefügt werden ohne sich groß mit den nötigen gpg Keys usw. befassen zu müssen - diese werden nämlich gleich mit heruntergeladen und installiert. Ein guter Komfortgewinn für faule User. ;-)

Die Fehlermeldung kommt von der fehlenden Python Bibliothek python3-launchpadlib. Nach Installation derselben funktioniert add-apt-repository einwandfrei.

Nach einem Hinweis von dieser Quelle bearbeitet.


cronjob