Skip to content

Instantly share code, notes, and snippets.

@adlerweb
Last active April 18, 2025 22:09
Show Gist options
  • Save adlerweb/ccc6323b77148cad06fff98c232e6212 to your computer and use it in GitHub Desktop.
Save adlerweb/ccc6323b77148cad06fff98c232e6212 to your computer and use it in GitHub Desktop.
Mastodon v4.3.x (<4.3.4) docker post character limit change
#!/bin/bash
# Mastodon v4.3.x docker character limit change
# Does *NOT* word with >= 4.3.4 as the handling was changed
# Based on https://mpp-service.de/en/mastodon-character-limit-increase-in-a-docker-environment/
# Based on https://fouquet.me/2024/10/10/mastodon-4-3-char-limit
# ./postLimit.sh 2500 → change post limit to 2500
# Must be executed in the directory Mastodons docker-compose.yaml is located
set -e
POST_LIMIT=${1:-2500}
export TMPDIR=/tmp
docker-compose exec --user=root web sed -i "s/max_characters'], [0-9]\+/max_characters'], $POST_LIMIT)/g" app/javascript/mastodon/features/compose/containers/compose_form_container.js
docker-compose exec --user=root web sed -i "s/MAX_CHARS = [0-9]\+/MAX_CHARS = $POST_LIMIT/g" app/validators/status_length_validator.rb
docker-compose restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment