Mastodon 要设置 elastic search 中文优化是不是必须修改源文件?

如果是 docker 部署的是不是自己维护一个镜像比较方便?

:tmks047: 可以直接本地修改下镜像,感觉小改动另外开一个 git 还是挺麻烦的 ... 

@zeka
> Dockerfile

FROM tootsuite/mastodon:v3.4.1

# Elasticsearch 分词优化
COPY --chown=991:991 ./chewy /opt/mastodon/app/chewy

RUN echo "修改字数上限" \
&& sed -i "s|MAX_CHARS = 500|MAX_CHARS = 20000|" /opt/mastodon/app/validators/status_length_validator.rb \
&& sed -i "s|length(fulltext) > 500|length(fulltext) > 20000|" /opt/mastodon/app/javascript/mastodon/features/compose/components/compose_form.js \
&& sed -i "s|CharacterCounter max={500}|CharacterCounter max={20000}|" /opt/mastodon/app/javascript/mastodon/features/compose/components/compose_form.js \
&& echo "修改媒体上限" \
&& sed -i "s|MAX_IMAGE_PIXELS = 2073600|MAX_IMAGE_PIXELS = 9999999|" /opt/mastodon/app/javascript/mastodon/utils/resize_image.js \
&& sed -i "s|pixels: 2_073_600|pixels: 9_999_999|" /opt/mastodon/app/models/media_attachment.rb \
&& sed -i "s|IMAGE_LIMIT = 10|IMAGE_LIMIT = 80|" /opt/mastodon/app/models/media_attachment.rb \
&& sed -i "s|VIDEO_LIMIT = 40|VIDEO_LIMIT = 100|" /opt/mastodon/app/models/media_attachment.rb \
&& echo "修改投票上限" \
&& sed -i "s|options.size >= 4|options.size >= 16|" /opt/mastodon/app/javascript/mastodon/features/compose/components/poll_form.js \
&& sed -i "s|MAX_OPTIONS = 4|MAX_OPTIONS = 16|" /opt/mastodon/app/validators/poll_validator.rb \
&& echo "修改客户端接口" \
&& sed -i "s|:settings|:settings, :max_toot_chars|" /opt/mastodon/app/serializers/initial_state_serializer.rb \
&& sed -i "s|private|def max_toot_chars\n StatusLengthValidator::MAX_CHARS\n end\n\n private|" /opt/mastodon/app/serializers/initial_state_serializer.rb \
&& sed -i "s|:invites_enabled|:invites_enabled, :max_toot_chars|" /opt/mastodon/app/serializers/rest/instance_serializer.rb \
&& sed -i "s|private|def max_toot_chars\n StatusLengthValidator::MAX_CHARS\n end\n\n private|" /opt/mastodon/app/serializers/rest/instance_serializer.rb \
&& echo "重新编译资源文件" \
&& OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile \
&& yarn cache clean

关注

@fghrsh @zeka 分词优化还要改 elasticsearch 的docker

登录以加入对话
长毛象 · 壹头

长毛象是开源的微博客程序,这里没有玄学的审查和限流。本站采用原版程序,开启全文搜索(收藏)。积极治理公共时间轴,但基本不屏蔽外站。支持多账户登录,对注册和使用有要求。