character_limit.sh
· 982 B · Bash
Surowy
#!/bin/bash
# Increases post character limit on mastodon docker container
# Run from the same dir as the docker-compose.yaml file
# https://gist.github.com/adlerweb/ccc6323b77148cad06fff98c232e6212
POST_LIMIT=${1:-2000}
POLL_LIMIT=${2:-16}
POLL_POST_LIMIT=${3:-100}
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 exec --user=root web sed -i "s/MAX_OPTIONS = [0-9]\+/MAX_OPTIONS = $POLL_LIMIT/g" app/validators/poll_options_validator.rb
docker compose exec --user=root web sed -i "s/MAX_OPTION_CHARS = [0-9]\+/MAX_OPTION_CHARS = $POLL_POST_LIMIT/g" app/validators/poll_options_validator.rb
docker compose exec --user=root web bundle exec rails assets:precompile
docker compose restart web
| 1 | #!/bin/bash |
| 2 | # Increases post character limit on mastodon docker container |
| 3 | # Run from the same dir as the docker-compose.yaml file |
| 4 | # https://gist.github.com/adlerweb/ccc6323b77148cad06fff98c232e6212 |
| 5 | POST_LIMIT=${1:-2000} |
| 6 | POLL_LIMIT=${2:-16} |
| 7 | POLL_POST_LIMIT=${3:-100} |
| 8 | |
| 9 | 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 |
| 10 | docker compose exec --user=root web sed -i "s/MAX_CHARS = [0-9]\+/MAX_CHARS = $POST_LIMIT/g" app/validators/status_length_validator.rb |
| 11 | docker compose exec --user=root web sed -i "s/MAX_OPTIONS = [0-9]\+/MAX_OPTIONS = $POLL_LIMIT/g" app/validators/poll_options_validator.rb |
| 12 | docker compose exec --user=root web sed -i "s/MAX_OPTION_CHARS = [0-9]\+/MAX_OPTION_CHARS = $POLL_POST_LIMIT/g" app/validators/poll_options_validator.rb |
| 13 | |
| 14 | docker compose exec --user=root web bundle exec rails assets:precompile |
| 15 | |
| 16 | docker compose restart web |