Compare commits

...

78 Commits

Author SHA1 Message Date
mashirozx 08f1fe29ff feat: add Prometheus exporter metrics 9 months ago
mashirozx 76aac746c4 perf: add bot check box warning text 9 months ago
mashirozx 8d995f5806 perf: bump api rate limit 300=>600 9 months ago
Mashiro ff98d23ff8 build(deps): fixup rouge version 9 months ago
Mashiro b7019ff600 ci: upgrade docker/build-push-action@v2 9 months ago
mashirozx bfdb08af43 fix: quote account click in detailed status 9 months ago
Mashiro 98df72434d ci: disable i18n check 9 months ago
mashirozx 296ab34942 build(deps): bump rouge 9 months ago
mashirozx 87a5125445 fix: change drag upload image limit 4 => 9 9 months ago
mashirozx 9bc1ac5d1e build: bump rouge version 9 months ago
mashirozx 74b2e5bb8b fix: add auth page styles in neon-city 9 months ago
mashirozx 92d6e84d24 build: remove ruby and bundle version lock 9 months ago
mashirozx 0532b24e46 fix: revert local account check 9 months ago
mashirozx bb7fd8a4f9 fix: [WIP] rspec 9 months ago
mashirozx 23b2120378 feat: revert auto follow feature for admins 9 months ago
mashirozx 60c440843d build: switch fontawesome to github repo 9 months ago
mashirozx dfab6c8385 build: add rails host config to development environment 9 months ago
mashirozx c4f9a2c655 fix: normalize i18n (bundle) 9 months ago
mashirozx 367095d3e5 fix: accounts controller sytax mistake & bump sidekiq-statistic 9 months ago
Mashiro ca17753927 docs: add CI badges in README 9 months ago
mashirozx 4e7bd71e0a ci: switch workflow to main branch 9 months ago
Mashiro 22644ac25f feat: add iframe fullscreen button (#257) 9 months ago
mashirozx 5860a0b29e fix: change unlisted quote display 9 months ago
mashirozx f170023a21 fix: rich-content iframe button style 9 months ago
mashirozx 0aca2306c7 feat: display external link preview card in quotation 9 months ago
mashirozx f4e11f3530 fix: add secondary-text-color output 9 months ago
mashirozx 92c36b22f1 feat: add custom full width iframe support 9 months ago
mashirozx 9914df902f fix: move local only icon to header 9 months ago
noellabo 47f7c6ac74 feat: move bookmark to action bar 9 months ago
noellabo a8958a77ea feat: add quote and bookmark button in PiP 9 months ago
noellabo 51e4d70862 fix: fixup video modal handler in quotation 9 months ago
mashirozx d68b0c3126 feat: disable feed for bot account 9 months ago
mashirozx b0d6c90d82 fix: change quote video height to 1/1 9 months ago
mashirozx b44e5e0dfc fix: support remote code block highlight (rouge) 9 months ago
mashirozx e5caab3d95 feat: add RaRuRe theme 9 months ago
noellabo 44fc9c14cf fix: expand video on public page for quote 9 months ago
noellabo 7a50b1cf27 feat: add support for WebP and HEIC formats through conversion 9 months ago
mashirozx 4a24214fb7 feat: add user custom css option 9 months ago
mashirozx e10f055f03 fix: fixup neon-city theme 9 months ago
mashirozx 35eeddd0e0 feat: Media Sudoku (media attachments limit 4 -> 9) 9 months ago
mashirozx ae8db317a4 feat: add password option to account create CLI 9 months ago
mashirozx df54c7eedf fix: bot accounts shall be searchable 9 months ago
mashirozx 98b6a31494 feat: exclude bots statuses from Elasticsearch 9 months ago
mashirozx 7cc0242ae9 fix: remove bot statuses in React from LTL (TODO: remove from Redux) 9 months ago
mashirozx e6a432fa71 feat: exclude bot statuses from LTL 9 months ago
mashirozx 9ef5a2ebc2 fix: status public page crash caused by missing remote media opengraph 9 months ago
mashirozx c55149ea3a feat: insert remote media with short code 9 months ago
mashirozx da61b24003 docs: add notes to README 9 months ago
mashirozx 40cbb1d529 feat: snowfall effect 9 months ago
mashirozx 160fd09a45 fix: remove unused theme fonts 9 months ago
mashirozx f81bcea990 docs: update invite request hint 9 months ago
mashirozx 97d4222a6b feat: RSSHub translation endpoint support 9 months ago
mashirozx 6ca618477f fix: remove RTL in quote indicator 9 months ago
mashirozx f0942b8c6f chore: add gem version lock 9 months ago
mashirozx b4ece1c7da fix: update media model handlers in quotation 9 months ago
Mashiro c2bd3b92d3 fixup: change rucaptcha redis cache storage 9 months ago
Mashiro e3bdb944d5 feat: add captcha to registration form 9 months ago
mashirozx 61657b935e feat: make media file size limit configurable 9 months ago
mashirozx 730e12eda3 feat: make character limit configurable 9 months ago
mashirozx b9099b3e6e feat: enhance join reason display in admin UI 9 months ago
mashirozx 8d18ef9120 chore: add Github workflow for master branch 9 months ago
mashirozx 5e6f4f72c4 chore: add translation server and markdown image proxy configuration 9 months ago
Mashiro d154b83a99 feat: squash commits before 2020.11.09 (#253) 9 months ago
Mashiro b58d32cfe2
Enhance dashboard styles (#16884) 9 months ago
Claire 3f9b28ce26
Add support for fetching Create and Announce activities by URI (#16383) 9 months ago
dependabot[bot] 70931fd687
Bump babel-jest from 27.2.5 to 27.3.1 (#16879) 9 months ago
dependabot[bot] 8f06e2b4e7
Bump jest from 27.2.5 to 27.3.0 (#16874) 9 months ago
dependabot[bot] 34ea929f40
Bump axios from 0.22.0 to 0.23.0 (#16875) 9 months ago
dependabot[bot] d314954093
Bump utf-8-validate from 5.0.6 to 5.0.7 (#16872) 9 months ago
dependabot[bot] 1071e10ca4
Bump rubocop-rails from 2.12.3 to 2.12.4 (#16869) 9 months ago
dependabot[bot] 0f43404d9e
Bump puma from 5.5.1 to 5.5.2 (#16870) 9 months ago
dependabot[bot] 4d9e1fd255
Bump webpack-bundle-analyzer from 4.4.2 to 4.5.0 (#16871) 9 months ago
dependabot[bot] 2dac5ae167
Bump bufferutil from 4.0.4 to 4.0.5 (#16876) 9 months ago
dependabot[bot] 8a786e02f8
Bump sass from 1.42.1 to 1.43.2 (#16877) 9 months ago
dependabot[bot] db54a1d56d
Bump redis from 4.4.0 to 4.5.1 (#16868) 9 months ago
dependabot[bot] b6f7ea1fd3
Bump babel-jest from 27.2.5 to 27.3.0 (#16873) 9 months ago
dependabot[bot] 6f76ca59a9
Bump eslint-plugin-import from 2.24.2 to 2.25.2 (#16878) 9 months ago
dependabot[bot] be00267084
Bump tzinfo-data from 1.2021.3 to 1.2021.4 (#16867) 9 months ago
  1. 32
      .env.production.sample
  2. 22
      .github/dependabot.yml
  3. 4
      .github/workflows/check-i18n.yml
  4. 23
      .github/workflows/docker-build-dev.yml
  5. 44
      .github/workflows/docker-build-main.yml
  6. 1
      .gitignore
  7. 10
      Gemfile
  8. 41
      Gemfile.lock
  9. 13
      README.md
  10. 3
      app/chewy/accounts_index.rb
  11. 14
      app/chewy/statuses_index.rb
  12. 13
      app/chewy/tags_index.rb
  13. 8
      app/controllers/accounts_controller.rb
  14. 2
      app/controllers/api/v1/accounts/credentials_controller.rb
  15. 19
      app/controllers/api/v1/accounts_controller.rb
  16. 27
      app/controllers/api/v1/custom_emojis_controller.rb
  17. 8
      app/controllers/api/v1/statuses_controller.rb
  18. 11
      app/controllers/auth/registrations_controller.rb
  19. 10
      app/controllers/custom_css_controller.rb
  20. 4
      app/controllers/settings/preferences_controller.rb
  21. 52
      app/controllers/translate_controller.rb
  22. 2
      app/helpers/mascot_helper.rb
  23. BIN
      app/javascript/fonts/witchesAwesome/witchesAwesome.eot
  24. 17
      app/javascript/fonts/witchesAwesome/witchesAwesome.svg
  25. BIN
      app/javascript/fonts/witchesAwesome/witchesAwesome.ttf
  26. BIN
      app/javascript/fonts/witchesAwesome/witchesAwesome.woff
  27. BIN
      app/javascript/images/elephant-fren_sub.png
  28. BIN
      app/javascript/images/elephant_ui_disappointed_sub.png
  29. BIN
      app/javascript/images/elephant_ui_plane_sub.png
  30. BIN
      app/javascript/images/elephant_ui_working_sub.png
  31. 2
      app/javascript/images/google_logo.svg
  32. 42
      app/javascript/mastodon/actions/compose.js
  33. 28
      app/javascript/mastodon/actions/importer/normalizer.js
  34. 25
      app/javascript/mastodon/actions/statuses.js
  35. 3
      app/javascript/mastodon/common.js
  36. 4
      app/javascript/mastodon/components/animated_number.js
  37. 16
      app/javascript/mastodon/components/icon.js
  38. 160
      app/javascript/mastodon/components/media_gallery.js
  39. 2
      app/javascript/mastodon/components/missing_indicator.js
  40. 5
      app/javascript/mastodon/components/poll.js
  41. 2
      app/javascript/mastodon/components/regeneration_indicator.js
  42. 191
      app/javascript/mastodon/components/status.js
  43. 11
      app/javascript/mastodon/components/status_action_bar.js
  44. 135
      app/javascript/mastodon/components/status_content.js
  45. 3
      app/javascript/mastodon/components/status_list.js
  46. 29
      app/javascript/mastodon/containers/status_container.js
  47. 1
      app/javascript/mastodon/features/community_timeline/index.js
  48. 15
      app/javascript/mastodon/features/compose/components/compose_form.js
  49. 272
      app/javascript/mastodon/features/compose/components/content_type_dropdown.js
  50. 55
      app/javascript/mastodon/features/compose/components/cw_mark_button.js
  51. 4
      app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
  52. 250
      app/javascript/mastodon/features/compose/components/federation_dropdown.js
  53. 2
      app/javascript/mastodon/features/compose/components/poll_form.js
  54. 71
      app/javascript/mastodon/features/compose/components/quote_indicator.js
  55. 10
      app/javascript/mastodon/features/compose/components/search_results.js
  56. 2
      app/javascript/mastodon/features/compose/containers/compose_form_container.js
  57. 24
      app/javascript/mastodon/features/compose/containers/content_type_dropdown_container.js
  58. 24
      app/javascript/mastodon/features/compose/containers/federation_dropdown_container.js
  59. 24
      app/javascript/mastodon/features/compose/containers/quote_indicator_container.js
  60. 6
      app/javascript/mastodon/features/compose/containers/spoiler_button_container.js
  61. 2
      app/javascript/mastodon/features/compose/containers/upload_button_container.js
  62. 2
      app/javascript/mastodon/features/compose/index.js
  63. 2
      app/javascript/mastodon/features/getting_started/components/announcements.js
  64. 3
      app/javascript/mastodon/features/getting_started/index.js
  65. 52
      app/javascript/mastodon/features/picture_in_picture/components/footer.js
  66. 9
      app/javascript/mastodon/features/status/components/action_bar.js
  67. 112
      app/javascript/mastodon/features/status/components/card.js
  68. 123
      app/javascript/mastodon/features/status/components/detailed_status.js
  69. 8
      app/javascript/mastodon/features/status/containers/detailed_status_container.js
  70. 48
      app/javascript/mastodon/features/status/index.js
  71. 2
      app/javascript/mastodon/features/ui/components/link_footer.js
  72. 2
      app/javascript/mastodon/features/ui/index.js
  73. 9
      app/javascript/mastodon/features/video/index.js
  74. 8
      app/javascript/mastodon/locales/ar.json
  75. 8
      app/javascript/mastodon/locales/ast.json
  76. 5
      app/javascript/mastodon/locales/bn.json
  77. 8
      app/javascript/mastodon/locales/br.json
  78. 8
      app/javascript/mastodon/locales/ca.json
  79. 8
      app/javascript/mastodon/locales/co.json
  80. 5
      app/javascript/mastodon/locales/cs.json
  81. 8
      app/javascript/mastodon/locales/cy.json
  82. 2
      app/javascript/mastodon/locales/da.json
  83. 8
      app/javascript/mastodon/locales/de.json
  84. 87
      app/javascript/mastodon/locales/defaultMessages.json
  85. 8
      app/javascript/mastodon/locales/el.json
  86. 20
      app/javascript/mastodon/locales/en.json
  87. 8
      app/javascript/mastodon/locales/eo.json
  88. 8
      app/javascript/mastodon/locales/es-AR.json
  89. 8
      app/javascript/mastodon/locales/es.json
  90. 8
      app/javascript/mastodon/locales/et.json
  91. 8
      app/javascript/mastodon/locales/eu.json
  92. 3
      app/javascript/mastodon/locales/fa.json
  93. 8
      app/javascript/mastodon/locales/fi.json
  94. 8
      app/javascript/mastodon/locales/fr.json
  95. 8
      app/javascript/mastodon/locales/ga.json
  96. 8
      app/javascript/mastodon/locales/gl.json
  97. 8
      app/javascript/mastodon/locales/he.json
  98. 8
      app/javascript/mastodon/locales/hi.json
  99. 2
      app/javascript/mastodon/locales/hr.json
  100. 8
      app/javascript/mastodon/locales/hu.json
  101. Some files were not shown because too many files have changed in this diff Show More

32
.env.production.sample

@ -58,3 +58,35 @@ S3_BUCKET=files.example.com
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
S3_ALIAS_HOST=files.example.com
##
## follow to the end of file is configuration for mashirozx's fork
##
# git display repo
GITHUB_REPOSITORY=mashirozx/mastodon
## there are two kinds of free Google translate API
# high performance translation server (https://github.com/mashirozx/google-translate-server)
# NB: Google forbiden requests of this endpoint from most VPS IDCs
TRANSLATION_SERVER_HOST=http://translate:30031
# RSSHub based translate API (https://github.com/mashirozx/RSSHub)
TRANSLATION_SERVER_TYPE=rsshub
TRANSLATION_SERVER_HOST=http://rsshub.example.com
# markdown proxy
IMAGE_PROXY_HOST=https://images.weserv.nl
IMAGE_PROXY_PATH=https://images.weserv.nl/?n=-1&il&default=ssl:images.weserv.nl/?url=https://hello.2heng.xin/aws/static/d4_.png%26bg=fff&url=
# max toot charactor limit
MAX_TOOT_CHARS=500
# max media file size
IMAGE_LIMIT=10
VIDEO_LIMIT=40
AVATAR_LIMIT=2
HEADER_LIMIT=2
# allow insert remote media with url on toots
# MEDIA: [https://example.com/example.png]
ALLOW_REMOTE_MEDIA_TAG=true

22
.github/dependabot.yml

@ -1,22 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 99
allow:
- dependency-type: direct
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 99
allow:
- dependency-type: direct

4
.github/workflows/check-i18n.yml

@ -2,9 +2,9 @@ name: Check i18n
on:
push:
branches: [ main ]
branches: [ main_ ]
pull_request:
branches: [ main ]
branches: [ main_ ]
env:
RAILS_ENV: test

23
.github/workflows/docker-build-dev.yml

@ -0,0 +1,23 @@
name: Build and Push Dev Image to Docker Hub
on:
push:
branches:
- dev
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: 🔍 Checkout code
uses: actions/checkout@v2
- name: ⚓ Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: mashirozx/mastodon
tag_with_ref: true
tag_with_sha: true

44
.github/workflows/docker-build-main.yml

@ -0,0 +1,44 @@
name: Build and Push Alpha Image to Docker Hub
on:
push:
branches:
- main
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: 🔍 Checkout code
uses: actions/checkout@v2
- name: 🏗 Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: 🔑 Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: ⚓ Build and push
uses: docker/build-push-action@v2
with:
context: .
pull: true
push: true
# build-args: |
# arg1=value1
# arg2=value2
cache-from: type=registry,ref=mashirozx/mastodon:alpha
cache-to: type=inline
tags: mashirozx/mastodon:alpha
# - name: ⚓ Build and push Docker images
# uses: docker/build-push-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: mashirozx/mastodon
# tags: alpha

1
.gitignore vendored

@ -25,6 +25,7 @@
.env
.env.production
.env.development
.env.development.sample
/node_modules/
/build/

10
Gemfile

@ -1,4 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: truey
source 'https://rubygems.org'
ruby '>= 2.5.0', '< 3.1.0'
@ -58,6 +58,9 @@ gem 'http_accept_language', '~> 2.1'
gem 'httplog', '~> 1.5.0'
gem 'idn-ruby', require: 'idn'
gem 'kaminari', '~> 1.2'
gem 'kramdown', '~> 2.3'
gem 'kramdown-parser-gfm', '~> 1.1'
gem 'rouge', '~> 3.21'
gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.3.1', require: 'mime/types/columnar'
gem 'nokogiri', '~> 1.12'
@ -72,7 +75,7 @@ gem 'rack-attack', '~> 6.5'
gem 'rack-cors', '~> 1.1', require: 'rack/cors'
gem 'rails-i18n', '~> 6.0'
gem 'rails-settings-cached', '~> 0.6'
gem 'redis', '~> 4.4', require: ['redis', 'redis/connection/hiredis']
gem 'redis', '~> 4.5', require: ['redis', 'redis/connection/hiredis']
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
gem 'rqrcode', '~> 2.1'
gem 'ruby-progressbar', '~> 1.11'
@ -82,6 +85,7 @@ gem 'sidekiq', '~> 6.2'
gem 'sidekiq-scheduler', '~> 3.1'
gem 'sidekiq-unique-jobs', '~> 7.1'
gem 'sidekiq-bulk', '~>0.2.0'
gem 'sidekiq-prometheus-exporter', '~> 0.1'
gem 'simple-navigation', '~> 4.3'
gem 'simple_form', '~> 5.1'
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
@ -152,4 +156,6 @@ end
gem 'concurrent-ruby', require: false
gem 'connection_pool', require: false
gem 'rucaptcha', git: 'https://github.com/huacnlee/rucaptcha', ref: '3e8361a06521c45811d1487cceb41dc524ab9b69', branch: 'main'
gem "sidekiq-statistic"
gem 'xorcist', '~> 1.1'

41
Gemfile.lock

@ -1,3 +1,12 @@
GIT
remote: https://github.com/huacnlee/rucaptcha
revision: 3e8361a06521c45811d1487cceb41dc524ab9b69
ref: 3e8361a06521c45811d1487cceb41dc524ab9b69
branch: main
specs:
rucaptcha (2.5.5)
railties (>= 3.2)
GEM
remote: https://rubygems.org/
specs:
@ -316,6 +325,10 @@ GEM
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
kt-paperclip (7.0.1)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
@ -422,7 +435,7 @@ GEM
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.6)
puma (5.5.1)
puma (5.5.2)
nio4r (~> 2.0)
pundit (2.1.1)
activesupport (>= 3.0.0)
@ -479,7 +492,7 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.4.0)
rdf (~> 3.1)
redis (4.4.0)
redis (4.5.1)
redis-namespace (1.8.1)
redis (>= 3.0.4)
regexp_parser (2.1.1)
@ -490,6 +503,7 @@ GEM
railties (>= 5.0)
rexml (3.2.5)
rotp (6.2.0)
rouge (3.26.0)
rpam2 (4.0.2)
rqrcode (2.1.0)
chunky_png (~> 1.0)
@ -528,7 +542,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.12.0)
parser (>= 3.0.1.1)
rubocop-rails (2.12.3)
rubocop-rails (2.12.4)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
@ -555,6 +569,8 @@ GEM
redis (>= 4.2.0)
sidekiq-bulk (0.2.0)
sidekiq
sidekiq-prometheus-exporter (0.1.15)
sidekiq (>= 3.3.1)
sidekiq-scheduler (3.1.0)
e2mmap
redis (>= 3, < 5)
@ -562,6 +578,9 @@ GEM
sidekiq (>= 3)
thwait
tilt (>= 1.4.0)
sidekiq-statistic (1.4.0)
sidekiq (>= 5.0)
tilt (~> 2.0)
sidekiq-unique-jobs (7.1.8)
brpoplpush-redis_script (> 0.1.1, <= 2.0.0)
concurrent-ruby (~> 1.0, >= 1.0.5)
@ -620,7 +639,7 @@ GEM
unf (~> 0.1.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2021.3)
tzinfo-data (1.2021.4)
tzinfo (>= 1.0.0)
unf (0.1.4)
unf_ext
@ -715,6 +734,8 @@ DEPENDENCIES
json-ld
json-ld-preloaded (~> 3.1)
kaminari (~> 1.2)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
kt-paperclip (~> 7.0)
letter_opener (~> 1.7)
letter_opener_web (~> 1.4)
@ -753,8 +774,9 @@ DEPENDENCIES
rails-i18n (~> 6.0)
rails-settings-cached (~> 0.6)
rdf-normalize (~> 0.4)
redis (~> 4.4)
redis (~> 4.5)
redis-namespace (~> 1.8)
rouge (~> 3.21)
rqrcode (~> 2.1)
rspec-rails (~> 5.0)
rspec-sidekiq (~> 3.1)
@ -762,11 +784,14 @@ DEPENDENCIES
rubocop (~> 1.22)
rubocop-rails (~> 2.12)
ruby-progressbar (~> 1.11)
rucaptcha!
sanitize (~> 6.0)
scenic (~> 1.5)
sidekiq (~> 6.2)
sidekiq-bulk (~> 0.2.0)
sidekiq-prometheus-exporter (~> 0.1)
sidekiq-scheduler (~> 3.1)
sidekiq-statistic
sidekiq-unique-jobs (~> 7.1)
simple-navigation (~> 4.3)
simple_form (~> 5.1)
@ -785,3 +810,9 @@ DEPENDENCIES
webpacker (~> 5.4)
webpush (~> 0.3)
xorcist (~> 1.1)
RUBY VERSION
ruby 2.7.2p137
BUNDLED WITH
2.1.4

13
README.md

@ -1,3 +1,16 @@
**Mastodon fork for <https://hello.2heng.xin>**
[![Maintainability](https://api.codeclimate.com/v1/badges/1644d6adc0f9d1bbae6a/maintainability)](https://codeclimate.com/github/mashirozx/mastodon/maintainability)
[![DeepSource](https://deepsource.io/gh/mashirozx/mastodon.svg/?label=active+issues)](https://deepsource.io/gh/mashirozx/mastodon/?ref=repository-badge)
[![CircleCI](https://circleci.com/gh/mashirozx/mastodon.svg?style=svg)](https://circleci.com/gh/tootsuite/mastodon)
[![DockerHub](https://img.shields.io/docker/pulls/mashirozx/mastodon.svg?logo=docker&color=2496ED)](https://hub.docker.com/r/mashirozx/mastodon)
[![Build and Push Alpha Image to Docker Hub](https://github.com/mashirozx/mastodon/workflows/Build%20and%20Push%20Alpha%20Image%20to%20Docker%20Hub/badge.svg)](https://github.com/mashirozx/mastodon/actions/workflows/docker-build-main.yml)
This is a rebase fork of tootsuite/mastodon, all local changes are rebased on the top. To pull the latest commits of this repo, use `git reset --hard origin/master` instead of `git pull`.
To apply the new custom features, please add the necessary configurations first according to the file end of `.env.production.sample`.
![Mastodon](https://i.imgur.com/NhZc40l.png)
========

3
app/chewy/accounts_index.rb

@ -4,7 +4,8 @@ class AccountsIndex < Chewy::Index
settings index: { refresh_interval: '5m' }, analysis: {
analyzer: {
content: {
tokenizer: 'whitespace',
#tokenizer: 'whitespace',
tokenizer: 'ik_max_word',
filter: %w(lowercase asciifolding cjk_width),
},

14
app/chewy/statuses_index.rb

@ -16,9 +16,18 @@ class StatusesIndex < Chewy::Index
language: 'possessive_english',
},
},
char_filter: {
tsconvert: {
type: 'stconvert',
keep_both: false,
delimiter: '#',
convert_type: 't2s',
},
},
analyzer: {
content: {
tokenizer: 'uax_url_email',
#tokenizer: 'uax_url_email',
tokenizer: 'ik_max_word',
filter: %w(
english_possessive_stemmer
lowercase
@ -27,11 +36,12 @@ class StatusesIndex < Chewy::Index
english_stop
english_stemmer
),
char_filter: %w(tsconvert),
},
},
}
define_type ::Status.unscoped.kept.without_reblogs.includes(:media_attachments, :preloadable_poll) do
define_type ::Status.unscoped.kept.without_reblogs.excluding_bots_accounts.includes(:media_attachments, :preloadable_poll) do
crutch :mentions do |collection|
data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local, silent: false).pluck(:status_id, :account_id)
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }

13
app/chewy/tags_index.rb

@ -2,10 +2,21 @@
class TagsIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: {
char_filter: {
tsconvert: {
type: 'stconvert',
keep_both: false,
delimiter: '#',
convert_type: 't2s',
},
},
analyzer: {
content: {
tokenizer: 'keyword',
#tokenizer: 'keyword',
tokenizer: 'ik_max_word',
filter: %w(lowercase asciifolding cjk_width),
char_filter: %w(tsconvert),
},
edge_ngram: {

8
app/controllers/accounts_controller.rb

@ -42,7 +42,7 @@ class AccountsController < ApplicationController
expires_in 1.minute, public: true
limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE
@statuses = filtered_statuses.without_reblogs.limit(limit)
@statuses = filtered_statuses.without_reblogs.without_local_only.limit(limit)
@statuses = cache_collection(@statuses, Status)
render xml: RSS::AccountSerializer.render(@account, @statuses, params[:tag])
end
@ -73,7 +73,11 @@ class AccountsController < ApplicationController
end
def default_statuses
@account.statuses.where(visibility: [:public, :unlisted])
if current_user.nil?
@account.statuses.without_local_only.where(visibility: [:public, :unlisted])
else
@account.statuses.where(visibility: [:public, :unlisted])
end
end
def only_media_scope

2
app/controllers/api/v1/accounts/credentials_controller.rb

@ -33,6 +33,8 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
'setting_default_privacy' => source_params.fetch(:privacy, @account.user.setting_default_privacy),
'setting_default_sensitive' => source_params.fetch(:sensitive, @account.user.setting_default_sensitive),
'setting_default_language' => source_params.fetch(:language, @account.user.setting_default_language),
'setting_default_federation' => source_params.fetch(:federation, @account.user.setting_default_federation),
'setting_default_content_type' => source_params.fetch(:content_type, @account.user.setting_default_content_type),
}
end
end

19
app/controllers/api/v1/accounts_controller.rb

@ -20,13 +20,18 @@ class Api::V1::AccountsController < Api::BaseController
end
def create
token = AppSignUpService.new.call(doorkeeper_token.application, request.remote_ip, account_params)
response = Doorkeeper::OAuth::TokenResponse.new(token)
headers.merge!(response.headers)
self.response_body = Oj.dump(response.body)
self.status = response.status
if Setting.enable_captcha
# disable registration via Rest API when captcha enabled
not_found
else
token = AppSignUpService.new.call(doorkeeper_token.application, request.remote_ip, account_params)
response = Doorkeeper::OAuth::TokenResponse.new(token)
headers.merge!(response.headers)
self.response_body = Oj.dump(response.body)
self.status = response.status
end
rescue ActiveRecord::RecordInvalid => e
render json: ValidationErrorFormatter.new(e, :'account.username' => :username, :'invite_request.text' => :reason).as_json, status: :unprocessable_entity
end

27
app/controllers/api/v1/custom_emojis_controller.rb

@ -1,10 +1,29 @@
# frozen_string_literal: true
class Api::V1::CustomEmojisController < Api::BaseController
skip_before_action :set_cache_headers
before_action :set_tags
def index
expires_in 3.minutes, public: true
render_with_cache(each_serializer: REST::CustomEmojiSerializer) { CustomEmoji.listed.includes(:category) }
@tags = set_tags
# must cache in Nginx side, or should use original render_with_cache method
render json: @tags, each_serializer: REST::CustomEmojiSerializer
end
private
def custom_emojis_params
params.slice(:range).permit(:range)
end
def set_tags
@range = custom_emojis_params[:range]
case @range
when 'all'
CustomEmoji.fullist.includes(:category)
when 'unlisted'
CustomEmoji.unlisted.includes(:category)
else
CustomEmoji.listed.includes(:category)
end
end
end

8
app/controllers/api/v1/statuses_controller.rb

@ -46,7 +46,10 @@ class Api::V1::StatusesController < Api::BaseController
application: doorkeeper_token.application,
poll: status_params[:poll],
idempotency: request.headers['Idempotency-Key'],
with_rate_limit: true)
with_rate_limit: true,
content_type: status_params[:content_type], #'text/markdown'
local_only: status_params[:local_only],
quote_id: status_params[:quote_id].presence)
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
end
@ -85,6 +88,9 @@ class Api::V1::StatusesController < Api::BaseController
:spoiler_text,
:visibility,
:scheduled_at,
:content_type,
:local_only,
:quote_id,
media_ids: [],
poll: [
:multiple,

11
app/controllers/auth/registrations_controller.rb

@ -15,6 +15,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
before_action :require_not_suspended!, only: [:update]
before_action :set_cache_headers, only: [:edit, :update]
before_action :set_registration_form_time, only: :new
before_action :check_captcha, only: [:create]
skip_before_action :require_functional!, only: [:edit, :update]
@ -101,6 +102,16 @@ class Auth::RegistrationsController < Devise::RegistrationsController
private
# https://github.com/heartcombo/devise/wiki/How-To:-Use-Recaptcha-with-Devise
def check_captcha
if Setting.enable_captcha && !verify_rucaptcha?
build_resource(sign_up_params)
resource.validate
resource.errors.add(:base, I18n.t('auth.rucaptcha_invalid'))
respond_with resource
end
end
def set_instance_presenter
@instance_presenter = InstancePresenter.new
end

10
app/controllers/custom_css_controller.rb

@ -11,6 +11,16 @@ class CustomCssController < ApplicationController
before_action :set_cache_headers
def show
return site_setting unless user_signed_in?
sha = Digest::SHA1.hexdigest("#{Setting.custom_css}\n#{current_user.setting_custom_css}")
return site_setting unless params[:sha] = sha
expires_in 3.minutes, public: true
render plain: "#{Setting.custom_css}\n#{current_user.setting_custom_css}" || '', content_type: 'text/css'
end
def site_setting
expires_in 3.minutes, public: true
request.session_options[:skip] = true
render plain: Setting.custom_css || '', content_type: 'text/css'

4
app/controllers/settings/preferences_controller.rb

@ -36,6 +36,8 @@ class Settings::PreferencesController < Settings::BaseController
:setting_default_privacy,
:setting_default_sensitive,
:setting_default_language,
:setting_default_federation,
:setting_default_content_type,
:setting_unfollow_modal,
:setting_boost_modal,
:setting_delete_modal,
@ -44,6 +46,8 @@ class Settings::PreferencesController < Settings::BaseController
:setting_expand_spoilers,
:setting_reduce_motion,
:setting_disable_swiping,
:setting_enable_snowfall,
:setting_custom_css,
:setting_system_font_ui,
:setting_noindex,
:setting_theme,

52
app/controllers/translate_controller.rb

@ -0,0 +1,52 @@
# frozen_string_literal: true
class TranslateController < ApplicationController
before_action :authenticate_user!
def create
if !user_signed_in?
render json: {
'text' => I18n.t('errors.login_to_translate'),
}
return
end
if !ENV['TRANSLATION_SERVER_HOST']
render json: {
'text' => 'TRANSLATION_SERVER_HOST not found in ENV',
}
return
end
endpoint = ENV['TRANSLATION_SERVER_HOST']
text = params[:data][:text]
to = params[:data][:to]
if ENV['TRANSLATION_SERVER_TYPE'] == 'rsshub'
to = 'zh-CN' if to == 'zh-cn'
to = 'zh-TW' if to == 'zh-tw'
sha = Digest::SHA1.hexdigest(text)
route = "/google/translate/#{to}/#{sha}/1/auto/#{ENV['TRANSLATION_SERVER_GOOGLE_DOMAIN'] || 'com.hk'}/.json"
text = URI::encode(text)
resp = Faraday.get("#{endpoint}#{route}", { :text => text })
res = ActiveSupport::JSON.decode(resp.body)
respond = {
'text' => res['items'][0]['description'],
}
render json: respond
else
resp = Faraday.post(endpoint, text: text, to: to)
render json: ActiveSupport::JSON.decode(resp.body)
end
end
end

2
app/helpers/mascot_helper.rb

@ -2,7 +2,7 @@
module MascotHelper
def mascot_url
full_asset_url(instance_presenter.mascot&.file&.url || asset_pack_path('media/images/elephant_ui_plane.svg'))
full_asset_url(instance_presenter.mascot&.file&.url || asset_pack_path('media/images/elephant_ui_plane_sub.png'))
end
private

BIN
app/javascript/fonts/witchesAwesome/witchesAwesome.eot

Binary file not shown.

17
app/javascript/fonts/witchesAwesome/witchesAwesome.svg

@ -0,0 +1,17 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="witchesAwesome" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xf005;" glyph-name="pentagram" d="M510.58 942.996c-184.53 1.564-364.1-111.374-443.5-277.82-71.936-146.226-66.342-328.58 18.451-468.36 78.326-132.962 221-227.020 375.26-241.26 145.944-15.337 298.060 37.224 401.020 142.342 105.984 105.74 161.442 260.96 141.698 409.86-18.164 150.966-109.406 291.74-241.74 367.36-75.748 44.274-163.348 68.6-251.2 67.852zM511.955 877.938c77.94-0.729 157.286-19.971 222.44-63.578-7.158-8.725-19.113-11.948-27.078-20.040-46.696-32.916-91.812-69.998-140.008-99.496-4.173 6.813-14.93 10.826-20.378 3.172-16.031-11.647-32.062-23.296-48.094-34.942 23.094-16.779 46.19-33.556 69.282-50.34 44.97 31.004 88.074 66.636 133.816 95.274-17.166-51.494-33.696-103.874-50.704-155.656 18.421-13.383 36.84-26.77 55.258-40.156 29.234 86.76 55.21 175.018 86.082 260.98 9.726-4.959 15.409-15.588 24.35-21.924 102.536-102.164 148.168-258.24 114.116-399.22-3.055-5.326-9.686 3.308-13.18 4.891-27.878 22.42-58.158 41.804-86.642 63.53-180.662 131.518-362.56 261.94-541.92 394.86 7.143 7.717 18.841 9.481 27.284 15.763 60.014 30.712 128.128 47 195.388 46.896zM232.255 772.43c6.605-10.949 6.228-24.694 12.315-36.014 24.292-74.76 48.582-149.52 72.876-224.28 18.409 13.381 36.822 26.756 55.234 40.132-15.572 52.458-36.018 103.754-49.188 156.61 9.684-6.581 18.537-14.803 28.786-21.042 155.224-113.374 312.38-225.48 466.24-339.86-24.25-1.022-49.308 0.414-73.852-0.156h-304.36c7.037-21.67 14.079-43.338 21.118-65.008 148.86-0.743 297.74 1.358 446.58-1.051-1.687-10.938-9.977-19.945-13.5-30.464-65.992-129.252-201.8-222.5-347-231 1.308 13.86 9.436 26.764 12.66 40.508 23.322 73.804 47.778 147.244 71.536 220.96h-68.27c-18.181-51.576-32.076-105.642-52.266-155.696-34.84 108.174-70.422 216.72-105.506 325.040-3.697 11.377-7.392 22.756-11.091 34.132-18.432-13.398-36.864-26.796-55.3-40.188 45.286-141.782 93.378-282.82 136.964-425.020-10.729-1.784-21.644 3.362-32.456 3.31-143.878 22.44-273.36 122.998-327.74 258 5.131 5.323 14.995 0.113 21.772 1.506 62.562-1.498 125.252 2.248 187.736-1.444-0.818-8.085 5.479-18.17 14.637-15.129h56.062c-8.817 27.152-17.644 54.3-26.46 81.454-54.364 1.513-111.454-2.481-164.058 1.867 101.918 73.342 203.56 147.862 305.4 221.6-18.434 13.391-36.864 26.786-55.296 40.18-120.898-86.814-240.28-176.486-362.040-261.56-5.029 9.779-3.285 21.864-6.808 32.334-22.714 142.086 31.844 296.92 143.288 389.78 0.427-0.906 1.619 2.137 1.988 0.504zM627.74 480c-14.206-43.718-28.412-87.436-42.614-131.156h68.376c10.419 32.064 20.836 64.128 31.258 96.192-18.44 13.398-36.88 26.798-55.316 40.2-0.568-1.745-1.135-3.49-1.703-5.234z" />
<glyph unicode="&#xf015;" glyph-name="witch-cauldron" d="M929.929 528.641c0 44.407-82.631 83.227-205.761 104.296l90.395 296.58c3.171 10.381-2.675 21.37-13.056 24.527l-16.736 5.093c-10.374 3.175-21.34-2.678-24.511-13.056l-93.005-305.040c-47.998 5.563-100.376 8.635-155.233 8.635-230.826 0-417.948-54.207-417.948-121.039 0-24.179 24.484-46.738 66.752-65.636l-0.585-1.261c-78.199-105.224-37.609-263.071-37.609-263.071 12.372-51.995 41.812-90.671 79.59-119.419h-0.543v-61.15c-15.853 3.492-30.22-2.308-32.539-13.515-2.438-11.65 9.079-24.683 25.707-29.115 16.598-4.421 32.038 1.406 34.453 13.056l0.214 1.345 0.772 70.641c81.412-47.876 187.344-60.187 250.767-62.976l0.615-47.001c2.415-11.654 17.848-17.477 34.449-13.056 16.625 4.428 28.145 17.465 25.707 29.115-2.312 11.211-16.686 17.007-32.539 13.515v16.694c53.092 0.397 173.172 7.279 266.62 57.069l0.703-64 0.218-1.345c2.411-11.65 17.848-17.477 34.449-13.056 16.625 4.432 28.141 17.465 25.703 29.115-2.315 11.211-16.682 17.007-32.539 13.515v52.977c43.196 29.467 77.328 70.5 90.919 127.592 0 0 40.364 156.994-36.956 262.219h0.015c45.133 19.357 71.509 42.668 71.509 67.753zM512.027 439.197c-193.48 0-350.295 41.717-350.295 93.223 0 51.456 156.815 93.173 350.295 93.173 52.843 0 102.955-3.122 147.881-8.696l-4.287-14.038h-0.004c-31.179-3.049-55.552-29.356-55.552-61.345 0-2.545 0.203-5.059 0.493-7.52h122.277c0.306 2.461 0.508 4.975 0.508 7.52 0 15.303-5.598 29.306-14.829 40.081l8.062 26.46c88.256-16.908 145.703-44.487 145.703-75.635 0-51.502-156.815-93.223-350.253-93.223zM380.174 524.976c-24.068 0-43.589-19.533-43.589-43.604 0-1.792 0.145-3.565 0.359-5.307h86.464c0.225 1.742 0.371 3.515 0.371 5.307 0 24.072-19.517 43.604-43.604 43.604zM472.629 598.969c-17.431 0-31.568-14.13-31.568-31.568 0-1.307 0.107-2.587 0.267-3.844h62.617c0.157 1.257 0.252 2.537 0.252 3.844 0 17.439-14.126 31.568-31.568 31.568z" />
<glyph unicode="&#xf079;" glyph-name="ouroboros" horiz-adv-x="1009" d="M658.837 855.237c3.298-27.046-34.137-51.721-83.607-55.107-49.479-3.373-92.268 15.821-95.558 42.873-1.846 15.216 9.187 29.682 27.995 40.028 1.827 0.996 3.732 1.966 5.708 2.891 13.806 6.472 30.988 10.892 49.926 12.181 49.479 3.386 92.243-15.808 95.54-42.866zM908.111 873.649c-113.289-20.411-252.95 151.162-429.572 58.89l-0.006-0.007c-32.706-17.084-66.685-43.224-101.997-81.298-64.92-21.056-210.292-36.147-294.324-90.126-121.314-77.927 84.082-266.322 133.426-241.782 32.569 16.205 113.356 50.465 137.353 52.939l-13.982 19.598 14.422 19.265c22.087 29.474 37.247 64.302 46.674 104.158l8.092 45.862c0.104 0.762 0.214 1.511 0.298 2.272l64.877-7.702c-7.030-59.684-23.473-115.178-53.353-162.991 30.295-39.585 71.55-84.638 121.042-121.968 85.249-59.769 182.11-106.825 269.056-76.341-71.229 33.367-125.216 72.933-161.793 114.887-41.251 47.346-61.839 99.818-50.568 148.928 8.455 36.824 35.348 66.451 73.914 84.94 12.86 6.159 27.011 11.081 42.21 14.63 57.921 13.51 133.432 10.554 228.318-12.677 9.135 46.090-5.371 87.86-34.092 128.525zM779.836 686.702c-0.117 0.046-0.228 0.078-0.346 0.111-15.893 3.828-29.997 2.116-39.048 0.007-9.42-2.201-16.761-7.312-22.656-11.42-2.293-1.595-4.438-3.099-6.498-4.284-1.153-0.651-1.782-1.94-1.607-3.262 0.173-1.315 1.127-2.396 2.41-2.721l12.886-3.412-11.72-42.469-22.106 5.651c-1.037 0.248-2.164-0.072-2.961-0.814-0.79-0.755-1.14-1.856-0.953-2.936 2.449-13.653 9.705-28.745 20.979-43.648 0.333-0.436 0.764-0.781 1.263-1.003 143.921-64.623 136.099-193.932 127.049-343.675-1.16-19.141-2.352-38.941-3.187-58.368-0.026-0.142-2.592-14.59-13.036-27.821-8.442-10.697-22.087-15.925-40.888-15.346l-580.469 0.026c-2.3 0-4.555 2.272-4.555 4.584l-3.515 341.514c-49.745 8.79-136.852 84.341-166.287 153.002-22.935-32.573-24.562-59.059-24.562-101.911v-392.605c0-110.227 89.231-199.908 198.92-199.908h579.185c104.43 0 225.842 88.286 225.836 201.957l0.444 9.552c12.189 261.179 20.988 449.882-224.583 539.199z" />
<glyph unicode="&#xf0ac;" glyph-name="crystal-ball" d="M112.088 283.184l-60.647-303.221c-2.158-10.799 0.638-21.997 7.616-30.513 6.982-8.516 17.415-13.45 28.424-13.45h849.030c11.009 0 21.442 4.937 28.424 13.45 6.978 8.516 9.778 19.715 7.616 30.513l-60.647 303.221c-3.434 17.18-18.518 29.548-36.040 29.548h-727.733c-17.518 0.003-32.606-12.364-36.043-29.548zM838.184 364.187c38.647 60.233 61.102 131.799 61.102 208.524 0 213.551-173.739 387.289-387.286 387.289s-387.286-173.739-387.286-387.286c0-76.724 22.456-148.294 61.102-208.524h652.367zM512 817.619c14.208 0 25.728-11.519 25.728-25.728 0-14.212-11.519-25.731-25.728-25.731-106.668 0-193.446-86.781-193.446-193.446 0-14.208-11.519-25.728-25.731-25.728-14.208 0-25.728 11.519-25.728 25.728 0 135.040 109.865 244.905 244.905 244.905z" />
<glyph unicode="&#xf0f3;" glyph-name="raven(2)" d="M1022.389 863.166c-11.059 15.192-42.59 26.047-63.974 26.286-5.962 0.067-19.176 2.013-35.906 4.48-32.705 4.817-82.137 12.102-124.684 12.102-30.387 0-52.583-3.562-67.842-10.884-39.815-14.26-59.428-49.295-78.397-83.18-3.731-6.664-7.587-13.555-11.464-20.041-3.734-5.717-22.913-22.963-45.121-42.928-33.084-29.743-78.397-70.481-105.435-102.382-35.475-41.856-72.59-78.115-108.481-113.179-51.345-50.16-104.436-102.030-156.375-173.082-12.713-17.397-16.971-29.927-13.013-38.315 4.963-10.509 21.166-11.441 34.179-12.189 5.505-0.315 15.745-0.906 16.275-2.819 0.687-2.496-5.181-11.449-52.24-43.333l-0.259-0.198c-50.824-43.447-177.634-159.090-178.948-160.29-4.718-4.465-6.53-8.63-5.388-12.375 1.29-4.223 5.738-5.779 6.856-5.965 1.226-0.204 1.858-0.44 2.158-0.591-0.51-1.692-4.212-5.822-7.22-9.18-9.891-11.036-26.446-29.504-27.107-55.688-0.067-2.706 0.792-4.846 2.557-6.655 4.037-4.142 12.198-4.555 19.645-4.555 0.003 0 0.003 0 0.006 0 3.408 0 7.075-0.012 10.619 0.119 3.562 0.131 7.244 0.192 10.675 0.192 6.183 0 14.74-0.422 17.606-3.754 0.603-0.702 1.36-1.96 0.955-4.631-0.486-3.236 0.052-5.799 1.599-7.596 1.465-1.698 3.664-2.566 6.539-2.566 17.085 0 62.745 31.097 116.226 68.669 18.37 12.906 34.231 24.049 39.981 26.839 13.829 6.713 33.791 21.037 56.903 37.627 40.080 28.764 89.957 64.563 116.805 64.563 9.154 0 14.676-4.069 17.382-12.804 1.075-3.469 4.299-7.608 13.549-7.608 19.599 0 59.745 18.352 98.083 38.6 7.643-14.761 18.55-24.366 29.073-29.219-0.044-17.787-0.128-43.196-0.766-66.526-0.079-0.076-0.154-0.175-0.236-0.239-3.751-2.994-10.042-3.070-18.011-3.166-13.005-0.157-30.812-0.37-49.307-14.472-10.785-8.225-17.918-19.998-19.537-25.732-0.428-1.52-0.28-2.779 0.446-3.74 0.617-0.816 1.567-1.282 2.604-1.282 0.848 0 1.695 0.306 2.589 0.941l1.884 1.346c5.991 4.296 20.024 14.353 27.535 17.21 10.162 3.868 17.624 5.444 25.759 5.444 7.043 0 14.985-1.215 25.153-3.481-1.002-16.724-2.543-29.111-4.943-31.319-3.751-2.994-10.042-3.070-18.011-3.166-13.005-0.157-30.812-0.37-49.307-14.472-10.785-8.225-17.918-19.998-19.537-25.732-0.428-1.52-0.28-2.779 0.446-3.74 0.617-0.816 1.567-1.282 2.604-1.282 0.848 0 1.695 0.306 2.589 0.941l1.884 1.346c5.991 4.296 20.024 14.353 27.535 17.21 10.162 3.868 17.624 5.444 25.759 5.444 10.704 0 23.373-2.758 43.013-7.844 12.075-3.128 22.383-4.648 31.517-4.648 11.898 0 20.522 2.514 29.653 5.176 10.57 3.081 21.501 6.265 39.354 6.265 3.317 0 6.818-0.114 10.407-0.338 19.535-1.223 37.065-11.408 45.485-16.304 3.702-2.149 4.82-2.799 6.105-2.799l2.036 0.076 0.772 1.724c0.982 2.182-0.163 3.475-5.65 9.661-19.17 21.585-35.763 25.578-52.484 28.019-6.3 0.917-11.237 3.081-11.738 5.106-0.312 1.276 1.191 4.037 6.37 7.806 7.945 5.787 15.929 8.837 23.729 8.837 13.121 0 22.24-8.455 23.242-12.157l0.722-1.94h2.231c1.086 0 2.519 0.198 2.98 2.033 0.722 2.878 0.163 13.392-8.082 20.117 6.533-2.962 11.927-6.096 15.594-8.225 3.702-2.149 4.82-2.799 6.105-2.799l2.036 0.076 0.772 1.724c0.982 2.182-0.163 3.475-5.65 9.661-19.17 21.585-35.763 25.578-52.484 28.019-6.3 0.917-11.237 3.081-11.738 5.106-0.312 1.276 1.191 4.037 6.37 7.806 7.945 5.787 15.929 8.837 23.729 8.837 13.121 0 22.24-8.455 23.242-12.157l0.722-1.94h2.231c1.086 0 2.519 0.198 2.98 2.033 0.816 3.25 0.017 16.261-11.682 22.526-5.72 3.064-14.554 4.75-24.876 4.75-27.157 0-56.996-10.645-80.124-28.593-3.215 6.568-2.68 40.648-2.318 63.569 0.070 4.389 0.128 8.458 0.172 12.227 6.437 4.879 13.007 10.87 19.103 18.067 12.308 14.534 26.056 38.457 24.926 71.882 19.508 12.582 36.212 23.959 46.126 31.639-1.949-6.574-1.957-10.96-0.122-13.741 0.871-1.319 2.575-2.889 5.755-2.889 3.064 0 7.069 1.523 12.241 4.657 40.584 24.585 150.326 171.247 174.008 226.096 1.812 4.194 3.952 8.825 6.259 13.82 14.106 30.521 33.422 72.319 25.424 111.37-5.42 26.254-12.981 43.301-26.964 60.811-2.342 2.927-5.1 5.633-8.018 8.496-9.373 9.192-19.060 18.699-16.095 36.896 8.406 51.675 33.095 59.815 70.466 72.141 8.93 2.945 18.166 5.991 28.185 9.917 3.769 1.477 7.992 3.664 12.466 5.977 9.99 5.164 21.308 11.018 31.26 11.018 1.596 0 3.131-0.154 4.561-0.46l0.728-0.079c1.331 0 2.543 0.757 3.163 1.975 0.612 1.171 0.897 3.172-1.159 5.997zM686.525 84.112c-26.991 0-56.629-10.517-79.589-28.191-1.255 2.726-2.254 9.233-3.058 18.043 0.606-0.015 1.223-0.038 1.82-0.038 11.898 0 20.522 2.514 29.653 5.176 10.57 3.081 21.501 6.265 39.354 6.265 3.317 0 6.818-0.114 10.407-0.338 3.25-0.204 6.437-0.673 9.542-1.308-2.581 0.253-5.292 0.39-8.129 0.39z" />
<glyph unicode="&#xf112;" glyph-name="quill" d="M589.812 136.406h-489.656c-55.228 0-100.156-44.928-100.156-100.156v-66.772c0-18.442 14.954-33.386 33.386-33.386h623.198c18.432 0 33.386 14.944 33.386 33.386v66.772c0 55.228-44.928 100.156-100.158 100.156zM1023.386 358.49c-12.15 280.396-251.566 601.428-343.746 601.428-14.888 0-28.604-6.662-38.626-18.77-58.968-71.216 8.738-485.352 54.36-725.888 16.046-84.556 72.972-143.676 141.018-151.32-0.008-0.088-0.018-0.178-0.026-0.27 0.026 0.002 0.054 0.002 0.080 0.004 15.26 170.922-19.63 337.652-61.214 494.076-4.738 17.818 5.866 36.106 23.688 40.842 17.822 4.75 36.106-5.866 40.842-23.688 41.922-157.68 77.252-325.864 64.588-500.724 65.666 28.144 126.448 113.422 119.036 284.31zM835.704 64.716c-0.080-0.216-0.16-0.432-0.254-0.644 0.316-0.038 0.628-0.094 0.944-0.13-2.6-29.246-6.492-58.6-12.252-88.064-3.544-18.096 8.26-35.624 26.344-39.168 2.174-0.422 4.324-0.63 6.454-0.63 15.626 0 29.604 11.064 32.712 26.996 7.28 37.224 11.918 74.172 14.586 110.844-0.872-0.226-19.518-14.858-68.534-9.204zM456.27 326.462v43.644c0 18.442-14.954 33.386-33.386 33.386h-155.8c-18.432 0-33.386-14.944-33.386-33.386v-43.644c-64.652-19.102-116.34-64.644-144.24-123.284h511.052c-27.896 58.644-79.588 104.186-144.24 123.284z" />
<glyph unicode="&#xf122;" glyph-name="quill-drop" d="M589.82 136.4h-489.66c-55.228 0-100.156-44.928-100.156-100.156v-66.772c0-18.442 14.954-33.386 33.386-33.386h623.2c18.432 0 33.386 14.944 33.386 33.386v66.772c0 55.228-44.928 100.156-100.158 100.156zM1023.38 358.48c-12.15 280.4-251.56 601.42-343.74 601.42-14.888 0-28.604-6.662-38.626-18.77-58.968-71.216 8.738-485.36 54.36-725.88 16.046-84.556 72.972-143.676 141.018-151.32-0.008-0.088-0.018-0.178-0.026-0.27 0.026 0.002 0.054 0.002 0.080 0.004 15.26 170.922-19.63 337.66-61.214 494.080-4.738 17.818 5.866 36.106 23.688 40.842 17.822 4.75 36.106-5.866 40.842-23.688 41.922-157.68 77.252-325.86 64.588-500.72 65.666 28.144 126.448 113.422 119.036 284.32zM835.7 64.72c-0.080-0.216-0.16-0.432-0.254-0.644 0.316-0.038 0.628-0.094 0.944-0.13-2.6-29.246-6.492-58.6-12.252-88.064-3.544-18.096 8.26-35.624 26.344-39.168 2.174-0.422 4.324-0.63 6.454-0.63 15.626 0 29.604 11.064 32.712 26.996 7.28 37.224 11.918 74.172 14.586 110.844-0.872-0.226-19.518-14.858-68.534-9.204zM456.28 326.46v43.644c0 18.442-14.954 33.386-33.386 33.386h-155.8c-18.432 0-33.386-14.944-33.386-33.386v-43.644c-64.652-19.102-116.34-64.644-144.24-123.284h511.060c-27.896 58.644-79.588 104.186-144.24 123.284zM433.158 613.24c0 17.519-5.802 54.563-29.912 89.374-20.818 30.057-54.77 110.235-54.77 110.235s-32.329-80.18-53.146-110.235c-24.11-34.812-29.912-71.857-29.912-89.374 0-46.227 37.040-83.795 83.057-84.666v-0.020c0.271 0 0.541 0.008 0.812 0.010 0.271-0.003 0.541-0.010 0.813-0.010v0.020c46.019 0.866 83.057 38.436 83.057 84.666z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
app/javascript/fonts/witchesAwesome/witchesAwesome.ttf

Binary file not shown.

BIN
app/javascript/fonts/witchesAwesome/witchesAwesome.woff

Binary file not shown.

BIN
app/javascript/images/elephant-fren_sub.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

BIN
app/javascript/images/elephant_ui_disappointed_sub.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

BIN
app/javascript/images/elephant_ui_plane_sub.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

BIN
app/javascript/images/elephant_ui_working_sub.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

2
app/javascript/images/google_logo.svg

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 272 92" width="272" height="92"><path fill="#EA4335" d="M115.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18C71.25 34.32 81.24 25 93.5 25s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44S80.99 39.2 80.99 47.18c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z"/><path fill="#FBBC05" d="M163.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18c0-12.85 9.99-22.18 22.25-22.18s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44s-12.51 5.46-12.51 13.44c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z"/><path fill="#4285F4" d="M209.75 26.34v39.82c0 16.38-9.66 23.07-21.08 23.07-10.75 0-17.22-7.19-19.66-13.07l8.48-3.53c1.51 3.61 5.21 7.87 11.17 7.87 7.31 0 11.84-4.51 11.84-13v-3.19h-.34c-2.18 2.69-6.38 5.04-11.68 5.04-11.09 0-21.25-9.66-21.25-22.09 0-12.52 10.16-22.26 21.25-22.26 5.29 0 9.49 2.35 11.68 4.96h.34v-3.61h9.25zm-8.56 20.92c0-7.81-5.21-13.52-11.84-13.52-6.72 0-12.35 5.71-12.35 13.52 0 7.73 5.63 13.36 12.35 13.36 6.63 0 11.84-5.63 11.84-13.36z"/><path fill="#34A853" d="M225 3v65h-9.5V3h9.5z"/><path fill="#EA4335" d="M262.02 54.48l7.56 5.04c-2.44 3.61-8.32 9.83-18.48 9.83-12.6 0-22.01-9.74-22.01-22.18 0-13.19 9.49-22.18 20.92-22.18 11.51 0 17.14 9.16 18.98 14.11l1.01 2.52-29.65 12.28c2.27 4.45 5.8 6.72 10.75 6.72 4.96 0 8.4-2.44 10.92-6.14zm-23.27-7.98l19.82-8.23c-1.09-2.77-4.37-4.7-8.23-4.7-4.95 0-11.84 4.37-11.59 12.93z"/><path fill="#4285F4" d="M35.29 41.41V32H67c.31 1.64.47 3.58.47 5.68 0 7.06-1.93 15.79-8.15 22.01-6.05 6.3-13.78 9.66-24.02 9.66C16.32 69.35.36 53.89.36 34.91.36 15.93 16.32.47 35.3.47c10.5 0 17.98 4.12 23.6 9.49l-6.64 6.64c-4.03-3.78-9.49-6.72-16.97-6.72-13.86 0-24.7 11.17-24.7 25.03 0 13.86 10.84 25.03 24.7 25.03 8.99 0 14.11-3.61 17.39-6.89 2.66-2.66 4.41-6.46 5.1-11.65l-22.49.01z"/></svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

42
app/javascript/mastodon/actions/compose.js

@ -21,6 +21,8 @@ export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL';
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
export const COMPOSE_DIRECT = 'COMPOSE_DIRECT';
export const COMPOSE_QUOTE = 'COMPOSE_QUOTE';
export const COMPOSE_QUOTE_CANCEL = 'COMPOSE_QUOTE_CANCEL';
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
export const COMPOSE_RESET = 'COMPOSE_RESET';
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
@ -48,6 +50,8 @@ export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE';
export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE';
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
export const COMPOSE_FEDERATION_CHANGE = 'COMPOSE_FEDERATION_CHANGE';
export const COMPOSE_CONTENT_TYPE_CHANGE = 'COMPOSE_CONTENT_TYPE_CHANGE';
export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE';
export const COMPOSE_COMPOSING_CHANGE = 'COMPOSE_COMPOSING_CHANGE';
@ -106,6 +110,23 @@ export function cancelReplyCompose() {
};
};
export function quoteCompose(status, routerHistory) {
return (dispatch, getState) => {
dispatch({
type: COMPOSE_QUOTE,
status: status,
});
ensureComposeIsVisible(getState, routerHistory);
};
};
export function cancelQuoteCompose() {
return {
type: COMPOSE_QUOTE_CANCEL,
};
};
export function resetCompose() {
return {
type: COMPOSE_RESET,
@ -153,6 +174,9 @@ export function submitCompose(routerHistory) {
spoiler_text: getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '',
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
local_only: !getState().getIn(['compose', 'federation']),
content_type: getState().getIn(['compose', 'content_type']),
quote_id: getState().getIn(['compose', 'quote_from'], null),
}, {
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
@ -212,7 +236,7 @@ export function submitComposeFail(error) {
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = 4;
const uploadLimit = 9;
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
const progress = new Array(files.length).fill(0);
@ -231,7 +255,7 @@ export function uploadCompose(files) {
dispatch(uploadComposeRequest());
for (const [i, f] of Array.from(files).entries()) {
if (media.size + i > 3) break;
if (media.size + i > 8) break;
resizeImage(f).then(file => {
const data = new FormData();
@ -624,6 +648,20 @@ export function changeComposeVisibility(value) {
};
};
export function changeComposeFederation(value) {
return {
type: COMPOSE_FEDERATION_CHANGE,
value,
};
};
export function changeComposeContentType(value) {
return {
type: COMPOSE_CONTENT_TYPE_CHANGE,
value,
};
};
export function insertEmojiCompose(position, emoji, needsSpace) {
return {
type: COMPOSE_EMOJI_INSERT,

28
app/javascript/mastodon/actions/importer/normalizer.js

@ -62,6 +62,8 @@ export function normalizeStatus(status, normalOldStatus) {
normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
normalStatus.spoiler_text = normalOldStatus.get('spoiler_text');
normalStatus.hidden = normalOldStatus.get('hidden');
normalStatus.quote = normalOldStatus.get('quote');
normalStatus.quote_hidden = normalOldStatus.get('quote_hidden');
} else {
// If the status has a CW but no contents, treat the CW as if it were the
// status' contents, to avoid having a CW toggle with seemingly no effect.
@ -78,6 +80,32 @@ export function normalizeStatus(status, normalOldStatus) {
normalStatus.contentHtml = emojify(normalStatus.content, emojiMap);
normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(spoilerText), emojiMap);
normalStatus.hidden = expandSpoilers ? false : spoilerText.length > 0 || normalStatus.sensitive;
if (status.quote && status.quote.id) {
const quote_spoilerText = status.quote.spoiler_text || '';
const quote_searchContent = [quote_spoilerText, status.quote.content].join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
const quote_emojiMap = makeEmojiMap(normalStatus.quote);
const quote_account_emojiMap = makeEmojiMap(status.quote.account);
const displayName = normalStatus.quote.account.display_name.length === 0 ? normalStatus.quote.account.username : normalStatus.quote.account.display_name;
normalStatus.quote.account.display_name_html = emojify(escapeTextContentForBrowser(displayName), quote_account_emojiMap);
normalStatus.quote.search_index = domParser.parseFromString(quote_searchContent, 'text/html').documentElement.textContent;
let docElem = domParser.parseFromString(normalStatus.quote.content, 'text/html').documentElement;
Array.from(docElem.querySelectorAll('p,br'), line => {
let parentNode = line.parentNode;
if (line.nextSibling) {
parentNode.insertBefore(document.createTextNode(' '), line.nextSibling);
}
});
// TODO: how to use normalOldStatus?
// let _contentHtml = docElem.textContent;
// normalStatus.quote.contentHtml = '<p>'+emojify(_contentHtml.substr(0, 150), quote_emojiMap) + (_contentHtml.substr(150) ? '...' : '')+'</p>';
let _contentHtml = docElem.innerHTML;
normalStatus.quote.contentHtml = '<p>'+emojify(_contentHtml, quote_emojiMap)+'</p>';
normalStatus.quote.spoilerHtml = emojify(escapeTextContentForBrowser(quote_spoilerText), quote_emojiMap);
normalStatus.quote_hidden = expandSpoilers ? false : quote_spoilerText.length > 0 || normalStatus.quote.sensitive;
}
}
return normalStatus;

25
app/javascript/mastodon/actions/statuses.js

@ -30,6 +30,9 @@ export const STATUS_COLLAPSE = 'STATUS_COLLAPSE';
export const REDRAFT = 'REDRAFT';
export const QUOTE_REVEAL = 'QUOTE_REVEAL';
export const QUOTE_HIDE = 'QUOTE_HIDE';
export function fetchStatusRequest(id, skipLoading) {
return {
type: STATUS_FETCH_REQUEST,
@ -272,3 +275,25 @@ export function toggleStatusCollapse(id, isCollapsed) {
isCollapsed,
};
}
export function hideQuote(ids) {
if (!Array.isArray(ids)) {
ids = [ids];
}
return {
type: QUOTE_HIDE,
ids,
};