Skip to content

Commit

Permalink
Merge branch 'mastodon:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nipundev authored Oct 13, 2023
2 parents d9f8869 + 77098c6 commit 8a1dfa7
Show file tree
Hide file tree
Showing 95 changed files with 1,111 additions and 590 deletions.
4 changes: 0 additions & 4 deletions .bundler-audit.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = {
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
],

env: {
Expand Down Expand Up @@ -63,7 +62,9 @@ module.exports = {
'consistent-return': 'error',
'dot-notation': 'error',
eqeqeq: ['error', 'always', { 'null': 'ignore' }],
'indent': ['error', 2],
'jsx-quotes': ['error', 'prefer-single'],
'semi': ['error', 'always'],
'no-case-declarations': 'off',
'no-catch-shadow': 'error',
'no-console': [
Expand Down
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
# Ignore Vagrant files
.vagrant/

# Ignore Capistrano customizations
/config/deploy/*

# Ignore IDE files
.vscode/
.idea/
Expand Down
12 changes: 2 additions & 10 deletions .haml-lint_todo.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This configuration was generated by
# `haml-lint --auto-gen-config`
# on 2023-10-03 08:32:28 -0400 using Haml-Lint version 0.51.0.
# on 2023-10-11 11:31:24 -0400 using Haml-Lint version 0.51.0.
# The point is for the user to remove these configuration records
# one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again.

linters:
# Offense count: 944
# Offense count: 946
LineLength:
enabled: false

Expand All @@ -26,14 +26,6 @@ linters:
- 'app/views/admin/reports/show.html.haml'
- 'app/views/disputes/strikes/show.html.haml'

# Offense count: 15
InstanceVariables:
exclude:
- 'app/views/admin/reports/_actions.html.haml'
- 'app/views/auth/registrations/_status.html.haml'
- 'app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml'
- 'app/views/relationships/_account.html.haml'

# Offense count: 2
IdNames:
exclude:
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
# Ignore Vagrant files
.vagrant/

# Ignore Capistrano customizations
/config/deploy/*

# Ignore IDE files
.vscode/
.idea/
Expand Down
15 changes: 0 additions & 15 deletions Capfile

This file was deleted.

6 changes: 0 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,6 @@ group :development do
# Linter CLI for HAML files
gem 'haml_lint', require: false

# Deployment automation
gem 'capistrano', '~> 3.17'
gem 'capistrano-rails', '~> 1.6'
gem 'capistrano-rbenv', '~> 2.2'
gem 'capistrano-yarn', '~> 2.0'

# Validate missing i18n keys
gem 'i18n-tasks', '~> 1.0', require: false
end
Expand Down
65 changes: 19 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.13)
actionpack (>= 4.1, < 7.1)
activemodel (>= 4.1, < 7.1)
active_model_serializers (0.10.14)
actionpack (>= 4.1)
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.0.8)
Expand All @@ -112,8 +112,6 @@ GEM
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
aes_key_wrap (1.1.0)
airbrussh (1.4.1)
sshkit (>= 1.6.1, != 1.7.0)
android_key_attestation (0.3.0)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
Expand Down Expand Up @@ -148,7 +146,7 @@ GEM
net-http-persistent (~> 4.0)
nokogiri (~> 1, >= 1.10.8)
base64 (0.1.1)
bcrypt (3.1.18)
bcrypt (3.1.19)
better_errors (2.10.1)
erubi (>= 1.0.0)
rack (>= 0.9.0)
Expand All @@ -175,21 +173,6 @@ GEM
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
capistrano (3.17.3)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-rails (1.6.3)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
capybara (3.39.2)
addressable
matrix
Expand Down Expand Up @@ -227,17 +210,17 @@ GEM
database_cleaner-core (2.0.1)
date (3.3.3)
debug_inspector (1.1.0)
devise (4.9.2)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-two-factor (4.1.0)
activesupport (< 7.1)
devise-two-factor (4.1.1)
activesupport (~> 7.0)
attr_encrypted (>= 1.3, < 5, != 2)
devise (~> 4.0)
railties (< 7.1)
railties (~> 7.0)
rotp (~> 6.0)
devise_pam_authenticatable2 (9.2.0)
devise (>= 4.0.0)
Expand Down Expand Up @@ -429,12 +412,12 @@ GEM
llhttp-ffi (0.4.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
lograge (0.13.0)
lograge (0.14.0)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.21.3)
loofah (2.21.4)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand All @@ -457,7 +440,7 @@ GEM
mime-types-data (3.2023.0808)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.19.0)
minitest (5.20.0)
msgpack (1.7.1)
multi_json (1.15.0)
multipart-post (2.3.0)
Expand All @@ -473,11 +456,8 @@ GEM
net-protocol
net-protocol (0.2.1)
timeout
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.3.3)
net-protocol
net-ssh (7.1.0)
nio4r (2.5.9)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
Expand Down Expand Up @@ -513,7 +493,7 @@ GEM
orm_adapter (0.5.0)
ox (2.14.17)
parallel (1.23.0)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
parslet (2.0.0)
Expand Down Expand Up @@ -574,7 +554,7 @@ GEM
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.1.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
Expand Down Expand Up @@ -603,10 +583,10 @@ GEM
redis (>= 4)
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.8.1)
regexp_parser (2.8.2)
request_store (1.5.1)
rack (>= 1.4)
responders (3.1.0)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.6)
Expand Down Expand Up @@ -640,12 +620,12 @@ GEM
sidekiq (>= 5, < 8)
rspec-support (3.12.1)
rspec_chunked (0.6)
rubocop (1.56.4)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
Expand Down Expand Up @@ -691,7 +671,7 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
sidekiq (6.5.9)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
Expand Down Expand Up @@ -726,9 +706,6 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sshkit (1.21.5)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.25)
statsd-ruby (1.5.0)
stoplight (3.0.2)
Expand Down Expand Up @@ -812,7 +789,7 @@ GEM
xorcist (1.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.11)
zeitwerk (2.6.12)

PLATFORMS
ruby
Expand All @@ -829,10 +806,6 @@ DEPENDENCIES
brakeman (~> 6.0)
browser
bundler-audit (~> 0.9)
capistrano (~> 3.17)
capistrano-rails (~> 1.6)
capistrano-rbenv (~> 2.2)
capistrano-yarn (~> 2.0)
capybara (~> 3.39)
charlock_holmes (~> 0.7.7)
chewy (~> 7.3)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Mastodon acts as an OAuth2 provider, so 3rd party apps can use the REST and Stre
- **PostgreSQL** 9.5+
- **Redis** 4+
- **Ruby** 2.7+
- **Node.js** 14+
- **Node.js** 16+

The repository includes deployment configurations for **Docker and docker-compose** as well as specific platforms like **Heroku**, **Scalingo**, and **Nanobox**. For Helm charts, reference the [mastodon/chart repository](https://github.com/mastodon/chart). The [**standalone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation.

Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ A "vulnerability in Mastodon" is a vulnerability in the code distributed through

| Version | Supported |
| ------- | ---------------- |
| 4.2.x | Yes |
| 4.1.x | Yes |
| 4.0.x | Until 2023-10-31 |
| 3.5.x | Until 2023-12-31 |
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/concerns/two_factor_authentication_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module TwoFactorAuthenticationConcern

included do
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
helper_method :webauthn_enabled?
end

def two_factor_enabled?
Expand Down Expand Up @@ -87,4 +88,10 @@ def prompt_for_two_factor(user)

set_locale { render :two_factor }
end

protected

def webauthn_enabled?
@webauthn_enabled
end
end
10 changes: 6 additions & 4 deletions app/controllers/concerns/web_app_controller_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module WebAppControllerConcern
extend ActiveSupport::Concern

included do
prepend_before_action :redirect_unauthenticated_to_permalinks!
before_action :set_app_body_class

vary_by 'Accept, Accept-Language, Cookie'

before_action :redirect_unauthenticated_to_permalinks!
before_action :set_app_body_class
end

def skip_csrf_meta_tags?
Expand All @@ -22,7 +22,9 @@ def redirect_unauthenticated_to_permalinks!
return if user_signed_in? && current_account.moved_to_account_id.nil?

redirect_path = PermalinkRedirector.new(request.path).redirect_path
return if redirect_path.blank?

redirect_to(redirect_path) if redirect_path.present?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
redirect_to(redirect_path)
end
end
1 change: 0 additions & 1 deletion app/controllers/follower_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class FollowerAccountsController < ApplicationController
include AccountControllerConcern
include SignatureVerification
include WebAppControllerConcern

vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }

Expand Down
1 change: 0 additions & 1 deletion app/controllers/following_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class FollowingAccountsController < ApplicationController
include AccountControllerConcern
include SignatureVerification
include WebAppControllerConcern

vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/actions/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ export const showAlertForError = (error, skipNotFound = false) => {
title: messages.unexpectedTitle,
message: messages.unexpectedMessage,
});
}
};
Loading

0 comments on commit 8a1dfa7

Please sign in to comment.