Last active
February 11, 2023 00:31
-
-
Save djpadz/3c00c8a2f7f424394845c584238cf3a7 to your computer and use it in GitHub Desktop.
Patch the mastodon server to allow 5000-character toots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Last tested version: 4.1.0 | |
set -e | |
set -x | |
cd "${BASH_SOURCE%/*}" | |
patch -p0 <<'EOF' | |
diff -Naur live/app/javascript/mastodon/features/compose/components/compose_form.js live/app/javascript/mastodon/features/compose/components/compose_form.js.mod | |
--- live/app/javascript/mastodon/features/compose/components/compose_form.js 2022-11-18 22:09:53.733496609 +0000 | |
+++ live/app/javascript/mastodon/features/compose/components/compose_form.js.mod 2022-11-18 22:09:54.733496609 +0000 | |
@@ -90,7 +90,7 @@ class ComposeForm extends ImmutablePureComponent { | |
const fulltext = this.getFulltextForCharacterCounting(); | |
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0; | |
- return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia)); | |
+ return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 5000 || (isOnlyWhitespace && !anyMedia)); | |
}; | |
handleSubmit = (e) => { | |
@@ -280,7 +280,7 @@ class ComposeForm extends ImmutablePureComponent { | |
</div> | |
<div className='character-counter__wrapper'> | |
- <CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} /> | |
+ <CharacterCounter max={5000} text={this.getFulltextForCharacterCounting()} /> | |
</div> | |
</div> | |
diff -Naur live/app/validators/status_length_validator.rb live/app/validators/status_length_validator.rb.mod | |
--- live/app/validators/status_length_validator.rb 2022-11-18 22:09:53.733496609 +0000 | |
+++ live/app/validators/status_length_validator.rb.mod 2022-11-18 22:09:53.733496609 +0000 | |
@@ -1,7 +1,7 @@ | |
# frozen_string_literal: true | |
class StatusLengthValidator < ActiveModel::Validator | |
- MAX_CHARS = 500 | |
+ MAX_CHARS = 5000 | |
URL_PLACEHOLDER_CHARS = 23 | |
URL_PLACEHOLDER = 'x' * 23 | |
EOF | |
cd live | |
RAILS_ENV=production bundle exec rails assets:clean | |
RAILS_ENV=production bundle exec rails assets:precompile | |
cat <<'EOF' | |
Now run the following commands as root: | |
systemctl restart mastodon-sidekiq | |
systemctl reload mastodon-web | |
systemctl restart mastodon-streaming | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment