From 83a90f20d78120098b413fdff0e7dc1943598ffc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:31:59 +0100 Subject: [PATCH 01/55] Update dependency async-mutex to v0.4.1 (#28797) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 953147fe4..2be132476 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4613,11 +4613,11 @@ __metadata: linkType: hard "async-mutex@npm:^0.4.0": - version: 0.4.0 - resolution: "async-mutex@npm:0.4.0" + version: 0.4.1 + resolution: "async-mutex@npm:0.4.1" dependencies: tslib: "npm:^2.4.0" - checksum: 6541695f80c1d6c5acbf3f7f04e8ff0733b3e029312c48d77bb95243fbe21fc5319f45ac3d72ce08551e6df83dc32440285ce9a3ac17bfc5d385ff0cc8ccd62a + checksum: 3c412736c0bc4a9a2cfd948276a8caab8686aa615866a5bd20986e616f8945320acb310058a17afa1b31b8de6f634a78b7ec2217a33d7559b38f68bb85a95854 languageName: node linkType: hard From 4c23297c04240ae3f4780f1614047be83a909c59 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 09:33:21 +0000 Subject: [PATCH 02/55] Update dependency autoprefixer to v10.4.17 (#28794) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2be132476..6f8381db0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4670,12 +4670,12 @@ __metadata: linkType: hard "autoprefixer@npm:^10.4.14": - version: 10.4.16 - resolution: "autoprefixer@npm:10.4.16" + version: 10.4.17 + resolution: "autoprefixer@npm:10.4.17" dependencies: - browserslist: "npm:^4.21.10" - caniuse-lite: "npm:^1.0.30001538" - fraction.js: "npm:^4.3.6" + browserslist: "npm:^4.22.2" + caniuse-lite: "npm:^1.0.30001578" + fraction.js: "npm:^4.3.7" normalize-range: "npm:^0.1.2" picocolors: "npm:^1.0.0" postcss-value-parser: "npm:^4.2.0" @@ -4683,7 +4683,7 @@ __metadata: postcss: ^8.1.0 bin: autoprefixer: bin/autoprefixer - checksum: e00256e754d481a026d928bca729b25954074dd142dbec022f0a7db0d3bbc0dc2e2dc7542e94fec22eff81e21fe140e6856448e2d9a002660cb1e2ad434daee0 + checksum: 1d21cc8edb7bf993682094ceed03a32c18f5293f071182a64c2c6defb44bbe91d576ad775d2347469a81997b80cea0bbc4ad3eeb5b12710f9feacf2e6c04bb51 languageName: node linkType: hard @@ -5230,7 +5230,7 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.0.0, browserslist@npm:^4.21.10, browserslist@npm:^4.22.2": +"browserslist@npm:^4.0.0, browserslist@npm:^4.22.2": version: 4.22.2 resolution: "browserslist@npm:4.22.2" dependencies: @@ -5456,10 +5456,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001538, caniuse-lite@npm:^1.0.30001565": - version: 1.0.30001568 - resolution: "caniuse-lite@npm:1.0.30001568" - checksum: 13f01e5a2481134bd61cf565ce9fecbd8e107902927a0dcf534230a92191a81f1715792170f5f39719c767c3a96aa6df9917a8d5601f15bbd5e4041a8cfecc99 +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001565, caniuse-lite@npm:^1.0.30001578": + version: 1.0.30001578 + resolution: "caniuse-lite@npm:1.0.30001578" + checksum: c3bd9c08a945cee4f0cc284a217ebe9c2613e04d5aef4b48f1871a779b1875c34286469eb8d7d94bd028b5a354613e676ad503b6bf8db20a2f154574bd5fde48 languageName: node linkType: hard @@ -8274,10 +8274,10 @@ __metadata: languageName: node linkType: hard -"fraction.js@npm:^4.3.6": - version: 4.3.6 - resolution: "fraction.js@npm:4.3.6" - checksum: d224bf62e350c4dbe66c6ac5ad9c4ec6d3c8e64c13323686dbebe7c8cc118491c297dca4961d3c93f847670794cb05e6d8b706f0e870846ab66a9c4491d0e914 +"fraction.js@npm:^4.3.7": + version: 4.3.7 + resolution: "fraction.js@npm:4.3.7" + checksum: df291391beea9ab4c263487ffd9d17fed162dbb736982dee1379b2a8cc94e4e24e46ed508c6d278aded9080ba51872f1bc5f3a5fd8d7c74e5f105b508ac28711 languageName: node linkType: hard From 89c9a4502d2463d2146de3bf5b32f728cdeb3e1c Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 04:36:16 -0500 Subject: [PATCH 03/55] Fix `Rails/WhereExists` cop in account/interactions concern (#28789) --- .rubocop_todo.yml | 1 - app/models/concerns/account/interactions.rb | 26 ++++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b962fbddd..73ad0cac0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -82,7 +82,6 @@ Rails/WhereExists: - 'app/lib/feed_manager.rb' - 'app/lib/status_cache_hydrator.rb' - 'app/lib/suspicious_sign_in_detector.rb' - - 'app/models/concerns/account/interactions.rb' - 'app/models/featured_tag.rb' - 'app/models/poll.rb' - 'app/models/session_activation.rb' diff --git a/app/models/concerns/account/interactions.rb b/app/models/concerns/account/interactions.rb index 351530c2f..5b05c31e0 100644 --- a/app/models/concerns/account/interactions.rb +++ b/app/models/concerns/account/interactions.rb @@ -183,7 +183,7 @@ module Account::Interactions end def following?(other_account) - active_relationships.where(target_account: other_account).exists? + active_relationships.exists?(target_account: other_account) end def following_anyone? @@ -199,51 +199,51 @@ module Account::Interactions end def blocking?(other_account) - block_relationships.where(target_account: other_account).exists? + block_relationships.exists?(target_account: other_account) end def domain_blocking?(other_domain) - domain_blocks.where(domain: other_domain).exists? + domain_blocks.exists?(domain: other_domain) end def muting?(other_account) - mute_relationships.where(target_account: other_account).exists? + mute_relationships.exists?(target_account: other_account) end def muting_conversation?(conversation) - conversation_mutes.where(conversation: conversation).exists? + conversation_mutes.exists?(conversation: conversation) end def muting_notifications?(other_account) - mute_relationships.where(target_account: other_account, hide_notifications: true).exists? + mute_relationships.exists?(target_account: other_account, hide_notifications: true) end def muting_reblogs?(other_account) - active_relationships.where(target_account: other_account, show_reblogs: false).exists? + active_relationships.exists?(target_account: other_account, show_reblogs: false) end def requested?(other_account) - follow_requests.where(target_account: other_account).exists? + follow_requests.exists?(target_account: other_account) end def favourited?(status) - status.proper.favourites.where(account: self).exists? + status.proper.favourites.exists?(account: self) end def bookmarked?(status) - status.proper.bookmarks.where(account: self).exists? + status.proper.bookmarks.exists?(account: self) end def reblogged?(status) - status.proper.reblogs.where(account: self).exists? + status.proper.reblogs.exists?(account: self) end def pinned?(status) - status_pins.where(status: status).exists? + status_pins.exists?(status: status) end def endorsed?(account) - account_pins.where(target_account: account).exists? + account_pins.exists?(target_account: account) end def status_matches_filters(status) From 07e10e37477bdaa1bea30fbf2bebb05cf9ae793d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 04:36:59 -0500 Subject: [PATCH 04/55] Combine assertions about same setup in `Account#suspend!` spec (#28787) --- spec/models/account_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index ab7457962..d360d934d 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -9,14 +9,10 @@ RSpec.describe Account do let(:bob) { Fabricate(:account, username: 'bob') } describe '#suspend!' do - it 'marks the account as suspended' do - subject.suspend! - expect(subject.suspended?).to be true - end - - it 'creates a deletion request' do - subject.suspend! - expect(AccountDeletionRequest.where(account: subject).exists?).to be true + it 'marks the account as suspended and creates a deletion request' do + expect { subject.suspend! } + .to change(subject, :suspended?).from(false).to(true) + .and(change { AccountDeletionRequest.exists?(account: subject) }.from(false).to(true)) end context 'when the account is of a local user' do From 6c5a2d51bc30e0a0d46160952295f743c6fa4b2d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 05:07:49 -0500 Subject: [PATCH 05/55] Reduced repeated setup in `PurgeDomainService` spec (#28786) --- spec/services/purge_domain_service_spec.rb | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/services/purge_domain_service_spec.rb b/spec/services/purge_domain_service_spec.rb index e96618310..6d8af14de 100644 --- a/spec/services/purge_domain_service_spec.rb +++ b/spec/services/purge_domain_service_spec.rb @@ -5,25 +5,25 @@ require 'rails_helper' RSpec.describe PurgeDomainService, type: :service do subject { described_class.new } - let!(:old_account) { Fabricate(:account, domain: 'obsolete.org') } - let!(:old_status_plain) { Fabricate(:status, account: old_account) } - let!(:old_status_with_attachment) { Fabricate(:status, account: old_account) } - let!(:old_attachment) { Fabricate(:media_attachment, account: old_account, status: old_status_with_attachment, file: attachment_fixture('attachment.jpg')) } + let(:domain) { 'obsolete.org' } + let!(:account) { Fabricate(:account, domain: domain) } + let!(:status_plain) { Fabricate(:status, account: account) } + let!(:status_with_attachment) { Fabricate(:status, account: account) } + let!(:attachment) { Fabricate(:media_attachment, account: account, status: status_with_attachment, file: attachment_fixture('attachment.jpg')) } describe 'for a suspension' do - before do - subject.call('obsolete.org') + it 'refreshes instance view and removes associated records' do + expect { subject.call(domain) } + .to change { domain_instance_exists }.from(true).to(false) + + expect { account.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { status_plain.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { status_with_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { attachment.reload }.to raise_exception ActiveRecord::RecordNotFound end - it 'removes the remote accounts\'s statuses and media attachments' do - expect { old_account.reload }.to raise_exception ActiveRecord::RecordNotFound - expect { old_status_plain.reload }.to raise_exception ActiveRecord::RecordNotFound - expect { old_status_with_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound - expect { old_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound - end - - it 'refreshes instances view' do - expect(Instance.where(domain: 'obsolete.org').exists?).to be false + def domain_instance_exists + Instance.exists?(domain: domain) end end end From 3d82040b26846c5431eaff1b997b17a55a6256da Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 05:11:10 -0500 Subject: [PATCH 06/55] Reduced repeated setup in `UnallowDomainService` spec (#28785) --- spec/services/unallow_domain_service_spec.rb | 53 +++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/spec/services/unallow_domain_service_spec.rb b/spec/services/unallow_domain_service_spec.rb index 6ac6bc401..383977d35 100644 --- a/spec/services/unallow_domain_service_spec.rb +++ b/spec/services/unallow_domain_service_spec.rb @@ -5,12 +5,13 @@ require 'rails_helper' RSpec.describe UnallowDomainService, type: :service do subject { described_class.new } - let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') } + let(:bad_domain) { 'evil.org' } + let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: bad_domain) } let!(:bad_status_harassment) { Fabricate(:status, account: bad_account, text: 'You suck') } let!(:bad_status_mean) { Fabricate(:status, account: bad_account, text: 'Hahaha') } let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status_mean, file: attachment_fixture('attachment.jpg')) } - let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) } - let!(:domain_allow) { Fabricate(:domain_allow, domain: 'evil.org') } + let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: bad_domain, suspended: true, silenced: true) } + let!(:domain_allow) { Fabricate(:domain_allow, domain: bad_domain) } context 'with limited federation mode', :sidekiq_inline do before do @@ -18,23 +19,15 @@ RSpec.describe UnallowDomainService, type: :service do end describe '#call' do - before do - subject.call(domain_allow) - end + it 'makes the domain not allowed and removes accounts from that domain' do + expect { subject.call(domain_allow) } + .to change { bad_domain_allowed }.from(true).to(false) + .and change { bad_domain_account_exists }.from(true).to(false) - it 'removes the allowed domain' do - expect(DomainAllow.allowed?('evil.org')).to be false - end - - it 'removes remote accounts from that domain' do expect { already_banned_account.reload }.to raise_error(ActiveRecord::RecordNotFound) - expect(Account.where(domain: 'evil.org').exists?).to be false - end - - it 'removes the remote accounts\'s statuses and media attachments' do - expect { bad_status_harassment.reload }.to raise_exception ActiveRecord::RecordNotFound - expect { bad_status_mean.reload }.to raise_exception ActiveRecord::RecordNotFound - expect { bad_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { bad_status_harassment.reload }.to raise_error(ActiveRecord::RecordNotFound) + expect { bad_status_mean.reload }.to raise_error(ActiveRecord::RecordNotFound) + expect { bad_attachment.reload }.to raise_error(ActiveRecord::RecordNotFound) end end end @@ -45,23 +38,23 @@ RSpec.describe UnallowDomainService, type: :service do end describe '#call' do - before do - subject.call(domain_allow) - end + it 'makes the domain not allowed but preserves accounts from the domain' do + expect { subject.call(domain_allow) } + .to change { bad_domain_allowed }.from(true).to(false) + .and not_change { bad_domain_account_exists }.from(true) - it 'removes the allowed domain' do - expect(DomainAllow.allowed?('evil.org')).to be false - end - - it 'does not remove accounts from that domain' do - expect(Account.where(domain: 'evil.org').exists?).to be true - end - - it 'removes the remote accounts\'s statuses and media attachments' do expect { bad_status_harassment.reload }.to_not raise_error expect { bad_status_mean.reload }.to_not raise_error expect { bad_attachment.reload }.to_not raise_error end end end + + def bad_domain_allowed + DomainAllow.allowed?(bad_domain) + end + + def bad_domain_account_exists + Account.exists?(domain: bad_domain) + end end From da31792ac7768299d32419764bdc118adf7e1ea5 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 07:22:12 -0500 Subject: [PATCH 07/55] Fix `Rails/WhereExists` cop in FeaturedTag model (#28791) --- .rubocop_todo.yml | 1 - app/models/featured_tag.rb | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 73ad0cac0..eaa86ad15 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -82,7 +82,6 @@ Rails/WhereExists: - 'app/lib/feed_manager.rb' - 'app/lib/status_cache_hydrator.rb' - 'app/lib/suspicious_sign_in_detector.rb' - - 'app/models/featured_tag.rb' - 'app/models/poll.rb' - 'app/models/session_activation.rb' - 'app/models/status.rb' diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb index 7c36aa8b0..63cd67476 100644 --- a/app/models/featured_tag.rb +++ b/app/models/featured_tag.rb @@ -66,6 +66,10 @@ class FeaturedTag < ApplicationRecord end def validate_tag_uniqueness - errors.add(:name, :taken) if FeaturedTag.by_name(name).where(account_id: account_id).exists? + errors.add(:name, :taken) if tag_already_featured_for_account? + end + + def tag_already_featured_for_account? + FeaturedTag.by_name(name).exists?(account_id: account_id) end end From aaa6f2e9302252b70d1e430ed5b4e6689b827d78 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 07:29:41 -0500 Subject: [PATCH 08/55] Group common `class_name` options in associations (#28779) --- app/models/appeal.rb | 7 +++++-- app/models/email_domain_block.rb | 6 ++++-- app/models/poll.rb | 7 +++++-- app/models/report.rb | 9 ++++++--- app/models/status.rb | 6 ++++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/models/appeal.rb b/app/models/appeal.rb index f1290ad01..395056b76 100644 --- a/app/models/appeal.rb +++ b/app/models/appeal.rb @@ -20,8 +20,11 @@ class Appeal < ApplicationRecord belongs_to :account belongs_to :strike, class_name: 'AccountWarning', foreign_key: 'account_warning_id', inverse_of: :appeal - belongs_to :approved_by_account, class_name: 'Account', optional: true - belongs_to :rejected_by_account, class_name: 'Account', optional: true + + with_options class_name: 'Account', optional: true do + belongs_to :approved_by_account + belongs_to :rejected_by_account + end validates :text, presence: true, length: { maximum: 2_000 } validates :account_warning_id, uniqueness: true diff --git a/app/models/email_domain_block.rb b/app/models/email_domain_block.rb index f1b14c8b0..40be59420 100644 --- a/app/models/email_domain_block.rb +++ b/app/models/email_domain_block.rb @@ -21,8 +21,10 @@ class EmailDomainBlock < ApplicationRecord include DomainNormalizable include Paginable - belongs_to :parent, class_name: 'EmailDomainBlock', optional: true - has_many :children, class_name: 'EmailDomainBlock', foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy + with_options class_name: 'EmailDomainBlock' do + belongs_to :parent, optional: true + has_many :children, foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy + end validates :domain, presence: true, uniqueness: true, domain: true diff --git a/app/models/poll.rb b/app/models/poll.rb index 72f04f00a..37149c3d8 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -27,8 +27,11 @@ class Poll < ApplicationRecord belongs_to :status has_many :votes, class_name: 'PollVote', inverse_of: :poll, dependent: :delete_all - has_many :voters, -> { group('accounts.id') }, through: :votes, class_name: 'Account', source: :account - has_many :local_voters, -> { group('accounts.id').merge(Account.local) }, through: :votes, class_name: 'Account', source: :account + + with_options class_name: 'Account', source: :account, through: :votes do + has_many :voters, -> { group('accounts.id') } + has_many :local_voters, -> { group('accounts.id').merge(Account.local) } + end has_many :notifications, as: :activity, dependent: :destroy diff --git a/app/models/report.rb b/app/models/report.rb index c565362cc..126701b3d 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -29,9 +29,12 @@ class Report < ApplicationRecord rate_limit by: :account, family: :reports belongs_to :account - belongs_to :target_account, class_name: 'Account' - belongs_to :action_taken_by_account, class_name: 'Account', optional: true - belongs_to :assigned_account, class_name: 'Account', optional: true + + with_options class_name: 'Account' do + belongs_to :target_account + belongs_to :action_taken_by_account, optional: true + belongs_to :assigned_account, optional: true + end has_many :notes, class_name: 'ReportNote', inverse_of: :report, dependent: :destroy has_many :notifications, as: :activity, dependent: :destroy diff --git a/app/models/status.rb b/app/models/status.rb index a498da288..9a2169f99 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -59,8 +59,10 @@ class Status < ApplicationRecord belongs_to :conversation, optional: true belongs_to :preloadable_poll, class_name: 'Poll', foreign_key: 'poll_id', optional: true, inverse_of: false - belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies, optional: true - belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs, optional: true + with_options class_name: 'Status', optional: true do + belongs_to :thread, foreign_key: 'in_reply_to_id', inverse_of: :replies + belongs_to :reblog, foreign_key: 'reblog_of_id', inverse_of: :reblogs + end has_many :favourites, inverse_of: :status, dependent: :destroy has_many :bookmarks, inverse_of: :status, dependent: :destroy From 81e4e65610932841750bdbef8d96961165b8eb0c Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 07:29:54 -0500 Subject: [PATCH 09/55] Update links to upstream migration helpers, remove unused methods (#28781) --- lib/mastodon/migration_helpers.rb | 161 ++---------------------------- 1 file changed, 9 insertions(+), 152 deletions(-) diff --git a/lib/mastodon/migration_helpers.rb b/lib/mastodon/migration_helpers.rb index 1a2ce6420..a713f42d4 100644 --- a/lib/mastodon/migration_helpers.rb +++ b/lib/mastodon/migration_helpers.rb @@ -8,15 +8,15 @@ # shorten temporary column names. # Documentation on using these functions (and why one might do so): -# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/what_requires_downtime.md +# https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/doc/development/database/avoiding_downtime_in_migrations.md -# The file itself: -# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/database/migration_helpers.rb +# The original file (since updated): +# https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/database/migration_helpers.rb # It is licensed as follows: -# Copyright (c) 2011-2017 GitLab B.V. - +# Copyright (c) 2011-present GitLab B.V. +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights @@ -24,16 +24,16 @@ # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. # This is bad form, but there are enough differences that it's impractical to do # otherwise: @@ -77,37 +77,12 @@ module Mastodon end end - BACKGROUND_MIGRATION_BATCH_SIZE = 1000 # Number of rows to process per job - BACKGROUND_MIGRATION_JOB_BUFFER_SIZE = 1000 # Number of jobs to bulk queue at a time - # Gets an estimated number of rows for a table def estimate_rows_in_table(table_name) exec_query('SELECT reltuples FROM pg_class WHERE relname = ' + "'#{table_name}'").to_a.first['reltuples'] end - # Adds `created_at` and `updated_at` columns with timezone information. - # - # This method is an improved version of Rails' built-in method `add_timestamps`. - # - # Available options are: - # default - The default value for the column. - # null - When set to `true` the column will allow NULL values. - # The default is to not allow NULL values. - def add_timestamps_with_timezone(table_name, **options) - options[:null] = false if options[:null].nil? - - [:created_at, :updated_at].each do |column_name| - if options[:default] && transaction_open? - raise '`add_timestamps_with_timezone` with default value cannot be run inside a transaction. ' \ - 'You can disable transactions by calling `disable_ddl_transaction!` ' \ - 'in the body of your migration class' - end - - add_column(table_name, column_name, :datetime_with_timezone, **options) - end - end - # Creates a new index, concurrently when supported # # On PostgreSQL this method creates an index concurrently, on MySQL this @@ -746,39 +721,6 @@ module Mastodon rename_index table_name, "#{index_name}_new", index_name end - # This will replace the first occurrence of a string in a column with - # the replacement - # On postgresql we can use `regexp_replace` for that. - # On mysql we find the location of the pattern, and overwrite it - # with the replacement - def replace_sql(column, pattern, replacement) - quoted_pattern = Arel::Nodes::Quoted.new(pattern.to_s) - quoted_replacement = Arel::Nodes::Quoted.new(replacement.to_s) - - replace = Arel::Nodes::NamedFunction - .new("regexp_replace", [column, quoted_pattern, quoted_replacement]) - Arel::Nodes::SqlLiteral.new(replace.to_sql) - end - - def remove_foreign_key_without_error(*args) - remove_foreign_key(*args) - rescue ArgumentError - end - - def sidekiq_queue_migrate(queue_from, to:) - while sidekiq_queue_length(queue_from) > 0 - Sidekiq.redis do |conn| - conn.rpoplpush "queue:#{queue_from}", "queue:#{to}" - end - end - end - - def sidekiq_queue_length(queue_name) - Sidekiq.redis do |conn| - conn.llen("queue:#{queue_name}") - end - end - def check_trigger_permissions!(table) unless Grant.create_and_execute_trigger?(table) dbname = ActiveRecord::Base.configurations[Rails.env]['database'] @@ -799,91 +741,6 @@ into similar problems in the future (e.g. when new tables are created). end end - # Bulk queues background migration jobs for an entire table, batched by ID range. - # "Bulk" meaning many jobs will be pushed at a time for efficiency. - # If you need a delay interval per job, then use `queue_background_migration_jobs_by_range_at_intervals`. - # - # model_class - The table being iterated over - # job_class_name - The background migration job class as a string - # batch_size - The maximum number of rows per job - # - # Example: - # - # class Route < ActiveRecord::Base - # include EachBatch - # self.table_name = 'routes' - # end - # - # bulk_queue_background_migration_jobs_by_range(Route, 'ProcessRoutes') - # - # Where the model_class includes EachBatch, and the background migration exists: - # - # class Gitlab::BackgroundMigration::ProcessRoutes - # def perform(start_id, end_id) - # # do something - # end - # end - def bulk_queue_background_migration_jobs_by_range(model_class, job_class_name, batch_size: BACKGROUND_MIGRATION_BATCH_SIZE) - raise "#{model_class} does not have an ID to use for batch ranges" unless model_class.column_names.include?('id') - - jobs = [] - - model_class.each_batch(of: batch_size) do |relation| - start_id, end_id = relation.pluck('MIN(id), MAX(id)').first - - if jobs.length >= BACKGROUND_MIGRATION_JOB_BUFFER_SIZE - # Note: This code path generally only helps with many millions of rows - # We push multiple jobs at a time to reduce the time spent in - # Sidekiq/Redis operations. We're using this buffer based approach so we - # don't need to run additional queries for every range. - BackgroundMigrationWorker.perform_bulk(jobs) - jobs.clear - end - - jobs << [job_class_name, [start_id, end_id]] - end - - BackgroundMigrationWorker.perform_bulk(jobs) unless jobs.empty? - end - - # Queues background migration jobs for an entire table, batched by ID range. - # Each job is scheduled with a `delay_interval` in between. - # If you use a small interval, then some jobs may run at the same time. - # - # model_class - The table being iterated over - # job_class_name - The background migration job class as a string - # delay_interval - The duration between each job's scheduled time (must respond to `to_f`) - # batch_size - The maximum number of rows per job - # - # Example: - # - # class Route < ActiveRecord::Base - # include EachBatch - # self.table_name = 'routes' - # end - # - # queue_background_migration_jobs_by_range_at_intervals(Route, 'ProcessRoutes', 1.minute) - # - # Where the model_class includes EachBatch, and the background migration exists: - # - # class Gitlab::BackgroundMigration::ProcessRoutes - # def perform(start_id, end_id) - # # do something - # end - # end - def queue_background_migration_jobs_by_range_at_intervals(model_class, job_class_name, delay_interval, batch_size: BACKGROUND_MIGRATION_BATCH_SIZE) - raise "#{model_class} does not have an ID to use for batch ranges" unless model_class.column_names.include?('id') - - model_class.each_batch(of: batch_size) do |relation, index| - start_id, end_id = relation.pluck('MIN(id), MAX(id)').first - - # `BackgroundMigrationWorker.bulk_perform_in` schedules all jobs for - # the same time, which is not helpful in most cases where we wish to - # spread the work over time. - BackgroundMigrationWorker.perform_in(delay_interval * index, job_class_name, [start_id, end_id]) - end - end - private # https://github.com/rails/rails/blob/v5.2.0/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L678-L684 From 9fb9ef418a58dbeeb568050a72e697f17c85afc3 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 08:55:44 -0500 Subject: [PATCH 10/55] Fix `Rails/WhereExists` cop in User model (#28792) --- .rubocop_todo.yml | 1 - app/models/user.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index eaa86ad15..87120daef 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -85,7 +85,6 @@ Rails/WhereExists: - 'app/models/poll.rb' - 'app/models/session_activation.rb' - 'app/models/status.rb' - - 'app/models/user.rb' - 'app/policies/status_policy.rb' - 'app/serializers/rest/announcement_serializer.rb' - 'app/serializers/rest/tag_serializer.rb' diff --git a/app/models/user.rb b/app/models/user.rb index 5c90af56d..70c24336f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -434,7 +434,7 @@ class User < ApplicationRecord end def sign_up_from_ip_requires_approval? - !sign_up_ip.nil? && IpBlock.where(severity: :sign_up_requires_approval).where('ip >>= ?', sign_up_ip.to_s).exists? + sign_up_ip.present? && IpBlock.sign_up_requires_approval.exists?(['ip >>= ?', sign_up_ip.to_s]) end def sign_up_email_requires_approval? From 2115bc52e47e66a4a15fe3073df9d39da0bf6e3e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 09:53:29 -0500 Subject: [PATCH 11/55] Order by sql in `CLI::Maintenance` task (#28289) --- lib/mastodon/cli/maintenance.rb | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index f37662aa0..e2ea86615 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -223,7 +223,7 @@ module Mastodon::CLI say 'Deduplicating accounts… for local accounts, you will be asked to chose which account to keep unchanged.' find_duplicate_accounts.each do |row| - accounts = Account.where(id: row['ids'].split(',')).to_a + accounts = Account.where(id: row['ids'].split(',')) if accounts.first.local? deduplicate_local_accounts!(accounts) @@ -275,7 +275,7 @@ module Mastodon::CLI def deduplicate_users_process_email ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users GROUP BY email HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).sort_by(&:updated_at).reverse + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a ref_user = users.shift say "Multiple users registered with e-mail address #{ref_user.email}.", :yellow say "e-mail will be disabled for the following accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow @@ -289,7 +289,7 @@ module Mastodon::CLI def deduplicate_users_process_confirmation_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE confirmation_token IS NOT NULL GROUP BY confirmation_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).sort_by(&:created_at).reverse.drop(1) + users = User.where(id: row['ids'].split(',')).order(created_at: :desc).to_a.drop(1) say "Unsetting confirmation token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -301,7 +301,7 @@ module Mastodon::CLI def deduplicate_users_process_remember_token if migrator_version < 2022_01_18_183010 ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE remember_token IS NOT NULL GROUP BY remember_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).sort_by(&:updated_at).reverse.drop(1) + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a.drop(1) say "Unsetting remember token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -313,7 +313,7 @@ module Mastodon::CLI def deduplicate_users_process_password_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE reset_password_token IS NOT NULL GROUP BY reset_password_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).sort_by(&:updated_at).reverse.drop(1) + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a.drop(1) say "Unsetting password reset token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -341,7 +341,7 @@ module Mastodon::CLI say 'Removing duplicate account identity proofs…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM account_identity_proofs GROUP BY account_id, provider, provider_username HAVING count(*) > 1").each do |row| - AccountIdentityProof.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + AccountIdentityProof.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy) end say 'Restoring account identity proofs indexes…' @@ -355,7 +355,7 @@ module Mastodon::CLI say 'Removing duplicate announcement reactions…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM announcement_reactions GROUP BY account_id, announcement_id, name HAVING count(*) > 1").each do |row| - AnnouncementReaction.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + AnnouncementReaction.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy) end say 'Restoring announcement_reactions indexes…' @@ -367,7 +367,7 @@ module Mastodon::CLI say 'Deduplicating conversations…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM conversations WHERE uri IS NOT NULL GROUP BY uri HAVING count(*) > 1").each do |row| - conversations = Conversation.where(id: row['ids'].split(',')).sort_by(&:id).reverse + conversations = Conversation.where(id: row['ids'].split(',')).order(id: :desc).to_a ref_conversation = conversations.shift @@ -390,7 +390,7 @@ module Mastodon::CLI say 'Deduplicating custom_emojis…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM custom_emojis GROUP BY shortcode, domain HAVING count(*) > 1").each do |row| - emojis = CustomEmoji.where(id: row['ids'].split(',')).sort_by(&:id).reverse + emojis = CustomEmoji.where(id: row['ids'].split(',')).order(id: :desc).to_a ref_emoji = emojis.shift @@ -409,7 +409,7 @@ module Mastodon::CLI say 'Deduplicating custom_emoji_categories…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM custom_emoji_categories GROUP BY name HAVING count(*) > 1").each do |row| - categories = CustomEmojiCategory.where(id: row['ids'].split(',')).sort_by(&:id).reverse + categories = CustomEmojiCategory.where(id: row['ids'].split(',')).order(id: :desc).to_a ref_category = categories.shift @@ -428,7 +428,7 @@ module Mastodon::CLI say 'Deduplicating domain_allows…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM domain_allows GROUP BY domain HAVING count(*) > 1").each do |row| - DomainAllow.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + DomainAllow.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy) end say 'Restoring domain_allows indexes…' @@ -466,7 +466,7 @@ module Mastodon::CLI say 'Deduplicating unavailable_domains…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM unavailable_domains GROUP BY domain HAVING count(*) > 1").each do |row| - UnavailableDomain.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + UnavailableDomain.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy) end say 'Restoring unavailable_domains indexes…' @@ -478,7 +478,7 @@ module Mastodon::CLI say 'Deduplicating email_domain_blocks…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM email_domain_blocks GROUP BY domain HAVING count(*) > 1").each do |row| - domain_blocks = EmailDomainBlock.where(id: row['ids'].split(',')).sort_by { |b| b.parent.nil? ? 1 : 0 }.to_a + domain_blocks = EmailDomainBlock.where(id: row['ids'].split(',')).order(EmailDomainBlock.arel_table[:parent_id].asc.nulls_first).to_a domain_blocks.drop(1).each(&:destroy) end @@ -507,7 +507,7 @@ module Mastodon::CLI say 'Deduplicating preview_cards…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM preview_cards GROUP BY url HAVING count(*) > 1").each do |row| - PreviewCard.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + PreviewCard.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy) end say 'Restoring preview_cards indexes…' @@ -519,7 +519,7 @@ module Mastodon::CLI say 'Deduplicating statuses…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM statuses WHERE uri IS NOT NULL GROUP BY uri HAVING count(*) > 1").each do |row| - statuses = Status.where(id: row['ids'].split(',')).sort_by(&:id) + statuses = Status.where(id: row['ids'].split(',')).order(id: :asc).to_a ref_status = statuses.shift statuses.each do |status| merge_statuses!(ref_status, status) if status.account_id == ref_status.account_id @@ -541,7 +541,7 @@ module Mastodon::CLI say 'Deduplicating tags…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM tags GROUP BY lower((name)::text) HAVING count(*) > 1").each do |row| - tags = Tag.where(id: row['ids'].split(',')).sort_by { |t| [t.usable?, t.trendable?, t.listable?].count(false) } + tags = Tag.where(id: row['ids'].split(',')).order(Arel.sql('(usable::int + trendable::int + listable::int) desc')).to_a ref_tag = tags.shift tags.each do |tag| merge_tags!(ref_tag, tag) @@ -564,7 +564,7 @@ module Mastodon::CLI say 'Deduplicating webauthn_credentials…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM webauthn_credentials GROUP BY external_id HAVING count(*) > 1").each do |row| - WebauthnCredential.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + WebauthnCredential.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy) end say 'Restoring webauthn_credentials indexes…' @@ -578,7 +578,7 @@ module Mastodon::CLI say 'Deduplicating webhooks…' ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM webhooks GROUP BY url HAVING count(*) > 1").each do |row| - Webhook.where(id: row['ids'].split(',')).sort_by(&:id).reverse.drop(1).each(&:destroy) + Webhook.where(id: row['ids'].split(',')).order(id: :desc).drop(1).each(&:destroy) end say 'Restoring webhooks indexes…' @@ -590,8 +590,8 @@ module Mastodon::CLI SoftwareUpdate.delete_all end - def deduplicate_local_accounts!(accounts) - accounts = accounts.sort_by(&:id).reverse + def deduplicate_local_accounts!(scope) + accounts = scope.order(id: :desc).to_a say "Multiple local accounts were found for username '#{accounts.first.username}'.", :yellow say 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.', :yellow @@ -629,8 +629,8 @@ module Mastodon::CLI end end - def deduplicate_remote_accounts!(accounts) - accounts = accounts.sort_by(&:updated_at).reverse + def deduplicate_remote_accounts!(scope) + accounts = scope.order(updated_at: :desc).to_a reference_account = accounts.shift From 0b853678a45df06f5b9453217a9bf72f23ee322d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 10:57:10 -0500 Subject: [PATCH 12/55] Add coverage for `api/v1/peers/search` endpoint and extract controller query to Instance scope (#28796) --- .../api/v1/peers/search_controller.rb | 15 +++-- app/models/instance.rb | 1 + spec/requests/api/v1/peers/search_spec.rb | 59 +++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 spec/requests/api/v1/peers/search_spec.rb diff --git a/app/controllers/api/v1/peers/search_controller.rb b/app/controllers/api/v1/peers/search_controller.rb index 0c503d9bc..1780554c5 100644 --- a/app/controllers/api/v1/peers/search_controller.rb +++ b/app/controllers/api/v1/peers/search_controller.rb @@ -27,7 +27,7 @@ class Api::V1::Peers::SearchController < Api::BaseController @domains = InstancesIndex.query(function_score: { query: { prefix: { - domain: TagManager.instance.normalize_domain(params[:q].strip), + domain: normalized_domain, }, }, @@ -37,11 +37,18 @@ class Api::V1::Peers::SearchController < Api::BaseController }, }).limit(10).pluck(:domain) else - domain = params[:q].strip - domain = TagManager.instance.normalize_domain(domain) - @domains = Instance.searchable.where(Instance.arel_table[:domain].matches("#{Instance.sanitize_sql_like(domain)}%", false, true)).limit(10).pluck(:domain) + domain = normalized_domain + @domains = Instance.searchable.domain_starts_with(domain).limit(10).pluck(:domain) end rescue Addressable::URI::InvalidURIError @domains = [] end + + def normalized_domain + TagManager.instance.normalize_domain(query_value) + end + + def query_value + params[:q].strip + end end diff --git a/app/models/instance.rb b/app/models/instance.rb index 17ee0cbb1..8f8d87c62 100644 --- a/app/models/instance.rb +++ b/app/models/instance.rb @@ -23,6 +23,7 @@ class Instance < ApplicationRecord scope :searchable, -> { where.not(domain: DomainBlock.select(:domain)) } scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } + scope :domain_starts_with, ->(value) { where(arel_table[:domain].matches("#{sanitize_sql_like(value)}%", false, true)) } scope :by_domain_and_subdomains, ->(domain) { where("reverse('.' || domain) LIKE reverse(?)", "%.#{domain}") } def self.refresh diff --git a/spec/requests/api/v1/peers/search_spec.rb b/spec/requests/api/v1/peers/search_spec.rb new file mode 100644 index 000000000..dcdea387a --- /dev/null +++ b/spec/requests/api/v1/peers/search_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'API Peers Search' do + describe 'GET /api/v1/peers/search' do + context 'when peers api is disabled' do + before do + Setting.peers_api_enabled = false + end + + it 'returns http not found response' do + get '/api/v1/peers/search' + + expect(response) + .to have_http_status(404) + end + end + + context 'with no search param' do + it 'returns http success and empty response' do + get '/api/v1/peers/search' + + expect(response) + .to have_http_status(200) + expect(body_as_json) + .to be_blank + end + end + + context 'with invalid search param' do + it 'returns http success and empty response' do + get '/api/v1/peers/search', params: { q: 'ftp://Invalid-Host!!.valüe' } + + expect(response) + .to have_http_status(200) + expect(body_as_json) + .to be_blank + end + end + + context 'with search param' do + let!(:account) { Fabricate(:account, domain: 'host.example') } + + before { Instance.refresh } + + it 'returns http success and json with known domains' do + get '/api/v1/peers/search', params: { q: 'host.example' } + + expect(response) + .to have_http_status(200) + expect(body_as_json.size) + .to eq(1) + expect(body_as_json.first) + .to eq(account.domain) + end + end + end +end From d0b3bc23d739e38ca7b7ac9a7f20f1f2a751563b Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 11:11:04 -0500 Subject: [PATCH 13/55] Remove unused `matches_domain` scopes on Account, DomainAllow, DomainBlock (#28803) --- app/models/account.rb | 1 - app/models/domain_allow.rb | 2 -- app/models/domain_block.rb | 1 - spec/models/domain_allow_spec.rb | 20 +++++++++++--------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index 0fca7ce4b..c17de682e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -125,7 +125,6 @@ class Account < ApplicationRecord scope :alphabetic, -> { order(domain: :asc, username: :asc) } scope :matches_username, ->(value) { where('lower((username)::text) LIKE lower(?)', "#{value}%") } scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) } - scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } scope :without_unapproved, -> { left_outer_joins(:user).merge(User.approved.confirmed).or(remote) } scope :searchable, -> { without_unapproved.without_suspended.where(moved_to_account_id: nil) } scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat) } diff --git a/app/models/domain_allow.rb b/app/models/domain_allow.rb index ce9597b4d..47ada7ac2 100644 --- a/app/models/domain_allow.rb +++ b/app/models/domain_allow.rb @@ -17,8 +17,6 @@ class DomainAllow < ApplicationRecord validates :domain, presence: true, uniqueness: true, domain: true - scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } - def to_log_human_identifier domain end diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 8da099256..a05db099a 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -28,7 +28,6 @@ class DomainBlock < ApplicationRecord has_many :accounts, foreign_key: :domain, primary_key: :domain, inverse_of: false, dependent: nil delegate :count, to: :accounts, prefix: true - scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } scope :with_user_facing_limitations, -> { where(severity: [:silence, :suspend]) } scope :with_limitations, -> { where(severity: [:silence, :suspend]).or(where(reject_media: true)) } scope :by_severity, -> { in_order_of(:severity, %w(noop silence suspend)).order(:domain) } diff --git a/spec/models/domain_allow_spec.rb b/spec/models/domain_allow_spec.rb index 49e16376e..12504211a 100644 --- a/spec/models/domain_allow_spec.rb +++ b/spec/models/domain_allow_spec.rb @@ -3,16 +3,18 @@ require 'rails_helper' describe DomainAllow do - describe 'scopes' do - describe 'matches_domain' do - let(:domain) { Fabricate(:domain_allow, domain: 'example.com') } - let(:other_domain) { Fabricate(:domain_allow, domain: 'example.biz') } + describe 'Validations' do + it 'is invalid without a domain' do + domain_allow = Fabricate.build(:domain_allow, domain: nil) + domain_allow.valid? + expect(domain_allow).to model_have_error_on_field(:domain) + end - it 'returns the correct records' do - results = described_class.matches_domain('example.com') - - expect(results).to eq([domain]) - end + it 'is invalid if the same normalized domain already exists' do + _domain_allow = Fabricate(:domain_allow, domain: 'にゃん') + domain_allow_with_normalized_value = Fabricate.build(:domain_allow, domain: 'xn--r9j5b5b') + domain_allow_with_normalized_value.valid? + expect(domain_allow_with_normalized_value).to model_have_error_on_field(:domain) end end end From f0b93ab02fdae64fcf3e89508ad3e5919a861264 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 11:11:50 -0500 Subject: [PATCH 14/55] Use AR `database_version` in PG version checks in migrations (#28804) --- db/migrate/20180812173710_copy_status_stats.rb | 3 +-- db/migrate/20181116173541_copy_account_stats.rb | 3 +-- ...0230803082451_add_unique_index_on_preview_cards_statuses.rb | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/db/migrate/20180812173710_copy_status_stats.rb b/db/migrate/20180812173710_copy_status_stats.rb index 52ab43b76..087b1290d 100644 --- a/db/migrate/20180812173710_copy_status_stats.rb +++ b/db/migrate/20180812173710_copy_status_stats.rb @@ -20,8 +20,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2] private def supports_upsert? - version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i - version >= 90_500 + ActiveRecord::Base.connection.database_version >= 90_500 end def up_fast diff --git a/db/migrate/20181116173541_copy_account_stats.rb b/db/migrate/20181116173541_copy_account_stats.rb index 9070200fe..e5faee0cb 100644 --- a/db/migrate/20181116173541_copy_account_stats.rb +++ b/db/migrate/20181116173541_copy_account_stats.rb @@ -24,8 +24,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2] private def supports_upsert? - version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i - version >= 90_500 + ActiveRecord::Base.connection.database_version >= 90_500 end def up_fast diff --git a/db/post_migrate/20230803082451_add_unique_index_on_preview_cards_statuses.rb b/db/post_migrate/20230803082451_add_unique_index_on_preview_cards_statuses.rb index d29d7847c..4271f8c08 100644 --- a/db/post_migrate/20230803082451_add_unique_index_on_preview_cards_statuses.rb +++ b/db/post_migrate/20230803082451_add_unique_index_on_preview_cards_statuses.rb @@ -17,8 +17,7 @@ class AddUniqueIndexOnPreviewCardsStatuses < ActiveRecord::Migration[6.1] def supports_concurrent_reindex? @supports_concurrent_reindex ||= begin - version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i - version >= 120_000 + ActiveRecord::Base.connection.database_version >= 120_000 end end From f866413e724c2e7f8329fbc6e96f56f0b186c62a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 11:14:15 -0500 Subject: [PATCH 15/55] Extract shared tagged statuses method in `FeaturedTag` (#28805) --- app/models/featured_tag.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb index 63cd67476..ea8aa4787 100644 --- a/app/models/featured_tag.rb +++ b/app/models/featured_tag.rb @@ -45,7 +45,7 @@ class FeaturedTag < ApplicationRecord end def decrement(deleted_status_id) - update(statuses_count: [0, statuses_count - 1].max, last_status_at: account.statuses.where(visibility: %i(public unlisted)).tagged_with(tag).where.not(id: deleted_status_id).select(:created_at).first&.created_at) + update(statuses_count: [0, statuses_count - 1].max, last_status_at: visible_tagged_account_statuses.where.not(id: deleted_status_id).select(:created_at).first&.created_at) end private @@ -55,8 +55,8 @@ class FeaturedTag < ApplicationRecord end def reset_data - self.statuses_count = account.statuses.where(visibility: %i(public unlisted)).tagged_with(tag).count - self.last_status_at = account.statuses.where(visibility: %i(public unlisted)).tagged_with(tag).select(:created_at).first&.created_at + self.statuses_count = visible_tagged_account_statuses.count + self.last_status_at = visible_tagged_account_statuses.select(:created_at).first&.created_at end def validate_featured_tags_limit @@ -72,4 +72,8 @@ class FeaturedTag < ApplicationRecord def tag_already_featured_for_account? FeaturedTag.by_name(name).exists?(account_id: account_id) end + + def visible_tagged_account_statuses + account.statuses.where(visibility: %i(public unlisted)).tagged_with(tag) + end end From 1335083bedd1dd563cfa9c54e69abc189ba3ec7b Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Thu, 18 Jan 2024 19:40:25 +0100 Subject: [PATCH 16/55] Streaming: replace npmlog with pino & pino-http (#27828) --- streaming/.eslintrc.js | 11 ++ streaming/index.js | 334 ++++++++++++++++++++---------------- streaming/logging.js | 119 +++++++++++++ streaming/package.json | 5 +- yarn.lock | 376 +++++++++++++++++++++++++++++------------ 5 files changed, 593 insertions(+), 252 deletions(-) create mode 100644 streaming/logging.js diff --git a/streaming/.eslintrc.js b/streaming/.eslintrc.js index 5e2d233c6..188ebb512 100644 --- a/streaming/.eslintrc.js +++ b/streaming/.eslintrc.js @@ -15,7 +15,18 @@ module.exports = defineConfig({ ecmaVersion: 2021, }, rules: { + // In the streaming server we need to delete some variables to ensure + // garbage collection takes place on the values referenced by those objects; + // The alternative is to declare the variable as nullable, but then we need + // to assert it's in existence before every use, which becomes much harder + // to maintain. + 'no-delete-var': 'off', + + // The streaming server is written in commonjs, not ESM for now: 'import/no-commonjs': 'off', + + // This overrides the base configuration for this rule to pick up + // dependencies for the streaming server from the correct package.json file. 'import/no-extraneous-dependencies': [ 'error', { diff --git a/streaming/index.js b/streaming/index.js index c8124fcc0..aa75a08b7 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -10,12 +10,11 @@ const dotenv = require('dotenv'); const express = require('express'); const Redis = require('ioredis'); const { JSDOM } = require('jsdom'); -const log = require('npmlog'); const pg = require('pg'); const dbUrlToConfig = require('pg-connection-string').parse; -const uuid = require('uuid'); const WebSocket = require('ws'); +const { logger, httpLogger, initializeLogLevel, attachWebsocketHttpLogger, createWebsocketLogger } = require('./logging'); const { setupMetrics } = require('./metrics'); const { isTruthy } = require("./utils"); @@ -28,15 +27,30 @@ dotenv.config({ path: path.resolve(__dirname, path.join('..', dotenvFile)) }); -log.level = process.env.LOG_LEVEL || 'verbose'; +initializeLogLevel(process.env, environment); + +/** + * Declares the result type for accountFromToken / accountFromRequest. + * + * Note: This is here because jsdoc doesn't like importing types that + * are nested in functions + * @typedef ResolvedAccount + * @property {string} accessTokenId + * @property {string[]} scopes + * @property {string} accountId + * @property {string[]} chosenLanguages + * @property {string} deviceId + */ /** * @param {Object.} config */ const createRedisClient = async (config) => { const { redisParams, redisUrl } = config; + // @ts-ignore const client = new Redis(redisUrl, redisParams); - client.on('error', (err) => log.error('Redis Client Error!', err)); + // @ts-ignore + client.on('error', (err) => logger.error({ err }, 'Redis Client Error!')); return client; }; @@ -61,12 +75,12 @@ const parseJSON = (json, req) => { */ if (req) { if (req.accountId) { - log.warn(req.requestId, `Error parsing message from user ${req.accountId}: ${err}`); + req.log.error({ err }, `Error parsing message from user ${req.accountId}`); } else { - log.silly(req.requestId, `Error parsing message from ${req.remoteAddress}: ${err}`); + req.log.error({ err }, `Error parsing message from ${req.remoteAddress}`); } } else { - log.warn(`Error parsing message from redis: ${err}`); + logger.error({ err }, `Error parsing message from redis`); } return null; } @@ -105,6 +119,7 @@ const pgConfigFromEnv = (env) => { baseConfig.password = env.DB_PASS; } } else { + // @ts-ignore baseConfig = pgConfigs[environment]; if (env.DB_SSLMODE) { @@ -149,6 +164,7 @@ const redisConfigFromEnv = (env) => { // redisParams.path takes precedence over host and port. if (env.REDIS_URL && env.REDIS_URL.startsWith('unix://')) { + // @ts-ignore redisParams.path = env.REDIS_URL.slice(7); } @@ -195,6 +211,7 @@ const startServer = async () => { app.set('trust proxy', process.env.TRUSTED_PROXY_IP ? process.env.TRUSTED_PROXY_IP.split(/(?:\s*,\s*|\s+)/) : 'loopback,uniquelocal'); + app.use(httpLogger); app.use(cors()); // Handle eventsource & other http requests: @@ -202,32 +219,37 @@ const startServer = async () => { // Handle upgrade requests: server.on('upgrade', async function handleUpgrade(request, socket, head) { + // Setup the HTTP logger, since websocket upgrades don't get the usual http + // logger. This decorates the `request` object. + attachWebsocketHttpLogger(request); + + request.log.info("HTTP Upgrade Requested"); + /** @param {Error} err */ const onSocketError = (err) => { - log.error(`Error with websocket upgrade: ${err}`); + request.log.error({ error: err }, err.message); }; socket.on('error', onSocketError); - // Authenticate: - try { - await accountFromRequest(request); - } catch (err) { - log.error(`Error authenticating request: ${err}`); + /** @type {ResolvedAccount} */ + let resolvedAccount; + try { + resolvedAccount = await accountFromRequest(request); + } catch (err) { // Unfortunately for using the on('upgrade') setup, we need to manually // write a HTTP Response to the Socket to close the connection upgrade // attempt, so the following code is to handle all of that. const statusCode = err.status ?? 401; - /** @type {Record} */ + /** @type {Record} */ const headers = { 'Connection': 'close', 'Content-Type': 'text/plain', 'Content-Length': 0, 'X-Request-Id': request.id, - // TODO: Send the error message via header so it can be debugged in - // developer tools + 'X-Error-Message': err.status ? err.toString() : 'An unexpected error occurred' }; // Ensure the socket is closed once we've finished writing to it: @@ -238,15 +260,28 @@ const startServer = async () => { // Write the HTTP response manually: socket.end(`HTTP/1.1 ${statusCode} ${http.STATUS_CODES[statusCode]}\r\n${Object.keys(headers).map((key) => `${key}: ${headers[key]}`).join('\r\n')}\r\n\r\n`); + // Finally, log the error: + request.log.error({ + err, + res: { + statusCode, + headers + } + }, err.toString()); + return; } + // Remove the error handler, wss.handleUpgrade has its own: + socket.removeListener('error', onSocketError); + wss.handleUpgrade(request, socket, head, function done(ws) { - // Remove the error handler: - socket.removeListener('error', onSocketError); + request.log.info("Authenticated request & upgraded to WebSocket connection"); + + const wsLogger = createWebsocketLogger(request, resolvedAccount); // Start the connection: - wss.emit('connection', ws, request); + wss.emit('connection', ws, request, wsLogger); }); }); @@ -273,9 +308,9 @@ const startServer = async () => { // When checking metrics in the browser, the favicon is requested this // prevents the request from falling through to the API Router, which would // error for this endpoint: - app.get('/favicon.ico', (req, res) => res.status(404).end()); + app.get('/favicon.ico', (_req, res) => res.status(404).end()); - app.get('/api/v1/streaming/health', (req, res) => { + app.get('/api/v1/streaming/health', (_req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK'); }); @@ -285,7 +320,7 @@ const startServer = async () => { res.set('Content-Type', metrics.register.contentType); res.end(await metrics.register.metrics()); } catch (ex) { - log.error(ex); + req.log.error(ex); res.status(500).end(); } }); @@ -319,7 +354,7 @@ const startServer = async () => { const callbacks = subs[channel]; - log.silly(`New message on channel ${redisPrefix}${channel}`); + logger.debug(`New message on channel ${redisPrefix}${channel}`); if (!callbacks) { return; @@ -343,17 +378,16 @@ const startServer = async () => { * @param {SubscriptionListener} callback */ const subscribe = (channel, callback) => { - log.silly(`Adding listener for ${channel}`); + logger.debug(`Adding listener for ${channel}`); subs[channel] = subs[channel] || []; if (subs[channel].length === 0) { - log.verbose(`Subscribe ${channel}`); + logger.debug(`Subscribe ${channel}`); redisSubscribeClient.subscribe(channel, (err, count) => { if (err) { - log.error(`Error subscribing to ${channel}`); - } - else { + logger.error(`Error subscribing to ${channel}`); + } else if (typeof count === 'number') { redisSubscriptions.set(count); } }); @@ -367,7 +401,7 @@ const startServer = async () => { * @param {SubscriptionListener} callback */ const unsubscribe = (channel, callback) => { - log.silly(`Removing listener for ${channel}`); + logger.debug(`Removing listener for ${channel}`); if (!subs[channel]) { return; @@ -376,12 +410,11 @@ const startServer = async () => { subs[channel] = subs[channel].filter(item => item !== callback); if (subs[channel].length === 0) { - log.verbose(`Unsubscribe ${channel}`); + logger.debug(`Unsubscribe ${channel}`); redisSubscribeClient.unsubscribe(channel, (err, count) => { if (err) { - log.error(`Error unsubscribing to ${channel}`); - } - else { + logger.error(`Error unsubscribing to ${channel}`); + } else if (typeof count === 'number') { redisSubscriptions.set(count); } }); @@ -390,45 +423,13 @@ const startServer = async () => { }; /** - * @param {any} req - * @param {any} res - * @param {function(Error=): void} next - */ - const setRequestId = (req, res, next) => { - req.requestId = uuid.v4(); - res.header('X-Request-Id', req.requestId); - - next(); - }; - - /** - * @param {any} req - * @param {any} res - * @param {function(Error=): void} next - */ - const setRemoteAddress = (req, res, next) => { - req.remoteAddress = req.connection.remoteAddress; - - next(); - }; - - /** - * @param {any} req + * @param {http.IncomingMessage & ResolvedAccount} req * @param {string[]} necessaryScopes * @returns {boolean} */ const isInScope = (req, necessaryScopes) => req.scopes.some(scope => necessaryScopes.includes(scope)); - /** - * @typedef ResolvedAccount - * @property {string} accessTokenId - * @property {string[]} scopes - * @property {string} accountId - * @property {string[]} chosenLanguages - * @property {string} deviceId - */ - /** * @param {string} token * @param {any} req @@ -441,6 +442,7 @@ const startServer = async () => { return; } + // @ts-ignore client.query('SELECT oauth_access_tokens.id, oauth_access_tokens.resource_owner_id, users.account_id, users.chosen_languages, oauth_access_tokens.scopes, devices.device_id FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id LEFT OUTER JOIN devices ON oauth_access_tokens.id = devices.access_token_id WHERE oauth_access_tokens.token = $1 AND oauth_access_tokens.revoked_at IS NULL LIMIT 1', [token], (err, result) => { done(); @@ -451,6 +453,7 @@ const startServer = async () => { if (result.rows.length === 0) { err = new Error('Invalid access token'); + // @ts-ignore err.status = 401; reject(err); @@ -485,6 +488,7 @@ const startServer = async () => { if (!authorization && !accessToken) { const err = new Error('Missing access token'); + // @ts-ignore err.status = 401; reject(err); @@ -529,15 +533,16 @@ const startServer = async () => { }; /** - * @param {any} req + * @param {http.IncomingMessage & ResolvedAccount} req + * @param {import('pino').Logger} logger * @param {string|undefined} channelName * @returns {Promise.} */ - const checkScopes = (req, channelName) => new Promise((resolve, reject) => { - log.silly(req.requestId, `Checking OAuth scopes for ${channelName}`); + const checkScopes = (req, logger, channelName) => new Promise((resolve, reject) => { + logger.debug(`Checking OAuth scopes for ${channelName}`); // When accessing public channels, no scopes are needed - if (PUBLIC_CHANNELS.includes(channelName)) { + if (channelName && PUBLIC_CHANNELS.includes(channelName)) { resolve(); return; } @@ -564,6 +569,7 @@ const startServer = async () => { } const err = new Error('Access token does not cover required scopes'); + // @ts-ignore err.status = 401; reject(err); @@ -577,38 +583,40 @@ const startServer = async () => { /** * @param {any} req * @param {SystemMessageHandlers} eventHandlers - * @returns {function(object): void} + * @returns {SubscriptionListener} */ const createSystemMessageListener = (req, eventHandlers) => { return message => { + if (!message?.event) { + return; + } + const { event } = message; - log.silly(req.requestId, `System message for ${req.accountId}: ${event}`); + req.log.debug(`System message for ${req.accountId}: ${event}`); if (event === 'kill') { - log.verbose(req.requestId, `Closing connection for ${req.accountId} due to expired access token`); + req.log.debug(`Closing connection for ${req.accountId} due to expired access token`); eventHandlers.onKill(); } else if (event === 'filters_changed') { - log.verbose(req.requestId, `Invalidating filters cache for ${req.accountId}`); + req.log.debug(`Invalidating filters cache for ${req.accountId}`); req.cachedFilters = null; } }; }; /** - * @param {any} req - * @param {any} res + * @param {http.IncomingMessage & ResolvedAccount} req + * @param {http.OutgoingMessage} res */ const subscribeHttpToSystemChannel = (req, res) => { const accessTokenChannelId = `timeline:access_token:${req.accessTokenId}`; const systemChannelId = `timeline:system:${req.accountId}`; const listener = createSystemMessageListener(req, { - onKill() { res.end(); }, - }); res.on('close', () => { @@ -641,13 +649,14 @@ const startServer = async () => { // the connection, as there's nothing to stream back if (!channelName) { const err = new Error('Unknown channel requested'); + // @ts-ignore err.status = 400; next(err); return; } - accountFromRequest(req).then(() => checkScopes(req, channelName)).then(() => { + accountFromRequest(req).then(() => checkScopes(req, req.log, channelName)).then(() => { subscribeHttpToSystemChannel(req, res); }).then(() => { next(); @@ -663,22 +672,28 @@ const startServer = async () => { * @param {function(Error=): void} next */ const errorMiddleware = (err, req, res, next) => { - log.error(req.requestId, err.toString()); + req.log.error({ err }, err.toString()); if (res.headersSent) { next(err); return; } - res.writeHead(err.status || 500, { 'Content-Type': 'application/json' }); - res.end(JSON.stringify({ error: err.status ? err.toString() : 'An unexpected error occurred' })); + const hasStatusCode = Object.hasOwnProperty.call(err, 'status'); + // @ts-ignore + const statusCode = hasStatusCode ? err.status : 500; + const errorMessage = hasStatusCode ? err.toString() : 'An unexpected error occurred'; + + res.writeHead(statusCode, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ error: errorMessage })); }; /** - * @param {array} arr + * @param {any[]} arr * @param {number=} shift * @returns {string} */ + // @ts-ignore const placeholders = (arr, shift = 0) => arr.map((_, i) => `$${i + 1 + shift}`).join(', '); /** @@ -695,6 +710,7 @@ const startServer = async () => { return; } + // @ts-ignore client.query('SELECT id, account_id FROM lists WHERE id = $1 LIMIT 1', [listId], (err, result) => { done(); @@ -709,34 +725,43 @@ const startServer = async () => { }); /** - * @param {string[]} ids - * @param {any} req + * @param {string[]} channelIds + * @param {http.IncomingMessage & ResolvedAccount} req + * @param {import('pino').Logger} log * @param {function(string, string): void} output * @param {undefined | function(string[], SubscriptionListener): void} attachCloseHandler * @param {'websocket' | 'eventsource'} destinationType * @param {boolean=} needsFiltering * @returns {SubscriptionListener} */ - const streamFrom = (ids, req, output, attachCloseHandler, destinationType, needsFiltering = false) => { - const accountId = req.accountId || req.remoteAddress; - - log.verbose(req.requestId, `Starting stream from ${ids.join(', ')} for ${accountId}`); + const streamFrom = (channelIds, req, log, output, attachCloseHandler, destinationType, needsFiltering = false) => { + log.info({ channelIds }, `Starting stream`); + /** + * @param {string} event + * @param {object|string} payload + */ const transmit = (event, payload) => { // TODO: Replace "string"-based delete payloads with object payloads: const encodedPayload = typeof payload === 'object' ? JSON.stringify(payload) : payload; messagesSent.labels({ type: destinationType }).inc(1); - log.silly(req.requestId, `Transmitting for ${accountId}: ${event} ${encodedPayload}`); + log.debug({ event, payload }, `Transmitting ${event} to ${req.accountId}`); + output(event, encodedPayload); }; // The listener used to process each message off the redis subscription, // message here is an object with an `event` and `payload` property. Some // events also include a queued_at value, but this is being removed shortly. + /** @type {SubscriptionListener} */ const listener = message => { + if (!message?.event || !message?.payload) { + return; + } + const { event, payload } = message; // Streaming only needs to apply filtering to some channels and only to @@ -759,7 +784,7 @@ const startServer = async () => { // Filter based on language: if (Array.isArray(req.chosenLanguages) && payload.language !== null && req.chosenLanguages.indexOf(payload.language) === -1) { - log.silly(req.requestId, `Message ${payload.id} filtered by language (${payload.language})`); + log.debug(`Message ${payload.id} filtered by language (${payload.language})`); return; } @@ -770,6 +795,7 @@ const startServer = async () => { } // Filter based on domain blocks, blocks, mutes, or custom filters: + // @ts-ignore const targetAccountIds = [payload.account.id].concat(payload.mentions.map(item => item.id)); const accountDomain = payload.account.acct.split('@')[1]; @@ -781,6 +807,7 @@ const startServer = async () => { } const queries = [ + // @ts-ignore client.query(`SELECT 1 FROM blocks WHERE (account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 2)})) @@ -793,10 +820,13 @@ const startServer = async () => { ]; if (accountDomain) { + // @ts-ignore queries.push(client.query('SELECT 1 FROM account_domain_blocks WHERE account_id = $1 AND domain = $2', [req.accountId, accountDomain])); } + // @ts-ignore if (!payload.filtered && !req.cachedFilters) { + // @ts-ignore queries.push(client.query('SELECT filter.id AS id, filter.phrase AS title, filter.context AS context, filter.expires_at AS expires_at, filter.action AS filter_action, keyword.keyword AS keyword, keyword.whole_word AS whole_word FROM custom_filter_keywords keyword JOIN custom_filters filter ON keyword.custom_filter_id = filter.id WHERE filter.account_id = $1 AND (filter.expires_at IS NULL OR filter.expires_at > NOW())', [req.accountId])); } @@ -819,9 +849,11 @@ const startServer = async () => { // Handling for constructing the custom filters and caching them on the request // TODO: Move this logic out of the message handling lifecycle + // @ts-ignore if (!req.cachedFilters) { const filterRows = values[accountDomain ? 2 : 1].rows; + // @ts-ignore req.cachedFilters = filterRows.reduce((cache, filter) => { if (cache[filter.id]) { cache[filter.id].keywords.push([filter.keyword, filter.whole_word]); @@ -851,7 +883,9 @@ const startServer = async () => { // needs to be done in a separate loop as the database returns one // filterRow per keyword, so we need all the keywords before // constructing the regular expression + // @ts-ignore Object.keys(req.cachedFilters).forEach((key) => { + // @ts-ignore req.cachedFilters[key].regexp = new RegExp(req.cachedFilters[key].keywords.map(([keyword, whole_word]) => { let expr = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); @@ -872,13 +906,16 @@ const startServer = async () => { // Apply cachedFilters against the payload, constructing a // `filter_results` array of FilterResult entities + // @ts-ignore if (req.cachedFilters) { const status = payload; // TODO: Calculate searchableContent in Ruby on Rails: + // @ts-ignore const searchableContent = ([status.spoiler_text || '', status.content].concat((status.poll && status.poll.options) ? status.poll.options.map(option => option.title) : [])).concat(status.media_attachments.map(att => att.description)).join('\n\n').replace(//g, '\n').replace(/<\/p>

/g, '\n\n'); const searchableTextContent = JSDOM.fragment(searchableContent).textContent; const now = new Date(); + // @ts-ignore const filter_results = Object.values(req.cachedFilters).reduce((results, cachedFilter) => { // Check the filter hasn't expired before applying: if (cachedFilter.expires_at !== null && cachedFilter.expires_at < now) { @@ -926,12 +963,12 @@ const startServer = async () => { }); }; - ids.forEach(id => { + channelIds.forEach(id => { subscribe(`${redisPrefix}${id}`, listener); }); if (typeof attachCloseHandler === 'function') { - attachCloseHandler(ids.map(id => `${redisPrefix}${id}`), listener); + attachCloseHandler(channelIds.map(id => `${redisPrefix}${id}`), listener); } return listener; @@ -943,8 +980,6 @@ const startServer = async () => { * @returns {function(string, string): void} */ const streamToHttp = (req, res) => { - const accountId = req.accountId || req.remoteAddress; - const channelName = channelNameFromPath(req); connectedClients.labels({ type: 'eventsource' }).inc(); @@ -963,7 +998,8 @@ const startServer = async () => { const heartbeat = setInterval(() => res.write(':thump\n'), 15000); req.on('close', () => { - log.verbose(req.requestId, `Ending stream for ${accountId}`); + req.log.info({ accountId: req.accountId }, `Ending stream`); + // We decrement these counters here instead of in streamHttpEnd as in that // method we don't have knowledge of the channel names connectedClients.labels({ type: 'eventsource' }).dec(); @@ -1007,15 +1043,15 @@ const startServer = async () => { */ const streamToWs = (req, ws, streamName) => (event, payload) => { if (ws.readyState !== ws.OPEN) { - log.error(req.requestId, 'Tried writing to closed socket'); + req.log.error('Tried writing to closed socket'); return; } const message = JSON.stringify({ stream: streamName, event, payload }); - ws.send(message, (/** @type {Error} */ err) => { + ws.send(message, (/** @type {Error|undefined} */ err) => { if (err) { - log.error(req.requestId, `Failed to send to websocket: ${err}`); + req.log.error({err}, `Failed to send to websocket`); } }); }; @@ -1032,20 +1068,19 @@ const startServer = async () => { app.use(api); - api.use(setRequestId); - api.use(setRemoteAddress); - api.use(authenticationMiddleware); api.use(errorMiddleware); api.get('/api/v1/streaming/*', (req, res) => { + // @ts-ignore channelNameToIds(req, channelNameFromPath(req), req.query).then(({ channelIds, options }) => { const onSend = streamToHttp(req, res); const onEnd = streamHttpEnd(req, subscriptionHeartbeat(channelIds)); - streamFrom(channelIds, req, onSend, onEnd, 'eventsource', options.needsFiltering); + // @ts-ignore + streamFrom(channelIds, req, req.log, onSend, onEnd, 'eventsource', options.needsFiltering); }).catch(err => { - log.verbose(req.requestId, 'Subscription error:', err.toString()); + res.log.info({ err }, 'Subscription error:', err.toString()); httpNotFound(res); }); }); @@ -1197,6 +1232,7 @@ const startServer = async () => { break; case 'list': + // @ts-ignore authorizeListAccess(params.list, req).then(() => { resolve({ channelIds: [`timeline:list:${params.list}`], @@ -1218,9 +1254,9 @@ const startServer = async () => { * @returns {string[]} */ const streamNameFromChannelName = (channelName, params) => { - if (channelName === 'list') { + if (channelName === 'list' && params.list) { return [channelName, params.list]; - } else if (['hashtag', 'hashtag:local'].includes(channelName)) { + } else if (['hashtag', 'hashtag:local'].includes(channelName) && params.tag) { return [channelName, params.tag]; } else { return [channelName]; @@ -1229,8 +1265,9 @@ const startServer = async () => { /** * @typedef WebSocketSession - * @property {WebSocket} websocket - * @property {http.IncomingMessage} request + * @property {WebSocket & { isAlive: boolean}} websocket + * @property {http.IncomingMessage & ResolvedAccount} request + * @property {import('pino').Logger} logger * @property {Object.} subscriptions */ @@ -1240,8 +1277,8 @@ const startServer = async () => { * @param {StreamParams} params * @returns {void} */ - const subscribeWebsocketToChannel = ({ socket, request, subscriptions }, channelName, params) => { - checkScopes(request, channelName).then(() => channelNameToIds(request, channelName, params)).then(({ + const subscribeWebsocketToChannel = ({ websocket, request, logger, subscriptions }, channelName, params) => { + checkScopes(request, logger, channelName).then(() => channelNameToIds(request, channelName, params)).then(({ channelIds, options, }) => { @@ -1249,9 +1286,9 @@ const startServer = async () => { return; } - const onSend = streamToWs(request, socket, streamNameFromChannelName(channelName, params)); + const onSend = streamToWs(request, websocket, streamNameFromChannelName(channelName, params)); const stopHeartbeat = subscriptionHeartbeat(channelIds); - const listener = streamFrom(channelIds, request, onSend, undefined, 'websocket', options.needsFiltering); + const listener = streamFrom(channelIds, request, logger, onSend, undefined, 'websocket', options.needsFiltering); connectedChannels.labels({ type: 'websocket', channel: channelName }).inc(); @@ -1261,14 +1298,17 @@ const startServer = async () => { stopHeartbeat, }; }).catch(err => { - log.verbose(request.requestId, 'Subscription error:', err.toString()); - socket.send(JSON.stringify({ error: err.toString() })); + logger.error({ err }, 'Subscription error'); + websocket.send(JSON.stringify({ error: err.toString() })); }); }; - - const removeSubscription = (subscriptions, channelIds, request) => { - log.verbose(request.requestId, `Ending stream from ${channelIds.join(', ')} for ${request.accountId}`); + /** + * @param {WebSocketSession} session + * @param {string[]} channelIds + */ + const removeSubscription = ({ request, logger, subscriptions }, channelIds) => { + logger.info({ channelIds, accountId: request.accountId }, `Ending stream`); const subscription = subscriptions[channelIds.join(';')]; @@ -1292,16 +1332,17 @@ const startServer = async () => { * @param {StreamParams} params * @returns {void} */ - const unsubscribeWebsocketFromChannel = ({ socket, request, subscriptions }, channelName, params) => { + const unsubscribeWebsocketFromChannel = (session, channelName, params) => { + const { websocket, request, logger } = session; + channelNameToIds(request, channelName, params).then(({ channelIds }) => { - removeSubscription(subscriptions, channelIds, request); + removeSubscription(session, channelIds); }).catch(err => { - log.verbose(request.requestId, 'Unsubscribe error:', err); + logger.error({err}, 'Unsubscribe error'); // If we have a socket that is alive and open still, send the error back to the client: - // FIXME: In other parts of the code ws === socket - if (socket.isAlive && socket.readyState === socket.OPEN) { - socket.send(JSON.stringify({ error: "Error unsubscribing from channel" })); + if (websocket.isAlive && websocket.readyState === websocket.OPEN) { + websocket.send(JSON.stringify({ error: "Error unsubscribing from channel" })); } }); }; @@ -1309,16 +1350,14 @@ const startServer = async () => { /** * @param {WebSocketSession} session */ - const subscribeWebsocketToSystemChannel = ({ socket, request, subscriptions }) => { + const subscribeWebsocketToSystemChannel = ({ websocket, request, subscriptions }) => { const accessTokenChannelId = `timeline:access_token:${request.accessTokenId}`; const systemChannelId = `timeline:system:${request.accountId}`; const listener = createSystemMessageListener(request, { - onKill() { - socket.close(); + websocket.close(); }, - }); subscribe(`${redisPrefix}${accessTokenChannelId}`, listener); @@ -1355,18 +1394,15 @@ const startServer = async () => { /** * @param {WebSocket & { isAlive: boolean }} ws - * @param {http.IncomingMessage} req + * @param {http.IncomingMessage & ResolvedAccount} req + * @param {import('pino').Logger} log */ - function onConnection(ws, req) { + function onConnection(ws, req, log) { // Note: url.parse could throw, which would terminate the connection, so we // increment the connected clients metric straight away when we establish // the connection, without waiting: connectedClients.labels({ type: 'websocket' }).inc(); - // Setup request properties: - req.requestId = uuid.v4(); - req.remoteAddress = ws._socket.remoteAddress; - // Setup connection keep-alive state: ws.isAlive = true; ws.on('pong', () => { @@ -1377,8 +1413,9 @@ const startServer = async () => { * @type {WebSocketSession} */ const session = { - socket: ws, + websocket: ws, request: req, + logger: log, subscriptions: {}, }; @@ -1386,27 +1423,30 @@ const startServer = async () => { const subscriptions = Object.keys(session.subscriptions); subscriptions.forEach(channelIds => { - removeSubscription(session.subscriptions, channelIds.split(';'), req); + removeSubscription(session, channelIds.split(';')); }); // Decrement the metrics for connected clients: connectedClients.labels({ type: 'websocket' }).dec(); - // ensure garbage collection: - session.socket = null; - session.request = null; - session.subscriptions = {}; + // We need to delete the session object as to ensure it correctly gets + // garbage collected, without doing this we could accidentally hold on to + // references to the websocket, the request, and the logger, causing + // memory leaks. + // + // @ts-ignore + delete session; }); // Note: immediately after the `error` event is emitted, the `close` event // is emitted. As such, all we need to do is log the error here. - ws.on('error', (err) => { - log.error('websocket', err.toString()); + ws.on('error', (/** @type {Error} */ err) => { + log.error(err); }); ws.on('message', (data, isBinary) => { if (isBinary) { - log.warn('websocket', 'Received binary data, closing connection'); + log.warn('Received binary data, closing connection'); ws.close(1003, 'The mastodon streaming server does not support binary messages'); return; } @@ -1441,18 +1481,20 @@ const startServer = async () => { setInterval(() => { wss.clients.forEach(ws => { + // @ts-ignore if (ws.isAlive === false) { ws.terminate(); return; } + // @ts-ignore ws.isAlive = false; ws.ping('', false); }); }, 30000); attachServerWithConfig(server, address => { - log.warn(`Streaming API now listening on ${address}`); + logger.info(`Streaming API now listening on ${address}`); }); const onExit = () => { @@ -1460,8 +1502,10 @@ const startServer = async () => { process.exit(0); }; + /** @param {Error} err */ const onError = (err) => { - log.error(err); + logger.error(err); + server.close(); process.exit(0); }; @@ -1485,7 +1529,7 @@ const attachServerWithConfig = (server, onSuccess) => { } }); } else { - server.listen(+process.env.PORT || 4000, process.env.BIND || '127.0.0.1', () => { + server.listen(+(process.env.PORT || 4000), process.env.BIND || '127.0.0.1', () => { if (onSuccess) { onSuccess(`${server.address().address}:${server.address().port}`); } diff --git a/streaming/logging.js b/streaming/logging.js new file mode 100644 index 000000000..64ee47487 --- /dev/null +++ b/streaming/logging.js @@ -0,0 +1,119 @@ +const { pino } = require('pino'); +const { pinoHttp, stdSerializers: pinoHttpSerializers } = require('pino-http'); +const uuid = require('uuid'); + +/** + * Generates the Request ID for logging and setting on responses + * @param {http.IncomingMessage} req + * @param {http.ServerResponse} [res] + * @returns {import("pino-http").ReqId} + */ +function generateRequestId(req, res) { + if (req.id) { + return req.id; + } + + req.id = uuid.v4(); + + // Allow for usage with WebSockets: + if (res) { + res.setHeader('X-Request-Id', req.id); + } + + return req.id; +} + +/** + * Request log sanitizer to prevent logging access tokens in URLs + * @param {http.IncomingMessage} req + */ +function sanitizeRequestLog(req) { + const log = pinoHttpSerializers.req(req); + if (typeof log.url === 'string' && log.url.includes('access_token')) { + // Doorkeeper uses SecureRandom.urlsafe_base64 per RFC 6749 / RFC 6750 + log.url = log.url.replace(/(access_token)=([a-zA-Z0-9\-_]+)/gi, '$1=[Redacted]'); + } + return log; +} + +const logger = pino({ + name: "streaming", + // Reformat the log level to a string: + formatters: { + level: (label) => { + return { + level: label + }; + }, + }, + redact: { + paths: [ + 'req.headers["sec-websocket-key"]', + // Note: we currently pass the AccessToken via the websocket subprotocol + // field, an anti-pattern, but this ensures it doesn't end up in logs. + 'req.headers["sec-websocket-protocol"]', + 'req.headers.authorization', + 'req.headers.cookie', + 'req.query.access_token' + ] + } +}); + +const httpLogger = pinoHttp({ + logger, + genReqId: generateRequestId, + serializers: { + req: sanitizeRequestLog + } +}); + +/** + * Attaches a logger to the request object received by http upgrade handlers + * @param {http.IncomingMessage} request + */ +function attachWebsocketHttpLogger(request) { + generateRequestId(request); + + request.log = logger.child({ + req: sanitizeRequestLog(request), + }); +} + +/** + * Creates a logger instance for the Websocket connection to use. + * @param {http.IncomingMessage} request + * @param {import('./index.js').ResolvedAccount} resolvedAccount + */ +function createWebsocketLogger(request, resolvedAccount) { + // ensure the request.id is always present. + generateRequestId(request); + + return logger.child({ + req: { + id: request.id + }, + account: { + id: resolvedAccount.accountId ?? null + } + }); +} + +exports.logger = logger; +exports.httpLogger = httpLogger; +exports.attachWebsocketHttpLogger = attachWebsocketHttpLogger; +exports.createWebsocketLogger = createWebsocketLogger; + +/** + * Initializes the log level based on the environment + * @param {Object} env + * @param {string} environment + */ +exports.initializeLogLevel = function initializeLogLevel(env, environment) { + if (env.LOG_LEVEL && Object.keys(logger.levels.values).includes(env.LOG_LEVEL)) { + logger.level = env.LOG_LEVEL; + } else if (environment === 'development') { + logger.level = 'debug'; + } else { + logger.level = 'info'; + } +}; diff --git a/streaming/package.json b/streaming/package.json index 149055ca1..52a997970 100644 --- a/streaming/package.json +++ b/streaming/package.json @@ -21,9 +21,10 @@ "express": "^4.18.2", "ioredis": "^5.3.2", "jsdom": "^23.0.0", - "npmlog": "^7.0.1", "pg": "^8.5.0", "pg-connection-string": "^2.6.0", + "pino": "^8.17.2", + "pino-http": "^9.0.0", "prom-client": "^15.0.0", "uuid": "^9.0.0", "ws": "^8.12.1" @@ -31,11 +32,11 @@ "devDependencies": { "@types/cors": "^2.8.16", "@types/express": "^4.17.17", - "@types/npmlog": "^7.0.0", "@types/pg": "^8.6.6", "@types/uuid": "^9.0.0", "@types/ws": "^8.5.9", "eslint-define-config": "^2.0.0", + "pino-pretty": "^10.3.1", "typescript": "^5.0.4" }, "optionalDependencies": { diff --git a/yarn.lock b/yarn.lock index 6f8381db0..75586ac49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2536,7 +2536,6 @@ __metadata: dependencies: "@types/cors": "npm:^2.8.16" "@types/express": "npm:^4.17.17" - "@types/npmlog": "npm:^7.0.0" "@types/pg": "npm:^8.6.6" "@types/uuid": "npm:^9.0.0" "@types/ws": "npm:^8.5.9" @@ -2547,9 +2546,11 @@ __metadata: express: "npm:^4.18.2" ioredis: "npm:^5.3.2" jsdom: "npm:^23.0.0" - npmlog: "npm:^7.0.1" pg: "npm:^8.5.0" pg-connection-string: "npm:^2.6.0" + pino: "npm:^8.17.2" + pino-http: "npm:^9.0.0" + pino-pretty: "npm:^10.3.1" prom-client: "npm:^15.0.0" typescript: "npm:^5.0.4" utf-8-validate: "npm:^6.0.3" @@ -3338,15 +3339,6 @@ __metadata: languageName: node linkType: hard -"@types/npmlog@npm:^7.0.0": - version: 7.0.0 - resolution: "@types/npmlog@npm:7.0.0" - dependencies: - "@types/node": "npm:*" - checksum: e94cb1d7dc6b1251d58d0a3cbf0c5b9e9b7c7649774cf816b9277fc10e1a09e65f2854357c4972d04d477f8beca3c8accb5e8546d594776e59e35ddfee79aff2 - languageName: node - linkType: hard - "@types/object-assign@npm:^4.0.30": version: 4.0.33 resolution: "@types/object-assign@npm:4.0.33" @@ -3791,6 +3783,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/scope-manager@npm:6.9.1" + dependencies: + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/visitor-keys": "npm:6.9.1" + checksum: 53fa7c3813d22b119e464f9b6d7d23407dfe103ee8ad2dcacf9ad6d656fda20e2bb3346df39e62b0e6b6ce71572ce5838071c5d2cca6daa4e0ce117ff22eafe5 + languageName: node + linkType: hard + "@typescript-eslint/type-utils@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/type-utils@npm:6.19.0" @@ -3815,6 +3817,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/types@npm:6.9.1" + checksum: 4ba21ba18e256da210a4caedfbc5d4927cf8cb4f2c4d74f8ccc865576f3659b974e79119d3c94db2b68a4cec9cd687e43971d355450b7082d6d1736a5dd6db85 + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/typescript-estree@npm:6.19.0" @@ -3834,7 +3843,25 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.19.0, @typescript-eslint/utils@npm:^6.5.0": +"@typescript-eslint/typescript-estree@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/typescript-estree@npm:6.9.1" + dependencies: + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/visitor-keys": "npm:6.9.1" + debug: "npm:^4.3.4" + globby: "npm:^11.1.0" + is-glob: "npm:^4.0.3" + semver: "npm:^7.5.4" + ts-api-utils: "npm:^1.0.1" + peerDependenciesMeta: + typescript: + optional: true + checksum: 850b1865a90107879186c3f2969968a2c08fc6fcc56d146483c297cf5be376e33d505ac81533ba8e8103ca4d2edfea7d21b178de9e52217f7ee2922f51a445fa + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/utils@npm:6.19.0" dependencies: @@ -3851,6 +3878,23 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/utils@npm:^6.5.0": + version: 6.9.1 + resolution: "@typescript-eslint/utils@npm:6.9.1" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.4.0" + "@types/json-schema": "npm:^7.0.12" + "@types/semver": "npm:^7.5.0" + "@typescript-eslint/scope-manager": "npm:6.9.1" + "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/typescript-estree": "npm:6.9.1" + semver: "npm:^7.5.4" + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + checksum: 3d329d54c3d155ed29e2b456a602aef76bda1b88dfcf847145849362e4ddefabe5c95de236de750d08d5da9bedcfb2131bdfd784ce4eb87cf82728f0b6662033 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/visitor-keys@npm:6.19.0" @@ -3861,6 +3905,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:6.9.1": + version: 6.9.1 + resolution: "@typescript-eslint/visitor-keys@npm:6.9.1" + dependencies: + "@typescript-eslint/types": "npm:6.9.1" + eslint-visitor-keys: "npm:^3.4.1" + checksum: ac5f375a177add30489e5b63cafa8d82a196b33624bb36418422ebe0d7973b3ba550dc7e0dda36ea75a94cf9b200b4fb5f5fb4d77c027fd801201c1a269d343b + languageName: node + linkType: hard + "@ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" @@ -4324,13 +4378,6 @@ __metadata: languageName: node linkType: hard -"aproba@npm:^1.0.3 || ^2.0.0": - version: 2.0.0 - resolution: "aproba@npm:2.0.0" - checksum: d06e26384a8f6245d8c8896e138c0388824e259a329e0c9f196b4fa533c82502a6fd449586e3604950a0c42921832a458bb3aa0aa9f0ba449cfd4f50fd0d09b5 - languageName: node - linkType: hard - "are-docs-informative@npm:^0.0.2": version: 0.0.2 resolution: "are-docs-informative@npm:0.0.2" @@ -4338,16 +4385,6 @@ __metadata: languageName: node linkType: hard -"are-we-there-yet@npm:^4.0.0": - version: 4.0.0 - resolution: "are-we-there-yet@npm:4.0.0" - dependencies: - delegates: "npm:^1.0.0" - readable-stream: "npm:^4.1.0" - checksum: 760008e32948e9f738c5a288792d187e235fee0f170e042850bc7ff242f2a499f3f2874d6dd43ac06f5d9f5306137bc51bbdd4ae0bb11379c58b01678e0f684d - languageName: node - linkType: hard - "argparse@npm:^1.0.7": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -4669,6 +4706,13 @@ __metadata: languageName: node linkType: hard +"atomic-sleep@npm:^1.0.0": + version: 1.0.0 + resolution: "atomic-sleep@npm:1.0.0" + checksum: e329a6665512736a9bbb073e1761b4ec102f7926cce35037753146a9db9c8104f5044c1662e4a863576ce544fb8be27cd2be6bc8c1a40147d03f31eb1cfb6e8a + languageName: node + linkType: hard + "autoprefixer@npm:^10.4.14": version: 10.4.17 resolution: "autoprefixer@npm:10.4.17" @@ -5763,15 +5807,6 @@ __metadata: languageName: node linkType: hard -"color-support@npm:^1.1.3": - version: 1.1.3 - resolution: "color-support@npm:1.1.3" - bin: - color-support: bin.js - checksum: 8ffeaa270a784dc382f62d9be0a98581db43e11eee301af14734a6d089bd456478b1a8b3e7db7ca7dc5b18a75f828f775c44074020b51c05fc00e6d0992b1cc6 - languageName: node - linkType: hard - "colord@npm:^2.9.1, colord@npm:^2.9.3": version: 2.9.3 resolution: "colord@npm:2.9.3" @@ -5779,7 +5814,7 @@ __metadata: languageName: node linkType: hard -"colorette@npm:^2.0.20": +"colorette@npm:^2.0.20, colorette@npm:^2.0.7": version: 2.0.20 resolution: "colorette@npm:2.0.20" checksum: e94116ff33b0ff56f3b83b9ace895e5bf87c2a7a47b3401b8c3f3226e050d5ef76cf4072fb3325f9dc24d1698f9b730baf4e05eeaf861d74a1883073f4c98a40 @@ -5911,13 +5946,6 @@ __metadata: languageName: node linkType: hard -"console-control-strings@npm:^1.1.0": - version: 1.1.0 - resolution: "console-control-strings@npm:1.1.0" - checksum: 7ab51d30b52d461412cd467721bb82afe695da78fff8f29fe6f6b9cbaac9a2328e27a22a966014df9532100f6dd85370460be8130b9c677891ba36d96a343f50 - languageName: node - linkType: hard - "constants-browserify@npm:^1.0.0": version: 1.0.0 resolution: "constants-browserify@npm:1.0.0" @@ -6445,6 +6473,13 @@ __metadata: languageName: node linkType: hard +"dateformat@npm:^4.6.3": + version: 4.6.3 + resolution: "dateformat@npm:4.6.3" + checksum: e2023b905e8cfe2eb8444fb558562b524807a51cdfe712570f360f873271600b5c94aebffaf11efb285e2c072264a7cf243eadb68f3eba0f8cc85fb86cd25df6 + languageName: node + linkType: hard + "debounce@npm:^1.2.1": version: 1.2.1 resolution: "debounce@npm:1.2.1" @@ -6680,13 +6715,6 @@ __metadata: languageName: node linkType: hard -"delegates@npm:^1.0.0": - version: 1.0.0 - resolution: "delegates@npm:1.0.0" - checksum: ba05874b91148e1db4bf254750c042bf2215febd23a6d3cda2e64896aef79745fbd4b9996488bd3cafb39ce19dbce0fd6e3b6665275638befffe1c9b312b91b5 - languageName: node - linkType: hard - "denque@npm:^2.1.0": version: 2.1.0 resolution: "denque@npm:2.1.0" @@ -7952,6 +7980,13 @@ __metadata: languageName: node linkType: hard +"fast-copy@npm:^3.0.0": + version: 3.0.1 + resolution: "fast-copy@npm:3.0.1" + checksum: a8310dbcc4c94ed001dc3e0bbc3c3f0491bb04e6c17163abe441a54997ba06cdf1eb532c2f05e54777c6f072c84548c23ef0ecd54665cd611be1d42f37eca258 + languageName: node + linkType: hard + "fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -7993,6 +8028,20 @@ __metadata: languageName: node linkType: hard +"fast-redact@npm:^3.1.1": + version: 3.3.0 + resolution: "fast-redact@npm:3.3.0" + checksum: d81562510681e9ba6404ee5d3838ff5257a44d2f80937f5024c099049ff805437d0fae0124458a7e87535cc9dcf4de305bb075cab8f08d6c720bbc3447861b4e + languageName: node + linkType: hard + +"fast-safe-stringify@npm:^2.1.1": + version: 2.1.1 + resolution: "fast-safe-stringify@npm:2.1.1" + checksum: d90ec1c963394919828872f21edaa3ad6f1dddd288d2bd4e977027afff09f5db40f94e39536d4646f7e01761d704d72d51dce5af1b93717f3489ef808f5f4e4d + languageName: node + linkType: hard + "fastest-levenshtein@npm:^1.0.16": version: 1.0.16 resolution: "fastest-levenshtein@npm:1.0.16" @@ -8407,22 +8456,6 @@ __metadata: languageName: node linkType: hard -"gauge@npm:^5.0.0": - version: 5.0.1 - resolution: "gauge@npm:5.0.1" - dependencies: - aproba: "npm:^1.0.3 || ^2.0.0" - color-support: "npm:^1.1.3" - console-control-strings: "npm:^1.1.0" - has-unicode: "npm:^2.0.1" - signal-exit: "npm:^4.0.1" - string-width: "npm:^4.2.3" - strip-ansi: "npm:^6.0.1" - wide-align: "npm:^1.1.5" - checksum: 845f9a2534356cd0e9c1ae590ed471bbe8d74c318915b92a34e8813b8d3441ca8e0eb0fa87a48081e70b63b84d398c5e66a13b8e8040181c10b9d77e9fe3287f - languageName: node - linkType: hard - "gensync@npm:^1.0.0-beta.2": version: 1.0.0-beta.2 resolution: "gensync@npm:1.0.0-beta.2" @@ -8771,13 +8804,6 @@ __metadata: languageName: node linkType: hard -"has-unicode@npm:^2.0.1": - version: 2.0.1 - resolution: "has-unicode@npm:2.0.1" - checksum: ebdb2f4895c26bb08a8a100b62d362e49b2190bcfd84b76bc4be1a3bd4d254ec52d0dd9f2fbcc093fc5eb878b20c52146f9dfd33e2686ed28982187be593b47c - languageName: node - linkType: hard - "has-value@npm:^0.3.1": version: 0.3.1 resolution: "has-value@npm:0.3.1" @@ -8854,6 +8880,13 @@ __metadata: languageName: node linkType: hard +"help-me@npm:^5.0.0": + version: 5.0.0 + resolution: "help-me@npm:5.0.0" + checksum: 054c0e2e9ae2231c85ab5e04f75109b9d068ffcc54e58fb22079822a5ace8ff3d02c66fd45379c902ad5ab825e5d2e1451fcc2f7eab1eb49e7d488133ba4cacb + languageName: node + linkType: hard + "history@npm:^4.10.1, history@npm:^4.9.0": version: 4.10.1 resolution: "history@npm:4.10.1" @@ -9320,7 +9353,7 @@ __metadata: languageName: node linkType: hard -"intl-messageformat@npm:10.5.10, intl-messageformat@npm:^10.3.5": +"intl-messageformat@npm:10.5.10": version: 10.5.10 resolution: "intl-messageformat@npm:10.5.10" dependencies: @@ -9332,6 +9365,18 @@ __metadata: languageName: node linkType: hard +"intl-messageformat@npm:^10.3.5": + version: 10.5.8 + resolution: "intl-messageformat@npm:10.5.8" + dependencies: + "@formatjs/ecma402-abstract": "npm:1.18.0" + "@formatjs/fast-memoize": "npm:2.2.0" + "@formatjs/icu-messageformat-parser": "npm:2.7.3" + tslib: "npm:^2.4.0" + checksum: 1d2854aae8471ec48165ca265760d6c5b1814eca831c88db698eb29b5ed20bee21ca8533090c9d28d9c6f1d844dda210b0bc58a2e036446158fae0845e5eed4f + languageName: node + linkType: hard + "invariant@npm:^2.2.2, invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" @@ -10570,6 +10615,13 @@ __metadata: languageName: node linkType: hard +"joycon@npm:^3.1.1": + version: 3.1.1 + resolution: "joycon@npm:3.1.1" + checksum: 131fb1e98c9065d067fd49b6e685487ac4ad4d254191d7aa2c9e3b90f4e9ca70430c43cad001602bdbdabcf58717d3b5c5b7461c1bd8e39478c8de706b3fe6ae + languageName: node + linkType: hard + "jpeg-autorotate@npm:^7.1.1": version: 7.1.1 resolution: "jpeg-autorotate@npm:7.1.1" @@ -11966,18 +12018,6 @@ __metadata: languageName: node linkType: hard -"npmlog@npm:^7.0.1": - version: 7.0.1 - resolution: "npmlog@npm:7.0.1" - dependencies: - are-we-there-yet: "npm:^4.0.0" - console-control-strings: "npm:^1.1.0" - gauge: "npm:^5.0.0" - set-blocking: "npm:^2.0.0" - checksum: d4e6a2aaa7b5b5d2e2ed8f8ac3770789ca0691a49f3576b6a8c97d560a4c3305d2c233a9173d62be737e6e4506bf9e89debd6120a3843c1d37315c34f90fef71 - languageName: node - linkType: hard - "nth-check@npm:^1.0.2": version: 1.0.2 resolution: "nth-check@npm:1.0.2" @@ -12150,6 +12190,13 @@ __metadata: languageName: node linkType: hard +"on-exit-leak-free@npm:^2.1.0": + version: 2.1.2 + resolution: "on-exit-leak-free@npm:2.1.2" + checksum: faea2e1c9d696ecee919026c32be8d6a633a7ac1240b3b87e944a380e8a11dc9c95c4a1f8fb0568de7ab8db3823e790f12bda45296b1d111e341aad3922a0570 + languageName: node + linkType: hard + "on-finished@npm:2.4.1": version: 2.4.1 resolution: "on-finished@npm:2.4.1" @@ -12717,6 +12764,80 @@ __metadata: languageName: node linkType: hard +"pino-abstract-transport@npm:^1.0.0, pino-abstract-transport@npm:v1.1.0": + version: 1.1.0 + resolution: "pino-abstract-transport@npm:1.1.0" + dependencies: + readable-stream: "npm:^4.0.0" + split2: "npm:^4.0.0" + checksum: 6e9b9d5a2c0a37f91ecaf224d335daae1ae682b1c79a05b06ef9e0f0a5d289f8e597992217efc857796dae6f1067e9b4882f95c6228ff433ddc153532cae8aca + languageName: node + linkType: hard + +"pino-http@npm:^9.0.0": + version: 9.0.0 + resolution: "pino-http@npm:9.0.0" + dependencies: + get-caller-file: "npm:^2.0.5" + pino: "npm:^8.17.1" + pino-std-serializers: "npm:^6.2.2" + process-warning: "npm:^3.0.0" + checksum: 05496cb76cc9908658e50c4620fbdf7b0b5d99fb529493d601c3e4635b0bf7ce12b8a8eed7b5b520089f643b099233d61dd71f7cdfad8b66e59b9b81d79b6512 + languageName: node + linkType: hard + +"pino-pretty@npm:^10.3.1": + version: 10.3.1 + resolution: "pino-pretty@npm:10.3.1" + dependencies: + colorette: "npm:^2.0.7" + dateformat: "npm:^4.6.3" + fast-copy: "npm:^3.0.0" + fast-safe-stringify: "npm:^2.1.1" + help-me: "npm:^5.0.0" + joycon: "npm:^3.1.1" + minimist: "npm:^1.2.6" + on-exit-leak-free: "npm:^2.1.0" + pino-abstract-transport: "npm:^1.0.0" + pump: "npm:^3.0.0" + readable-stream: "npm:^4.0.0" + secure-json-parse: "npm:^2.4.0" + sonic-boom: "npm:^3.0.0" + strip-json-comments: "npm:^3.1.1" + bin: + pino-pretty: bin.js + checksum: 6964fba5acc7a9f112e4c6738d602e123daf16cb5f6ddc56ab4b6bb05059f28876d51da8f72358cf1172e95fa12496b70465431a0836df693c462986d050686b + languageName: node + linkType: hard + +"pino-std-serializers@npm:^6.0.0, pino-std-serializers@npm:^6.2.2": + version: 6.2.2 + resolution: "pino-std-serializers@npm:6.2.2" + checksum: 8f1c7f0f0d8f91e6c6b5b2a6bfb48f06441abeb85f1c2288319f736f9c6d814fbeebe928d2314efc2ba6018fa7db9357a105eca9fc99fc1f28945a8a8b28d3d5 + languageName: node + linkType: hard + +"pino@npm:^8.17.1, pino@npm:^8.17.2": + version: 8.17.2 + resolution: "pino@npm:8.17.2" + dependencies: + atomic-sleep: "npm:^1.0.0" + fast-redact: "npm:^3.1.1" + on-exit-leak-free: "npm:^2.1.0" + pino-abstract-transport: "npm:v1.1.0" + pino-std-serializers: "npm:^6.0.0" + process-warning: "npm:^3.0.0" + quick-format-unescaped: "npm:^4.0.3" + real-require: "npm:^0.2.0" + safe-stable-stringify: "npm:^2.3.1" + sonic-boom: "npm:^3.7.0" + thread-stream: "npm:^2.0.0" + bin: + pino: bin.js + checksum: 9e55af6cd9d1833a4dbe64924fc73163295acd3c988a9c7db88926669f2574ab7ec607e8487b6dd71dbdad2d7c1c1aac439f37e59233f37220b1a9d88fa2ce01 + languageName: node + linkType: hard + "pirates@npm:^4.0.4": version: 4.0.6 resolution: "pirates@npm:4.0.6" @@ -13319,6 +13440,13 @@ __metadata: languageName: node linkType: hard +"process-warning@npm:^3.0.0": + version: 3.0.0 + resolution: "process-warning@npm:3.0.0" + checksum: 60f3c8ddee586f0706c1e6cb5aa9c86df05774b9330d792d7c8851cf0031afd759d665404d07037e0b4901b55c44a423f07bdc465c63de07d8d23196bb403622 + languageName: node + linkType: hard + "process@npm:^0.11.10": version: 0.11.10 resolution: "process@npm:0.11.10" @@ -13496,6 +13624,13 @@ __metadata: languageName: node linkType: hard +"quick-format-unescaped@npm:^4.0.3": + version: 4.0.4 + resolution: "quick-format-unescaped@npm:4.0.4" + checksum: fe5acc6f775b172ca5b4373df26f7e4fd347975578199e7d74b2ae4077f0af05baa27d231de1e80e8f72d88275ccc6028568a7a8c9ee5e7368ace0e18eff93a4 + languageName: node + linkType: hard + "raf@npm:^3.1.0": version: 3.4.1 resolution: "raf@npm:3.4.1" @@ -13991,15 +14126,16 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^4.1.0": - version: 4.4.0 - resolution: "readable-stream@npm:4.4.0" +"readable-stream@npm:^4.0.0": + version: 4.4.2 + resolution: "readable-stream@npm:4.4.2" dependencies: abort-controller: "npm:^3.0.0" buffer: "npm:^6.0.3" events: "npm:^3.3.0" process: "npm:^0.11.10" - checksum: 83f5a11285e5ebefb7b22a43ea77a2275075639325b4932a328a1fb0ee2475b83b9cc94326724d71c6aa3b60fa87e2b16623530b1cac34f3825dcea0996fdbe4 + string_decoder: "npm:^1.3.0" + checksum: cf7cc8daa2b57872d120945a20a1458c13dcb6c6f352505421115827b18ac4df0e483ac1fe195cb1f5cd226e1073fc55b92b569269d8299e8530840bcdbba40c languageName: node linkType: hard @@ -14023,6 +14159,13 @@ __metadata: languageName: node linkType: hard +"real-require@npm:^0.2.0": + version: 0.2.0 + resolution: "real-require@npm:0.2.0" + checksum: 23eea5623642f0477412ef8b91acd3969015a1501ed34992ada0e3af521d3c865bb2fe4cdbfec5fe4b505f6d1ef6a03e5c3652520837a8c3b53decff7e74b6a0 + languageName: node + linkType: hard + "redent@npm:^3.0.0": version: 3.0.0 resolution: "redent@npm:3.0.0" @@ -14568,6 +14711,13 @@ __metadata: languageName: node linkType: hard +"safe-stable-stringify@npm:^2.3.1": + version: 2.4.3 + resolution: "safe-stable-stringify@npm:2.4.3" + checksum: 81dede06b8f2ae794efd868b1e281e3c9000e57b39801c6c162267eb9efda17bd7a9eafa7379e1f1cacd528d4ced7c80d7460ad26f62ada7c9e01dec61b2e768 + languageName: node + linkType: hard + "safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0, safer-buffer@npm:^2.1.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" @@ -14681,6 +14831,13 @@ __metadata: languageName: node linkType: hard +"secure-json-parse@npm:^2.4.0": + version: 2.7.0 + resolution: "secure-json-parse@npm:2.7.0" + checksum: f57eb6a44a38a3eeaf3548228585d769d788f59007454214fab9ed7f01fbf2e0f1929111da6db28cf0bcc1a2e89db5219a59e83eeaec3a54e413a0197ce879e4 + languageName: node + linkType: hard + "select-hose@npm:^2.0.0": version: 2.0.0 resolution: "select-hose@npm:2.0.0" @@ -15084,6 +15241,15 @@ __metadata: languageName: node linkType: hard +"sonic-boom@npm:^3.0.0, sonic-boom@npm:^3.7.0": + version: 3.7.0 + resolution: "sonic-boom@npm:3.7.0" + dependencies: + atomic-sleep: "npm:^1.0.0" + checksum: 57a3d560efb77f4576db111168ee2649c99e7869fda6ce0ec2a4e5458832d290ba58d74b073ddb5827d9a30f96d23cff79157993d919e1a6d5f28d8b6391c7f0 + languageName: node + linkType: hard + "source-list-map@npm:^2.0.0": version: 2.0.1 resolution: "source-list-map@npm:2.0.1" @@ -15242,7 +15408,7 @@ __metadata: languageName: node linkType: hard -"split2@npm:^4.1.0": +"split2@npm:^4.0.0, split2@npm:^4.1.0": version: 4.2.0 resolution: "split2@npm:4.2.0" checksum: b292beb8ce9215f8c642bb68be6249c5a4c7f332fc8ecadae7be5cbdf1ea95addc95f0459ef2e7ad9d45fd1064698a097e4eb211c83e772b49bc0ee423e91534 @@ -15407,7 +15573,7 @@ __metadata: languageName: node linkType: hard -"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": +"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" dependencies: @@ -15500,7 +15666,7 @@ __metadata: languageName: node linkType: hard -"string_decoder@npm:^1.0.0, string_decoder@npm:^1.1.1": +"string_decoder@npm:^1.0.0, string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" dependencies: @@ -16046,6 +16212,15 @@ __metadata: languageName: node linkType: hard +"thread-stream@npm:^2.0.0": + version: 2.4.1 + resolution: "thread-stream@npm:2.4.1" + dependencies: + real-require: "npm:^0.2.0" + checksum: ce29265810b9550ce896726301ff006ebfe96b90292728f07cfa4c379740585583046e2a8018afc53aca66b18fed12b33a84f3883e7ebc317185f6682898b8f8 + languageName: node + linkType: hard + "thunky@npm:^1.0.2": version: 1.1.0 resolution: "thunky@npm:1.1.0" @@ -17283,15 +17458,6 @@ __metadata: languageName: node linkType: hard -"wide-align@npm:^1.1.5": - version: 1.1.5 - resolution: "wide-align@npm:1.1.5" - dependencies: - string-width: "npm:^1.0.2 || 2 || 3 || 4" - checksum: 1d9c2a3e36dfb09832f38e2e699c367ef190f96b82c71f809bc0822c306f5379df87bab47bed27ea99106d86447e50eb972d3c516c2f95782807a9d082fbea95 - languageName: node - linkType: hard - "wildcard@npm:^2.0.0": version: 2.0.1 resolution: "wildcard@npm:2.0.1" From 244182ad63f93a9617011a197095078322215a74 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:42:07 +0100 Subject: [PATCH 17/55] Update dependency rdf-normalize to v0.7.0 (#26769) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6cf0504b5..c8042fcb8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -600,8 +600,8 @@ GEM rdf (3.3.1) bcp47_spec (~> 0.2) link_header (~> 0.0, >= 0.0.8) - rdf-normalize (0.6.1) - rdf (~> 3.2) + rdf-normalize (0.7.0) + rdf (~> 3.3) rdoc (6.6.2) psych (>= 4.0.0) redcarpet (3.6.0) From 5ae3bae586d5344b406cf63c91247d94489f2e22 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:43:03 +0100 Subject: [PATCH 18/55] Update dependency sass to v1.70.0 (#28799) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 75586ac49..b2afdc049 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14751,15 +14751,15 @@ __metadata: linkType: hard "sass@npm:^1.62.1": - version: 1.69.7 - resolution: "sass@npm:1.69.7" + version: 1.70.0 + resolution: "sass@npm:1.70.0" dependencies: chokidar: "npm:>=3.0.0 <4.0.0" immutable: "npm:^4.0.0" source-map-js: "npm:>=0.6.2 <2.0.0" bin: sass: sass.js - checksum: 773d0938e7d4ff3972d3fda3132f34fe98a2f712e028a58e28fecd615434795eff3266eddc38d5e13f03b90c0d6360d0e737b30bff2949a47280c64a18e0fb18 + checksum: 7c309ee1c096d591746d122da9f1ebd65b4c4b3a60c2cc0ec720fd98fe1205fa8b44c9f563d113b9fdfeb25af1e32ec9b3e048bd4b8e05d267f020953bd7baf0 languageName: node linkType: hard From 1480573c83f580a3a7eb5fef61ddbba69242032f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 20:39:30 -0500 Subject: [PATCH 19/55] Add `Account.auditable` scope, fix N+1 in admin/action_logs#index (#28812) --- .../admin/action_logs_controller.rb | 2 +- app/models/account.rb | 1 + app/models/admin/action_log_filter.rb | 2 +- spec/models/account_spec.rb | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/action_logs_controller.rb b/app/controllers/admin/action_logs_controller.rb index 37a00ad22..8b8e83fde 100644 --- a/app/controllers/admin/action_logs_controller.rb +++ b/app/controllers/admin/action_logs_controller.rb @@ -6,7 +6,7 @@ module Admin def index authorize :audit_log, :index? - @auditable_accounts = Account.where(id: Admin::ActionLog.select('distinct account_id')).select(:id, :username) + @auditable_accounts = Account.auditable.select(:id, :username) end private diff --git a/app/models/account.rb b/app/models/account.rb index c17de682e..2fdfc2d51 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -126,6 +126,7 @@ class Account < ApplicationRecord scope :matches_username, ->(value) { where('lower((username)::text) LIKE lower(?)', "#{value}%") } scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) } scope :without_unapproved, -> { left_outer_joins(:user).merge(User.approved.confirmed).or(remote) } + scope :auditable, -> { where(id: Admin::ActionLog.select(:account_id).distinct) } scope :searchable, -> { without_unapproved.without_suspended.where(moved_to_account_id: nil) } scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat) } scope :by_recent_status, -> { includes(:account_stat).merge(AccountStat.order('last_status_at DESC NULLS LAST')).references(:account_stat) } diff --git a/app/models/admin/action_log_filter.rb b/app/models/admin/action_log_filter.rb index d413cb386..f581af74e 100644 --- a/app/models/admin/action_log_filter.rb +++ b/app/models/admin/action_log_filter.rb @@ -72,7 +72,7 @@ class Admin::ActionLogFilter end def results - scope = latest_action_logs.includes(:target) + scope = latest_action_logs.includes(:target, :account) params.each do |key, value| next if key.to_s == 'page' diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index d360d934d..8488ccea4 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -835,6 +835,25 @@ RSpec.describe Account do end describe 'scopes' do + describe 'auditable' do + let!(:alice) { Fabricate :account } + let!(:bob) { Fabricate :account } + + before do + 2.times { Fabricate :action_log, account: alice } + end + + it 'returns distinct accounts with action log records' do + results = described_class.auditable + + expect(results.size) + .to eq(1) + expect(results) + .to include(alice) + .and not_include(bob) + end + end + describe 'alphabetic' do it 'sorts by alphabetic order of domain and username' do matches = [ From de09176ab9f04ac64b3ea5f877fa0895bf55e2eb Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Fri, 19 Jan 2024 10:18:21 +0100 Subject: [PATCH 20/55] Retry 401 errors on replies fetching (#28788) Co-authored-by: Claire --- app/helpers/jsonld_helper.rb | 12 ++++++------ app/services/activitypub/fetch_replies_service.rb | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb index ce3ff094f..b3d0d032c 100644 --- a/app/helpers/jsonld_helper.rb +++ b/app/helpers/jsonld_helper.rb @@ -155,7 +155,7 @@ module JsonLdHelper end end - def fetch_resource(uri, id, on_behalf_of = nil) + def fetch_resource(uri, id, on_behalf_of = nil, request_options: {}) unless id json = fetch_resource_without_id_validation(uri, on_behalf_of) @@ -164,14 +164,14 @@ module JsonLdHelper uri = json['id'] end - json = fetch_resource_without_id_validation(uri, on_behalf_of) + json = fetch_resource_without_id_validation(uri, on_behalf_of, request_options: request_options) json.present? && json['id'] == uri ? json : nil end - def fetch_resource_without_id_validation(uri, on_behalf_of = nil, raise_on_temporary_error = false) + def fetch_resource_without_id_validation(uri, on_behalf_of = nil, raise_on_temporary_error = false, request_options: {}) on_behalf_of ||= Account.representative - build_request(uri, on_behalf_of).perform do |response| + build_request(uri, on_behalf_of, options: request_options).perform do |response| raise Mastodon::UnexpectedResponseError, response unless response_successful?(response) || response_error_unsalvageable?(response) || !raise_on_temporary_error body_to_json(response.body_with_limit) if response.code == 200 @@ -204,8 +204,8 @@ module JsonLdHelper response.code == 501 || ((400...500).cover?(response.code) && ![401, 408, 429].include?(response.code)) end - def build_request(uri, on_behalf_of = nil) - Request.new(:get, uri).tap do |request| + def build_request(uri, on_behalf_of = nil, options: {}) + Request.new(:get, uri, **options).tap do |request| request.on_behalf_of(on_behalf_of) if on_behalf_of request.add_headers('Accept' => 'application/activity+json, application/ld+json') end diff --git a/app/services/activitypub/fetch_replies_service.rb b/app/services/activitypub/fetch_replies_service.rb index b5c7759ec..a9dd327e9 100644 --- a/app/services/activitypub/fetch_replies_service.rb +++ b/app/services/activitypub/fetch_replies_service.rb @@ -37,7 +37,20 @@ class ActivityPub::FetchRepliesService < BaseService return unless @allow_synchronous_requests return if non_matching_uri_hosts?(@account.uri, collection_or_uri) - fetch_resource_without_id_validation(collection_or_uri, nil, true) + # NOTE: For backward compatibility reasons, Mastodon signs outgoing + # queries incorrectly by default. + # + # While this is relevant for all URLs with query strings, this is + # the only code path where this happens in practice. + # + # Therefore, retry with correct signatures if this fails. + begin + fetch_resource_without_id_validation(collection_or_uri, nil, true) + rescue Mastodon::UnexpectedResponseError => e + raise unless e.response && e.response.code == 401 && Addressable::URI.parse(collection_or_uri).query.present? + + fetch_resource_without_id_validation(collection_or_uri, nil, true, request_options: { with_query_string: true }) + end end def filtered_replies From fd64817fbe658514e2753c2e03e13624719f4e41 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 19 Jan 2024 04:19:48 -0500 Subject: [PATCH 21/55] Fix `Rails/WhereExists` cop in app/lib/status_cache_hydrator (#28808) --- .rubocop_todo.yml | 1 - app/lib/status_cache_hydrator.rb | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 87120daef..31cefa032 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -80,7 +80,6 @@ Rails/WhereExists: - 'app/lib/activitypub/activity/create.rb' - 'app/lib/delivery_failure_tracker.rb' - 'app/lib/feed_manager.rb' - - 'app/lib/status_cache_hydrator.rb' - 'app/lib/suspicious_sign_in_detector.rb' - 'app/models/poll.rb' - 'app/models/session_activation.rb' diff --git a/app/lib/status_cache_hydrator.rb b/app/lib/status_cache_hydrator.rb index 45b50cb37..34f6199ec 100644 --- a/app/lib/status_cache_hydrator.rb +++ b/app/lib/status_cache_hydrator.rb @@ -26,11 +26,11 @@ class StatusCacheHydrator def hydrate_non_reblog_payload(empty_payload, account_id) empty_payload.tap do |payload| - payload[:favourited] = Favourite.where(account_id: account_id, status_id: @status.id).exists? - payload[:reblogged] = Status.where(account_id: account_id, reblog_of_id: @status.id).exists? - payload[:muted] = ConversationMute.where(account_id: account_id, conversation_id: @status.conversation_id).exists? - payload[:bookmarked] = Bookmark.where(account_id: account_id, status_id: @status.id).exists? - payload[:pinned] = StatusPin.where(account_id: account_id, status_id: @status.id).exists? if @status.account_id == account_id + payload[:favourited] = Favourite.exists?(account_id: account_id, status_id: @status.id) + payload[:reblogged] = Status.exists?(account_id: account_id, reblog_of_id: @status.id) + payload[:muted] = ConversationMute.exists?(account_id: account_id, conversation_id: @status.conversation_id) + payload[:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.id) + payload[:pinned] = StatusPin.exists?(account_id: account_id, status_id: @status.id) if @status.account_id == account_id payload[:filtered] = mapped_applied_custom_filter(account_id, @status) if payload[:poll] @@ -51,11 +51,11 @@ class StatusCacheHydrator # used to create the status, we need to hydrate it here too payload[:reblog][:application] = payload_reblog_application if payload[:reblog][:application].nil? && @status.reblog.account_id == account_id - payload[:reblog][:favourited] = Favourite.where(account_id: account_id, status_id: @status.reblog_of_id).exists? - payload[:reblog][:reblogged] = Status.where(account_id: account_id, reblog_of_id: @status.reblog_of_id).exists? - payload[:reblog][:muted] = ConversationMute.where(account_id: account_id, conversation_id: @status.reblog.conversation_id).exists? - payload[:reblog][:bookmarked] = Bookmark.where(account_id: account_id, status_id: @status.reblog_of_id).exists? - payload[:reblog][:pinned] = StatusPin.where(account_id: account_id, status_id: @status.reblog_of_id).exists? if @status.reblog.account_id == account_id + payload[:reblog][:favourited] = Favourite.exists?(account_id: account_id, status_id: @status.reblog_of_id) + payload[:reblog][:reblogged] = Status.exists?(account_id: account_id, reblog_of_id: @status.reblog_of_id) + payload[:reblog][:muted] = ConversationMute.exists?(account_id: account_id, conversation_id: @status.reblog.conversation_id) + payload[:reblog][:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.reblog_of_id) + payload[:reblog][:pinned] = StatusPin.exists?(account_id: account_id, status_id: @status.reblog_of_id) if @status.reblog.account_id == account_id payload[:reblog][:filtered] = payload[:filtered] if payload[:reblog][:poll] From 6dc97321a3b780226f50098e31cf96cbbd7a3156 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:20:16 +0000 Subject: [PATCH 22/55] Update dependency intl-messageformat to v10.5.10 (#28809) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 78 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 76 deletions(-) diff --git a/yarn.lock b/yarn.lock index b2afdc049..8b5537723 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3783,16 +3783,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/scope-manager@npm:6.9.1" - dependencies: - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/visitor-keys": "npm:6.9.1" - checksum: 53fa7c3813d22b119e464f9b6d7d23407dfe103ee8ad2dcacf9ad6d656fda20e2bb3346df39e62b0e6b6ce71572ce5838071c5d2cca6daa4e0ce117ff22eafe5 - languageName: node - linkType: hard - "@typescript-eslint/type-utils@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/type-utils@npm:6.19.0" @@ -3817,13 +3807,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/types@npm:6.9.1" - checksum: 4ba21ba18e256da210a4caedfbc5d4927cf8cb4f2c4d74f8ccc865576f3659b974e79119d3c94db2b68a4cec9cd687e43971d355450b7082d6d1736a5dd6db85 - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/typescript-estree@npm:6.19.0" @@ -3843,25 +3826,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/typescript-estree@npm:6.9.1" - dependencies: - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/visitor-keys": "npm:6.9.1" - debug: "npm:^4.3.4" - globby: "npm:^11.1.0" - is-glob: "npm:^4.0.3" - semver: "npm:^7.5.4" - ts-api-utils: "npm:^1.0.1" - peerDependenciesMeta: - typescript: - optional: true - checksum: 850b1865a90107879186c3f2969968a2c08fc6fcc56d146483c297cf5be376e33d505ac81533ba8e8103ca4d2edfea7d21b178de9e52217f7ee2922f51a445fa - languageName: node - linkType: hard - -"@typescript-eslint/utils@npm:6.19.0": +"@typescript-eslint/utils@npm:6.19.0, @typescript-eslint/utils@npm:^6.5.0": version: 6.19.0 resolution: "@typescript-eslint/utils@npm:6.19.0" dependencies: @@ -3878,23 +3843,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:^6.5.0": - version: 6.9.1 - resolution: "@typescript-eslint/utils@npm:6.9.1" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.4.0" - "@types/json-schema": "npm:^7.0.12" - "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:6.9.1" - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/typescript-estree": "npm:6.9.1" - semver: "npm:^7.5.4" - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - checksum: 3d329d54c3d155ed29e2b456a602aef76bda1b88dfcf847145849362e4ddefabe5c95de236de750d08d5da9bedcfb2131bdfd784ce4eb87cf82728f0b6662033 - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:6.19.0": version: 6.19.0 resolution: "@typescript-eslint/visitor-keys@npm:6.19.0" @@ -3905,16 +3853,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/visitor-keys@npm:6.9.1" - dependencies: - "@typescript-eslint/types": "npm:6.9.1" - eslint-visitor-keys: "npm:^3.4.1" - checksum: ac5f375a177add30489e5b63cafa8d82a196b33624bb36418422ebe0d7973b3ba550dc7e0dda36ea75a94cf9b200b4fb5f5fb4d77c027fd801201c1a269d343b - languageName: node - linkType: hard - "@ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" @@ -9353,7 +9291,7 @@ __metadata: languageName: node linkType: hard -"intl-messageformat@npm:10.5.10": +"intl-messageformat@npm:10.5.10, intl-messageformat@npm:^10.3.5": version: 10.5.10 resolution: "intl-messageformat@npm:10.5.10" dependencies: @@ -9365,18 +9303,6 @@ __metadata: languageName: node linkType: hard -"intl-messageformat@npm:^10.3.5": - version: 10.5.8 - resolution: "intl-messageformat@npm:10.5.8" - dependencies: - "@formatjs/ecma402-abstract": "npm:1.18.0" - "@formatjs/fast-memoize": "npm:2.2.0" - "@formatjs/icu-messageformat-parser": "npm:2.7.3" - tslib: "npm:^2.4.0" - checksum: 1d2854aae8471ec48165ca265760d6c5b1814eca831c88db698eb29b5ed20bee21ca8533090c9d28d9c6f1d844dda210b0bc58a2e036446158fae0845e5eed4f - languageName: node - linkType: hard - "invariant@npm:^2.2.2, invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" From 6a1c9987220b0e6537e4c31fd2e812f498d93858 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:21:07 +0100 Subject: [PATCH 23/55] Update dependency kt-paperclip to v7.2.2 (#28813) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c8042fcb8..93931d872 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -150,7 +150,7 @@ GEM erubi (~> 1.4) parser (>= 2.4) smart_properties - bigdecimal (3.1.5) + bigdecimal (3.1.6) bindata (2.4.15) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) @@ -398,12 +398,12 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - kt-paperclip (7.2.1) + kt-paperclip (7.2.2) activemodel (>= 4.2.0) activesupport (>= 4.2.0) marcel (~> 1.0.1) mime-types - terrapin (~> 0.6.0) + terrapin (>= 0.6.0, < 2.0) language_server-protocol (3.17.0.3) launchy (2.5.2) addressable (~> 2.8) From 86cc88c21627bef221f461749189c91d446f3902 Mon Sep 17 00:00:00 2001 From: HTeuMeuLeu Date: Fri, 19 Jan 2024 10:23:59 +0100 Subject: [PATCH 24/55] Fix banner image not showing in follow emails (#28814) --- app/javascript/styles/mailer.scss | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/javascript/styles/mailer.scss b/app/javascript/styles/mailer.scss index bd220bb1a..a2cbb494b 100644 --- a/app/javascript/styles/mailer.scss +++ b/app/javascript/styles/mailer.scss @@ -100,9 +100,8 @@ table + p { border-top-right-radius: 12px; height: 140px; vertical-align: bottom; - background-color: #f3f2f5; - background-position: center; - background-size: cover; + background-position: center !important; + background-size: cover !important; } .email-account-banner-inner-td { From 329911b0a31016c313b433c1068308236736598f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 19 Jan 2024 04:32:41 -0500 Subject: [PATCH 25/55] Migrate controller->request spec for api/v1/follow* (#28811) --- .../accounts/follower_accounts_controller.rb | 2 +- .../accounts/following_accounts_controller.rb | 2 +- .../v1/accounts/follower_accounts_spec.rb} | 19 +++++++++---------- .../v1/accounts/following_accounts_spec.rb} | 19 +++++++++---------- 4 files changed, 20 insertions(+), 22 deletions(-) rename spec/{controllers/api/v1/accounts/follower_accounts_controller_spec.rb => requests/api/v1/accounts/follower_accounts_spec.rb} (69%) rename spec/{controllers/api/v1/accounts/following_accounts_controller_spec.rb => requests/api/v1/accounts/following_accounts_spec.rb} (69%) diff --git a/app/controllers/api/v1/accounts/follower_accounts_controller.rb b/app/controllers/api/v1/accounts/follower_accounts_controller.rb index 21b1095f1..d6a5a7176 100644 --- a/app/controllers/api/v1/accounts/follower_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/follower_accounts_controller.rb @@ -21,7 +21,7 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController return [] if hide_results? scope = default_accounts - scope = scope.where.not(id: current_account.excluded_from_timeline_account_ids) unless current_account.nil? || current_account.id == @account.id + scope = scope.not_excluded_by_account(current_account) unless current_account.nil? || current_account.id == @account.id scope.merge(paginated_follows).to_a end diff --git a/app/controllers/api/v1/accounts/following_accounts_controller.rb b/app/controllers/api/v1/accounts/following_accounts_controller.rb index 1db521f79..b8578ef53 100644 --- a/app/controllers/api/v1/accounts/following_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/following_accounts_controller.rb @@ -21,7 +21,7 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController return [] if hide_results? scope = default_accounts - scope = scope.where.not(id: current_account.excluded_from_timeline_account_ids) unless current_account.nil? || current_account.id == @account.id + scope = scope.not_excluded_by_account(current_account) unless current_account.nil? || current_account.id == @account.id scope.merge(paginated_follows).to_a end diff --git a/spec/controllers/api/v1/accounts/follower_accounts_controller_spec.rb b/spec/requests/api/v1/accounts/follower_accounts_spec.rb similarity index 69% rename from spec/controllers/api/v1/accounts/follower_accounts_controller_spec.rb rename to spec/requests/api/v1/accounts/follower_accounts_spec.rb index 510a47566..7ff92d6a4 100644 --- a/spec/controllers/api/v1/accounts/follower_accounts_controller_spec.rb +++ b/spec/requests/api/v1/accounts/follower_accounts_spec.rb @@ -2,11 +2,11 @@ require 'rails_helper' -describe Api::V1::Accounts::FollowerAccountsController do - render_views - +describe 'API V1 Accounts FollowerAccounts' do let(:user) { Fabricate(:user) } - let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } + let(:scopes) { 'read:accounts' } + let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:account) { Fabricate(:account) } let(:alice) { Fabricate(:account) } let(:bob) { Fabricate(:account) } @@ -14,12 +14,11 @@ describe Api::V1::Accounts::FollowerAccountsController do before do alice.follow!(account) bob.follow!(account) - allow(controller).to receive(:doorkeeper_token) { token } end - describe 'GET #index' do + describe 'GET /api/v1/accounts/:acount_id/followers' do it 'returns accounts following the given account', :aggregate_failures do - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers expect(response).to have_http_status(200) expect(body_as_json.size).to eq 2 @@ -28,7 +27,7 @@ describe Api::V1::Accounts::FollowerAccountsController do it 'does not return blocked users', :aggregate_failures do user.account.block!(bob) - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers expect(response).to have_http_status(200) expect(body_as_json.size).to eq 1 @@ -41,7 +40,7 @@ describe Api::V1::Accounts::FollowerAccountsController do end it 'hides results' do - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers expect(body_as_json.size).to eq 0 end end @@ -51,7 +50,7 @@ describe Api::V1::Accounts::FollowerAccountsController do it 'returns all accounts, including muted accounts' do account.mute!(bob) - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers expect(body_as_json.size).to eq 2 expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s) diff --git a/spec/controllers/api/v1/accounts/following_accounts_controller_spec.rb b/spec/requests/api/v1/accounts/following_accounts_spec.rb similarity index 69% rename from spec/controllers/api/v1/accounts/following_accounts_controller_spec.rb rename to spec/requests/api/v1/accounts/following_accounts_spec.rb index a7d07a6be..b343a4865 100644 --- a/spec/controllers/api/v1/accounts/following_accounts_controller_spec.rb +++ b/spec/requests/api/v1/accounts/following_accounts_spec.rb @@ -2,11 +2,11 @@ require 'rails_helper' -describe Api::V1::Accounts::FollowingAccountsController do - render_views - +describe 'API V1 Accounts FollowingAccounts' do let(:user) { Fabricate(:user) } - let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } + let(:scopes) { 'read:accounts' } + let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:account) { Fabricate(:account) } let(:alice) { Fabricate(:account) } let(:bob) { Fabricate(:account) } @@ -14,12 +14,11 @@ describe Api::V1::Accounts::FollowingAccountsController do before do account.follow!(alice) account.follow!(bob) - allow(controller).to receive(:doorkeeper_token) { token } end - describe 'GET #index' do + describe 'GET /api/v1/accounts/:account_id/following' do it 'returns accounts followed by the given account', :aggregate_failures do - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers expect(response).to have_http_status(200) expect(body_as_json.size).to eq 2 @@ -28,7 +27,7 @@ describe Api::V1::Accounts::FollowingAccountsController do it 'does not return blocked users', :aggregate_failures do user.account.block!(bob) - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers expect(response).to have_http_status(200) expect(body_as_json.size).to eq 1 @@ -41,7 +40,7 @@ describe Api::V1::Accounts::FollowingAccountsController do end it 'hides results' do - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers expect(body_as_json.size).to eq 0 end end @@ -51,7 +50,7 @@ describe Api::V1::Accounts::FollowingAccountsController do it 'returns all accounts, including muted accounts' do account.mute!(bob) - get :index, params: { account_id: account.id, limit: 2 } + get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers expect(body_as_json.size).to eq 2 expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s) From 4ec7d7d98911f5047e9da9004748ea5900f975d7 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 19 Jan 2024 04:35:58 -0500 Subject: [PATCH 26/55] Fix `Rails/WhereExists` cop in REST::TagSerializer model (#28790) --- .rubocop_todo.yml | 1 - app/serializers/rest/tag_serializer.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 31cefa032..0cebf37b5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -86,7 +86,6 @@ Rails/WhereExists: - 'app/models/status.rb' - 'app/policies/status_policy.rb' - 'app/serializers/rest/announcement_serializer.rb' - - 'app/serializers/rest/tag_serializer.rb' - 'app/services/activitypub/fetch_remote_status_service.rb' - 'app/services/vote_service.rb' - 'app/validators/reaction_validator.rb' diff --git a/app/serializers/rest/tag_serializer.rb b/app/serializers/rest/tag_serializer.rb index 7801e77d1..017b57271 100644 --- a/app/serializers/rest/tag_serializer.rb +++ b/app/serializers/rest/tag_serializer.rb @@ -19,7 +19,7 @@ class REST::TagSerializer < ActiveModel::Serializer if instance_options && instance_options[:relationships] instance_options[:relationships].following_map[object.id] || false else - TagFollow.where(tag_id: object.id, account_id: current_user.account_id).exists? + TagFollow.exists?(tag_id: object.id, account_id: current_user.account_id) end end From 163db814c2b3cf544b78e427e7f7bbd99b94a025 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:41:03 +0100 Subject: [PATCH 27/55] Update dependency react-redux to v9.1.0 (#28717) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renaud Chaput --- app/javascript/mastodon/store/typed_functions.ts | 5 ++--- yarn.lock | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/javascript/mastodon/store/typed_functions.ts b/app/javascript/mastodon/store/typed_functions.ts index 46a10b8b4..4859b8265 100644 --- a/app/javascript/mastodon/store/typed_functions.ts +++ b/app/javascript/mastodon/store/typed_functions.ts @@ -1,12 +1,11 @@ import { createAsyncThunk } from '@reduxjs/toolkit'; -import type { TypedUseSelectorHook } from 'react-redux'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { useDispatch, useSelector } from 'react-redux'; import type { AppDispatch, RootState } from './store'; -export const useAppDispatch: () => AppDispatch = useDispatch; -export const useAppSelector: TypedUseSelectorHook = useSelector; +export const useAppDispatch = useDispatch.withTypes(); +export const useAppSelector = useSelector.withTypes(); export const createAppAsyncThunk = createAsyncThunk.withTypes<{ state: RootState; diff --git a/yarn.lock b/yarn.lock index 8b5537723..35abcf80b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13799,8 +13799,8 @@ __metadata: linkType: hard "react-redux@npm:^9.0.4": - version: 9.0.4 - resolution: "react-redux@npm:9.0.4" + version: 9.1.0 + resolution: "react-redux@npm:9.1.0" dependencies: "@types/use-sync-external-store": "npm:^0.0.3" use-sync-external-store: "npm:^1.0.0" @@ -13816,7 +13816,7 @@ __metadata: optional: true redux: optional: true - checksum: 23af10014b129aeb051de729bde01de21175170b860deefb7ad83483feab5816253f770a4cea93333fc22a53ac9ac699b27f5c3705c388dab53dbcb2906a571a + checksum: 53161b5dc4d109020fbc42d26906ace92fed9ba1d7ab6274af60e9c0684583d20d1c8ec6d58601ac7b833c6468a652bbf3d4a102149d1793cb8a28b05b042f73 languageName: node linkType: hard From 9cd17020bc6aa966bdf26787a6ce4c9d2204c5e0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:41:57 +0000 Subject: [PATCH 28/55] New Crowdin Translations (automated) (#28798) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/vi.json | 2 +- config/locales/devise.fi.yml | 9 +++++++++ config/locales/devise.hu.yml | 9 +++++++++ config/locales/devise.ko.yml | 9 +++++++++ config/locales/fi.yml | 6 ++++++ config/locales/hu.yml | 6 ++++++ config/locales/ko.yml | 6 ++++++ config/locales/sk.yml | 2 ++ 8 files changed, 48 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/locales/vi.json b/app/javascript/mastodon/locales/vi.json index 9de043bb2..c623caa3f 100644 --- a/app/javascript/mastodon/locales/vi.json +++ b/app/javascript/mastodon/locales/vi.json @@ -358,7 +358,7 @@ "keyboard_shortcuts.my_profile": "mở hồ sơ của bạn", "keyboard_shortcuts.notifications": "mở thông báo", "keyboard_shortcuts.open_media": "mở ảnh hoặc video", - "keyboard_shortcuts.pinned": "mở những tút đã ghim", + "keyboard_shortcuts.pinned": "Open pinned posts list", "keyboard_shortcuts.profile": "mở trang của người đăng tút", "keyboard_shortcuts.reply": "trả lời", "keyboard_shortcuts.requests": "mở danh sách yêu cầu theo dõi", diff --git a/config/locales/devise.fi.yml b/config/locales/devise.fi.yml index bedf8a56f..ac7a57c6f 100644 --- a/config/locales/devise.fi.yml +++ b/config/locales/devise.fi.yml @@ -47,14 +47,19 @@ fi: subject: 'Mastodon: ohjeet salasanan vaihtoon' title: Salasanan vaihto two_factor_disabled: + explanation: Olet nyt mahdollistanut sisäänkirjautumisen pelkästään sähköpostiosoitteella ja salasanalla. subject: 'Mastodon: kaksivaiheinen todennus poistettu käytöstä' + subtitle: Kaksivaiheinen tunnistautuminen käyttäjätilillesi on poistettu käytöstä. title: 2-vaiheinen todennus pois käytöstä two_factor_enabled: + explanation: Sisäänkirjautuminen edellyttää liitetyn TOTP-sovelluksen luomaa aikarajattua kertatunnuslukua. subject: 'Mastodon: kaksivaiheinen todennus otettu käyttöön' + subtitle: Kaksivaiheinen kirjautuminen tilillesi on määritetty käyttöön. title: 2-vaiheinen todennus käytössä two_factor_recovery_codes_changed: explanation: Uudet palautuskoodit on nyt luotu ja vanhat on mitätöity. subject: 'Mastodon: kaksivaiheisen todennuksen palautuskoodit luotiin uudelleen' + subtitle: Aiemmat palautuskoodit on mitätöity, ja korvaavat uudet koodit on luotu. title: 2-vaiheisen todennuksen palautuskoodit vaihdettiin unlock_instructions: subject: 'Mastodon: lukituksen poistamisen ohjeet' @@ -68,9 +73,13 @@ fi: subject: 'Mastodon: suojausavain poistettu' title: Yksi suojausavaimistasi on poistettu webauthn_disabled: + explanation: Turva-avaimin kirjautuminen tilillesi on kytketty pois käytöstä. + extra: Olet nyt mahdollistanut sisäänkirjautumisen käyttäjätilillesi pelkästään palveluun liitetyn TOTP-sovelluksen luomalla aikarajoitteisella kertatunnusluvulla. subject: 'Mastodon: Todennus suojausavaimilla poistettu käytöstä' title: Suojausavaimet poistettu käytöstä webauthn_enabled: + explanation: Turva-avainkirjautuminen käyttäjätilillesi on otettu käyttöön. + extra: Voit nyt kirjautua sisään käyttäen turva-avaintasi. subject: 'Mastodon: Todennus suojausavaimella on otettu käyttöön' title: Suojausavaimet käytössä omniauth_callbacks: diff --git a/config/locales/devise.hu.yml b/config/locales/devise.hu.yml index 522ac66ad..fea56ab24 100644 --- a/config/locales/devise.hu.yml +++ b/config/locales/devise.hu.yml @@ -47,14 +47,19 @@ hu: subject: 'Mastodon: Jelszóvisszaállítási utasítások' title: Jelszó visszaállítása two_factor_disabled: + explanation: A bejelentkezés most már csupán email címmel és jelszóval lehetséges. subject: Kétlépcsős azonosítás kikapcsolva + subtitle: A kétlépcsős hitelesítés a fiókodhoz ki lett kapcsolva. title: Kétlépcsős hitelesítés kikapcsolva two_factor_enabled: + explanation: Egy párosított TOTP appal generált tokenre lesz szükség a bejelentkezéshez. subject: 'Mastodon: Kétlépcsős azonosítás engedélyezve' + subtitle: A kétlépcsős hitelesítés a fiókodhoz aktiválva lett. title: Kétlépcsős hitelesítés engedélyezve two_factor_recovery_codes_changed: explanation: A korábbi helyreállítási kódok letiltásra és újragenerálásra kerültek. subject: 'Mastodon: Kétlépcsős helyreállítási kódok újból előállítva' + subtitle: A korábbi helyreállítási kódokat letiltottuk, és újakat generáltunk. title: A kétlépcsős kódok megváltoztak unlock_instructions: subject: 'Mastodon: Feloldási utasítások' @@ -68,9 +73,13 @@ hu: subject: 'Mastodon: A biztonsági kulcs törlésre került' title: Az egyik biztonsági kulcsodat törölték webauthn_disabled: + explanation: A biztonsági kulcsokkal történő hitelesítés a fiókodhoz ki lett kapcsolva. + extra: A bejelentkezés most már csak TOTP app által generált tokennel lehetséges. subject: 'Mastodon: A biztonsági kulccsal történő hitelesítés letiltásra került' title: A biztonsági kulcsok letiltásra kerültek webauthn_enabled: + explanation: A biztonsági kulcsokkal történő hitelesítés a fiókodhoz aktiválva lett. + extra: A biztonsági kulcsodat mostantól lehet bejelentkezésre használni. subject: 'Mastodon: A biztonsági kulcsos hitelesítés engedélyezésre került' title: A biztonsági kulcsok engedélyezésre kerültek omniauth_callbacks: diff --git a/config/locales/devise.ko.yml b/config/locales/devise.ko.yml index 88865aec5..0c848e4ba 100644 --- a/config/locales/devise.ko.yml +++ b/config/locales/devise.ko.yml @@ -47,14 +47,19 @@ ko: subject: 'Mastodon: 암호 재설정 설명' title: 암호 재설정 two_factor_disabled: + explanation: 이제 이메일과 암호만 이용해서 로그인이 가능합니다. subject: '마스토돈: 이중 인증 비활성화' + subtitle: 계정에 대한 2단계 인증이 비활성화되었습니다. title: 2FA 비활성화 됨 two_factor_enabled: + explanation: 로그인 하기 위해서는 짝이 되는 TOTP 앱에서 생성한 토큰이 필요합니다. subject: '마스토돈: 이중 인증 활성화' + subtitle: 계정에 대한 2단계 인증이 활성화되었습니다. title: 2FA 활성화 됨 two_factor_recovery_codes_changed: explanation: 이전 복구 코드가 무효화되고 새 코드가 생성되었습니다 subject: '마스토돈: 이중 인증 복구 코드 재생성 됨' + subtitle: 이전 복구 코드가 무효화되고 새 코드가 생성되었습니다. title: 2FA 복구 코드 변경됨 unlock_instructions: subject: '마스토돈: 잠금 해제 방법' @@ -68,9 +73,13 @@ ko: subject: '마스토돈: 보안 키 삭제' title: 보안 키가 삭제되었습니다 webauthn_disabled: + explanation: 계정의 보안 키 인증이 비활성화되었습니다 + extra: 이제 TOTP 앱에서 생성한 토큰을 통해서만 로그인 가능합니다. subject: '마스토돈: 보안 키를 이용한 인증이 비활성화 됨' title: 보안 키 비활성화 됨 webauthn_enabled: + explanation: 계정에 대한 보안키 인증이 활성화되었습니다. + extra: 로그인시 보안키가 사용됩니다. subject: '마스토돈: 보안 키 인증 활성화 됨' title: 보안 키 활성화 됨 omniauth_callbacks: diff --git a/config/locales/fi.yml b/config/locales/fi.yml index a719f3496..26fe6b7f0 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1608,6 +1608,7 @@ fi: unknown_browser: Tuntematon selain weibo: Weibo current_session: Nykyinen istunto + date: Päiväys description: "%{browser} alustalla %{platform}" explanation: Nämä verkkoselaimet ovat tällä hetkellä kirjautuneena Mastodon-tilillesi. ip: IP-osoite @@ -1774,14 +1775,19 @@ fi: webauthn: Suojausavaimet user_mailer: appeal_approved: + action: Tilin asetukset explanation: Valitus tiliäsi koskevasta varoituksesta %{strike_date} jonka lähetit %{appeal_date} on hyväksytty. Tilisi on jälleen hyvässä kunnossa. subject: Valituksesi %{date} on hyväksytty + subtitle: Tilisi on jälleen normaalissa tilassa. title: Valitus hyväksytty appeal_rejected: explanation: Valitus tiliäsi koskevasta varoituksesta %{strike_date} jonka lähetit %{appeal_date} on hylätty. subject: Valituksesi %{date} on hylätty + subtitle: Vetoomuksesi on hylätty. title: Valitus hylätty backup_ready: + explanation: Olet pyytänyt täysvarmuuskopion Mastodon-tilistäsi. + extra: Se on nyt valmis ladattavaksi! subject: Arkisto on valmiina ladattavaksi title: Arkiston tallennus suspicious_sign_in: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 536af8b6b..7cfd7d80e 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1608,6 +1608,7 @@ hu: unknown_browser: Ismeretlen böngésző weibo: Weibo current_session: Jelenlegi munkamenet + date: Dátum description: "%{browser} az alábbi platformon: %{platform}" explanation: Jelenleg az alábbi böngészőkkel vagy bejelentkezve a fiókodba. ip: IP @@ -1774,14 +1775,19 @@ hu: webauthn: Biztonsági kulcsok user_mailer: appeal_approved: + action: Fiók Beállításai explanation: A fiókod %{appeal_date}-i fellebbezése, mely a %{strike_date}-i vétségeddel kapcsolatos, jóváhagyásra került. A fiókod megint makulátlan. subject: A %{date}-i fellebbezésedet jóváhagyták + subtitle: A fiókod ismét használható állapotban van. title: Fellebbezés jóváhagyva appeal_rejected: explanation: A %{appeal_date}-i fellebbezésed, amely a fiókod %{strike_date}-i vétségével kapcsolatos, elutasításra került. subject: A %{date}-i fellebbezésedet visszautasították + subtitle: A fellebbezésedet visszautasították. title: Fellebbezés visszautasítva backup_ready: + explanation: A Mastodon fiókod teljes biztonsági mentését kérted. + extra: Már letöltésre kész! subject: Az adataidról készült archív letöltésre kész title: Archiválás suspicious_sign_in: diff --git a/config/locales/ko.yml b/config/locales/ko.yml index b0eadc050..b85b9b586 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1584,6 +1584,7 @@ ko: unknown_browser: 알 수 없는 브라우저 weibo: 웨이보 current_session: 현재 세션 + date: 날짜 description: "%{platform}의 %{browser}" explanation: 내 마스토돈 계정에 로그인되어 있는 웹 브라우저 목록입니다. ip: IP @@ -1744,14 +1745,19 @@ ko: webauthn: 보안 키 user_mailer: appeal_approved: + action: 계정 설정 explanation: "%{strike_date}에 일어난 중재결정에 대한 소명을 %{appeal_date}에 작성했으며 승낙되었습니다. 당신의 계정은 정상적인 상태로 돌아왔습니다." subject: 귀하가 %{date}에 작성한 소명이 승낙되었습니다 + subtitle: 계정이 다시 정상적인 상태입니다. title: 소명이 받아들여짐 appeal_rejected: explanation: "%{strike_date}에 일어난 중재결정에 대한 소명을 %{appeal_date}에 작성했지만 반려되었습니다." subject: "%{date}에 작성한 소명이 반려되었습니다." + subtitle: 소명이 기각되었습니다. title: 이의 제기가 거절되었습니다 backup_ready: + explanation: 마스토돈 계정에 대한 전체 백업을 요청했습니다 + extra: 다운로드 할 준비가 되었습니다! subject: 아카이브를 다운로드할 수 있습니다 title: 아카이브 테이크아웃 suspicious_sign_in: diff --git a/config/locales/sk.yml b/config/locales/sk.yml index fdd64b5bb..89f456a20 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -633,6 +633,7 @@ sk: documentation_link: Zisti viac release_notes: Poznámky k vydaniu title: Dostupné aktualizácie + type: Druh types: major: Hlavné vydanie patch: Opravné vydanie - opravy a jednoducho uplatniteľné zmeny @@ -641,6 +642,7 @@ sk: account: Autor application: Aplikácia back_to_account: Späť na účet + back_to_report: Späť na stránku hlásenia batch: remove_from_report: Vymaž z hlásenia report: Hlásenie From 6a5d70e146c0bc15e965b802f3711f3b7c145169 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 19 Jan 2024 06:20:20 -0500 Subject: [PATCH 29/55] Update pre_migration_check postgres version requirement (#28800) --- lib/tasks/db.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 3bc526bd2..4208c2ae4 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -16,8 +16,8 @@ namespace :db do end task pre_migration_check: :environment do - version = ActiveRecord::Base.connection.select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i - abort 'This version of Mastodon requires PostgreSQL 9.5 or newer. Please update PostgreSQL before updating Mastodon' if version < 90_500 + version = ActiveRecord::Base.connection.database_version + abort 'This version of Mastodon requires PostgreSQL 12.0 or newer. Please update PostgreSQL before updating Mastodon.' if version < 120_000 end Rake::Task['db:migrate'].enhance(['db:pre_migration_check']) From 5fc4ae7c5f9667b335e63f97cacaa1efe5f7a6d5 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 19 Jan 2024 06:22:23 -0500 Subject: [PATCH 30/55] Move privacy policy into markdown file (#28699) --- .rubocop_todo.yml | 1 - app/models/privacy_policy.rb | 61 +------------- config/templates/privacy-policy.md | 128 +++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 61 deletions(-) create mode 100644 config/templates/privacy-policy.md diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0cebf37b5..a2ee32d28 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -135,7 +135,6 @@ Style/FetchEnvVar: # AllowedMethods: redirect Style/FormatStringToken: Exclude: - - 'app/models/privacy_policy.rb' - 'config/initializers/devise.rb' - 'lib/paperclip/color_extractor.rb' diff --git a/app/models/privacy_policy.rb b/app/models/privacy_policy.rb index 36cbf1882..c0d6e1b76 100644 --- a/app/models/privacy_policy.rb +++ b/app/models/privacy_policy.rb @@ -1,66 +1,7 @@ # frozen_string_literal: true class PrivacyPolicy < ActiveModelSerializers::Model - DEFAULT_PRIVACY_POLICY = <<~TXT - This privacy policy describes how %{domain} ("%{domain}", "we", "us") collects, protects and uses the personally identifiable information you may provide through the %{domain} website or its API. The policy also describes the choices available to you regarding our use of your personal information and how you can access and update this information. This policy does not apply to the practices of companies that %{domain} does not own or control, or to individuals that %{domain} does not employ or manage. - - # What information do we collect? - - - **Basic account information**: If you register on this server, you may be asked to enter a username, an e-mail address and a password. You may also enter additional profile information such as a display name and biography, and upload a profile picture and header image. The username, display name, biography, profile picture and header image are always listed publicly. - - **Posts, following and other public information**: The list of people you follow is listed publicly, the same is true for your followers. When you submit a message, the date and time is stored as well as the application you submitted the message from. Messages may contain media attachments, such as pictures and videos. Public and unlisted posts are available publicly. When you feature a post on your profile, that is also publicly available information. Your posts are delivered to your followers, in some cases it means they are delivered to different servers and copies are stored there. When you delete posts, this is likewise delivered to your followers. The action of reblogging or favouriting another post is always public. - - **Direct and followers-only posts**: All posts are stored and processed on the server. Followers-only posts are delivered to your followers and users who are mentioned in them, and direct posts are delivered only to users mentioned in them. In some cases it means they are delivered to different servers and copies are stored there. We make a good faith effort to limit the access to those posts only to authorized persons, but other servers may fail to do so. Therefore it's important to review servers your followers belong to. You may toggle an option to approve and reject new followers manually in the settings. **Please keep in mind that the operators of the server and any receiving server may view such messages**, and that recipients may screenshot, copy or otherwise re-share them. **Do not share any sensitive information over Mastodon.** - - **IPs and other metadata**: When you log in, we record the IP address you log in from, as well as the name of your browser application. All the logged in sessions are available for your review and revocation in the settings. The latest IP address used is stored for up to 12 months. We also may retain server logs which include the IP address of every request to our server. - - # What do we use your information for? - - Any of the information we collect from you may be used in the following ways: - - - To provide the core functionality of Mastodon. You can only interact with other people's content and post your own content when you are logged in. For example, you may follow other people to view their combined posts in your own personalized home timeline. - - To aid moderation of the community, for example comparing your IP address with other known ones to determine ban evasion or other violations. - - The email address you provide may be used to send you information, notifications about other people interacting with your content or sending you messages, and to respond to inquiries, and/or other requests or questions. - - # How do we protect your information? - - We implement a variety of security measures to maintain the safety of your personal information when you enter, submit, or access your personal information. Among other things, your browser session, as well as the traffic between your applications and the API, are secured with SSL, and your password is hashed using a strong one-way algorithm. You may enable two-factor authentication to further secure access to your account. - - # What is our data retention policy? - - We will make a good faith effort to: - - - Retain server logs containing the IP address of all requests to this server, in so far as such logs are kept, no more than 90 days. - - Retain the IP addresses associated with registered users no more than 12 months. - - You can request and download an archive of your content, including your posts, media attachments, profile picture, and header image. - - You may irreversibly delete your account at any time. - - # Do we use cookies? - - Yes. Cookies are small files that a site or its service provider transfers to your computer's hard drive through your Web browser (if you allow). These cookies enable the site to recognize your browser and, if you have a registered account, associate it with your registered account. - - We use cookies to understand and save your preferences for future visits. - - # Do we disclose any information to outside parties? - - We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our site, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. - - Your public content may be downloaded by other servers in the network. Your public and followers-only posts are delivered to the servers where your followers reside, and direct messages are delivered to the servers of the recipients, in so far as those followers or recipients reside on a different server than this. - - When you authorize an application to use your account, depending on the scope of permissions you approve, it may access your public profile information, your following list, your followers, your lists, all your posts, and your favourites. Applications can never access your e-mail address or password. - - # Site usage by children - - If this server is in the EU or the EEA: Our site, products and services are all directed to people who are at least 16 years old. If you are under the age of 16, per the requirements of the GDPR (General Data Protection Regulation) do not use this site. - - If this server is in the USA: Our site, products and services are all directed to people who are at least 13 years old. If you are under the age of 13, per the requirements of COPPA (Children's Online Privacy Protection Act) do not use this site. - - Law requirements can be different if this server is in another jurisdiction. - - ___ - - This document is CC-BY-SA. Originally adapted from the [Discourse privacy policy](https://github.com/discourse/discourse). - TXT - + DEFAULT_PRIVACY_POLICY = Rails.root.join('config', 'templates', 'privacy-policy.md').read DEFAULT_UPDATED_AT = DateTime.new(2022, 10, 7).freeze attributes :updated_at, :text diff --git a/config/templates/privacy-policy.md b/config/templates/privacy-policy.md new file mode 100644 index 000000000..9e042af80 --- /dev/null +++ b/config/templates/privacy-policy.md @@ -0,0 +1,128 @@ +This privacy policy describes how %{domain}s ("%{domain}s", "we", "us") +collects, protects and uses the personally identifiable information you may +provide through the %{domain}s website or its API. The policy also +describes the choices available to you regarding our use of your personal +information and how you can access and update this information. This policy +does not apply to the practices of companies that %{domain}s does not own +or control, or to individuals that %{domain}s does not employ or manage. + +# What information do we collect? + +- **Basic account information**: If you register on this server, you may be + asked to enter a username, an e-mail address and a password. You may also + enter additional profile information such as a display name and biography, and + upload a profile picture and header image. The username, display name, + biography, profile picture and header image are always listed publicly. +- **Posts, following and other public information**: The list of people you + follow is listed publicly, the same is true for your followers. When you + submit a message, the date and time is stored as well as the application you + submitted the message from. Messages may contain media attachments, such as + pictures and videos. Public and unlisted posts are available publicly. When + you feature a post on your profile, that is also publicly available + information. Your posts are delivered to your followers, in some cases it + means they are delivered to different servers and copies are stored there. + When you delete posts, this is likewise delivered to your followers. The + action of reblogging or favouriting another post is always public. +- **Direct and followers-only posts**: All posts are stored and processed on the + server. Followers-only posts are delivered to your followers and users who are + mentioned in them, and direct posts are delivered only to users mentioned in + them. In some cases it means they are delivered to different servers and + copies are stored there. We make a good faith effort to limit the access to + those posts only to authorized persons, but other servers may fail to do so. + Therefore it's important to review servers your followers belong to. You may + toggle an option to approve and reject new followers manually in the settings. + **Please keep in mind that the operators of the server and any receiving + server may view such messages**, and that recipients may screenshot, copy or + otherwise re-share them. **Do not share any sensitive information over + Mastodon.** +- **IPs and other metadata**: When you log in, we record the IP address you log + in from, as well as the name of your browser application. All the logged in + sessions are available for your review and revocation in the settings. The + latest IP address used is stored for up to 12 months. We also may retain + server logs which include the IP address of every request to our server. + +# What do we use your information for? + +Any of the information we collect from you may be used in the following ways: + +- To provide the core functionality of Mastodon. You can only interact with + other people's content and post your own content when you are logged in. For + example, you may follow other people to view their combined posts in your own + personalized home timeline. +- To aid moderation of the community, for example comparing your IP address with + other known ones to determine ban evasion or other violations. +- The email address you provide may be used to send you information, + notifications about other people interacting with your content or sending you + messages, and to respond to inquiries, and/or other requests or questions. + +# How do we protect your information? + +We implement a variety of security measures to maintain the safety of your +personal information when you enter, submit, or access your personal +information. Among other things, your browser session, as well as the traffic +between your applications and the API, are secured with SSL, and your password +is hashed using a strong one-way algorithm. You may enable two-factor +authentication to further secure access to your account. + +# What is our data retention policy? + +We will make a good faith effort to: + +- Retain server logs containing the IP address of all requests to this server, + in so far as such logs are kept, no more than 90 days. +- Retain the IP addresses associated with registered users no more than 12 + months. + +You can request and download an archive of your content, including your posts, +media attachments, profile picture, and header image. + +You may irreversibly delete your account at any time. + +# Do we use cookies? + +Yes. Cookies are small files that a site or its service provider transfers to +your computer's hard drive through your Web browser (if you allow). These +cookies enable the site to recognize your browser and, if you have a registered +account, associate it with your registered account. + +We use cookies to understand and save your preferences for future visits. + +# Do we disclose any information to outside parties? + +We do not sell, trade, or otherwise transfer to outside parties your personally +identifiable information. This does not include trusted third parties who assist +us in operating our site, conducting our business, or servicing you, so long as +those parties agree to keep this information confidential. We may also release +your information when we believe release is appropriate to comply with the law, +enforce our site policies, or protect ours or others rights, property, or +safety. + +Your public content may be downloaded by other servers in the network. Your +public and followers-only posts are delivered to the servers where your +followers reside, and direct messages are delivered to the servers of the +recipients, in so far as those followers or recipients reside on a different +server than this. + +When you authorize an application to use your account, depending on the scope of +permissions you approve, it may access your public profile information, your +following list, your followers, your lists, all your posts, and your favourites. +Applications can never access your e-mail address or password. + +# Site usage by children + +If this server is in the EU or the EEA: Our site, products and services are all +directed to people who are at least 16 years old. If you are under the age of +16, per the requirements of the GDPR (General Data Protection Regulation) do not +use this site. + +If this server is in the USA: Our site, products and services are all directed +to people who are at least 13 years old. If you are under the age of 13, per the +requirements of COPPA (Children's Online Privacy Protection Act) do not use this +site. + +Law requirements can be different if this server is in another jurisdiction. + +--- + +This document is CC-BY-SA. Originally adapted from the [Discourse privacy +policy](https://github.com/discourse/discourse). From 3593ee2e36284de71be8dc74c1772de7a7e1a7e3 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 19 Jan 2024 13:19:49 +0100 Subject: [PATCH 31/55] Add rate-limit of TOTP authentication attempts at controller level (#28801) --- app/controllers/auth/sessions_controller.rb | 22 +++++++++++++++++++ .../auth/two_factor_authentication_concern.rb | 5 +++++ config/locales/en.yml | 1 + .../auth/sessions_controller_spec.rb | 20 +++++++++++++++++ 4 files changed, 48 insertions(+) diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 148ad5375..6bc48a780 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -1,6 +1,10 @@ # frozen_string_literal: true class Auth::SessionsController < Devise::SessionsController + include Redisable + + MAX_2FA_ATTEMPTS_PER_HOUR = 10 + layout 'auth' skip_before_action :check_self_destruct! @@ -130,9 +134,23 @@ class Auth::SessionsController < Devise::SessionsController session.delete(:attempt_user_updated_at) end + def clear_2fa_attempt_from_user(user) + redis.del(second_factor_attempts_key(user)) + end + + def check_second_factor_rate_limits(user) + attempts, = redis.multi do |multi| + multi.incr(second_factor_attempts_key(user)) + multi.expire(second_factor_attempts_key(user), 1.hour) + end + + attempts >= MAX_2FA_ATTEMPTS_PER_HOUR + end + def on_authentication_success(user, security_measure) @on_authentication_success_called = true + clear_2fa_attempt_from_user(user) clear_attempt_from_session user.update_sign_in!(new_sign_in: true) @@ -164,4 +182,8 @@ class Auth::SessionsController < Devise::SessionsController user_agent: request.user_agent ) end + + def second_factor_attempts_key(user) + "2fa_auth_attempts:#{user.id}:#{Time.now.utc.hour}" + end end diff --git a/app/controllers/concerns/auth/two_factor_authentication_concern.rb b/app/controllers/concerns/auth/two_factor_authentication_concern.rb index effdb8d21..404164751 100644 --- a/app/controllers/concerns/auth/two_factor_authentication_concern.rb +++ b/app/controllers/concerns/auth/two_factor_authentication_concern.rb @@ -66,6 +66,11 @@ module Auth::TwoFactorAuthenticationConcern end def authenticate_with_two_factor_via_otp(user) + if check_second_factor_rate_limits(user) + flash.now[:alert] = I18n.t('users.rate_limited') + return prompt_for_two_factor(user) + end + if valid_otp_attempt?(user) on_authentication_success(user, :otp) else diff --git a/config/locales/en.yml b/config/locales/en.yml index 78820c3b5..89ca0ad72 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1844,6 +1844,7 @@ en: go_to_sso_account_settings: Go to your identity provider's account settings invalid_otp_token: Invalid two-factor code otp_lost_help_html: If you lost access to both, you may get in touch with %{email} + rate_limited: Too many authentication attempts, try again later. seamless_external_login: You are logged in via an external service, so password and e-mail settings are not available. signed_in_as: 'Signed in as:' verification: diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb index e3f2b278b..d238626c9 100644 --- a/spec/controllers/auth/sessions_controller_spec.rb +++ b/spec/controllers/auth/sessions_controller_spec.rb @@ -262,6 +262,26 @@ RSpec.describe Auth::SessionsController do end end + context 'when repeatedly using an invalid TOTP code before using a valid code' do + before do + stub_const('Auth::SessionsController::MAX_2FA_ATTEMPTS_PER_HOUR', 2) + end + + it 'does not log the user in' do + # Travel to the beginning of an hour to avoid crossing rate-limit buckets + travel_to '2023-12-20T10:00:00Z' + + Auth::SessionsController::MAX_2FA_ATTEMPTS_PER_HOUR.times do + post :create, params: { user: { otp_attempt: '1234' } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } + expect(controller.current_user).to be_nil + end + + post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } + expect(controller.current_user).to be_nil + expect(flash[:alert]).to match I18n.t('users.rate_limited') + end + end + context 'when using a valid OTP' do before do post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } From cf2a2ed71c63cf113bd3569c237e8cebe00162bb Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 19 Jan 2024 13:43:10 +0100 Subject: [PATCH 32/55] Fix processing of compacted single-item JSON-LD collections (#28816) --- .../fetch_featured_collection_service.rb | 4 +-- .../activitypub/fetch_replies_service.rb | 4 +-- .../synchronize_followers_service.rb | 4 +-- app/services/keys/query_service.rb | 2 +- .../fetch_featured_collection_service_spec.rb | 34 +++++++++++++++++-- .../activitypub/fetch_replies_service_spec.rb | 12 +++++++ 6 files changed, 51 insertions(+), 9 deletions(-) diff --git a/app/services/activitypub/fetch_featured_collection_service.rb b/app/services/activitypub/fetch_featured_collection_service.rb index d2bae08a0..89c3a1b6c 100644 --- a/app/services/activitypub/fetch_featured_collection_service.rb +++ b/app/services/activitypub/fetch_featured_collection_service.rb @@ -23,9 +23,9 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService case collection['type'] when 'Collection', 'CollectionPage' - collection['items'] + as_array(collection['items']) when 'OrderedCollection', 'OrderedCollectionPage' - collection['orderedItems'] + as_array(collection['orderedItems']) end end diff --git a/app/services/activitypub/fetch_replies_service.rb b/app/services/activitypub/fetch_replies_service.rb index a9dd327e9..e2ecdef16 100644 --- a/app/services/activitypub/fetch_replies_service.rb +++ b/app/services/activitypub/fetch_replies_service.rb @@ -26,9 +26,9 @@ class ActivityPub::FetchRepliesService < BaseService case collection['type'] when 'Collection', 'CollectionPage' - collection['items'] + as_array(collection['items']) when 'OrderedCollection', 'OrderedCollectionPage' - collection['orderedItems'] + as_array(collection['orderedItems']) end end diff --git a/app/services/activitypub/synchronize_followers_service.rb b/app/services/activitypub/synchronize_followers_service.rb index 7ccc91730..f51d671a0 100644 --- a/app/services/activitypub/synchronize_followers_service.rb +++ b/app/services/activitypub/synchronize_followers_service.rb @@ -59,9 +59,9 @@ class ActivityPub::SynchronizeFollowersService < BaseService case collection['type'] when 'Collection', 'CollectionPage' - collection['items'] + as_array(collection['items']) when 'OrderedCollection', 'OrderedCollectionPage' - collection['orderedItems'] + as_array(collection['orderedItems']) end end diff --git a/app/services/keys/query_service.rb b/app/services/keys/query_service.rb index 14c9d9205..33e13293f 100644 --- a/app/services/keys/query_service.rb +++ b/app/services/keys/query_service.rb @@ -69,7 +69,7 @@ class Keys::QueryService < BaseService return if json['items'].blank? - @devices = json['items'].map do |device| + @devices = as_array(json['items']).map do |device| Device.new(device_id: device['id'], name: device['name'], identity_key: device.dig('identityKey', 'publicKeyBase64'), fingerprint_key: device.dig('fingerprintKey', 'publicKeyBase64'), claim_url: device['claim']) end rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error => e diff --git a/spec/services/activitypub/fetch_featured_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_collection_service_spec.rb index a98108cea..b9e95b825 100644 --- a/spec/services/activitypub/fetch_featured_collection_service_spec.rb +++ b/spec/services/activitypub/fetch_featured_collection_service_spec.rb @@ -31,7 +31,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do } end - let(:status_json_pinned_unknown_unreachable) do + let(:status_json_pinned_unknown_reachable) do { '@context': 'https://www.w3.org/ns/activitystreams', type: 'Note', @@ -75,7 +75,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do stub_request(:get, 'https://example.com/account/pinned/known').to_return(status: 200, body: Oj.dump(status_json_pinned_known)) stub_request(:get, 'https://example.com/account/pinned/unknown-inlined').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_inlined)) stub_request(:get, 'https://example.com/account/pinned/unknown-unreachable').to_return(status: 404) - stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_unreachable)) + stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable)) stub_request(:get, 'https://example.com/account/collections/featured').to_return(status: 200, body: Oj.dump(featured_with_null)) subject.call(actor, note: true, hashtag: false) @@ -115,6 +115,21 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do end it_behaves_like 'sets pinned posts' + + context 'when there is a single item, with the array compacted away' do + let(:items) { 'https://example.com/account/pinned/unknown-reachable' } + + before do + stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable)) + subject.call(actor, note: true, hashtag: false) + end + + it 'sets expected posts as pinned posts' do + expect(actor.pinned_statuses.pluck(:uri)).to contain_exactly( + 'https://example.com/account/pinned/unknown-reachable' + ) + end + end end context 'when the endpoint is a paginated Collection' do @@ -136,6 +151,21 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do end it_behaves_like 'sets pinned posts' + + context 'when there is a single item, with the array compacted away' do + let(:items) { 'https://example.com/account/pinned/unknown-reachable' } + + before do + stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable)) + subject.call(actor, note: true, hashtag: false) + end + + it 'sets expected posts as pinned posts' do + expect(actor.pinned_statuses.pluck(:uri)).to contain_exactly( + 'https://example.com/account/pinned/unknown-reachable' + ) + end + end end end end diff --git a/spec/services/activitypub/fetch_replies_service_spec.rb b/spec/services/activitypub/fetch_replies_service_spec.rb index d7716dd4e..a76b996c2 100644 --- a/spec/services/activitypub/fetch_replies_service_spec.rb +++ b/spec/services/activitypub/fetch_replies_service_spec.rb @@ -34,6 +34,18 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do describe '#call' do context 'when the payload is a Collection with inlined replies' do + context 'when there is a single reply, with the array compacted away' do + let(:items) { 'http://example.com/self-reply-1' } + + it 'queues the expected worker' do + allow(FetchReplyWorker).to receive(:push_bulk) + + subject.call(status, payload) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1']) + end + end + context 'when passing the collection itself' do it 'spawns workers for up to 5 replies on the same server' do allow(FetchReplyWorker).to receive(:push_bulk) From 93957daa500502520ba4d7c8fc9d7918c99d1cdb Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 19 Jan 2024 19:52:59 +0100 Subject: [PATCH 33/55] Fix error when processing remote files with unusually long names (#28823) --- lib/paperclip/response_with_limit_adapter.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/paperclip/response_with_limit_adapter.rb b/lib/paperclip/response_with_limit_adapter.rb index deb89717a..ff7a938ab 100644 --- a/lib/paperclip/response_with_limit_adapter.rb +++ b/lib/paperclip/response_with_limit_adapter.rb @@ -16,7 +16,7 @@ module Paperclip private def cache_current_values - @original_filename = filename_from_content_disposition.presence || filename_from_path.presence || 'data' + @original_filename = truncated_filename @tempfile = copy_to_tempfile(@target) @content_type = ContentTypeDetector.new(@tempfile.path).detect @size = File.size(@tempfile) @@ -43,6 +43,13 @@ module Paperclip source.response.connection.close end + def truncated_filename + filename = filename_from_content_disposition.presence || filename_from_path.presence || 'data' + extension = File.extname(filename) + basename = File.basename(filename, extension) + [basename[...20], extension[..4]].compact_blank.join + end + def filename_from_content_disposition disposition = @target.response.headers['content-disposition'] disposition&.match(/filename="([^"]*)"/)&.captures&.first From 9f8e3cca9a6764018ccef2bc48b5d9a867e3a4e3 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 21 Jan 2024 08:44:46 +0100 Subject: [PATCH 34/55] Fix duplicate and missing keys in search popout component in web UI (#28834) --- app/javascript/mastodon/actions/search.js | 7 +++++- .../features/compose/components/search.jsx | 22 ++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/javascript/mastodon/actions/search.js b/app/javascript/mastodon/actions/search.js index 38a089b48..a34a490e7 100644 --- a/app/javascript/mastodon/actions/search.js +++ b/app/javascript/mastodon/actions/search.js @@ -179,6 +179,11 @@ export const openURL = (value, history, onFailure) => (dispatch, getState) => { export const clickSearchResult = (q, type) => (dispatch, getState) => { const previous = getState().getIn(['search', 'recent']); + + if (previous.some(x => x.get('q') === q && x.get('type') === type)) { + return; + } + const me = getState().getIn(['meta', 'me']); const current = previous.add(fromJS({ type, q })).takeLast(4); @@ -207,4 +212,4 @@ export const hydrateSearch = () => (dispatch, getState) => { if (history !== null) { dispatch(updateSearchHistory(history)); } -}; \ No newline at end of file +}; diff --git a/app/javascript/mastodon/features/compose/components/search.jsx b/app/javascript/mastodon/features/compose/components/search.jsx index 0bcc41b92..ca02c23fc 100644 --- a/app/javascript/mastodon/features/compose/components/search.jsx +++ b/app/javascript/mastodon/features/compose/components/search.jsx @@ -62,14 +62,14 @@ class Search extends PureComponent { }; defaultOptions = [ - { label: <>has: , action: e => { e.preventDefault(); this._insertText('has:'); } }, - { label: <>is: , action: e => { e.preventDefault(); this._insertText('is:'); } }, - { label: <>language: , action: e => { e.preventDefault(); this._insertText('language:'); } }, - { label: <>from: , action: e => { e.preventDefault(); this._insertText('from:'); } }, - { label: <>before: , action: e => { e.preventDefault(); this._insertText('before:'); } }, - { label: <>during: , action: e => { e.preventDefault(); this._insertText('during:'); } }, - { label: <>after: , action: e => { e.preventDefault(); this._insertText('after:'); } }, - { label: <>in: , action: e => { e.preventDefault(); this._insertText('in:'); } } + { key: 'prompt-has', label: <>has: , action: e => { e.preventDefault(); this._insertText('has:'); } }, + { key: 'prompt-is', label: <>is: , action: e => { e.preventDefault(); this._insertText('is:'); } }, + { key: 'prompt-language', label: <>language: , action: e => { e.preventDefault(); this._insertText('language:'); } }, + { key: 'prompt-from', label: <>from: , action: e => { e.preventDefault(); this._insertText('from:'); } }, + { key: 'prompt-before', label: <>before: , action: e => { e.preventDefault(); this._insertText('before:'); } }, + { key: 'prompt-during', label: <>during: , action: e => { e.preventDefault(); this._insertText('during:'); } }, + { key: 'prompt-after', label: <>after: , action: e => { e.preventDefault(); this._insertText('after:'); } }, + { key: 'prompt-in', label: <>in: , action: e => { e.preventDefault(); this._insertText('in:'); } } ]; setRef = c => { @@ -262,6 +262,8 @@ class Search extends PureComponent { const { recent } = this.props; return recent.toArray().map(search => ({ + key: `${search.get('type')}/${search.get('q')}`, + label: labelForRecentSearch(search), action: () => this.handleRecentSearchClick(search), @@ -346,8 +348,8 @@ class Search extends PureComponent {

- {recent.size > 0 ? this._getOptions().map(({ label, action, forget }, i) => ( - From 3fbf01918f8dfe166c15032bdb782ee6a2d339d1 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Mon, 22 Jan 2024 11:02:26 +0100 Subject: [PATCH 35/55] Streaming: Move more methods to the utils from the main file (#28825) --- streaming/index.js | 42 +---------------------------------------- streaming/utils.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 41 deletions(-) diff --git a/streaming/index.js b/streaming/index.js index aa75a08b7..78b049723 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -16,7 +16,7 @@ const WebSocket = require('ws'); const { logger, httpLogger, initializeLogLevel, attachWebsocketHttpLogger, createWebsocketLogger } = require('./logging'); const { setupMetrics } = require('./metrics'); -const { isTruthy } = require("./utils"); +const { isTruthy, normalizeHashtag, firstParam } = require("./utils"); const environment = process.env.NODE_ENV || 'development'; @@ -1110,34 +1110,6 @@ const startServer = async () => { return arr; }; - /** - * See app/lib/ascii_folder.rb for the canon definitions - * of these constants - */ - const NON_ASCII_CHARS = 'ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž'; - const EQUIVALENT_ASCII_CHARS = 'AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz'; - - /** - * @param {string} str - * @returns {string} - */ - const foldToASCII = str => { - const regex = new RegExp(NON_ASCII_CHARS.split('').join('|'), 'g'); - - return str.replace(regex, match => { - const index = NON_ASCII_CHARS.indexOf(match); - return EQUIVALENT_ASCII_CHARS[index]; - }); - }; - - /** - * @param {string} str - * @returns {string} - */ - const normalizeHashtag = str => { - return foldToASCII(str.normalize('NFKC').toLowerCase()).replace(/[^\p{L}\p{N}_\u00b7\u200c]/gu, ''); - }; - /** * @param {any} req * @param {string} name @@ -1380,18 +1352,6 @@ const startServer = async () => { connectedChannels.labels({ type: 'websocket', channel: 'system' }).inc(2); }; - /** - * @param {string|string[]} arrayOrString - * @returns {string} - */ - const firstParam = arrayOrString => { - if (Array.isArray(arrayOrString)) { - return arrayOrString[0]; - } else { - return arrayOrString; - } - }; - /** * @param {WebSocket & { isAlive: boolean }} ws * @param {http.IncomingMessage & ResolvedAccount} req diff --git a/streaming/utils.js b/streaming/utils.js index ad8dd4889..7b87a1d14 100644 --- a/streaming/utils.js +++ b/streaming/utils.js @@ -20,3 +20,50 @@ const isTruthy = value => value && !FALSE_VALUES.includes(value); exports.isTruthy = isTruthy; + + +/** + * See app/lib/ascii_folder.rb for the canon definitions + * of these constants + */ +const NON_ASCII_CHARS = 'ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž'; +const EQUIVALENT_ASCII_CHARS = 'AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz'; + +/** + * @param {string} str + * @returns {string} + */ +function foldToASCII(str) { + const regex = new RegExp(NON_ASCII_CHARS.split('').join('|'), 'g'); + + return str.replace(regex, function(match) { + const index = NON_ASCII_CHARS.indexOf(match); + return EQUIVALENT_ASCII_CHARS[index]; + }); +} + +exports.foldToASCII = foldToASCII; + +/** + * @param {string} str + * @returns {string} + */ +function normalizeHashtag(str) { + return foldToASCII(str.normalize('NFKC').toLowerCase()).replace(/[^\p{L}\p{N}_\u00b7\u200c]/gu, ''); +} + +exports.normalizeHashtag = normalizeHashtag; + +/** + * @param {string|string[]} arrayOrString + * @returns {string} + */ +function firstParam(arrayOrString) { + if (Array.isArray(arrayOrString)) { + return arrayOrString[0]; + } else { + return arrayOrString; + } +} + +exports.firstParam = firstParam; From 62001b5a311fb98d41f546d36faffaaf8e82c4f7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:04:28 +0100 Subject: [PATCH 36/55] Update dependency jsdom to v24 (#28836) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- streaming/package.json | 2 +- yarn.lock | 34 +++++++--------------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/streaming/package.json b/streaming/package.json index 52a997970..3f76e2578 100644 --- a/streaming/package.json +++ b/streaming/package.json @@ -20,7 +20,7 @@ "dotenv": "^16.0.3", "express": "^4.18.2", "ioredis": "^5.3.2", - "jsdom": "^23.0.0", + "jsdom": "^24.0.0", "pg": "^8.5.0", "pg-connection-string": "^2.6.0", "pino": "^8.17.2", diff --git a/yarn.lock b/yarn.lock index 35abcf80b..34e0d526e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -42,17 +42,6 @@ __metadata: languageName: node linkType: hard -"@asamuzakjp/dom-selector@npm:^2.0.1": - version: 2.0.1 - resolution: "@asamuzakjp/dom-selector@npm:2.0.1" - dependencies: - bidi-js: "npm:^1.0.3" - css-tree: "npm:^2.3.1" - is-potential-custom-element-name: "npm:^1.0.1" - checksum: 232895f16f2f9dfc637764df2529084d16e1c122057766a79b16e1d40808e09fffae28c0f0cc8376f8a1564a85dba9d4b2f140a9a0b65f4f95c960192b797037 - languageName: node - linkType: hard - "@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5": version: 7.23.5 resolution: "@babel/code-frame@npm:7.23.5" @@ -2545,7 +2534,7 @@ __metadata: eslint-define-config: "npm:^2.0.0" express: "npm:^4.18.2" ioredis: "npm:^5.3.2" - jsdom: "npm:^23.0.0" + jsdom: "npm:^24.0.0" pg: "npm:^8.5.0" pg-connection-string: "npm:^2.6.0" pino: "npm:^8.17.2" @@ -4948,15 +4937,6 @@ __metadata: languageName: node linkType: hard -"bidi-js@npm:^1.0.3": - version: 1.0.3 - resolution: "bidi-js@npm:1.0.3" - dependencies: - require-from-string: "npm:^2.0.2" - checksum: fdddea4aa4120a34285486f2267526cd9298b6e8b773ad25e765d4f104b6d7437ab4ba542e6939e3ac834a7570bcf121ee2cf6d3ae7cd7082c4b5bedc8f271e1 - languageName: node - linkType: hard - "big-integer@npm:^1.6.44": version: 1.6.51 resolution: "big-integer@npm:1.6.51" @@ -10646,11 +10626,10 @@ __metadata: languageName: node linkType: hard -"jsdom@npm:^23.0.0": - version: 23.2.0 - resolution: "jsdom@npm:23.2.0" +"jsdom@npm:^24.0.0": + version: 24.0.0 + resolution: "jsdom@npm:24.0.0" dependencies: - "@asamuzakjp/dom-selector": "npm:^2.0.1" cssstyle: "npm:^4.0.1" data-urls: "npm:^5.0.0" decimal.js: "npm:^10.4.3" @@ -10659,6 +10638,7 @@ __metadata: http-proxy-agent: "npm:^7.0.0" https-proxy-agent: "npm:^7.0.2" is-potential-custom-element-name: "npm:^1.0.1" + nwsapi: "npm:^2.2.7" parse5: "npm:^7.1.2" rrweb-cssom: "npm:^0.6.0" saxes: "npm:^6.0.0" @@ -10676,7 +10656,7 @@ __metadata: peerDependenciesMeta: canvas: optional: true - checksum: b062af50f7be59d914ba75236b7817c848ef3cd007aea1d6b8020a41eb263b7d5bd2652298106e9756b56892f773d990598778d02adab7d0d0d8e58726fc41d3 + checksum: 7b35043d7af39ad6dcaef0fa5679d8c8a94c6c9b6cc4a79222b7c9987d57ab7150c50856684ae56b473ab28c7d82aec0fb7ca19dcbd4c3f46683c807d717a3af languageName: node linkType: hard @@ -11962,7 +11942,7 @@ __metadata: languageName: node linkType: hard -"nwsapi@npm:^2.2.2": +"nwsapi@npm:^2.2.2, nwsapi@npm:^2.2.7": version: 2.2.7 resolution: "nwsapi@npm:2.2.7" checksum: 44be198adae99208487a1c886c0a3712264f7bbafa44368ad96c003512fed2753d4e22890ca1e6edb2690c3456a169f2a3c33bfacde1905cf3bf01c7722464db From 9ff9849381e1c28b23920b72112d97994bb73ac1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:07:44 +0100 Subject: [PATCH 37/55] Update dependency core-js to v3.35.1 (#28831) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 34e0d526e..67c03e104 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5939,9 +5939,9 @@ __metadata: linkType: hard "core-js@npm:^3.30.2": - version: 3.35.0 - resolution: "core-js@npm:3.35.0" - checksum: 1d545ff4406f2afa5e681f44b45ed5f7f119d158b380234d5aa7787ce7e47fc7a635b98b74c28c766ba8191e3db8c2316ad6ab4ff1ddecbc3fd618413a52c29c + version: 3.35.1 + resolution: "core-js@npm:3.35.1" + checksum: ebc8e22c36d13bcf2140cbc1d8ad65d1b08192bff4c43ade70c72eac103cb4dcfbc521f2b1ad1c74881b0a4353e64986537893ae4f07888e49228340efa13ae6 languageName: node linkType: hard From a83aeccac9583528f50e24166ef9d42b147fb26d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 11:08:06 +0000 Subject: [PATCH 38/55] Update dependency dotenv to v16.3.2 (#28824) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 67c03e104..5272d4167 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6901,9 +6901,9 @@ __metadata: linkType: hard "dotenv@npm:^16.0.3": - version: 16.3.1 - resolution: "dotenv@npm:16.3.1" - checksum: b95ff1bbe624ead85a3cd70dbd827e8e06d5f05f716f2d0cbc476532d54c7c9469c3bc4dd93ea519f6ad711cb522c00ac9a62b6eb340d5affae8008facc3fbd7 + version: 16.3.2 + resolution: "dotenv@npm:16.3.2" + checksum: a87d62cef0810b670cb477db1a24a42a093b6b428c9e65c185ce1d6368ad7175234b13547718ba08da18df43faae4f814180cc0366e11be1ded2277abc4dd22e languageName: node linkType: hard From e078d0048cd84a3bb33be569628cfbcf18999e2b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:08:22 +0100 Subject: [PATCH 39/55] Update dependency @types/react to v18.2.48 (#28839) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5272d4167..aca2278f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3533,13 +3533,13 @@ __metadata: linkType: hard "@types/react@npm:*, @types/react@npm:16 || 17 || 18, @types/react@npm:>=16.9.11, @types/react@npm:^18.2.7": - version: 18.2.47 - resolution: "@types/react@npm:18.2.47" + version: 18.2.48 + resolution: "@types/react@npm:18.2.48" dependencies: "@types/prop-types": "npm:*" "@types/scheduler": "npm:*" csstype: "npm:^3.0.2" - checksum: e98ea1827fe60636d0f7ce206397159a29fc30613fae43e349e32c10ad3c0b7e0ed2ded2f3239e07bd5a3cba8736b6114ba196acccc39905ca4a06f56a8d2841 + checksum: 7e89f18ea2928b1638f564b156d692894dcb9352a7e0a807873c97e858abe1f23dbd165a25dd088a991344e973fdeef88ba5724bfb64504b74072cbc9c220c3a languageName: node linkType: hard From 9620b21259f4bb91862e954e16b90d566991670a Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Mon, 22 Jan 2024 11:11:47 +0000 Subject: [PATCH 40/55] docs: update FEDERATION.md to more closely follow FEP conventions. (#28838) --- FEDERATION.md | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/FEDERATION.md b/FEDERATION.md index e3721d724..2819fa935 100644 --- a/FEDERATION.md +++ b/FEDERATION.md @@ -1,19 +1,35 @@ -## ActivityPub federation in Mastodon +# Federation + +## Supported federation protocols and standards + +- [ActivityPub](https://www.w3.org/TR/activitypub/) (Server-to-Server) +- [WebFinger](https://webfinger.net/) +- [Http Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures) +- [NodeInfo](https://nodeinfo.diaspora.software/) + +## Supported FEPs + +- [FEP-67ff: FEDERATION.md](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md) +- [FEP-f1d5: NodeInfo in Fediverse Software](https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md) +- [FEP-8fcf: Followers collection synchronization across servers](https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md) +- [FEP-5feb: Search indexing consent for actors](https://codeberg.org/fediverse/fep/src/branch/main/fep/5feb/fep-5feb.md) + +## ActivityPub in Mastodon Mastodon largely follows the ActivityPub server-to-server specification but it makes uses of some non-standard extensions, some of which are required for interacting with Mastodon at all. -Supported vocabulary: https://docs.joinmastodon.org/spec/activitypub/ +- [Supported ActivityPub vocabulary](https://docs.joinmastodon.org/spec/activitypub/) ### Required extensions -#### Webfinger +#### WebFinger In Mastodon, users are identified by a `username` and `domain` pair (e.g., `Gargron@mastodon.social`). This is used both for discovery and for unambiguously mentioning users across the fediverse. Furthermore, this is part of Mastodon's database design from its very beginnings. As a result, Mastodon requires that each ActivityPub actor uniquely maps back to an `acct:` URI that can be resolved via WebFinger. -More information and examples are available at: https://docs.joinmastodon.org/spec/webfinger/ +- [WebFinger information and examples](https://docs.joinmastodon.org/spec/webfinger/) #### HTTP Signatures @@ -21,11 +37,13 @@ In order to authenticate activities, Mastodon relies on HTTP Signatures, signing Mastodon requires all `POST` requests to be signed, and MAY require `GET` requests to be signed, depending on the configuration of the Mastodon server. -More information on HTTP Signatures, as well as examples, can be found here: https://docs.joinmastodon.org/spec/security/#http +- [HTTP Signatures information and examples](https://docs.joinmastodon.org/spec/security/#http) ### Optional extensions -- Linked-Data Signatures: https://docs.joinmastodon.org/spec/security/#ld -- Bearcaps: https://docs.joinmastodon.org/spec/bearcaps/ -- Followers collection synchronization: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md -- Search indexing consent for actors: https://codeberg.org/fediverse/fep/src/branch/main/fep/5feb/fep-5feb.md +- [Linked-Data Signatures](https://docs.joinmastodon.org/spec/security/#ld) +- [Bearcaps](https://docs.joinmastodon.org/spec/bearcaps/) + +### Additional documentation + +- [Mastodon documentation](https://docs.joinmastodon.org/) From 76e383ea1e416d2a034d4327ed711eb01d106634 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:52:26 +0100 Subject: [PATCH 41/55] New Crowdin Translations (automated) (#28827) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/ast.json | 10 ++-- app/javascript/mastodon/locales/ko.json | 2 +- app/javascript/mastodon/locales/lad.json | 4 ++ app/javascript/mastodon/locales/th.json | 2 +- config/locales/ast.yml | 1 + config/locales/bg.yml | 1 + config/locales/ca.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/devise.fi.yml | 16 +++--- config/locales/devise.ie.yml | 2 + config/locales/devise.ja.yml | 6 +-- config/locales/devise.lad.yml | 8 +++ config/locales/devise.nn.yml | 9 ++++ config/locales/devise.no.yml | 9 ++++ config/locales/devise.sl.yml | 9 ++++ config/locales/devise.th.yml | 11 +++- config/locales/doorkeeper.ia.yml | 9 ++++ config/locales/eo.yml | 19 +++++++ config/locales/es-AR.yml | 1 + config/locales/es-MX.yml | 1 + config/locales/es.yml | 1 + config/locales/eu.yml | 1 + config/locales/fi.yml | 3 +- config/locales/fo.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/hu.yml | 1 + config/locales/ie.yml | 2 + config/locales/is.yml | 1 + config/locales/it.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/lad.yml | 40 ++++++++++++++ config/locales/nl.yml | 1 + config/locales/nn.yml | 7 +++ config/locales/no.yml | 69 +++++++++++++----------- config/locales/pl.yml | 1 + config/locales/pt-PT.yml | 1 + config/locales/simple_form.no.yml | 4 +- config/locales/sk.yml | 2 + config/locales/sl.yml | 1 + config/locales/sr-Latn.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/th.yml | 11 +++- config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-CN.yml | 1 + config/locales/zh-HK.yml | 1 + config/locales/zh-TW.yml | 1 + 52 files changed, 231 insertions(+), 53 deletions(-) diff --git a/app/javascript/mastodon/locales/ast.json b/app/javascript/mastodon/locales/ast.json index 4b555c482..1467f8891 100644 --- a/app/javascript/mastodon/locales/ast.json +++ b/app/javascript/mastodon/locales/ast.json @@ -116,7 +116,6 @@ "compose_form.publish_form": "Artículu nuevu", "compose_form.publish_loud": "¡{publish}!", "compose_form.save_changes": "Guardar los cambeos", - "compose_form.spoiler.unmarked": "Text is not hidden", "confirmation_modal.cancel": "Encaboxar", "confirmations.block.block_and_report": "Bloquiar ya informar", "confirmations.block.confirm": "Bloquiar", @@ -146,6 +145,7 @@ "dismissable_banner.community_timeline": "Esta seición contién los artículos públicos más actuales de los perfiles agospiaos nel dominiu {domain}.", "dismissable_banner.dismiss": "Escartar", "dismissable_banner.explore_tags": "Esta seición contién les etiquetes del fediversu que tán ganando popularidá güei. Les etiquetes más usaes polos perfiles apaecen no cimero.", + "dismissable_banner.public_timeline": "Esta seición contién los artículos más nuevos de les persones na web social que les persones de {domain} siguen.", "embed.instructions": "Empotra esti artículu nel to sitiu web pente la copia del códigu d'abaxo.", "embed.preview": "Va apaecer asina:", "emoji_button.activity": "Actividá", @@ -155,6 +155,7 @@ "emoji_button.not_found": "Nun s'atoparon fustaxes que concasen", "emoji_button.objects": "Oxetos", "emoji_button.people": "Persones", + "emoji_button.recent": "D'usu frecuente", "emoji_button.search": "Buscar…", "emoji_button.search_results": "Resultaos de la busca", "emoji_button.symbols": "Símbolos", @@ -217,7 +218,6 @@ "hashtag.column_header.tag_mode.any": "o {additional}", "hashtag.column_header.tag_mode.none": "ensin {additional}", "hashtag.column_settings.select.no_options_message": "Nun s'atopó nenguna suxerencia", - "hashtag.column_settings.tag_toggle": "Include additional tags in this column", "hashtag.counter_by_accounts": "{count, plural, one {{counter} participante} other {{counter} participantes}}", "hashtag.follow": "Siguir a la etiqueta", "hashtag.unfollow": "Dexar de siguir a la etiqueta", @@ -259,7 +259,6 @@ "keyboard_shortcuts.reply": "Responder a un artículu", "keyboard_shortcuts.requests": "Abrir la llista de solicitúes de siguimientu", "keyboard_shortcuts.search": "Enfocar la barra de busca", - "keyboard_shortcuts.spoilers": "to show/hide CW field", "keyboard_shortcuts.start": "Abrir la columna «Entamar»", "keyboard_shortcuts.toggle_sensitivity": "Amosar/anubrir el conteníu multimedia", "keyboard_shortcuts.toot": "Comenzar un artículu nuevu", @@ -412,12 +411,16 @@ "search.quick_action.go_to_hashtag": "Dir a la etiqueta {x}", "search.quick_action.status_search": "Artículos que concasen con {x}", "search.search_or_paste": "Busca o apiega una URL", + "search_popout.language_code": "códigu de llingua ISO", "search_popout.quick_actions": "Aiciones rápides", "search_popout.recent": "Busques de recién", + "search_popout.specific_date": "data específica", + "search_popout.user": "perfil", "search_results.accounts": "Perfiles", "search_results.all": "Too", "search_results.hashtags": "Etiquetes", "search_results.nothing_found": "Nun se pudo atopar nada con esos términos de busca", + "search_results.see_all": "Ver too", "search_results.statuses": "Artículos", "search_results.title": "Busca de: {q}", "server_banner.introduction": "{domain} ye parte de la rede social descentralizada que tien la teunoloxía de {mastodon}.", @@ -460,6 +463,7 @@ "status.replied_to": "En rempuesta a {name}", "status.reply": "Responder", "status.replyAll": "Responder al filu", + "status.report": "Informar de @{name}", "status.sensitive_warning": "Conteníu sensible", "status.show_filter_reason": "Amosar de toes toes", "status.show_less": "Amosar menos", diff --git a/app/javascript/mastodon/locales/ko.json b/app/javascript/mastodon/locales/ko.json index 264781baa..70ce6611d 100644 --- a/app/javascript/mastodon/locales/ko.json +++ b/app/javascript/mastodon/locales/ko.json @@ -683,7 +683,7 @@ "status.show_more": "펼치기", "status.show_more_all": "모두 펼치기", "status.show_original": "원본 보기", - "status.title.with_attachments": "{user} 님이 {attachmentCount, plural, one {첨부} other {{attachmentCount}개 첨부}}하여 게시", + "status.title.with_attachments": "{user} 님이 {attachmentCount, plural, one {첨부파일} other {{attachmentCount}개의 첨부파일}}과 함께 게시함", "status.translate": "번역", "status.translated_from_with": "{provider}에 의해 {lang}에서 번역됨", "status.uncached_media_warning": "마리보기 허용되지 않음", diff --git a/app/javascript/mastodon/locales/lad.json b/app/javascript/mastodon/locales/lad.json index 2a911483d..8fde68742 100644 --- a/app/javascript/mastodon/locales/lad.json +++ b/app/javascript/mastodon/locales/lad.json @@ -328,6 +328,7 @@ "interaction_modal.on_another_server": "En otro sirvidor", "interaction_modal.on_this_server": "En este sirvidor", "interaction_modal.sign_in": "No estas konektado kon este sirvidor. Ande tyenes tu kuento?", + "interaction_modal.sign_in_hint": "Konsejo: Akel es el sitio adonde te enrejistrates. Si no lo akodras, bushka el mesaj de posta elektronika de bienvenida en tu kuti de arivo. Tambien puedes eskrivir tu nombre de utilizador kompleto (por enshemplo @Mastodon@mastodon.social)", "interaction_modal.title.favourite": "Endika ke te plaze publikasyon de {name}", "interaction_modal.title.follow": "Sige a {name}", "interaction_modal.title.reblog": "Repartaja publikasyon de {name}", @@ -478,6 +479,7 @@ "onboarding.actions.go_to_explore": "Va a los trendes", "onboarding.actions.go_to_home": "Va a tu linya prinsipala", "onboarding.compose.template": "Ke haber, #Mastodon?", + "onboarding.follows.empty": "Malorozamente, no se pueden amostrar rezultados en este momento. Puedes aprovar uzar la bushkeda o navigar por la pajina de eksplorasyon para topar personas a las que segir, o aprovarlo de muevo mas tadre.", "onboarding.follows.title": "Personaliza tu linya prinsipala", "onboarding.profile.discoverable": "Faz ke mi profil apareska en bushkedas", "onboarding.profile.display_name": "Nombre amostrado", @@ -497,7 +499,9 @@ "onboarding.start.title": "Lo logrates!", "onboarding.steps.follow_people.body": "El buto de Mastodon es segir a djente interesante.", "onboarding.steps.follow_people.title": "Personaliza tu linya prinsipala", + "onboarding.steps.publish_status.body": "Puedes introdusirte al mundo con teksto, fotos, videos o anketas {emoji}", "onboarding.steps.publish_status.title": "Eskrive tu primera publikasyon", + "onboarding.steps.setup_profile.body": "Kompleta tu profil para aumentar tus enteraksyones.", "onboarding.steps.setup_profile.title": "Personaliza tu profil", "onboarding.steps.share_profile.body": "Informe a tus amigos komo toparte en Mastodon", "onboarding.steps.share_profile.title": "Partaja tu profil de Mastodon", diff --git a/app/javascript/mastodon/locales/th.json b/app/javascript/mastodon/locales/th.json index b108e581a..65f27ef06 100644 --- a/app/javascript/mastodon/locales/th.json +++ b/app/javascript/mastodon/locales/th.json @@ -314,7 +314,7 @@ "home.explore_prompt.body": "ฟีดหน้าแรกของคุณจะมีการผสมผสานของโพสต์จากแฮชแท็กที่คุณได้เลือกติดตาม, ผู้คนที่คุณได้เลือกติดตาม และโพสต์ที่เขาดัน หากนั่นรู้สึกเงียบเกินไป คุณอาจต้องการ:", "home.explore_prompt.title": "นี่คือฐานหน้าแรกของคุณภายใน Mastodon", "home.hide_announcements": "ซ่อนประกาศ", - "home.pending_critical_update.body": "โปรดอัปเดตเซิร์ฟเวอร์ Mastodon ของคุณโดยเร็วที่สุดเท่าที่จะทำได้!", + "home.pending_critical_update.body": "โปรดอัปเดตเซิร์ฟเวอร์ Mastodon ของคุณโดยเร็วที่สุดเท่าที่จะเป็นไปได้!", "home.pending_critical_update.link": "ดูการอัปเดต", "home.pending_critical_update.title": "มีการอัปเดตความปลอดภัยสำคัญพร้อมใช้งาน!", "home.show_announcements": "แสดงประกาศ", diff --git a/config/locales/ast.yml b/config/locales/ast.yml index a32413cb9..7e5a4c887 100644 --- a/config/locales/ast.yml +++ b/config/locales/ast.yml @@ -909,6 +909,7 @@ ast: users: follow_limit_reached: Nun pues siguir a más de %{limit} persones invalid_otp_token: El códigu de l'autenticación en dos pasos nun ye válidu + rate_limited: Fixéronse milenta intentos d'autenticación. Volvi tentalo dempués. seamless_external_login: Aniciesti la sesión pente un serviciu esternu, polo que la configuración de la contraseña ya de la direición de corréu electrónicu nun tán disponibles. signed_in_as: 'Aniciesti la sesión como:' verification: diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 377babe22..58a5cae2f 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1843,6 +1843,7 @@ bg: go_to_sso_account_settings: Отидете при настройките на акаунта на своя доставчик на идентичност invalid_otp_token: Невалиден код otp_lost_help_html: Ако загубите достъп до двете, то може да се свържете с %{email} + rate_limited: Премного опити за удостоверяване. Опитайте пак по-късно. seamless_external_login: Влезли сте чрез външна услуга, така че настройките за парола и имейл не са налични. signed_in_as: 'Влезли като:' verification: diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 580c4a3ed..36ebb9785 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1840,6 +1840,7 @@ ca: go_to_sso_account_settings: Ves a la configuració del compte del teu proveïdor d'identitat invalid_otp_token: El codi de dos factors no és correcte otp_lost_help_html: Si has perdut l'accés a tots dos pots contactar per %{email} + rate_limited: Excessius intents d'autenticació, torneu-ho a provar més tard. seamless_external_login: Has iniciat sessió via un servei extern per tant els ajustos de contrasenya i correu electrònic no estan disponibles. signed_in_as: 'Sessió iniciada com a:' verification: diff --git a/config/locales/da.yml b/config/locales/da.yml index e09a6eb2f..58fd723ae 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1843,6 +1843,7 @@ da: go_to_sso_account_settings: Gå til identitetsudbyderens kontoindstillinger invalid_otp_token: Ugyldig tofaktorkode otp_lost_help_html: Har du mistet adgang til begge, kan du kontakte %{email} + rate_limited: For mange godkendelsesforsøg. Prøv igen senere. seamless_external_login: Du er logget ind via en ekstern tjeneste, så adgangskode- og e-mailindstillinger er utilgængelige. signed_in_as: 'Logget ind som:' verification: diff --git a/config/locales/de.yml b/config/locales/de.yml index dc78b188e..e177c6d2d 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1843,6 +1843,7 @@ de: go_to_sso_account_settings: Kontoeinstellungen des Identitätsanbieters aufrufen invalid_otp_token: Ungültiger Code der Zwei-Faktor-Authentisierung (2FA) otp_lost_help_html: Wenn du beides nicht mehr weißt, melde dich bitte bei uns unter der E-Mail-Adresse %{email} + rate_limited: Zu viele Authentisierungsversuche. Bitte versuche es später noch einmal. seamless_external_login: Du bist über einen externen Dienst angemeldet, daher sind Passwort- und E-Mail-Einstellungen nicht verfügbar. signed_in_as: 'Angemeldet als:' verification: diff --git a/config/locales/devise.fi.yml b/config/locales/devise.fi.yml index ac7a57c6f..22fd7ff47 100644 --- a/config/locales/devise.fi.yml +++ b/config/locales/devise.fi.yml @@ -47,19 +47,19 @@ fi: subject: 'Mastodon: ohjeet salasanan vaihtoon' title: Salasanan vaihto two_factor_disabled: - explanation: Olet nyt mahdollistanut sisäänkirjautumisen pelkästään sähköpostiosoitteella ja salasanalla. + explanation: Sisäänkirjautuminen on nyt mahdollista pelkällä sähköpostiosoitteella ja salasanalla. subject: 'Mastodon: kaksivaiheinen todennus poistettu käytöstä' - subtitle: Kaksivaiheinen tunnistautuminen käyttäjätilillesi on poistettu käytöstä. + subtitle: Kaksivaiheinen todennus on poistettu käytöstä tililtäsi. title: 2-vaiheinen todennus pois käytöstä two_factor_enabled: explanation: Sisäänkirjautuminen edellyttää liitetyn TOTP-sovelluksen luomaa aikarajattua kertatunnuslukua. subject: 'Mastodon: kaksivaiheinen todennus otettu käyttöön' - subtitle: Kaksivaiheinen kirjautuminen tilillesi on määritetty käyttöön. + subtitle: Kaksivaiheinen todennus on otettu käyttöön tilillesi. title: 2-vaiheinen todennus käytössä two_factor_recovery_codes_changed: explanation: Uudet palautuskoodit on nyt luotu ja vanhat on mitätöity. subject: 'Mastodon: kaksivaiheisen todennuksen palautuskoodit luotiin uudelleen' - subtitle: Aiemmat palautuskoodit on mitätöity, ja korvaavat uudet koodit on luotu. + subtitle: Aiemmat palautuskoodit on mitätöity ja tilalle on luotu uudet. title: 2-vaiheisen todennuksen palautuskoodit vaihdettiin unlock_instructions: subject: 'Mastodon: lukituksen poistamisen ohjeet' @@ -73,13 +73,13 @@ fi: subject: 'Mastodon: suojausavain poistettu' title: Yksi suojausavaimistasi on poistettu webauthn_disabled: - explanation: Turva-avaimin kirjautuminen tilillesi on kytketty pois käytöstä. - extra: Olet nyt mahdollistanut sisäänkirjautumisen käyttäjätilillesi pelkästään palveluun liitetyn TOTP-sovelluksen luomalla aikarajoitteisella kertatunnusluvulla. + explanation: Turva-avaimin kirjautuminen on poistettu käytöstä tililtäsi. + extra: Sisäänkirjautuminen on nyt mahdollista pelkällä palveluun liitetyn TOTP-sovelluksen luomalla aikarajoitteisella kertatunnusluvulla. subject: 'Mastodon: Todennus suojausavaimilla poistettu käytöstä' title: Suojausavaimet poistettu käytöstä webauthn_enabled: - explanation: Turva-avainkirjautuminen käyttäjätilillesi on otettu käyttöön. - extra: Voit nyt kirjautua sisään käyttäen turva-avaintasi. + explanation: Turva-avaimella kirjautuminen on otettu käyttöön tilillesi. + extra: Voit nyt kirjautua sisään turva-avaimellasi. subject: 'Mastodon: Todennus suojausavaimella on otettu käyttöön' title: Suojausavaimet käytössä omniauth_callbacks: diff --git a/config/locales/devise.ie.yml b/config/locales/devise.ie.yml index 97cda4e8c..332c9da45 100644 --- a/config/locales/devise.ie.yml +++ b/config/locales/devise.ie.yml @@ -52,6 +52,7 @@ ie: subtitle: 2-factor autentication por tui conto ha esset desactivisat. title: 2FA desvalidat two_factor_enabled: + explanation: Un clave generat del acuplat TOTP-aplication nu va esser besonat por aperter session. subject: 'Mastodon: 2-factor autentication activat' subtitle: 2-factor autentication ha esset activisat por tui conto. title: 2FA permisset @@ -73,6 +74,7 @@ ie: title: Un ex tui claves de securitá ha esset deletet webauthn_disabled: explanation: Autentication per clave de securitá ha esset desactivisat por tui conto. + extra: Aperter session es nu possibil solmen per li clave generat del acuplat TOTP-aplication. subject: 'Mastodon: Autentication con claves de securitá desactivisat' title: Claves de securitá desactivisat webauthn_enabled: diff --git a/config/locales/devise.ja.yml b/config/locales/devise.ja.yml index 9a3ffd9c4..44a9a3183 100644 --- a/config/locales/devise.ja.yml +++ b/config/locales/devise.ja.yml @@ -49,12 +49,12 @@ ja: two_factor_disabled: explanation: メールアドレスとパスワードのみでログイン可能になりました。 subject: 'Mastodon: 二要素認証が無効になりました' - subtitle: 二要素認証が無効になっています。 + subtitle: 今後、アカウントへのログインに二要素認証を要求しません。 title: 二要素認証が無効化されました two_factor_enabled: explanation: ログインには設定済みのTOTPアプリが生成したトークンが必要です。 subject: 'Mastodon: 二要素認証が有効になりました' - subtitle: 二要素認証が有効になりました。 + subtitle: 今後、アカウントへのログインに二要素認証が必要になります。 title: 二要素認証が有効化されました two_factor_recovery_codes_changed: explanation: 以前のリカバリーコードが無効化され、新しいコードが生成されました。 @@ -73,7 +73,7 @@ ja: subject: 'Mastodon: セキュリティキーが削除されました' title: セキュリティキーが削除されました webauthn_disabled: - explanation: セキュリティキー認証が無効になっています。 + explanation: セキュリティキー認証が無効になりました。 extra: 設定済みのTOTPアプリが生成したトークンのみでログインできるようになりました。 subject: 'Mastodon: セキュリティキー認証が無効になりました' title: セキュリティキーは無効になっています diff --git a/config/locales/devise.lad.yml b/config/locales/devise.lad.yml index bec76d82f..2b6b8aafb 100644 --- a/config/locales/devise.lad.yml +++ b/config/locales/devise.lad.yml @@ -47,10 +47,14 @@ lad: subject: 'Mastodon: Instruksyones para reinisyar kod' title: Reinisyar kod two_factor_disabled: + explanation: Agora puedes konektarte kon tu kuento uzando solo tu adreso de posta i kod. subject: 'Mastodon: La autentifikasyon de dos pasos esta inkapasitada' + subtitle: La autentifikasyon en dos pasos para tu kuento tiene sido inkapasitada. title: Autentifikasyon 2FA inkapasitada two_factor_enabled: + explanation: Se rekierira un token djenerado por la aplikasyon TOTP konektada para entrar. subject: 'Mastodon: La autentifikasyon de dos pasos esta kapasitada' + subtitle: La autentifikasyon de dos pasos para tu kuento tiene sido kapasitada. title: Autentifikasyon 2FA aktivada two_factor_recovery_codes_changed: explanation: Los kodiches de rekuperasyon previos tienen sido invalidados i se djeneraron kodiches muevos. @@ -69,9 +73,13 @@ lad: subject: 'Mastodon: Yave de sigurita supremida' title: Una de tus yaves de sigurita tiene sido supremida webauthn_disabled: + explanation: La autentifikasyon kon yaves de sigurita tiene sido inkapasitada para tu kuento. + extra: Agora el inisyo de sesyon solo es posivle utilizando el token djeenerado por la aplikasyon TOTP konektada. subject: 'Mastodon: autentifikasyon kon yaves de sigurita inkapasitada' title: Yaves de sigurita inkapasitadas webauthn_enabled: + explanation: La autentifikasyon kon yave de sigurita tiene sido kapasitada para tu kuento. + extra: Agora tu yave de sigurita puede ser utilizada para konektarte kon tu kuento. subject: 'Mastodon: Autentifikasyon de yave de sigurita aktivada' title: Yaves de sigurita kapasitadas omniauth_callbacks: diff --git a/config/locales/devise.nn.yml b/config/locales/devise.nn.yml index acee9fdcd..96920d42b 100644 --- a/config/locales/devise.nn.yml +++ b/config/locales/devise.nn.yml @@ -47,14 +47,19 @@ nn: subject: 'Mastodon: Instuksjonar for å endra passord' title: Attstilling av passord two_factor_disabled: + explanation: Innlogging er nå mulig med kun e-postadresse og passord. subject: 'Mastodon: To-faktor-autentisering deaktivert' + subtitle: To-faktor autentisering for din konto har blitt deaktivert. title: 2FA deaktivert two_factor_enabled: + explanation: En token generert av den sammenkoblede TOTP-appen vil være påkrevd for innlogging. subject: 'Mastodon: To-faktor-autentisering aktivert' + subtitle: Tofaktorautentisering er aktivert for din konto. title: 2FA aktivert two_factor_recovery_codes_changed: explanation: Dei førre gjenopprettingskodane er ugyldige og nye er genererte. subject: 'Mastodon: To-faktor-gjenopprettingskodar har vorte genererte på nytt' + subtitle: De forrige gjenopprettingskodene er gjort ugyldige og nye er generert. title: 2FA-gjenopprettingskodane er endra unlock_instructions: subject: 'Mastodon: Instruksjonar for å opne kontoen igjen' @@ -68,9 +73,13 @@ nn: subject: 'Mastodon: Sikkerheitsnøkkel sletta' title: Ein av sikkerheitsnøklane dine har blitt sletta webauthn_disabled: + explanation: Autentisering med sikkerhetsnøkler er deaktivert for kontoen din. + extra: Innlogging er nå mulig med kun tilgangstoken generert av den sammenkoblede TOTP-appen. subject: 'Mastodon: Autentisering med sikkerheitsnøklar vart skrudd av' title: Sikkerheitsnøklar deaktivert webauthn_enabled: + explanation: Sikkerhetsnøkkelautentisering har blitt aktivert for kontoen din. + extra: Sikkerhetsnøkkelen din kan nå bli brukt for innlogging. subject: 'Mastodon: Sikkerheitsnøkkelsautentisering vart skrudd på' title: Sikkerheitsnøklar aktivert omniauth_callbacks: diff --git a/config/locales/devise.no.yml b/config/locales/devise.no.yml index 0d824da81..961778eaa 100644 --- a/config/locales/devise.no.yml +++ b/config/locales/devise.no.yml @@ -47,14 +47,19 @@ subject: 'Mastodon: Hvordan nullstille passord' title: Nullstill passord two_factor_disabled: + explanation: Innlogging er nå mulig med kun e-postadresse og passord. subject: 'Mastodon: Tofaktorautentisering deaktivert' + subtitle: To-faktor autentisering for din konto har blitt deaktivert. title: 2FA deaktivert two_factor_enabled: + explanation: En token generert av den sammenkoblede TOTP-appen vil være påkrevd for innlogging. subject: 'Mastodon: Tofaktorautentisering aktivert' + subtitle: Tofaktorautentisering er aktivert for din konto. title: 2FA aktivert two_factor_recovery_codes_changed: explanation: De forrige gjenopprettingskodene er gjort ugyldige og nye er generert. subject: 'Mastodon: Tofaktor-gjenopprettingskoder har blitt generert på nytt' + subtitle: De forrige gjenopprettingskodene er gjort ugyldige og nye er generert. title: 2FA-gjenopprettingskodene ble endret unlock_instructions: subject: 'Mastodon: Instruksjoner for å gjenåpne konto' @@ -68,9 +73,13 @@ subject: 'Mastodon: Sikkerhetsnøkkel slettet' title: En av sikkerhetsnøklene dine har blitt slettet webauthn_disabled: + explanation: Autentisering med sikkerhetsnøkler er deaktivert for kontoen din. + extra: Innlogging er nå mulig med kun tilgangstoken generert av den sammenkoblede TOTP-appen. subject: 'Mastodon: Autentisering med sikkerhetsnøkler ble skrudd av' title: Sikkerhetsnøkler deaktivert webauthn_enabled: + explanation: Sikkerhetsnøkkelautentisering har blitt aktivert for kontoen din. + extra: Sikkerhetsnøkkelen din kan nå bli brukt for innlogging. subject: 'Mastodon: Sikkerhetsnøkkelsautentisering ble skrudd på' title: Sikkerhetsnøkler aktivert omniauth_callbacks: diff --git a/config/locales/devise.sl.yml b/config/locales/devise.sl.yml index 72269e482..2d567e63f 100644 --- a/config/locales/devise.sl.yml +++ b/config/locales/devise.sl.yml @@ -47,14 +47,19 @@ sl: subject: 'Mastodon: navodila za ponastavitev gesla' title: Ponastavitev gesla two_factor_disabled: + explanation: Prijava je sedaj mogoče le z uporabo e-poštnega naslova in gesla. subject: 'Mastodon: dvojno preverjanje pristnosti je onemogočeno' + subtitle: Dvo-faktorsko preverjanje pristnosti za vaš račun je bilo onemogočeno. title: 2FA onemogočeno two_factor_enabled: + explanation: Za prijavo bo zahtevan žeton, ustvarjen s povezano aplikacijo TOTP. subject: 'Mastodon: dvojno preverjanje pristnosti je omogočeno' + subtitle: Dvo-faktorsko preverjanje pristnosti za vaš račun je bilo omogočeno. title: 2FA omogočeno two_factor_recovery_codes_changed: explanation: Prejšnje obnovitvene kode so postale neveljavne in ustvarjene so bile nove. subject: 'Mastodon: varnostne obnovitvene kode za dvojno preverjanje pristnosti so ponovno izdelane' + subtitle: Prejšnje kode za obnovitev so bile razveljavljene, ustvarjene pa so bile nove. title: obnovitvene kode 2FA spremenjene unlock_instructions: subject: 'Mastodon: navodila za odklepanje' @@ -68,9 +73,13 @@ sl: subject: 'Mastodon: varnostna koda izbrisana' title: Ena od vaših varnostnih kod je bila izbrisana webauthn_disabled: + explanation: Preverjanje pristnosti z varnostnimi ključi za vaš račun je bilo onemogočeno. + extra: Prijava je sedaj mogoče le z uporabo žetona, ustvarjenega s povezano aplikacijo TOTP. subject: 'Mastodon: overjanje pristnosti z varnosnimi kodami je onemogočeno' title: Varnostne kode onemogočene webauthn_enabled: + explanation: Preverjanje pristnosti z varnostnimi ključi za vaš račun je bilo omogočeno. + extra: Za prijavo sedaj lahko uporabite svoj varnostni ključ. subject: 'Mastodon: preverjanje pristnosti z varnostno kodo je omogočeno' title: Varnostne kode omogočene omniauth_callbacks: diff --git a/config/locales/devise.th.yml b/config/locales/devise.th.yml index 13fdea3fe..40baabcf7 100644 --- a/config/locales/devise.th.yml +++ b/config/locales/devise.th.yml @@ -47,14 +47,19 @@ th: subject: 'Mastodon: คำแนะนำการตั้งรหัสผ่านใหม่' title: การตั้งรหัสผ่านใหม่ two_factor_disabled: + explanation: ตอนนี้สามารถเข้าสู่ระบบได้โดยใช้เพียงที่อยู่อีเมลและรหัสผ่านเท่านั้น subject: 'Mastodon: ปิดใช้งานการรับรองความถูกต้องด้วยสองปัจจัยแล้ว' + subtitle: ปิดใช้งานการรับรองความถูกต้องด้วยสองปัจจัยสำหรับบัญชีของคุณแล้ว title: ปิดใช้งาน 2FA แล้ว two_factor_enabled: + explanation: จะต้องใช้โทเคนที่สร้างโดยแอป TOTP ที่จับคู่สำหรับการเข้าสู่ระบบ subject: 'Mastodon: เปิดใช้งานการรับรองความถูกต้องด้วยสองปัจจัยแล้ว' + subtitle: เปิดใช้งานการรับรองความถูกต้องด้วยสองปัจจัยสำหรับบัญชีของคุณแล้ว title: เปิดใช้งาน 2FA แล้ว two_factor_recovery_codes_changed: - explanation: ยกเลิกรหัสกู้คืนก่อนหน้านี้และสร้างรหัสใหม่แล้ว + explanation: ยกเลิกรหัสกู้คืนก่อนหน้านี้และสร้างรหัสกู้คืนใหม่แล้ว subject: 'Mastodon: สร้างรหัสกู้คืนสองปัจจัยใหม่แล้ว' + subtitle: ยกเลิกรหัสกู้คืนก่อนหน้านี้และสร้างรหัสกู้คืนใหม่แล้ว title: เปลี่ยนรหัสกู้คืน 2FA แล้ว unlock_instructions: subject: 'Mastodon: คำแนะนำการปลดล็อค' @@ -68,9 +73,13 @@ th: subject: 'Mastodon: ลบกุญแจความปลอดภัยแล้ว' title: ลบหนึ่งในกุญแจความปลอดภัยของคุณแล้ว webauthn_disabled: + explanation: ปิดใช้งานการรับรองความถูกต้องด้วยกุญแจความปลอดภัยสำหรับบัญชีของคุณแล้ว + extra: ตอนนี้สามารถเข้าสู่ระบบได้โดยใช้เพียงโทเคนที่สร้างโดยแอป TOTP ที่จับคู่เท่านั้น subject: 'Mastodon: ปิดใช้งานการรับรองความถูกต้องด้วยกุญแจความปลอดภัยแล้ว' title: ปิดใช้งานกุญแจความปลอดภัยแล้ว webauthn_enabled: + explanation: เปิดใช้งานการรับรองความถูกต้องด้วยกุญแจความปลอดภัยสำหรับบัญชีของคุณแล้ว + extra: ตอนนี้สามารถใช้กุญแจความปลอดภัยของคุณสำหรับการเข้าสู่ระบบ subject: 'Mastodon: เปิดใช้งานการรับรองความถูกต้องด้วยกุญแจความปลอดภัยแล้ว' title: เปิดใช้งานกุญแจความปลอดภัยแล้ว omniauth_callbacks: diff --git a/config/locales/doorkeeper.ia.yml b/config/locales/doorkeeper.ia.yml index ec85df24f..d689354f6 100644 --- a/config/locales/doorkeeper.ia.yml +++ b/config/locales/doorkeeper.ia.yml @@ -17,6 +17,7 @@ ia: index: application: Application delete: Deler + empty: Tu non ha applicationes. name: Nomine new: Nove application show: Monstrar @@ -47,6 +48,7 @@ ia: title: accounts: Contos admin/accounts: Gestion de contos + all: Accesso plen a tu conto de Mastodon bookmarks: Marcapaginas conversations: Conversationes favourites: Favoritos @@ -61,8 +63,15 @@ ia: applications: Applicationes oauth2_provider: Fornitor OAuth2 scopes: + read:favourites: vider tu favoritos + read:lists: vider tu listas + read:notifications: vider tu notificationes + read:statuses: vider tote le messages write:accounts: modificar tu profilo + write:blocks: blocar contos e dominios write:favourites: messages favorite + write:filters: crear filtros write:lists: crear listas + write:media: incargar files de medios write:notifications: rader tu notificationes write:statuses: publicar messages diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 1bcf36700..beb6aa6d9 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -309,6 +309,7 @@ eo: unpublish: Malpublikigi unpublished_msg: Anonco sukcese malpublikigita! updated_msg: Anonco sukcese ĝisdatigis! + critical_update_pending: Kritika ĝisdatigo pritraktotas custom_emojis: assign_category: Atribui kategorion by_domain: Domajno @@ -424,6 +425,7 @@ eo: view: Vidi domajna blokado email_domain_blocks: add_new: Aldoni novan + allow_registrations_with_approval: Permesi aliĝojn kun aprobo attempts_over_week: one: "%{count} provo ekde lasta semajno" other: "%{count} registroprovoj ekde lasta semajno" @@ -770,11 +772,21 @@ eo: approved: Bezonas aprobi por aliĝi none: Neniu povas aliĝi open: Iu povas aliĝi + security: + authorized_fetch: Devigi aŭtentigon de frataraj serviloj + title: Agordoj de la servilo site_uploads: delete: Forigi elŝutitan dosieron destroyed_msg: Reteja alŝuto sukcese forigita! software_updates: + critical_update: Kritika — bonvolu ĝisdatiĝi rapide documentation_link: Lerni pli + release_notes: Eldono-notoj + title: Disponeblaj ĝisdatigoj + type: Tipo + types: + major: Ĉefa eldono + minor: Neĉefa eldono statuses: account: Skribanto application: Aplikaĵo @@ -1259,6 +1271,9 @@ eo: overwrite: Anstataŭigi overwrite_long: Anstataŭigi la nunajn registrojn per la novaj preface: Vi povas importi datumojn, kiujn vi eksportis el alia servilo, kiel liston de homoj, kiujn vi sekvas aŭ blokas. + states: + finished: Finita + unconfirmed: Nekonfirmita success: Viaj datumoj estis sukcese alŝutitaj kaj estos traktitaj kiel planite titles: following: Importado de sekvaj kontoj @@ -1528,6 +1543,7 @@ eo: unknown_browser: Nekonata retumilo weibo: Weibo current_session: Nuna seanco + date: Dato description: "%{browser} en %{platform}" explanation: Ĉi tiuj estas la retumiloj nun ensalutintaj al via Mastodon-konto. ip: IP @@ -1693,6 +1709,7 @@ eo: webauthn: Sekurecaj ŝlosiloj user_mailer: appeal_approved: + action: Konto-agordoj explanation: La apelacio de la admono kontra via konto je %{strike_date} pri sendodato %{appeal_date} aprobitas. subject: Via apelacio de %{date} aprobitas title: Apelacio estis aprobita @@ -1701,6 +1718,7 @@ eo: subject: Via apelacio de %{date} estis malaprobita title: Apelacio estis malaprobita backup_ready: + extra: Estas nun preta por elŝuto! subject: Via arkivo estas preta por elŝutado title: Arkiva elŝuto suspicious_sign_in: @@ -1756,6 +1774,7 @@ eo: go_to_sso_account_settings: Iru al la agordoj de la konto de via identeca provizanto invalid_otp_token: Nevalida kodo de dufaktora aŭtentigo otp_lost_help_html: Se vi perdas aliron al ambaŭ, vi povas kontakti %{email} + rate_limited: Estas tro multaj aŭtentigaj provoj, reprovu poste. seamless_external_login: Vi estas ensalutinta per ekstera servo, do pasvortaj kaj retadresaj agordoj ne estas disponeblaj. signed_in_as: 'Salutinta kiel:' verification: diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 26c18b5fe..0b6e58db5 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -1843,6 +1843,7 @@ es-AR: go_to_sso_account_settings: Andá a la configuración de cuenta de tu proveedor de identidad invalid_otp_token: Código de dos factores no válido otp_lost_help_html: Si perdiste al acceso a ambos, podés ponerte en contacto con %{email} + rate_limited: Demasiados intentos de autenticación; intentá de nuevo más tarde. seamless_external_login: Iniciaste sesión desde un servicio externo, así que la configuración de contraseña y correo electrónico no están disponibles. signed_in_as: 'Iniciaste sesión como:' verification: diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index 32178d0b0..11c327bcc 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -1843,6 +1843,7 @@ es-MX: go_to_sso_account_settings: Diríjete a la configuración de la cuenta de su proveedor de identidad invalid_otp_token: Código de dos factores incorrecto otp_lost_help_html: Si perdiste al acceso a ambos, puedes ponerte en contancto con %{email} + rate_limited: Demasiados intentos de autenticación, inténtalo de nuevo más tarde. seamless_external_login: Has iniciado sesión desde un servicio externo, así que los ajustes de contraseña y correo no están disponibles. signed_in_as: 'Sesión iniciada como:' verification: diff --git a/config/locales/es.yml b/config/locales/es.yml index 9235b985f..4dbb76c52 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1843,6 +1843,7 @@ es: go_to_sso_account_settings: Diríjase a la configuración de la cuenta de su proveedor de identidad invalid_otp_token: Código de dos factores incorrecto otp_lost_help_html: Si perdiste al acceso a ambos, puedes ponerte en contancto con %{email} + rate_limited: Demasiados intentos de autenticación, inténtalo de nuevo más tarde. seamless_external_login: Has iniciado sesión desde un servicio externo, así que los ajustes de contraseña y correo no están disponibles. signed_in_as: 'Sesión iniciada como:' verification: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 4b91f7a52..bfa1f829b 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1847,6 +1847,7 @@ eu: go_to_sso_account_settings: Jo zure identitate-hornitzaileko kontuaren ezarpenetara invalid_otp_token: Bi faktoreetako kode baliogabea otp_lost_help_html: 'Bietara sarbidea galdu baduzu, jarri kontaktuan hemen: %{email}' + rate_limited: Autentifikazio saiakera gehiegi, saiatu berriro geroago. seamless_external_login: Kanpo zerbitzu baten bidez hasi duzu saioa, beraz pasahitza eta e-mail ezarpenak ez daude eskuragarri. signed_in_as: 'Saioa honela hasita:' verification: diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 26fe6b7f0..9d8974392 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1786,7 +1786,7 @@ fi: subtitle: Vetoomuksesi on hylätty. title: Valitus hylätty backup_ready: - explanation: Olet pyytänyt täysvarmuuskopion Mastodon-tilistäsi. + explanation: Olet pyytänyt täyden varmuuskopion Mastodon-tilistäsi. extra: Se on nyt valmis ladattavaksi! subject: Arkisto on valmiina ladattavaksi title: Arkiston tallennus @@ -1843,6 +1843,7 @@ fi: go_to_sso_account_settings: Avaa identiteettitarjoajasi tiliasetukset invalid_otp_token: Virheellinen kaksivaiheisen todentamisen koodi otp_lost_help_html: Jos sinulla ei ole pääsyä kumpaankaan, voit ottaa yhteyden osoitteeseen %{email} + rate_limited: Liian monta todennusyritystä. Yritä myöhemmin uudelleen. seamless_external_login: Olet kirjautunut ulkoisen palvelun kautta, joten salasana- ja sähköpostiasetukset eivät ole käytettävissä. signed_in_as: 'Kirjautunut tilillä:' verification: diff --git a/config/locales/fo.yml b/config/locales/fo.yml index 03a525fa5..dabaf24ba 100644 --- a/config/locales/fo.yml +++ b/config/locales/fo.yml @@ -1843,6 +1843,7 @@ fo: go_to_sso_account_settings: Far til kontustillingarnar hjá samleikaveitaranum hjá tær invalid_otp_token: Ógyldug tvey-stigs koda otp_lost_help_html: Hevur tú mist atgongd til bæði, so kanst tú koma í samband við %{email} + rate_limited: Ov nógvar samgildisroyndir, royn aftur seinni. seamless_external_login: Tú er ritað/ur inn umvegis eina uttanhýsis tænastu, so loyniorð og teldupoststillingar eru ikki tøkar. signed_in_as: 'Ritað/ur inn sum:' verification: diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 1398f6ad0..3c43a4e23 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1843,6 +1843,7 @@ gl: go_to_sso_account_settings: Ir aos axustes da conta no teu provedor de identidade invalid_otp_token: O código do segundo factor non é válido otp_lost_help_html: Se perdes o acceso a ambos, podes contactar con %{email} + rate_limited: Demasiados intentos de autenticación, inténtao máis tarde. seamless_external_login: Accedeches a través dun servizo externo, polo que os axustes de contrasinal e email non están dispoñibles. signed_in_as: 'Rexistrada como:' verification: diff --git a/config/locales/he.yml b/config/locales/he.yml index 2969cf33e..db57912d8 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1907,6 +1907,7 @@ he: go_to_sso_account_settings: מעבר לאפיוני החשבון שלך בשרת הזהות invalid_otp_token: קוד דו-שלבי שגוי otp_lost_help_html: אם איבדת גישה לשניהם, ניתן ליצור קשר ב-%{email} + rate_limited: יותר מדי ניסיונות אימות, נסו שוב מאוחר יותר. seamless_external_login: את.ה מחובר דרך שירות חיצוני, לכן אפשרויות הסיסמא והדוא"ל לא מאופשרות. signed_in_as: 'מחובר בתור:' verification: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 7cfd7d80e..8fce206e9 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1843,6 +1843,7 @@ hu: go_to_sso_account_settings: Ugrás az azonosítási szolgáltatód fiókbeállításaihoz invalid_otp_token: Érvénytelen ellenőrző kód otp_lost_help_html: Ha mindkettőt elvesztetted, kérhetsz segítséget itt %{email} + rate_limited: Túl sok hiteleítési kísérlet történt. Próbáld újra később. seamless_external_login: Külső szolgáltatáson keresztül jelentkeztél be, így a jelszó és e-mail beállítások nem elérhetőek. signed_in_as: Bejelentkezve mint verification: diff --git a/config/locales/ie.yml b/config/locales/ie.yml index c8cd5d5f8..c77a8f802 100644 --- a/config/locales/ie.yml +++ b/config/locales/ie.yml @@ -1786,6 +1786,7 @@ ie: subtitle: Tui apelle ha esset rejectet. title: Apelle rejectet backup_ready: + explanation: Tu petit un complet archive de tui conto de Mastodon. extra: It es ja pret a descargar! subject: Tui archive es pret por descargar title: Descargar archive @@ -1842,6 +1843,7 @@ ie: go_to_sso_account_settings: Ear al parametres de conto de tui provisor de identification invalid_otp_token: Ínvalid 2-factor code otp_lost_help_html: Si tu perdit accesse a ambis, tu posse contacter %{email} + rate_limited: Tro mult de provas de autentication, ples provar denov plu tard. seamless_external_login: Tu ha intrat per un servicie external, dunc parametres pri tui passa-parol e email-adresse ne es disponibil. signed_in_as: 'Session apertet quam:' verification: diff --git a/config/locales/is.yml b/config/locales/is.yml index 9f8d5d42d..b048d5cb0 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -1847,6 +1847,7 @@ is: go_to_sso_account_settings: Fara í stillingar aðgangsins hjá auðkennisveitunni þinni invalid_otp_token: Ógildur tveggja-þátta kóði otp_lost_help_html: Ef þú hefur misst aðganginn að hvoru tveggja, geturðu sett þig í samband við %{email} + rate_limited: Of margar tilraunir til auðkenningar, prófaðu aftur síðar. seamless_external_login: Innskráning þín er í gegnum utanaðkomandi þjónustu, þannig að stillingar fyrir lykilorð og tölvupóst eru ekki aðgengilegar. signed_in_as: 'Skráð inn sem:' verification: diff --git a/config/locales/it.yml b/config/locales/it.yml index a17fae480..adcef9559 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1845,6 +1845,7 @@ it: go_to_sso_account_settings: Vai alle impostazioni dell'account del tuo provider di identità invalid_otp_token: Codice d'accesso non valido otp_lost_help_html: Se perdessi l'accesso ad entrambi, puoi entrare in contatto con %{email} + rate_limited: Troppi tentativi di autenticazione, per favore riprova più tardi. seamless_external_login: Hai effettuato l'accesso tramite un servizio esterno, quindi le impostazioni di password e e-mail non sono disponibili. signed_in_as: 'Hai effettuato l''accesso come:' verification: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index a68426cb5..c966cbe36 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1813,6 +1813,7 @@ ja: go_to_sso_account_settings: 外部サービスアカウントの設定はこちらで行ってください invalid_otp_token: 二要素認証コードが間違っています otp_lost_help_html: どちらも使用できない場合、%{email}に連絡を取ると解決できるかもしれません + rate_limited: 認証に失敗した回数が多すぎます。時間をおいてからログインしてください。 seamless_external_login: あなたは外部サービスを介してログインしているため、パスワードとメールアドレスの設定は利用できません。 signed_in_as: '下記でログイン中:' verification: diff --git a/config/locales/ko.yml b/config/locales/ko.yml index b85b9b586..946aa3565 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1813,6 +1813,7 @@ ko: go_to_sso_account_settings: ID 공급자의 계정 설정으로 이동 invalid_otp_token: 2단계 인증 코드가 올바르지 않습니다 otp_lost_help_html: 만약 양쪽 모두를 잃어버렸다면 %{email}을 통해 복구할 수 있습니다 + rate_limited: 너무 많은 인증 시도가 있었습니다, 잠시 후에 시도하세요. seamless_external_login: 외부 서비스를 이용해 로그인했으므로 이메일과 암호는 설정할 수 없습니다. signed_in_as: '다음과 같이 로그인 중:' verification: diff --git a/config/locales/lad.yml b/config/locales/lad.yml index d1247fc78..5a09c4c60 100644 --- a/config/locales/lad.yml +++ b/config/locales/lad.yml @@ -384,6 +384,7 @@ lad: cancel: Anula confirm: Suspende permanent_action: Si kites la suspensyon no restoraras dingunos datos ni relasyones. + preamble_html: Estas a punto de suspender %{domain} i sus subdomenos. remove_all_data: Esto efasara todo el kontenido, multimedia i datos de profiles de los kuentos en este domeno de tu sirvidor. stop_communication: Tu sirvidor deshara de komunikarse kon estos sirvidores. title: Konfirma bloko de domeno para %{domain} @@ -608,6 +609,7 @@ lad: created_at: Raportado delete_and_resolve: Efasa publikasyones forwarded: Reembiado + forwarded_replies_explanation: Este raporto vyene de un utilizador remoto i es sovre kontenido remoto. Tiene sido reembiado a ti porke el kontenido raportado esta en una repuesta a uno de tus utilizadores. forwarded_to: Reembiado a %{domain} mark_as_resolved: Marka komo rezolvido mark_as_sensitive: Marka komo sensivle @@ -712,6 +714,7 @@ lad: manage_users: Administra utilizadores manage_users_description: Permete a los utilizadores ver los peratim de otros utilizadores i realizar aksyones de moderasyon kontra eyos manage_webhooks: Administrar webhooks + manage_webhooks_description: Permite a los utilizadores konfigurar webhooks para evenimientos administrativos view_audit_log: Mostra defter de revisyon view_audit_log_description: Permete a los utilizadores ver una estoria de aksyones administrativas en el sirvidor view_dashboard: Ve pano @@ -738,6 +741,8 @@ lad: branding: preamble: La marka de tu sirvidor lo desferensia de otros sirvidores de la red. Esta enformasyon puede amostrarse por una varieta de entornos, komo en la enterfaz web de Mastodon, en aplikasyones nativas, en previsualizasiones de atadijos en otros sitios internetikos i en aplikasyones de mesajes, etc. Por esta razon, es mijor mantener esta enformasyon klara, breve i konsiza. title: Marka + captcha_enabled: + title: Solisita ke los muevos utilizadores rezolven un CAPTCHA para konfirmar su konto content_retention: preamble: Kontrola komo el kontenido jenerado por el utilizador se magazina en Mastodon. title: Retensyon de kontenido @@ -765,6 +770,9 @@ lad: approved: Se rekiere achetasion para enrejistrarse none: Permete a los utilizadores trokar la konfigurasyon del sitio open: Kualkiera puede enrejistrarse + security: + authorized_fetch_overridden_hint: Agora no puedes trokar esta konfigurasyon dkee esta sovreeskrita por una variable de entorno. + federation_authentication: Forzamyento de autentifikasyon para la federasyon title: Konfigurasyon del sirvidor site_uploads: delete: Efasa dosya kargada @@ -820,8 +828,13 @@ lad: system_checks: database_schema_check: message_html: Ay migrasyones asperando de la baza de datos. Por favor, egzekutalas para asigurarte de ke la aplikasyon fonksiona komo deveria + elasticsearch_health_red: + message_html: El klaster de Elasticsearch no es sano (estado kolorado), funksyones de bushkeda no estan disponivles + elasticsearch_health_yellow: + message_html: El klaster de Elasticsearch no es sano (estado amariyo), es posivle ke keras investigar la razon elasticsearch_preset: action: Ve dokumentasyon + message_html: Tu klaster de Elasticsearch tiene mas ke un nodo, ama Mastodon no esta konfigurado para uzarlos. elasticsearch_preset_single_node: action: Ve dokumentasyon elasticsearch_running_check: @@ -1012,12 +1025,17 @@ lad: auth: apply_for_account: Solisita un kuento captcha_confirmation: + help_html: Si tyenes problemas kon rezolver el CAPTCHA, puedes kontaktarnos en %{email} i podremos ayudarte. + hint_html: Una koza mas! Tenemos ke konfirmar ke eres umano (para evitar spam!). Rezolve el CAPTCHA abasho i klika "Kontinua". title: Kontrolo de sigurita confirmations: + awaiting_review: Tu adreso de posta tiene sido konfirmado! La taifa de %{domain} esta revizando tu enrejistrasyon. Risiviras un meil si acheten tu kuento! awaiting_review_title: Estamos revizando tu enrejistramiento clicking_this_link: klikando en este atadijo login_link: konektate kon kuento proceed_to_login_html: Agora puedes ir a %{login_link}. + redirect_to_app_html: Seras readresado a la aplikasyon %{app_name}. Si esto no afita, aprova %{clicking_this_link} o regresa manualmente a la aplikasyon. + registration_complete: Tu enrejistrasyon en %{domain} ya esta kompletada! welcome_title: Bienvenido, %{name}! wrong_email_hint: Si este adreso de posta es inkorekto, puedes trokarlo en las preferensyas del kuento. delete_account: Efasa kuento @@ -1054,6 +1072,7 @@ lad: rules: accept: Acheta back: Atras + invited_by: 'Puedes adjuntarte a %{domain} grasyas a la envitasyon de:' preamble: Estas son establesidas i aplikadas por los moderadores de %{domain}. preamble_invited: Antes de kontinuar, por favor reviza las reglas del sirvidor establesidas por los moderatores de %{domain}. title: Algunas reglas bazikas. @@ -1078,6 +1097,7 @@ lad: functional: Tu kuento esta kompletamente funksyonal. pending: Tu solisitasyon esta asperando la revizion por muestros administradores. Esto puede tadrar algun tiempo. Arisiviras una posta elektronika si la solisitasyon sea achetada. redirecting_to: Tu kuento se topa inaktivo porke esta siendo readresado a %{acct}. + self_destruct: Deke %{domain} va a serrarse, solo tendras akseso limitado a tu kuento. view_strikes: Ve amonestamientos pasados kontra tu kuento too_fast: Formulario enviado demaziado rapido, aprovalo de muevo. use_security_key: Uza la yave de sigurita @@ -1271,6 +1291,19 @@ lad: merge_long: Manten rejistros egzistentes i adjusta muevos overwrite: Sobreskrive overwrite_long: Mete muevos rejistros en vez de los aktuales + overwrite_preambles: + blocking_html: Estas a punto de substituyir tu lista de blokos por asta %{total_items} kuentos de %{filename}. + bookmarks_html: Estas a punto de substituyir tus markadores por asta %{total_items} publikasyones ke vinyeron de %{filename}. + domain_blocking_html: Estas a punto de substituyir tu lista de blokos de domeno por asta %{total_items} domenos de %{filename}. + following_html: Estas a punto de segir asta %{total_items} kuentos de %{filename} i deshar de segir todos los otros kuentos. + lists_html: Estas a punto de sustituyir tus listas con el kontenido de %{filename}. Asta %{total_items} kuentos seran adjustados a muevas listas. + muting_html: Estas a punto de substituyir tu lista de kuentos silensyados por asta %{total_items} kuentos de %{filename}. + preambles: + blocking_html: Estas a punto de blokar asta %{total_items} kuentos de %{filename}. + bookmarks_html: Estas a punto de adjustar asta %{total_items} publikasyones de %{filename} a tus markadores. + domain_blocking_html: Estas a punto de blokar asta %{total_items} domenos de %{filename}. + following_html: Estas a punto de segir asta %{total_items} kuentos de %{filename}. + muting_html: Estas a punto de silensyar asta %{total_items} kuentos de %{filename}. preface: Puedes importar siertos datos, komo todas las personas a las kualas estas sigiendo o blokando en tu kuento en esta instansya, dizde dosyas eksportadas de otra instansya. recent_imports: Importasyones resyentes states: @@ -1474,7 +1507,9 @@ lad: public_timelines: Linyas de tiempo publikas privacy: privacy: Privasita + reach: Alkanse search: Bushkeda + title: Privasita i alkanse privacy_policy: title: Politika de privasita reactions: @@ -1711,6 +1746,7 @@ lad: action: Preferensyas de kuento explanation: La apelasyon del amonestamiento kontra tu kuento del %{strike_date} ke mandates el %{appeal_date} fue achetada. Tu kuento se topa de muevo en dobro estado. subject: Tu apelasyon del %{date} fue achetada + subtitle: Tu konto de muevo tiene una reputasyon buena. title: Apelasyon achetada appeal_rejected: explanation: La apelasyon del amonestamiento kontra tu kuento del %{strike_date} ke mandates el %{appeal_date} fue refuzada. @@ -1718,6 +1754,7 @@ lad: subtitle: Tu apelasyon fue refuzada. title: Apelasyon refuzada backup_ready: + extra: Agora esta pronto para abashar! subject: Tu dosya esta pronta para abashar title: Abasha dosya suspicious_sign_in: @@ -1773,6 +1810,8 @@ lad: go_to_sso_account_settings: Va a la konfigurasyon de kuento de tu prokurador de identita invalid_otp_token: Kodiche de dos pasos no valido otp_lost_help_html: Si pedriste akseso a los dos, puedes kontaktarte kon %{email} + rate_limited: Demaziadas provas de autentifikasyon, aprova de muevo dempues. + seamless_external_login: Estas konektado por un servisyo eksterno i estonses la konfigurasyon de kod i konto de posta no estan disponivles. signed_in_as: 'Konektado komo:' verification: here_is_how: Ansina es komo @@ -1785,6 +1824,7 @@ lad: success: Tu yave de sigurita fue adjustada kon sukseso. delete: Efasa delete_confirmation: Estas siguro ke keres efasar esta yave de sigurita? + description_html: Si kapasites autentifikasyon kon yave de sigurita, nesesitaras uno de tus yaves de sigurita para konektarte kon tu kuento. destroy: error: Uvo un problem al efasar tu yave de sigurita. Por favor aprova de muevo. success: Tu yave de sigurita fue efasada kon sukseso. diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 9235b99fe..5ffa788a8 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1843,6 +1843,7 @@ nl: go_to_sso_account_settings: Ga naar de accountinstellingen van je identiteitsprovider invalid_otp_token: Ongeldige tweestaps-toegangscode otp_lost_help_html: Als je toegang tot beiden kwijt bent geraakt, neem dan contact op via %{email} + rate_limited: Te veel authenticatiepogingen, probeer het later opnieuw. seamless_external_login: Je bent ingelogd via een externe dienst, daarom zijn wachtwoorden en e-mailinstellingen niet beschikbaar. signed_in_as: 'Ingelogd als:' verification: diff --git a/config/locales/nn.yml b/config/locales/nn.yml index 914ee7fb0..626252be0 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -1608,6 +1608,7 @@ nn: unknown_browser: Ukjend nettlesar weibo: Weibo current_session: Noverande økt + date: Dato description: "%{browser} på %{platform}" explanation: Desse nettlesarane er logga inn på Mastodon-kontoen din. ip: IP-adresse @@ -1774,14 +1775,19 @@ nn: webauthn: Sikkerhetsnøkler user_mailer: appeal_approved: + action: Kontoinnstillinger explanation: Apellen på prikken mot din kontor på %{strike_date} som du la inn på %{appeal_date} har blitt godkjend. Din konto er nok ein gong i god stand. subject: Din klage fra %{date} er godkjent + subtitle: Kontoen din er tilbake i god stand. title: Anke godkjend appeal_rejected: explanation: Klagen på advarselen mot din konto den %{strike_date} som du sendte inn den %{appeal_date} har blitt avvist. subject: Din klage fra %{date} er avvist + subtitle: Anken din har blitt avvist. title: Anke avvist backup_ready: + explanation: Du etterspurte en fullstendig sikkerhetskopi av din Mastodon-konto. + extra: Den er nå klar for nedlasting! subject: Arkivet ditt er klart til å lastes ned title: Nedlasting av arkiv suspicious_sign_in: @@ -1837,6 +1843,7 @@ nn: go_to_sso_account_settings: Gå til kontoinnstillingane hjå identitetsleverandøren din invalid_otp_token: Ugyldig tostegskode otp_lost_help_html: Hvis du mistet tilgangen til begge deler, kan du komme i kontakt med %{email} + rate_limited: For mange autentiseringsforsøk, prøv igjen seinare. seamless_external_login: Du er logga inn gjennom eit eksternt reiskap, so passord og e-postinstillingar er ikkje tilgjengelege. signed_in_as: 'Logga inn som:' verification: diff --git a/config/locales/no.yml b/config/locales/no.yml index 61cc89181..d90aa5bab 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -229,7 +229,7 @@ update_status: Oppdater statusen update_user_role: Oppdater rolle actions: - approve_appeal_html: "%{name} godkjente klagen på modereringa fra %{target}" + approve_appeal_html: "%{name} godkjente anken på moderering fra %{target}" approve_user_html: "%{name} godkjente registrering fra %{target}" assigned_to_self_report_html: "%{name} tildelte rapport %{target} til seg selv" change_email_user_html: "%{name} endret e-postadressen til brukeren %{target}" @@ -266,7 +266,7 @@ enable_user_html: "%{name} aktiverte innlogging for bruker %{target}" memorialize_account_html: "%{name} endret %{target}s konto til en minneside" promote_user_html: "%{name} forfremmet bruker %{target}" - reject_appeal_html: "%{name} avviste moderasjonsavgjørelsesklagen fra %{target}" + reject_appeal_html: "%{name} avviste anken på moderering fra %{target}" reject_user_html: "%{name} avslo registrering fra %{target}" remove_avatar_user_html: "%{name} fjernet %{target} sitt profilbilde" reopen_report_html: "%{name} gjenåpnet rapporten %{target}" @@ -372,8 +372,8 @@ website: Nettside disputes: appeals: - empty: Ingen klager funnet. - title: Klager + empty: Ingen anker funnet. + title: Anker domain_allows: add_new: Hvitelist domene created_msg: Domenet har blitt hvitelistet @@ -692,8 +692,8 @@ invite_users_description: Lar brukere invitere nye personer til serveren manage_announcements: Behandle Kunngjøringer manage_announcements_description: Lar brukere endre kunngjøringer på serveren - manage_appeals: Behandle klager - manage_appeals_description: Lar brukere gjennomgå klager mot modereringsaktiviteter + manage_appeals: Behandle anker + manage_appeals_description: Lar brukere gjennomgå anker mot modereringsaktiviteter manage_blocks: Behandle Blokker manage_blocks_description: Lar brukere blokkere e-postleverandører og IP-adresser manage_custom_emojis: Administrer egendefinerte Emojier @@ -829,8 +829,8 @@ sensitive: "%{name} merket %{target}s konto som følsom" silence: "%{name} begrenset %{target}s konto" suspend: "%{name} suspenderte %{target}s konto" - appeal_approved: Klage tatt til følge - appeal_pending: Klage behandles + appeal_approved: Anket + appeal_pending: Anke behandles appeal_rejected: Anke avvist system_checks: database_schema_check: @@ -975,9 +975,9 @@ sensitive: å merke kontoen sin som følsom silence: for å begrense deres konto suspend: for å avslutte kontoen - body: "%{target} klager på en moderasjonsbeslutning av %{action_taken_by} fra %{date}, noe som var %{type}. De skrev:" - next_steps: Du kan godkjenne klagen for å angre på moderasjonsvedtaket eller ignorere det. - subject: "%{username} klager på en moderasjonsbeslutning for %{instance}" + body: "%{target} anker en moderasjonsbeslutning av %{action_taken_by} fra %{date}, noe som var %{type}. De skrev:" + next_steps: Du kan godkjenne anken for å angre på moderasjonsvedtaket eller ignorere det. + subject: "%{username} anker en moderasjonsbeslutning for %{instance}" new_critical_software_updates: body: Nye kritiske versjoner av Mastodon har blitt utgitt, det kan være fordelaktig å oppdatere så snart som mulig! subject: Kritiske Mastodon-oppdateringer er tilgjengelige for %{instance}! @@ -1161,19 +1161,19 @@ disputes: strikes: action_taken: Handling utført - appeal: Klage - appeal_approved: Denne advarselens klage ble tatt til følge og er ikke lenger gyldig - appeal_rejected: Klagen ble avvist - appeal_submitted_at: Klage levert - appealed_msg: Din klage har blitt levert. Du får beskjed om den blir godkjent. + appeal: Anke + appeal_approved: Denne advarselens anke ble tatt til følge og er ikke lenger gyldig + appeal_rejected: Anken ble avvist + appeal_submitted_at: Anke levert + appealed_msg: Anken din har blitt levert. Du får beskjed om den blir godkjent. appeals: - submit: Lever klage - approve_appeal: Godkjenn klage + submit: Lever anke + approve_appeal: Godkjenn anke associated_report: Tilhørende rapport created_at: Datert description_html: Dette er tiltakene mot din konto og advarsler som har blitt sent til deg av %{instance}-personalet. recipient: Adressert til - reject_appeal: Avvis klage + reject_appeal: Avvis anke status: 'Innlegg #%{id}' status_removed: Innlegg allerede fjernet fra systemet title: "%{action} fra %{date}" @@ -1185,9 +1185,9 @@ sensitive: Merking av konto som sensitiv silence: Begrensning av konto suspend: Suspensjon av konto - your_appeal_approved: Din klage har blitt godkjent - your_appeal_pending: Du har levert en klage - your_appeal_rejected: Din klage har blitt avvist + your_appeal_approved: Anken din har blitt godkjent + your_appeal_pending: Du har levert en anke + your_appeal_rejected: Anken din har blitt avvist domain_validator: invalid_domain: er ikke et gyldig domenenavn edit_profile: @@ -1608,6 +1608,7 @@ unknown_browser: Ukjent Nettleser weibo: Weibo current_session: Nåværende økt + date: Dato description: "%{browser} på %{platform}" explanation: Dette er nettlesere som er pålogget på din Mastodon-konto akkurat nå. ip: IP-adresse @@ -1740,7 +1741,7 @@ sensitive_content: Følsomt innhold strikes: errors: - too_late: Det er for sent å klage på denne advarselen + too_late: Det er for sent å anke denne advarselen tags: does_not_match_previous_name: samsvarer ikke med det forrige navnet themes: @@ -1774,14 +1775,19 @@ webauthn: Sikkerhetsnøkler user_mailer: appeal_approved: - explanation: Klagen på advarselen mot din konto den %{strike_date} som du sendte inn den %{appeal_date} har blitt godkjent. Din konto er nok en gang i god stand. - subject: Din klage fra %{date} er godkjent - title: Klage godkjent + action: Kontoinnstillinger + explanation: Anken på advarselen mot din konto den %{strike_date} som du sendte inn den %{appeal_date} har blitt godkjent. Din konto er nok en gang i god stand. + subject: Anken din fra %{date} er godkjent + subtitle: Kontoen din er tilbake i god stand. + title: Anke godkjent appeal_rejected: - explanation: Klagen på advarselen mot din konto den %{strike_date} som du sendte inn den %{appeal_date} har blitt avvist. - subject: Din klage fra %{date} er avvist - title: Klage avvist + explanation: Anken på advarselen mot din konto den %{strike_date} som du sendte inn den %{appeal_date} har blitt avvist. + subject: Anken din fra %{date} er avvist + subtitle: Anken din har blitt avvist. + title: Anke avvist backup_ready: + explanation: Du etterspurte en fullstendig sikkerhetskopi av din Mastodon-konto. + extra: Den er nå klar for nedlasting! subject: Arkivet ditt er klart til å lastes ned title: Nedlasting av arkiv suspicious_sign_in: @@ -1792,8 +1798,8 @@ subject: Din konto ble tatt i bruk fra en ny IP-adresse title: En ny pålogging warning: - appeal: Lever en klage - appeal_description: Hvis du mener dette er feil, kan du sende inn en klage til personalet i %{instance}. + appeal: Lever en anke + appeal_description: Hvis du mener dette er feil, kan du sende inn en anke til personalet i %{instance}. categories: spam: Søppelpost violation: Innholdet bryter følgende retningslinjer for fellesskapet @@ -1837,6 +1843,7 @@ go_to_sso_account_settings: Gå til din identitetsleverandørs kontoinnstillinger invalid_otp_token: Ugyldig to-faktorkode otp_lost_help_html: Hvis du mistet tilgangen til begge deler, kan du komme i kontakt med %{email} + rate_limited: For mange autentiseringsforsøk, prøv igjen senere. seamless_external_login: Du er logget inn via en ekstern tjeneste, så passord og e-post innstillinger er ikke tilgjengelige. signed_in_as: 'Innlogget som:' verification: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 8a973b71c..4d8fde8f4 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1907,6 +1907,7 @@ pl: go_to_sso_account_settings: Przejdź do ustawień konta dostawcy tożsamości invalid_otp_token: Kod uwierzytelniający jest niepoprawny otp_lost_help_html: Jeżeli utracisz dostęp do obu, możesz skontaktować się z %{email} + rate_limited: Zbyt wiele prób uwierzytelnienia. Spróbuj ponownie później. seamless_external_login: Zalogowano z użyciem zewnętrznej usługi, więc ustawienia hasła i adresu e-mail nie są dostępne. signed_in_as: 'Zalogowano jako:' verification: diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index fc1e3e636..2e077b37a 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1843,6 +1843,7 @@ pt-PT: go_to_sso_account_settings: Ir para as definições de conta do seu fornecedor de identidade invalid_otp_token: Código de autenticação inválido otp_lost_help_html: Se perdeu o acesso a ambos, pode entrar em contacto com %{email} + rate_limited: Demasiadas tentativas de autenticação, tente novamente mais tarde. seamless_external_login: Tu estás ligado via um serviço externo. Por isso, as configurações da palavra-passe e do e-mail não estão disponíveis. signed_in_as: 'Registado como:' verification: diff --git a/config/locales/simple_form.no.yml b/config/locales/simple_form.no.yml index ca2020e21..765179221 100644 --- a/config/locales/simple_form.no.yml +++ b/config/locales/simple_form.no.yml @@ -36,7 +36,7 @@ starts_at: Valgfritt. I tilfellet din kunngjøring er bundet til en spesifikk tidsramme text: Du kan bruke innlegg-syntaks. Vennligst vær oppmerksom på plassen som kunngjøringen vil ta opp på brukeren sin skjerm appeal: - text: Du kan kun klage på en advarsel en gang + text: Du kan kun anke en advarsel en gang defaults: autofollow: Folk som lager en konto gjennom invitasjonen, vil automatisk følge deg avatar: PNG, GIF eller JPG. Maksimalt %{size}. Vil bli nedskalert til %{dimensions}px @@ -282,7 +282,7 @@ sign_up_requires_approval: Begrens påmeldinger severity: Oppføring notification_emails: - appeal: Noen klager på en moderator sin avgjørelse + appeal: Noen anker en moderator sin avgjørelse digest: Send sammendrag på e-post favourite: Send e-post når noen setter din status som favoritt follow: Send e-post når noen følger deg diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 89f456a20..c639bbe1a 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -732,6 +732,7 @@ sk: new_appeal: actions: none: varovanie + silence: obmedziť ich účet new_pending_account: body: Podrobnosti o novom účte sú uvedené nižšie. Môžeš túto registračnú požiadavku buď prijať, alebo zamietnúť. subject: Nový účet očakáva preverenie na %{instance} (%{username}) @@ -1279,6 +1280,7 @@ sk: follow_limit_reached: Nemôžeš následovať viac ako %{limit} ľudí invalid_otp_token: Neplatný kód pre dvojfaktorovú autentikáciu otp_lost_help_html: Pokiaľ si stratil/a prístup k obom, môžeš dať vedieť %{email} + rate_limited: Príliš veľa pokusov o overenie, skús to znova neskôr. seamless_external_login: Si prihlásená/ý cez externú službu, takže nastavenia hesla a emailu ti niesú prístupné. signed_in_as: 'Prihlásená/ý ako:' verification: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 1a0afe034..ba707f49e 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1907,6 +1907,7 @@ sl: go_to_sso_account_settings: Pojdite na nastavitve svojega računa ponudnika identitete invalid_otp_token: Neveljavna dvofaktorska koda otp_lost_help_html: Če ste izgubili dostop do obeh, stopite v stik z %{email} + rate_limited: Preveč poskusov preverjanja pristnosti, poskusite kasneje. seamless_external_login: Prijavljeni ste prek zunanje storitve, tako da nastavitve gesla in e-pošte niso na voljo. signed_in_as: 'Vpisani kot:' verification: diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index fc1239bed..39c9f2f87 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -1875,6 +1875,7 @@ sr-Latn: go_to_sso_account_settings: Idite na podešavanja naloga svog dobavljača identiteta invalid_otp_token: Neispravni dvofaktorski kod otp_lost_help_html: Ako izgubite pristup za oba, možete stupiti u kontakt sa %{email} + rate_limited: Previše pokušaja autentifikacije, pokušajte ponovo kasnije. seamless_external_login: Prijavljeni ste putem spoljašnje usluge, tako da lozinka i podešavanja E-pošte nisu dostupni. signed_in_as: 'Prijavljen/a kao:' verification: diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 4e5e58c85..0cf35c14c 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1875,6 +1875,7 @@ sr: go_to_sso_account_settings: Идите на подешавања налога свог добављача идентитета invalid_otp_token: Неисправни двофакторски код otp_lost_help_html: Ако изгубите приступ за оба, можете ступити у контакт са %{email} + rate_limited: Превише покушаја аутентификације, покушајте поново касније. seamless_external_login: Пријављени сте путем спољашње услуге, тако да лозинка и подешавања Е-поште нису доступни. signed_in_as: 'Пријављен/а као:' verification: diff --git a/config/locales/sv.yml b/config/locales/sv.yml index d4657e974..3a82f29d2 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1842,6 +1842,7 @@ sv: go_to_sso_account_settings: Gå till din identitetsleverantörs kontoinställningar invalid_otp_token: Ogiltig tvåfaktorskod otp_lost_help_html: Om du förlorat åtkomst till båda kan du komma i kontakt med %{email} + rate_limited: För många autentiseringsförsök, försök igen senare. seamless_external_login: Du är inloggad via en extern tjänst, inställningar för lösenord och e-post är därför inte tillgängliga. signed_in_as: 'Inloggad som:' verification: diff --git a/config/locales/th.yml b/config/locales/th.yml index 7bea8f9de..ac5cfbacf 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -847,7 +847,7 @@ th: message_html: ไม่มีกระบวนการ Sidekiq ที่กำลังทำงานสำหรับคิว %{value} โปรดตรวจทานการกำหนดค่า Sidekiq ของคุณ software_version_critical_check: action: ดูการอัปเดตที่พร้อมใช้งาน - message_html: มีการอัปเดต Mastodon สำคัญพร้อมใช้งาน โปรดอัปเดตโดยเร็วที่สุดเท่าที่จะทำได้ + message_html: มีการอัปเดต Mastodon สำคัญพร้อมใช้งาน โปรดอัปเดตโดยเร็วที่สุดเท่าที่จะเป็นไปได้ software_version_patch_check: action: ดูการอัปเดตที่พร้อมใช้งาน message_html: มีการอัปเดต Mastodon ที่แก้ไขข้อบกพร่องพร้อมใช้งาน @@ -961,7 +961,7 @@ th: next_steps: คุณสามารถอนุมัติการอุทธรณ์เพื่อเลิกทำการตัดสินใจในการควบคุม หรือเพิกเฉยต่อการอุทธรณ์ subject: "%{username} กำลังอุทธรณ์การตัดสินใจในการควบคุมใน %{instance}" new_critical_software_updates: - body: มีการปล่อยรุ่น Mastodon สำคัญใหม่ คุณอาจต้องการอัปเดตโดยเร็วที่สุดเท่าที่จะทำได้! + body: มีการปล่อยรุ่น Mastodon สำคัญใหม่ คุณอาจต้องการอัปเดตโดยเร็วที่สุดเท่าที่จะเป็นไปได้! subject: การอัปเดต Mastodon สำคัญพร้อมใช้งานสำหรับ %{instance}! new_pending_account: body: รายละเอียดของบัญชีใหม่อยู่ด้านล่าง คุณสามารถอนุมัติหรือปฏิเสธใบสมัครนี้ @@ -1582,6 +1582,7 @@ th: unknown_browser: เบราว์เซอร์ที่ไม่รู้จัก weibo: Weibo current_session: เซสชันปัจจุบัน + date: วันที่ description: "%{browser} ใน %{platform}" explanation: นี่คือเว็บเบราว์เซอร์ที่เข้าสู่ระบบบัญชี Mastodon ของคุณในปัจจุบัน ip: IP @@ -1742,14 +1743,19 @@ th: webauthn: กุญแจความปลอดภัย user_mailer: appeal_approved: + action: การตั้งค่าบัญชี explanation: อนุมัติการอุทธรณ์การดำเนินการต่อบัญชีของคุณเมื่อ %{strike_date} ที่คุณได้ส่งเมื่อ %{appeal_date} แล้ว บัญชีของคุณอยู่ในสถานะที่ดีอีกครั้งหนึ่ง subject: อนุมัติการอุทธรณ์ของคุณจาก %{date} แล้ว + subtitle: บัญชีของคุณอยู่ในสถานะที่ดีอีกครั้งหนึ่ง title: อนุมัติการอุทธรณ์แล้ว appeal_rejected: explanation: ปฏิเสธการอุทธรณ์การดำเนินการต่อบัญชีของคุณเมื่อ %{strike_date} ที่คุณได้ส่งเมื่อ %{appeal_date} แล้ว subject: ปฏิเสธการอุทธรณ์ของคุณจาก %{date} แล้ว + subtitle: ปฏิเสธการอุทธรณ์ของคุณแล้ว title: ปฏิเสธการอุทธรณ์แล้ว backup_ready: + explanation: คุณได้ขอข้อมูลสำรองแบบเต็มของบัญชี Mastodon ของคุณ + extra: ตอนนี้ข้อมูลสำรองพร้อมสำหรับการดาวน์โหลดแล้ว! subject: การเก็บถาวรของคุณพร้อมสำหรับการดาวน์โหลดแล้ว title: การส่งออกการเก็บถาวร suspicious_sign_in: @@ -1805,6 +1811,7 @@ th: go_to_sso_account_settings: ไปยังการตั้งค่าบัญชีของผู้ให้บริการข้อมูลประจำตัวของคุณ invalid_otp_token: รหัสสองปัจจัยไม่ถูกต้อง otp_lost_help_html: หากคุณสูญเสียการเข้าถึงทั้งสองอย่าง คุณสามารถติดต่อ %{email} + rate_limited: มีความพยายามในการรับรองความถูกต้องมากเกินไป ลองอีกครั้งในภายหลัง seamless_external_login: คุณได้เข้าสู่ระบบผ่านบริการภายนอก ดังนั้นจึงไม่มีการตั้งค่ารหัสผ่านและอีเมล signed_in_as: 'ลงชื่อเข้าเป็น:' verification: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 99b5e782c..3b74c4eaa 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1843,6 +1843,7 @@ tr: go_to_sso_account_settings: Kimlik sağlayıcı hesap ayarlarına gidin invalid_otp_token: Geçersiz iki adımlı doğrulama kodu otp_lost_help_html: Her ikisine de erişiminizi kaybettiyseniz, %{email} ile irtibata geçebilirsiniz + rate_limited: Çok fazla kimlik doğrulama denemesi. Daha sonra tekrar deneyin. seamless_external_login: Harici bir servis aracılığıyla oturum açtınız, bu nedenle parola ve e-posta ayarları mevcut değildir. signed_in_as: 'Oturum açtı:' verification: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index a80fbf140..40a858d72 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1903,6 +1903,7 @@ uk: go_to_sso_account_settings: Перейдіть до налаштувань облікового запису постачальника ідентифікації invalid_otp_token: Введено неправильний код otp_lost_help_html: Якщо ви втратили доступ до обох, ви можете отримати доступ з %{email} + rate_limited: Занадто багато спроб з'єднання. Спробуйте ще раз пізніше. seamless_external_login: Ви увійшли за допомогою зовнішнього сервісу, тому налаштування паролю та електронної пошти недоступні. signed_in_as: 'Ви увійшли як:' verification: diff --git a/config/locales/vi.yml b/config/locales/vi.yml index dabb73a47..3817b18f0 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1811,6 +1811,7 @@ vi: go_to_sso_account_settings: Thiết lập tài khoản nhà cung cấp danh tính invalid_otp_token: Mã xác minh 2 bước không hợp lệ otp_lost_help_html: Nếu bạn mất quyền truy cập vào cả hai, bạn có thể đăng nhập bằng %{email} + rate_limited: Quá nhiều lần thử, vui lòng thử lại sau. seamless_external_login: Bạn đã đăng nhập thông qua một dịch vụ bên ngoài, vì vậy mật khẩu và email không khả dụng. signed_in_as: 'Đăng nhập bằng:' verification: diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 6611510b7..80bb5653c 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1811,6 +1811,7 @@ zh-CN: go_to_sso_account_settings: 转到您的身份提供商进行账户设置 invalid_otp_token: 输入的双因素认证代码无效 otp_lost_help_html: 如果你不慎丢失了所有的代码,请联系 %{email} 寻求帮助 + rate_limited: 验证尝试次数过多,请稍后再试。 seamless_external_login: 因为你是通过外部服务登录的,所以密码和电子邮件地址设置都不可用。 signed_in_as: 当前登录的账户: verification: diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index 4b682f935..ac32c03e9 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -1811,6 +1811,7 @@ zh-HK: go_to_sso_account_settings: 前往你身份提供者的帳號設定 invalid_otp_token: 雙重認證碼不正確 otp_lost_help_html: 如果這兩者你均無法登入,你可以聯繫 %{email} + rate_limited: 嘗試認證次數太多,請稍後再試。 seamless_external_login: 因為你正在使用第三方服務登入,所以不能設定密碼和電郵。 signed_in_as: 目前登入的帳戶: verification: diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index dd17de7ef..6662e44cd 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1813,6 +1813,7 @@ zh-TW: go_to_sso_account_settings: 前往您的身分提供商 (identity provider) 之帳號設定 invalid_otp_token: 兩階段認證碼不正確 otp_lost_help_html: 如果您無法存取這兩者,您可以透過 %{email} 與我們聯繫 + rate_limited: 身份驗證嘗試太多次,請稍後再試。 seamless_external_login: 由於您是由外部系統登入,所以不能設定密碼與電子郵件。 signed_in_as: 目前登入的帳號: verification: From 5efb00ddb8cd8d4d36382a66e048e5c78424f9a1 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 22 Jan 2024 06:55:51 -0500 Subject: [PATCH 42/55] Use ruby version 3.2.3 (#28817) --- .ruby-version | 2 +- Dockerfile | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ruby-version b/.ruby-version index be94e6f53..b347b11ea 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.2.3 diff --git a/Dockerfile b/Dockerfile index 96f8b5cd2..119c266b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,15 +7,15 @@ ARG TARGETPLATFORM=${TARGETPLATFORM} ARG BUILDPLATFORM=${BUILDPLATFORM} -# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.2.2"] -ARG RUBY_VERSION="3.2.2" +# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.2.3"] +ARG RUBY_VERSION="3.2.3" # # Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="20"] ARG NODE_MAJOR_VERSION="20" # Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="bookworm"] ARG DEBIAN_VERSION="bookworm" # Node image to use for base image based on combined variables (ex: 20-bookworm-slim) FROM docker.io/node:${NODE_MAJOR_VERSION}-${DEBIAN_VERSION}-slim as node -# Ruby image to use for base image based on combined variables (ex: 3.2.2-slim-bookworm) +# Ruby image to use for base image based on combined variables (ex: 3.2.3-slim-bookworm) FROM docker.io/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} as ruby # Resulting version string is vX.X.X-MASTODON_VERSION_PRERELEASE+MASTODON_VERSION_METADATA From 7ecf7f540309a968027ff6ac3874e3643f3fe3e1 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 22 Jan 2024 06:58:54 -0500 Subject: [PATCH 43/55] Move controller->request specs for api/v1/statuses/* (#28818) --- .../favourited_by_accounts_controller.rb | 2 +- .../reblogged_by_accounts_controller.rb | 2 +- .../statuses/favourited_by_accounts_spec.rb} | 60 +++++++++++-------- .../statuses/reblogged_by_accounts_spec.rb} | 53 +++++++++------- 4 files changed, 69 insertions(+), 48 deletions(-) rename spec/{controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb => requests/api/v1/statuses/favourited_by_accounts_spec.rb} (52%) rename spec/{controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb => requests/api/v1/statuses/reblogged_by_accounts_spec.rb} (57%) diff --git a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb index 3cca246ce..98b69c347 100644 --- a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb @@ -14,7 +14,7 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::V1::Statuses::Bas def load_accounts scope = default_accounts - scope = scope.where.not(id: current_account.excluded_from_timeline_account_ids) unless current_account.nil? + scope = scope.not_excluded_by_account(current_account) unless current_account.nil? scope.merge(paginated_favourites).to_a end diff --git a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb index dd3e60846..aacab5f8f 100644 --- a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb @@ -14,7 +14,7 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::V1::Statuses::Base def load_accounts scope = default_accounts - scope = scope.where.not(id: current_account.excluded_from_timeline_account_ids) unless current_account.nil? + scope = scope.not_excluded_by_account(current_account) unless current_account.nil? scope.merge(paginated_statuses).to_a end diff --git a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb b/spec/requests/api/v1/statuses/favourited_by_accounts_spec.rb similarity index 52% rename from spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb rename to spec/requests/api/v1/statuses/favourited_by_accounts_spec.rb index 01816743e..44296f4c3 100644 --- a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb +++ b/spec/requests/api/v1/statuses/favourited_by_accounts_spec.rb @@ -2,21 +2,21 @@ require 'rails_helper' -RSpec.describe Api::V1::Statuses::FavouritedByAccountsController do - render_views - - let(:user) { Fabricate(:user) } - let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') } - let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: app, scopes: 'read:accounts') } +RSpec.describe 'API V1 Statuses Favourited by Accounts' do + let(:user) { Fabricate(:user) } + let(:scopes) { 'read:accounts' } + # let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } + let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:alice) { Fabricate(:account) } let(:bob) { Fabricate(:account) } context 'with an oauth token' do - before do - allow(controller).to receive(:doorkeeper_token) { token } + subject do + get "/api/v1/statuses/#{status.id}/favourited_by", headers: headers, params: { limit: 2 } end - describe 'GET #index' do + describe 'GET /api/v1/statuses/:status_id/favourited_by' do let(:status) { Fabricate(:status, account: user.account) } before do @@ -24,30 +24,38 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController do Favourite.create!(account: bob, status: status) end - it 'returns http success' do - get :index, params: { status_id: status.id, limit: 2 } - expect(response).to have_http_status(200) - expect(response.headers['Link'].links.size).to eq(2) - end + it 'returns http success and accounts who favourited the status' do + subject - it 'returns accounts who favorited the status' do - get :index, params: { status_id: status.id, limit: 2 } - expect(body_as_json.size).to eq 2 - expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s) + expect(response) + .to have_http_status(200) + expect(response.headers['Link'].links.size) + .to eq(2) + + expect(body_as_json.size) + .to eq(2) + expect(body_as_json) + .to contain_exactly( + include(id: alice.id.to_s), + include(id: bob.id.to_s) + ) end it 'does not return blocked users' do user.account.block!(bob) - get :index, params: { status_id: status.id, limit: 2 } - expect(body_as_json.size).to eq 1 - expect(body_as_json[0][:id]).to eq alice.id.to_s + + subject + + expect(body_as_json.size) + .to eq 1 + expect(body_as_json.first[:id]).to eq(alice.id.to_s) end end end context 'without an oauth token' do - before do - allow(controller).to receive(:doorkeeper_token).and_return(nil) + subject do + get "/api/v1/statuses/#{status.id}/favourited_by", params: { limit: 2 } end context 'with a private status' do @@ -59,7 +67,8 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController do end it 'returns http unauthorized' do - get :index, params: { status_id: status.id } + subject + expect(response).to have_http_status(404) end end @@ -74,7 +83,8 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController do end it 'returns http success' do - get :index, params: { status_id: status.id } + subject + expect(response).to have_http_status(200) end end diff --git a/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb b/spec/requests/api/v1/statuses/reblogged_by_accounts_spec.rb similarity index 57% rename from spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb rename to spec/requests/api/v1/statuses/reblogged_by_accounts_spec.rb index 0d15cca75..6f99ce946 100644 --- a/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb +++ b/spec/requests/api/v1/statuses/reblogged_by_accounts_spec.rb @@ -2,21 +2,20 @@ require 'rails_helper' -RSpec.describe Api::V1::Statuses::RebloggedByAccountsController do - render_views - - let(:user) { Fabricate(:user) } - let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') } - let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: app, scopes: 'read:accounts') } +RSpec.describe 'API V1 Statuses Reblogged by Accounts' do + let(:user) { Fabricate(:user) } + let(:scopes) { 'read:accounts' } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } + let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:alice) { Fabricate(:account) } let(:bob) { Fabricate(:account) } context 'with an oauth token' do - before do - allow(controller).to receive(:doorkeeper_token) { token } + subject do + get "/api/v1/statuses/#{status.id}/reblogged_by", headers: headers, params: { limit: 2 } end - describe 'GET #index' do + describe 'GET /api/v1/statuses/:status_id/reblogged_by' do let(:status) { Fabricate(:status, account: user.account) } before do @@ -25,27 +24,37 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController do end it 'returns accounts who reblogged the status', :aggregate_failures do - get :index, params: { status_id: status.id, limit: 2 } + subject - expect(response).to have_http_status(200) - expect(response.headers['Link'].links.size).to eq(2) + expect(response) + .to have_http_status(200) + expect(response.headers['Link'].links.size) + .to eq(2) - expect(body_as_json.size).to eq 2 - expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s) + expect(body_as_json.size) + .to eq(2) + expect(body_as_json) + .to contain_exactly( + include(id: alice.id.to_s), + include(id: bob.id.to_s) + ) end it 'does not return blocked users' do user.account.block!(bob) - get :index, params: { status_id: status.id, limit: 2 } - expect(body_as_json.size).to eq 1 - expect(body_as_json[0][:id]).to eq alice.id.to_s + + subject + + expect(body_as_json.size) + .to eq 1 + expect(body_as_json.first[:id]).to eq(alice.id.to_s) end end end context 'without an oauth token' do - before do - allow(controller).to receive(:doorkeeper_token).and_return(nil) + subject do + get "/api/v1/statuses/#{status.id}/reblogged_by", params: { limit: 2 } end context 'with a private status' do @@ -57,7 +66,8 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController do end it 'returns http unauthorized' do - get :index, params: { status_id: status.id } + subject + expect(response).to have_http_status(404) end end @@ -72,7 +82,8 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController do end it 'returns http success' do - get :index, params: { status_id: status.id } + subject + expect(response).to have_http_status(200) end end From 18004bf22723b677345f417b24729c7e17dac36e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 22 Jan 2024 08:55:37 -0500 Subject: [PATCH 44/55] Add `Account.matches_uri_prefix` scope and use in activitypub/followers_synchronizations controller (#28820) --- .../followers_synchronizations_controller.rb | 2 +- app/models/account.rb | 1 + spec/models/account_spec.rb | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/controllers/activitypub/followers_synchronizations_controller.rb b/app/controllers/activitypub/followers_synchronizations_controller.rb index 976caa344..d2942104e 100644 --- a/app/controllers/activitypub/followers_synchronizations_controller.rb +++ b/app/controllers/activitypub/followers_synchronizations_controller.rb @@ -24,7 +24,7 @@ class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseContro end def set_items - @items = @account.followers.where(Account.arel_table[:uri].matches("#{Account.sanitize_sql_like(uri_prefix)}/%", false, true)).or(@account.followers.where(uri: uri_prefix)).pluck(:uri) + @items = @account.followers.matches_uri_prefix(uri_prefix).pluck(:uri) end def collection_presenter diff --git a/app/models/account.rb b/app/models/account.rb index 2fdfc2d51..05e1f943c 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -123,6 +123,7 @@ class Account < ApplicationRecord scope :bots, -> { where(actor_type: %w(Application Service)) } scope :groups, -> { where(actor_type: 'Group') } scope :alphabetic, -> { order(domain: :asc, username: :asc) } + scope :matches_uri_prefix, ->(value) { where(arel_table[:uri].matches("#{sanitize_sql_like(value)}/%", false, true)).or(where(uri: value)) } scope :matches_username, ->(value) { where('lower((username)::text) LIKE lower(?)', "#{value}%") } scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) } scope :without_unapproved, -> { left_outer_joins(:user).merge(User.approved.confirmed).or(remote) } diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 8488ccea4..7ef5ca94c 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -835,6 +835,31 @@ RSpec.describe Account do end describe 'scopes' do + describe 'matches_uri_prefix' do + let!(:alice) { Fabricate :account, domain: 'host.example', uri: 'https://host.example/user/a' } + let!(:bob) { Fabricate :account, domain: 'top-level.example', uri: 'https://top-level.example' } + + it 'returns accounts which start with the value' do + results = described_class.matches_uri_prefix('https://host.example') + + expect(results.size) + .to eq(1) + expect(results) + .to include(alice) + .and not_include(bob) + end + + it 'returns accounts which equal the value' do + results = described_class.matches_uri_prefix('https://top-level.example') + + expect(results.size) + .to eq(1) + expect(results) + .to include(bob) + .and not_include(alice) + end + end + describe 'auditable' do let!(:alice) { Fabricate :account } let!(:bob) { Fabricate :account } From e2d9635074ad33cc8144adc434bcd90faae9c424 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 22 Jan 2024 14:55:43 +0100 Subject: [PATCH 45/55] Add notification email on invalid second authenticator (#28822) --- app/controllers/auth/sessions_controller.rb | 5 ++++ app/mailers/user_mailer.rb | 12 ++++++++++ app/views/user_mailer/failed_2fa.html.haml | 24 +++++++++++++++++++ app/views/user_mailer/failed_2fa.text.erb | 15 ++++++++++++ config/locales/en.yml | 6 +++++ .../auth/sessions_controller_spec.rb | 20 +++++++++++++--- spec/mailers/previews/user_mailer_preview.rb | 5 ++++ spec/mailers/user_mailer_spec.rb | 18 ++++++++++++++ 8 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 app/views/user_mailer/failed_2fa.html.haml create mode 100644 app/views/user_mailer/failed_2fa.text.erb diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 6bc48a780..962b78de6 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -181,6 +181,11 @@ class Auth::SessionsController < Devise::SessionsController ip: request.remote_ip, user_agent: request.user_agent ) + + # Only send a notification email every hour at most + return if redis.set("2fa_failure_notification:#{user.id}", '1', ex: 1.hour, get: true).present? + + UserMailer.failed_2fa(user, request.remote_ip, request.user_agent, Time.now.utc).deliver_later! end def second_factor_attempts_key(user) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 432b851b5..3b1a085cb 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -191,6 +191,18 @@ class UserMailer < Devise::Mailer end end + def failed_2fa(user, remote_ip, user_agent, timestamp) + @resource = user + @remote_ip = remote_ip + @user_agent = user_agent + @detection = Browser.new(user_agent) + @timestamp = timestamp.to_time.utc + + I18n.with_locale(locale) do + mail subject: default_i18n_subject + end + end + private def default_devise_subject diff --git a/app/views/user_mailer/failed_2fa.html.haml b/app/views/user_mailer/failed_2fa.html.haml new file mode 100644 index 000000000..e1da35ce0 --- /dev/null +++ b/app/views/user_mailer/failed_2fa.html.haml @@ -0,0 +1,24 @@ += content_for :heading do + = render 'application/mailer/heading', heading_title: t('user_mailer.failed_2fa.title'), heading_subtitle: t('user_mailer.failed_2fa.explanation'), heading_image_url: frontend_asset_url('images/mailer-new/heading/login.png') +%table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } + %tr + %td.email-body-padding-td + %table.email-inner-card-table{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } + %tr + %td.email-inner-card-td.email-prose + %p= t 'user_mailer.failed_2fa.details' + %p + %strong #{t('sessions.ip')}: + = @remote_ip + %br/ + %strong #{t('sessions.browser')}: + %span{ title: @user_agent } + = t 'sessions.description', + browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s), + platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s) + %br/ + %strong #{t('sessions.date')}: + = l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone) + = render 'application/mailer/button', text: t('settings.account_settings'), url: edit_user_registration_url + %p= t 'user_mailer.failed_2fa.further_actions_html', + action: link_to(t('user_mailer.suspicious_sign_in.change_password'), edit_user_registration_url) diff --git a/app/views/user_mailer/failed_2fa.text.erb b/app/views/user_mailer/failed_2fa.text.erb new file mode 100644 index 000000000..c1dbf7d92 --- /dev/null +++ b/app/views/user_mailer/failed_2fa.text.erb @@ -0,0 +1,15 @@ +<%= t 'user_mailer.failed_2fa.title' %> + +=== + +<%= t 'user_mailer.failed_2fa.explanation' %> + +<%= t 'user_mailer.failed_2fa.details' %> + +<%= t('sessions.ip') %>: <%= @remote_ip %> +<%= t('sessions.browser') %>: <%= t('sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: "#{@detection.id}"), platform: t("sessions.platforms.#{@detection.platform.id}", default: "#{@detection.platform.id}")) %> +<%= l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone) %> + +<%= t 'user_mailer.failed_2fa.further_actions_html', action: t('user_mailer.suspicious_sign_in.change_password') %> + +=> <%= edit_user_registration_url %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 89ca0ad72..83eaaa455 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1791,6 +1791,12 @@ en: extra: It's now ready for download! subject: Your archive is ready for download title: Archive takeout + failed_2fa: + details: 'Here are details of the sign-in attempt:' + explanation: Someone has tried to sign in to your account but provided an invalid second authentication factor. + further_actions_html: If this wasn't you, we recommend that you %{action} immediately as it may be compromised. + subject: Second factor authentication failure + title: Failed second factor authentication suspicious_sign_in: change_password: change your password details: 'Here are details of the sign-in:' diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb index d238626c9..b663f55af 100644 --- a/spec/controllers/auth/sessions_controller_spec.rb +++ b/spec/controllers/auth/sessions_controller_spec.rb @@ -265,21 +265,35 @@ RSpec.describe Auth::SessionsController do context 'when repeatedly using an invalid TOTP code before using a valid code' do before do stub_const('Auth::SessionsController::MAX_2FA_ATTEMPTS_PER_HOUR', 2) + + # Travel to the beginning of an hour to avoid crossing rate-limit buckets + travel_to '2023-12-20T10:00:00Z' end it 'does not log the user in' do - # Travel to the beginning of an hour to avoid crossing rate-limit buckets - travel_to '2023-12-20T10:00:00Z' - Auth::SessionsController::MAX_2FA_ATTEMPTS_PER_HOUR.times do post :create, params: { user: { otp_attempt: '1234' } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } expect(controller.current_user).to be_nil end post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } + expect(controller.current_user).to be_nil expect(flash[:alert]).to match I18n.t('users.rate_limited') end + + it 'sends a suspicious sign-in mail', :sidekiq_inline do + Auth::SessionsController::MAX_2FA_ATTEMPTS_PER_HOUR.times do + post :create, params: { user: { otp_attempt: '1234' } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } + expect(controller.current_user).to be_nil + end + + post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } + + expect(UserMailer.deliveries.size).to eq(1) + expect(UserMailer.deliveries.first.to.first).to eq(user.email) + expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.failed_2fa.subject')) + end end context 'when using a valid OTP' do diff --git a/spec/mailers/previews/user_mailer_preview.rb b/spec/mailers/previews/user_mailer_preview.rb index 098c9cd90..2722538e1 100644 --- a/spec/mailers/previews/user_mailer_preview.rb +++ b/spec/mailers/previews/user_mailer_preview.rb @@ -93,4 +93,9 @@ class UserMailerPreview < ActionMailer::Preview def suspicious_sign_in UserMailer.suspicious_sign_in(User.first, '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0', Time.now.utc) end + + # Preview this email at http://localhost:3000/rails/mailers/user_mailer/failed_2fa + def failed_2fa + UserMailer.failed_2fa(User.first, '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0', Time.now.utc) + end end diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 4a4392824..404b83470 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -135,6 +135,24 @@ describe UserMailer do 'user_mailer.suspicious_sign_in.subject' end + describe '#failed_2fa' do + let(:ip) { '192.168.0.1' } + let(:agent) { 'NCSA_Mosaic/2.0 (Windows 3.1)' } + let(:timestamp) { Time.now.utc } + let(:mail) { described_class.failed_2fa(receiver, ip, agent, timestamp) } + + it 'renders failed 2FA notification' do + receiver.update!(locale: nil) + + expect(mail) + .to be_present + .and(have_body_text(I18n.t('user_mailer.failed_2fa.explanation'))) + end + + include_examples 'localized subject', + 'user_mailer.failed_2fa.subject' + end + describe '#appeal_approved' do let(:appeal) { Fabricate(:appeal, account: receiver.account, approved_at: Time.now.utc) } let(:mail) { described_class.appeal_approved(receiver, appeal) } From 67f54c4e75aeaa78ba72e10603b43a713929fcbd Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:06:53 -0500 Subject: [PATCH 46/55] Fix `Rails/WhereExists` cop in app/validators (#28854) --- .rubocop_todo.yml | 2 -- app/validators/reaction_validator.rb | 2 +- app/validators/vote_validator.rb | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a2ee32d28..4d2f11ff7 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -88,8 +88,6 @@ Rails/WhereExists: - 'app/serializers/rest/announcement_serializer.rb' - 'app/services/activitypub/fetch_remote_status_service.rb' - 'app/services/vote_service.rb' - - 'app/validators/reaction_validator.rb' - - 'app/validators/vote_validator.rb' - 'app/workers/move_worker.rb' - 'lib/tasks/tests.rake' - 'spec/models/account_spec.rb' diff --git a/app/validators/reaction_validator.rb b/app/validators/reaction_validator.rb index 4ed3376e8..89d83de5a 100644 --- a/app/validators/reaction_validator.rb +++ b/app/validators/reaction_validator.rb @@ -19,7 +19,7 @@ class ReactionValidator < ActiveModel::Validator end def new_reaction?(reaction) - !reaction.announcement.announcement_reactions.where(name: reaction.name).exists? + !reaction.announcement.announcement_reactions.exists?(name: reaction.name) end def limit_reached?(reaction) diff --git a/app/validators/vote_validator.rb b/app/validators/vote_validator.rb index fa2bd223d..e725b4c0b 100644 --- a/app/validators/vote_validator.rb +++ b/app/validators/vote_validator.rb @@ -35,7 +35,7 @@ class VoteValidator < ActiveModel::Validator if vote.persisted? account_votes_on_same_poll(vote).where(choice: vote.choice).where.not(poll_votes: { id: vote }).exists? else - account_votes_on_same_poll(vote).where(choice: vote.choice).exists? + account_votes_on_same_poll(vote).exists?(choice: vote.choice) end end From defe5f407600e9259f6b7c0683b8d56a0349b3d9 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:07:22 -0500 Subject: [PATCH 47/55] Fix `Rails/WhereExists` cop in lib/tasks (#28852) --- .rubocop_todo.yml | 1 - lib/tasks/tests.rake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4d2f11ff7..c0fb7a5ce 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -89,7 +89,6 @@ Rails/WhereExists: - 'app/services/activitypub/fetch_remote_status_service.rb' - 'app/services/vote_service.rb' - 'app/workers/move_worker.rb' - - 'lib/tasks/tests.rake' - 'spec/models/account_spec.rb' - 'spec/services/activitypub/process_collection_service_spec.rb' - 'spec/services/purge_domain_service_spec.rb' diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index c3a9dbfd7..45f055e21 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -24,7 +24,7 @@ namespace :tests do exit(1) end - if Account.where(domain: Rails.configuration.x.local_domain).exists? + if Account.exists?(domain: Rails.configuration.x.local_domain) puts 'Faux remote accounts not properly cleaned up' exit(1) end From b0207d77579e8179b683fe56711a83f5d2fb0909 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:10:11 -0500 Subject: [PATCH 48/55] Add coverage for `Tag.recently_used` scope (#28850) --- app/models/tag.rb | 4 +++- spec/models/tag_spec.rb | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 46e55d74f..f2168ae90 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -39,6 +39,8 @@ class Tag < ApplicationRecord HASHTAG_NAME_RE = /\A(#{HASHTAG_NAME_PAT})\z/i HASHTAG_INVALID_CHARS_RE = /[^[:alnum:]\u0E47-\u0E4E#{HASHTAG_SEPARATORS}]/ + RECENT_STATUS_LIMIT = 1000 + validates :name, presence: true, format: { with: HASHTAG_NAME_RE } validates :display_name, format: { with: HASHTAG_NAME_RE } validate :validate_name_change, if: -> { !new_record? && name_changed? } @@ -53,7 +55,7 @@ class Tag < ApplicationRecord scope :not_trendable, -> { where(trendable: false) } scope :recently_used, lambda { |account| joins(:statuses) - .where(statuses: { id: account.statuses.select(:id).limit(1000) }) + .where(statuses: { id: account.statuses.select(:id).limit(RECENT_STATUS_LIMIT) }) .group(:id).order(Arel.sql('count(*) desc')) } scope :matches_name, ->(term) { where(arel_table[:name].lower.matches(arel_table.lower("#{sanitize_sql_like(Tag.normalize(term))}%"), nil, true)) } # Search with case-sensitive to use B-tree index diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 6177b7a25..69aaeed0a 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -100,6 +100,38 @@ RSpec.describe Tag do end end + describe '.recently_used' do + let(:account) { Fabricate(:account) } + let(:other_person_status) { Fabricate(:status) } + let(:out_of_range) { Fabricate(:status, account: account) } + let(:older_in_range) { Fabricate(:status, account: account) } + let(:newer_in_range) { Fabricate(:status, account: account) } + let(:unused_tag) { Fabricate(:tag) } + let(:used_tag_one) { Fabricate(:tag) } + let(:used_tag_two) { Fabricate(:tag) } + let(:used_tag_on_out_of_range) { Fabricate(:tag) } + + before do + stub_const 'Tag::RECENT_STATUS_LIMIT', 2 + + other_person_status.tags << used_tag_one + + out_of_range.tags << used_tag_on_out_of_range + + older_in_range.tags << used_tag_one + older_in_range.tags << used_tag_two + + newer_in_range.tags << used_tag_one + end + + it 'returns tags used by account within last X statuses ordered most used first' do + results = described_class.recently_used(account) + + expect(results) + .to eq([used_tag_one, used_tag_two]) + end + end + describe '.find_normalized' do it 'returns tag for a multibyte case-insensitive name' do upcase_string = 'abcABCabcABCやゆよ' From d03fe2bdee45b895a907aa484128cbe96c44b847 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:31:59 -0500 Subject: [PATCH 49/55] N+1 fixes for CLI maintenance command (#28847) --- lib/mastodon/cli/maintenance.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index e2ea86615..73012812f 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -275,7 +275,7 @@ module Mastodon::CLI def deduplicate_users_process_email ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users GROUP BY email HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).includes(:account).to_a ref_user = users.shift say "Multiple users registered with e-mail address #{ref_user.email}.", :yellow say "e-mail will be disabled for the following accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow @@ -289,7 +289,7 @@ module Mastodon::CLI def deduplicate_users_process_confirmation_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE confirmation_token IS NOT NULL GROUP BY confirmation_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).order(created_at: :desc).to_a.drop(1) + users = User.where(id: row['ids'].split(',')).order(created_at: :desc).includes(:account).to_a.drop(1) say "Unsetting confirmation token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -313,7 +313,7 @@ module Mastodon::CLI def deduplicate_users_process_password_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE reset_password_token IS NOT NULL GROUP BY reset_password_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a.drop(1) + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).includes(:account).to_a.drop(1) say "Unsetting password reset token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -591,7 +591,7 @@ module Mastodon::CLI end def deduplicate_local_accounts!(scope) - accounts = scope.order(id: :desc).to_a + accounts = scope.order(id: :desc).includes(:account_stat, :user).to_a say "Multiple local accounts were found for username '#{accounts.first.username}'.", :yellow say 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.', :yellow From 78ee1453f99bbdd1411349ac5b84833ff7b9e6cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:11:37 +0100 Subject: [PATCH 50/55] New Crowdin Translations (automated) (#28857) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/ca.json | 4 ++-- app/javascript/mastodon/locales/pt-BR.json | 2 ++ config/locales/bg.yml | 5 +++++ config/locales/ca.yml | 15 ++++++++++++--- config/locales/de.yml | 8 +++++++- config/locales/devise.ca.yml | 8 ++++---- config/locales/es-AR.yml | 6 ++++++ config/locales/es-MX.yml | 2 ++ config/locales/es.yml | 2 ++ config/locales/et.yml | 7 +++++++ config/locales/eu.yml | 6 ++++++ config/locales/fi.yml | 6 ++++++ config/locales/fo.yml | 6 ++++++ config/locales/fy.yml | 1 + config/locales/he.yml | 6 ++++++ config/locales/hu.yml | 6 ++++++ config/locales/is.yml | 6 ++++++ config/locales/it.yml | 6 ++++++ config/locales/ko.yml | 2 ++ config/locales/lad.yml | 2 ++ config/locales/lt.yml | 7 +++++++ config/locales/nl.yml | 5 +++++ config/locales/nn.yml | 6 ++++++ config/locales/no.yml | 6 ++++++ config/locales/pl.yml | 6 ++++++ config/locales/pt-BR.yml | 7 +++++++ config/locales/pt-PT.yml | 6 ++++++ config/locales/sr-Latn.yml | 6 ++++++ config/locales/sr.yml | 6 ++++++ config/locales/sv.yml | 3 +++ config/locales/tr.yml | 6 ++++++ config/locales/zh-CN.yml | 6 ++++++ config/locales/zh-HK.yml | 6 ++++++ config/locales/zh-TW.yml | 6 ++++++ 34 files changed, 178 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/locales/ca.json b/app/javascript/mastodon/locales/ca.json index 290b364a5..7d1049a30 100644 --- a/app/javascript/mastodon/locales/ca.json +++ b/app/javascript/mastodon/locales/ca.json @@ -150,7 +150,7 @@ "compose_form.poll.duration": "Durada de l'enquesta", "compose_form.poll.option_placeholder": "Opció {number}", "compose_form.poll.remove_option": "Elimina aquesta opció", - "compose_form.poll.switch_to_multiple": "Canvia l’enquesta per a permetre diverses opcions", + "compose_form.poll.switch_to_multiple": "Canvia l’enquesta per a permetre múltiples opcions", "compose_form.poll.switch_to_single": "Canvia l’enquesta per a permetre una única opció", "compose_form.publish": "Tut", "compose_form.publish_form": "Nou tut", @@ -607,7 +607,7 @@ "search.quick_action.status_search": "Tuts coincidint amb {x}", "search.search_or_paste": "Cerca o escriu l'URL", "search_popout.full_text_search_disabled_message": "No disponible a {domain}.", - "search_popout.full_text_search_logged_out_message": "Només disponible en iniciar la sessió.", + "search_popout.full_text_search_logged_out_message": "Només disponible amb la sessió iniciada.", "search_popout.language_code": "Codi de llengua ISO", "search_popout.options": "Opcions de cerca", "search_popout.quick_actions": "Accions ràpides", diff --git a/app/javascript/mastodon/locales/pt-BR.json b/app/javascript/mastodon/locales/pt-BR.json index 482cc8ee7..b8e18e122 100644 --- a/app/javascript/mastodon/locales/pt-BR.json +++ b/app/javascript/mastodon/locales/pt-BR.json @@ -32,6 +32,7 @@ "account.featured_tags.last_status_never": "Sem publicações", "account.featured_tags.title": "Hashtags em destaque de {name}", "account.follow": "Seguir", + "account.follow_back": "Seguir de volta", "account.followers": "Seguidores", "account.followers.empty": "Nada aqui.", "account.followers_counter": "{count, plural, one {{counter} seguidor} other {{counter} seguidores}}", @@ -52,6 +53,7 @@ "account.mute_notifications_short": "Silenciar notificações", "account.mute_short": "Silenciar", "account.muted": "Silenciado", + "account.mutual": "Mútuo", "account.no_bio": "Nenhuma descrição fornecida.", "account.open_original_page": "Abrir a página original", "account.posts": "Toots", diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 58a5cae2f..c3eaa7e4c 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1790,6 +1790,11 @@ bg: extra: Вече е готово за теглене! subject: Вашият архив е готов за изтегляне title: Сваляне на архива + failed_2fa: + details: 'Ето подробности на опита за влизане:' + explanation: Някой се опита да влезе в акаунта ви, но предостави невалиден втори фактор за удостоверяване. + subject: Неуспешен втори фактор за удостоверяване + title: Провал на втория фактор за удостоверяване suspicious_sign_in: change_password: промяна на паролата ви details: 'Ето подробности при вход:' diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 36ebb9785..38ef976b8 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -425,7 +425,7 @@ ca: view: Veure el bloqueig del domini email_domain_blocks: add_new: Afegir nou - allow_registrations_with_approval: Registre permès amb validació + allow_registrations_with_approval: Permet els registres amb validació attempts_over_week: one: "%{count} intent en la darrera setmana" other: "%{count} intents de registre en la darrera setmana" @@ -1046,6 +1046,7 @@ ca: clicking_this_link: en clicar aquest enllaç login_link: inici de sessió proceed_to_login_html: Ara pots passar a %{login_link}. + redirect_to_app_html: Se us hauria d'haver redirigit a l'app %{app_name}. Si això no ha passat, intenteu %{clicking_this_link} o torneu manualment a l'app. registration_complete: La teva inscripció a %{domain} ja és completa. welcome_title: Hola, %{name}! wrong_email_hint: Si aquesta adreça de correu electrònic no és correcte, pots canviar-la en els ajustos del compte. @@ -1109,6 +1110,7 @@ ca: functional: El teu compte està completament operatiu. pending: La vostra sol·licitud està pendent de revisió pel nostre personal. Això pot trigar una mica. Rebreu un correu electrònic quan sigui aprovada. redirecting_to: El teu compte és inactiu perquè actualment està redirigint a %{acct}. + self_destruct: Com que %{domain} tanca, només tindreu accés limitat al vostre compte. view_strikes: Veure accions del passat contra el teu compte too_fast: Formulari enviat massa ràpid, torna a provar-ho. use_security_key: Usa clau de seguretat @@ -1580,6 +1582,7 @@ ca: over_total_limit: Has superat el límit de %{limit} tuts programats too_soon: La data programada ha de ser futura self_destruct: + lead_html: Lamentablement, %{domain} tanca de forma definitiva. Si hi teníeu un compte, no el podreu continuar utilitzant, però podeu demanar una còpia de les vostres dades. title: Aquest servidor tancarà sessions: activity: Última activitat @@ -1784,9 +1787,15 @@ ca: title: Apel·lació rebutjada backup_ready: explanation: Heu demanat una còpia completa de les dades del vostre compte de Mastodon. - extra: Ja us ho podeu baixar + extra: Ja la podeu baixar subject: L'arxiu està preparat per a descàrrega title: Recollida de l'arxiu + failed_2fa: + details: 'Aquests són els detalls de l''intent d''accés:' + explanation: Algú ha intentat accedir al vostre compte però no ha proporcionat un factor de doble autenticació correcte. + further_actions_html: Si no heu estat vosaltres, us recomanem que %{action} immediatament perquè pot estar compromès. + subject: Ha fallat el factor de doble autenticació + title: Ha fallat l'autenticació de doble factor suspicious_sign_in: change_password: canvia la teva contrasenya details: 'Aquest són els detalls de l''inici de sessió:' @@ -1840,7 +1849,7 @@ ca: go_to_sso_account_settings: Ves a la configuració del compte del teu proveïdor d'identitat invalid_otp_token: El codi de dos factors no és correcte otp_lost_help_html: Si has perdut l'accés a tots dos pots contactar per %{email} - rate_limited: Excessius intents d'autenticació, torneu-ho a provar més tard. + rate_limited: Excessius intents d'autenticació, torneu-hi més tard. seamless_external_login: Has iniciat sessió via un servei extern per tant els ajustos de contrasenya i correu electrònic no estan disponibles. signed_in_as: 'Sessió iniciada com a:' verification: diff --git a/config/locales/de.yml b/config/locales/de.yml index e177c6d2d..9568f698d 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1790,8 +1790,14 @@ de: extra: Sie ist jetzt zum Herunterladen bereit! subject: Dein persönliches Archiv kann heruntergeladen werden title: Archiv-Download + failed_2fa: + details: 'Details zum Anmeldeversuch:' + explanation: Jemand hat versucht, sich bei deinem Konto anzumelden, aber die Zwei-Faktor-Authentisierung schlug fehl. + further_actions_html: Solltest du das nicht gewesen sein, empfehlen wir dir, sofort %{action}, da dein Konto möglicherweise kompromittiert ist. + subject: Zwei-Faktor-Authentisierung fehlgeschlagen + title: Zwei-Faktor-Authentisierung fehlgeschlagen suspicious_sign_in: - change_password: dein Passwort ändern + change_password: dein Passwort zu ändern details: 'Hier sind die Details zu den Anmeldeversuchen:' explanation: Wir haben eine Anmeldung zu deinem Konto von einer neuen IP-Adresse festgestellt. further_actions_html: Wenn du das nicht warst, empfehlen wir dir schnellstmöglich, %{action} und die Zwei-Faktor-Authentisierung (2FA) für dein Konto zu aktivieren, um es abzusichern. diff --git a/config/locales/devise.ca.yml b/config/locales/devise.ca.yml index 2bf741ee4..3720d3c5f 100644 --- a/config/locales/devise.ca.yml +++ b/config/locales/devise.ca.yml @@ -49,19 +49,19 @@ ca: subject: 'Mastodon: Instruccions per a reiniciar contrasenya' title: Contrasenya restablerta two_factor_disabled: - explanation: Només es pot accedir amb compte de correu i contrasenya. + explanation: Ara es pot accedir amb només compte de correu i contrasenya. subject: 'Mastodon: Autenticació de doble factor desactivada' subtitle: S'ha deshabilitat l'autenticació de doble factor al vostre compte. title: A2F desactivada two_factor_enabled: - explanation: Per accedir fa falta un token generat per l'aplicació TOTP aparellada. + explanation: Per accedir cal un token generat per l'aplicació TOTP aparellada. subject: 'Mastodon: Autenticació de doble factor activada' subtitle: S'ha habilitat l'autenticació de doble factor al vostre compte. title: A2F activada two_factor_recovery_codes_changed: explanation: Els codis de recuperació anteriors ja no són vàlids i se n'han generat de nous. subject: 'Mastodon: codis de recuperació de doble factor regenerats' - subtitle: S'han invalidat els codis de recuperació anteriors i se n'ha generat de nous. + subtitle: S'han invalidat els codis de recuperació anteriors i se n'han generat de nous. title: Codis de recuperació A2F canviats unlock_instructions: subject: 'Mastodon: Instruccions per a desblocar' @@ -76,7 +76,7 @@ ca: title: Una de les teves claus de seguretat ha estat esborrada webauthn_disabled: explanation: S'ha deshabilitat l'autenticació amb claus de seguretat al vostre compte. - extra: Ara només podeu accedir amb el token generat amb l'aplicació TOTP aparellada. + extra: Ara es pot accedir amb només el token generat amb l'aplicació TOTP aparellada. subject: 'Mastodon: S''ha desactivat l''autenticació amb claus de seguretat' title: Claus de seguretat desactivades webauthn_enabled: diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 0b6e58db5..cc55d3d3f 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -1790,6 +1790,12 @@ es-AR: extra: "¡Ya está lista para descargar!" subject: Tu archivo historial está listo para descargar title: Descargar archivo historial + failed_2fa: + details: 'Estos son los detalles del intento de inicio de sesión:' + explanation: Alguien intentó iniciar sesión en tu cuenta pero proporcionó un segundo factor de autenticación no válido. + further_actions_html: Si vos no fuiste, te recomendamos que %{action} inmediatamente, ya que la seguridad de tu cuenta podría estar comprometida. + subject: Fallo de autenticación del segundo factor + title: Fallo en la autenticación del segundo factor suspicious_sign_in: change_password: cambiés tu contraseña details: 'Acá están los detalles del inicio de sesión:' diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index 11c327bcc..040d8a9d3 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -1790,6 +1790,8 @@ es-MX: extra: "¡Ya está listo para descargar!" subject: Tu archivo está preparado para descargar title: Descargar archivo + failed_2fa: + details: 'Estos son los detalles del intento de inicio de sesión:' suspicious_sign_in: change_password: cambies tu contraseña details: 'Aquí están los detalles del inicio de sesión:' diff --git a/config/locales/es.yml b/config/locales/es.yml index 4dbb76c52..ffe3eb5b0 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1790,6 +1790,8 @@ es: extra: "¡Ya está listo para descargar!" subject: Tu archivo está preparado para descargar title: Descargar archivo + failed_2fa: + details: 'Estos son los detalles del intento de inicio de sesión:' suspicious_sign_in: change_password: cambies tu contraseña details: 'Aquí están los detalles del inicio de sesión:' diff --git a/config/locales/et.yml b/config/locales/et.yml index 71f49e1ab..f82ee6cb8 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -1792,6 +1792,12 @@ et: extra: See on nüüd allalaadimiseks valmis! subject: Arhiiv on allalaadimiseks valmis title: Arhiivi väljavõte + failed_2fa: + details: 'Sisenemise üksikasjad:' + explanation: Keegi püüdis Su kontole siseneda, ent sisestas vale teisese autentimisfaktori. + further_actions_html: Kui see polnud Sina, siis soovitame viivitamata %{action}, kuna see võib olla lekkinud. + subject: Kaheastmelise autentimise nurjumine + title: Kaheastmeline autentimine nurjus suspicious_sign_in: change_password: muuta oma salasõna details: 'Sisenemise üksikasjad:' @@ -1848,6 +1854,7 @@ et: go_to_sso_account_settings: Mine oma idenditeedipakkuja kontosätetesse invalid_otp_token: Vale kaheastmeline võti otp_lost_help_html: Kui kaotasid ligipääsu mõlemale, saad võtta ühendust %{email}-iga + rate_limited: Liiga palju autentimise katseid, proovi hiljem uuesti. seamless_external_login: Välise teenuse kaudu sisse logides pole salasõna ja e-posti sätted saadaval. signed_in_as: 'Sisse logitud kasutajana:' verification: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index bfa1f829b..bd6ea8c83 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1794,6 +1794,12 @@ eu: extra: Deskargatzeko prest! subject: Zure artxiboa deskargatzeko prest dago title: Artxiboa jasotzea + failed_2fa: + details: 'Hemen dituzu saio-hasieraren saiakeraren xehetasunak:' + explanation: Norbait zure kontuan saioa hasten saiatu da, baina bigarren autentifikazioaren faktore baliogabea eman du. + further_actions_html: Ez bazara zu izan, "%{action}" ekintza berehala egitea gomendatzen dugu, kontua arriskarazi daiteke eta. + subject: Autentifikazioaren bigarren faktoreak huts egin du + title: Huts egin duen autentifikazioaren bigarren faktorea suspicious_sign_in: change_password: aldatu pasahitza details: 'Hemen daude saio hasieraren xehetasunak:' diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 9d8974392..8e61c7b2a 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1790,6 +1790,12 @@ fi: extra: Se on nyt valmis ladattavaksi! subject: Arkisto on valmiina ladattavaksi title: Arkiston tallennus + failed_2fa: + details: 'Tässä on tiedot kirjautumisyrityksestä:' + explanation: Joku on yrittänyt kirjautua tilillesi, mutta antanut virheellisen kaksivaiheisen todennuksen. + further_actions_html: Jos se et ollut sinä, suosittelemme, että %{action} välittömästi, sillä se on saattanut vaarantua. + subject: Kaksivaiheisen todennuksen virhe + title: Epäonnistunut kaksivaiheinen todennus suspicious_sign_in: change_password: vaihda salasanasi details: 'Tässä on tiedot kirjautumisesta:' diff --git a/config/locales/fo.yml b/config/locales/fo.yml index dabaf24ba..8e3426531 100644 --- a/config/locales/fo.yml +++ b/config/locales/fo.yml @@ -1790,6 +1790,12 @@ fo: extra: Tað er nú klárt at taka niður! subject: Savnið hjá tær er tøkt at taka niður title: Tak savn niður + failed_2fa: + details: 'Her eru smálutirnir í innritanarroyndini:' + explanation: Onkur hevur roynt at rita inn á tína kontu, men gav eitt ógildugt seinna samgildi. + further_actions_html: Um hetta ikki var tú, so skjóta vit upp, at tú %{action} beinan vegin, tí tað kann vera sett í vanda. + subject: Seinna samgildi miseydnaðist + title: Miseydnað seinna samgildi suspicious_sign_in: change_password: broyt loyniorðið hjá tær details: 'Her eru smálutirnir í innritanini:' diff --git a/config/locales/fy.yml b/config/locales/fy.yml index 1d648f479..f861bc3e4 100644 --- a/config/locales/fy.yml +++ b/config/locales/fy.yml @@ -1843,6 +1843,7 @@ fy: go_to_sso_account_settings: Gean nei de accountynstellingen fan jo identiteitsprovider invalid_otp_token: Unjildige twa-stapstagongskoade otp_lost_help_html: As jo tagong ta beide kwytrekke binne, nim dan kontakt op fia %{email} + rate_limited: Te folle autentikaasjebesykjen, probearje it letter opnij. seamless_external_login: Jo binne oanmeld fia in eksterne tsjinst, dêrom binne wachtwurden en e-mailynstellingen net beskikber. signed_in_as: 'Oanmeld as:' verification: diff --git a/config/locales/he.yml b/config/locales/he.yml index db57912d8..1f5fd096a 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1854,6 +1854,12 @@ he: extra: הגיבוי מוכן להורדה! subject: הארכיון שלך מוכן להורדה title: הוצאת ארכיון + failed_2fa: + details: 'הנה פרטי נסיון ההתחברות:' + explanation: פולני אלמוני ניסה להתחבר לחשבונך אך האימות המשני נכשל. + further_actions_html: אם הנסיון לא היה שלך, אנו ממליצים על %{action} באופן מיידי כדי שהחשבון לא יפול קורבן. + subject: נכשל אימות בגורם שני + title: אימות בגורם שני נכשל suspicious_sign_in: change_password: שינוי הסיסמא שלך details: 'הנה פרטי ההתחברות:' diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 8fce206e9..2870435ea 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1790,6 +1790,12 @@ hu: extra: Már letöltésre kész! subject: Az adataidról készült archív letöltésre kész title: Archiválás + failed_2fa: + details: 'Itt vannak a bejelentkezési kísérlet részletei:' + explanation: Valaki megpróbált bejelentkezni a fiókodba, de a második hitelesítési lépése érvénytelen volt. + further_actions_html: Ha ez nem te voltál, azt javasoljuk, hogy azonnal %{action}, mivel lehetséges, hogy az rossz kezekbe került. + subject: Második körös hitelesítés sikertelen + title: Sikertelen a második körös hitelesítés suspicious_sign_in: change_password: módosítsd a jelszavad details: 'Itt vannak a bejelentkezés részletei:' diff --git a/config/locales/is.yml b/config/locales/is.yml index b048d5cb0..191383f56 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -1794,6 +1794,12 @@ is: extra: Það er núna tilbúið til niðurhals! subject: Safnskráin þín er tilbúin til niðurhals title: Taka út í safnskrá + failed_2fa: + details: 'Hér eru nánari upplýsingar um innskráningartilraunina:' + explanation: Einhver reyndi að skrá sig inn á aðganginn þinn en gaf upp ógild gögn seinna þrepi auðkenningar. + further_actions_html: Ef þetta varst ekki þú, þá mælum við eindregið með því að þú %{action} samstundis, þar sem það gæti verið berskjaldað. + subject: Bilun í seinna þrepi auðkenningar + title: Seinna þrep auðkenningar brást suspicious_sign_in: change_password: breytir lykilorðinu þínu details: 'Hér eru nánari upplýsingar um innskráninguna:' diff --git a/config/locales/it.yml b/config/locales/it.yml index adcef9559..89ff071f3 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1792,6 +1792,12 @@ it: extra: Ora è pronto per il download! subject: Il tuo archivio è pronto per essere scaricato title: Esportazione archivio + failed_2fa: + details: 'Questi sono i dettagli del tentativo di accesso:' + explanation: Qualcuno ha tentato di accedere al tuo account ma ha fornito un secondo fattore di autenticazione non valido. + further_actions_html: Se non eri tu, ti consigliamo di %{action} immediatamente poiché potrebbe essere compromesso. + subject: Errore di autenticazione del secondo fattore + title: Autenticazione del secondo fattore non riuscita suspicious_sign_in: change_password: cambiare la tua password details: 'Questi sono i dettagli del tentativo di accesso:' diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 946aa3565..b3c786e26 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1760,6 +1760,8 @@ ko: extra: 다운로드 할 준비가 되었습니다! subject: 아카이브를 다운로드할 수 있습니다 title: 아카이브 테이크아웃 + failed_2fa: + details: '로그인 시도에 대한 상세 정보입니다:' suspicious_sign_in: change_password: 암호 변경 details: '로그인에 대한 상세 정보입니다:' diff --git a/config/locales/lad.yml b/config/locales/lad.yml index 5a09c4c60..be5d2d21b 100644 --- a/config/locales/lad.yml +++ b/config/locales/lad.yml @@ -1757,6 +1757,8 @@ lad: extra: Agora esta pronto para abashar! subject: Tu dosya esta pronta para abashar title: Abasha dosya + failed_2fa: + details: 'Aki estan los peratim de las provas de koneksyon kon tu kuento:' suspicious_sign_in: change_password: troka tu kod details: 'Aki estan los peratim de la koneksyon kon tu kuento:' diff --git a/config/locales/lt.yml b/config/locales/lt.yml index f3715fd2e..ba8b53fdc 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -559,6 +559,12 @@ lt: extra: Jį jau galima atsisiųsti! subject: Jūsų archyvas paruoštas parsisiuntimui title: Archyvas išimtas + failed_2fa: + details: 'Štai išsami informacija apie bandymą prisijungti:' + explanation: Kažkas bandė prisijungti prie tavo paskyros, bet nurodė netinkamą antrąjį tapatybės nustatymo veiksnį. + further_actions_html: Jei tai buvo ne tu, rekomenduojame nedelsiant imtis %{action}, nes jis gali būti pažeistas. + subject: Antrojo veiksnio tapatybės nustatymas nesėkmingai + title: Nepavyko atlikti antrojo veiksnio tapatybės nustatymo warning: subject: disable: Jūsų paskyra %{acct} buvo užšaldyta @@ -584,6 +590,7 @@ lt: go_to_sso_account_settings: Eik į savo tapatybės teikėjo paskyros nustatymus invalid_otp_token: Netinkamas dviejų veiksnių kodas otp_lost_help_html: Jei praradai prieigą prie abiejų, gali susisiek su %{email} + rate_limited: Per daug tapatybės nustatymo bandymų. Bandyk dar kartą vėliau. seamless_external_login: Esi prisijungęs (-usi) per išorinę paslaugą, todėl slaptažodžio ir el. pašto nustatymai nepasiekiami. signed_in_as: 'Prisijungta kaip:' verification: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 5ffa788a8..2d27f9165 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1790,6 +1790,11 @@ nl: extra: Het staat nu klaar om te worden gedownload! subject: Jouw archief staat klaar om te worden gedownload title: Archief ophalen + failed_2fa: + details: 'Hier zijn details van de aanmeldpoging:' + explanation: Iemand heeft geprobeerd om in te loggen op uw account maar heeft een ongeldige tweede verificatiefactor opgegeven. + subject: Tweede factor authenticatiefout + title: Tweestapsverificatie mislukt suspicious_sign_in: change_password: je wachtwoord te wijzigen details: 'Hier zijn de details van inlogpoging:' diff --git a/config/locales/nn.yml b/config/locales/nn.yml index 626252be0..95eed4978 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -1790,6 +1790,12 @@ nn: extra: Den er nå klar for nedlasting! subject: Arkivet ditt er klart til å lastes ned title: Nedlasting av arkiv + failed_2fa: + details: 'Her er detaljane om innloggingsforsøket:' + explanation: Nokon har prøvd å logge inn på kontoen din, men brukte ein ugyldig andre-autentiseringsfaktor. + further_actions_html: Om dette ikkje var deg, rår me deg til å %{action} med éin gong, då det kan vere kompomittert. + subject: To-faktor-autentiseringsfeil + title: Mislukka to-faktor-autentisering suspicious_sign_in: change_password: endre passord details: 'Her er påloggingsdetaljane:' diff --git a/config/locales/no.yml b/config/locales/no.yml index d90aa5bab..7ece8564f 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -1790,6 +1790,12 @@ extra: Den er nå klar for nedlasting! subject: Arkivet ditt er klart til å lastes ned title: Nedlasting av arkiv + failed_2fa: + details: 'Her er detaljer om påloggingsforsøket:' + explanation: Noen har prøvd å logge på kontoen din, men ga en ugyldig andre-autentiseringsfaktor. + further_actions_html: Hvis dette ikke var deg, anbefaler vi at du %{action} umiddelbart fordi det kan ha blitt kompromittert. + subject: Andre-autentiseringsfaktorfeil + title: Mislykket andre-autentiseringsfaktor suspicious_sign_in: change_password: endre passord details: 'Her er detaljer om påloggingen:' diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 4d8fde8f4..6718f1994 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1854,6 +1854,12 @@ pl: extra: Gotowe do pobrania! subject: Twoje archiwum jest gotowe do pobrania title: Odbiór archiwum + failed_2fa: + details: 'Oto szczegóły próby logowania:' + explanation: Ktoś próbował zalogować się na twoje konto, ale nie przeszedł drugiego etapu autoryzacji. + further_actions_html: Jeśli to nie ty, polecamy natychmiastowo %{action}, bo może ono być narażone. + subject: Błąd drugiego etapu uwierzytelniania + title: Nieudane uwierzytelnienie w drugim etapie suspicious_sign_in: change_password: zmień hasło details: 'Oto szczegóły logowania:' diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 47ad0ac44..c1a47c016 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1789,6 +1789,12 @@ pt-BR: extra: Agora está pronto para baixar! subject: Seu arquivo está pronto para ser baixado title: Baixar arquivo + failed_2fa: + details: 'Aqui estão os detalhes da tentativa de acesso:' + explanation: Alguém tentou entrar em sua conta, mas forneceu um segundo fator de autenticação inválido. + further_actions_html: Se não foi você, recomendamos que %{action} imediatamente, pois ela pode ser comprometida. + subject: Falha na autenticação do segundo fator + title: Falha na autenticação do segundo fator suspicious_sign_in: change_password: Altere sua senha details: 'Aqui estão os detalhes do acesso:' @@ -1842,6 +1848,7 @@ pt-BR: go_to_sso_account_settings: Vá para as configurações de conta do seu provedor de identidade invalid_otp_token: Código de dois fatores inválido otp_lost_help_html: Se você perder o acesso à ambos, você pode entrar em contato com %{email} + rate_limited: Muitas tentativas de autenticação; tente novamente mais tarde. seamless_external_login: Você entrou usando um serviço externo, então configurações de e-mail e senha não estão disponíveis. signed_in_as: 'Entrou como:' verification: diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 2e077b37a..268531718 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1790,6 +1790,12 @@ pt-PT: extra: Está pronta para transferir! subject: O seu arquivo está pronto para descarregar title: Arquivo de ficheiros + failed_2fa: + details: 'Aqui estão os detalhes da tentativa de entrada:' + explanation: Alguém tentou entrar em sua conta mas forneceu um segundo fator de autenticação inválido. + further_actions_html: Se não foi você, recomendamos que %{action} imediatamente, pois pode ter sido comprometido. + subject: Falha na autenticação do segundo fator + title: Falha na autenticação do segundo fator suspicious_sign_in: change_password: alterar a sua palavra-passe details: 'Eis os pormenores do início de sessão:' diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index 39c9f2f87..9cb555c94 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -1822,6 +1822,12 @@ sr-Latn: extra: Sada je spremno za preuzimanje! subject: Vaša arhiva je spremna za preuzimanje title: Izvoz arhive + failed_2fa: + details: 'Evo detalja o pokušaju prijavljivanja:' + explanation: Neko je pokušao da se prijavi na vaš nalog ali je dao nevažeći drugi faktor autentifikacije. + further_actions_html: Ako to niste bili vi, preporučujemo vam da odmah %{action} jer može biti ugrožena. + subject: Neuspeh drugog faktora autentifikacije + title: Nije uspeo drugi faktor autentifikacije suspicious_sign_in: change_password: promenite svoju lozinku details: 'Evo detalja o prijavi:' diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 0cf35c14c..e1c2e992e 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1822,6 +1822,12 @@ sr: extra: Сада је спремно за преузимање! subject: Ваша архива је спремна за преузимање title: Извоз архиве + failed_2fa: + details: 'Ево детаља о покушају пријављивања:' + explanation: Неко је покушао да се пријави на ваш налог али је дао неважећи други фактор аутентификације. + further_actions_html: Ако то нисте били ви, препоручујемо вам да одмах %{action} јер може бити угрожена. + subject: Неуспех другог фактора аутентификације + title: Није успео други фактор аутентификације suspicious_sign_in: change_password: промените своју лозинку details: 'Ево детаља о пријави:' diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 3a82f29d2..c9000d50f 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1789,6 +1789,9 @@ sv: extra: Nu redo för nedladdning! subject: Ditt arkiv är klart för nedladdning title: Arkivuttagning + failed_2fa: + further_actions_html: Om detta inte var du, rekommenderar vi att du %{action} omedelbart eftersom ditt konto kan ha äventyrats. + title: Misslyckad tvåfaktorsautentisering suspicious_sign_in: change_password: Ändra ditt lösenord details: 'Här är inloggningsdetaljerna:' diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 3b74c4eaa..fa84d2a96 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1790,6 +1790,12 @@ tr: extra: Şimdi indirebilirsiniz! subject: Arşiviniz indirilmeye hazır title: Arşiv paketlemesi + failed_2fa: + details: 'Oturum açma denemesinin ayrıntıları şöyledir:' + explanation: Birisi hesabınızda oturum açmaya çalıştı ancak hatalı bir iki aşamalı doğrulama kodu kullandı. + further_actions_html: Eğer bu kişi siz değilseniz, hemen %{action} yapmanızı öneriyoruz çünkü hesabınız ifşa olmuş olabilir. + subject: İki aşamalı doğrulama başarısızlığı + title: Başarısız iki aşamalı kimlik doğrulama suspicious_sign_in: change_password: parolanızı değiştirin details: 'Oturum açma ayrıntıları şöyledir:' diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 80bb5653c..272787ce2 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1758,6 +1758,12 @@ zh-CN: extra: 现在它可以下载了! subject: 你的存档已经准备完毕 title: 存档导出 + failed_2fa: + details: 以下是该次登录尝试的详情: + explanation: 有人试图登录到您的账户,但提供了无效的辅助认证因子。 + further_actions_html: 如果这不是您所为,您的密码可能已经泄露,建议您立即 %{action} 。 + subject: 辅助认证失败 + title: 辅助认证失败 suspicious_sign_in: change_password: 更改密码 details: 以下是该次登录的详细信息: diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index ac32c03e9..0c39aa8c0 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -1758,6 +1758,12 @@ zh-HK: extra: 現在可以下載了! subject: 你的備份檔已可供下載 title: 檔案匯出 + failed_2fa: + details: 以下是嘗試登入的細節: + explanation: 有人嘗試登入你的帳號,但沒有通過雙重認證。 + further_actions_html: 如果這不是你,我們建議你立刻%{action},因為你的帳號或已遭到侵害。 + subject: 雙重認證失敗 + title: 雙重認證失敗 suspicious_sign_in: change_password: 更改你的密碼 details: 以下是登入的細節: diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 6662e44cd..8726ea72a 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1760,6 +1760,12 @@ zh-TW: extra: 準備好下載了! subject: 您的備份檔已可供下載 title: 檔案匯出 + failed_2fa: + details: 以下是該登入嘗試之詳細資訊: + explanation: 有人嘗試登入您的帳號,但提供了無效的第二個驗證因子。 + further_actions_html: 若這並非您所為,我們建議您立刻 %{action},因為其可能已被入侵。 + subject: 第二因子驗證失敗 + title: 第二因子身份驗證失敗 suspicious_sign_in: change_password: 變更密碼 details: 以下是該登入之詳細資訊: From ceade78182e882f3a045d4c6c748743bfc0b8f5e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 06:41:34 -0500 Subject: [PATCH 51/55] Fix `Rails/WhereExists` cop in app/services (#28853) --- .rubocop_todo.yml | 2 -- app/services/activitypub/fetch_remote_status_service.rb | 2 +- app/services/vote_service.rb | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c0fb7a5ce..bef79e451 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -86,8 +86,6 @@ Rails/WhereExists: - 'app/models/status.rb' - 'app/policies/status_policy.rb' - 'app/serializers/rest/announcement_serializer.rb' - - 'app/services/activitypub/fetch_remote_status_service.rb' - - 'app/services/vote_service.rb' - 'app/workers/move_worker.rb' - 'spec/models/account_spec.rb' - 'spec/services/activitypub/process_collection_service_spec.rb' diff --git a/app/services/activitypub/fetch_remote_status_service.rb b/app/services/activitypub/fetch_remote_status_service.rb index a491b32b2..e3a9b60b5 100644 --- a/app/services/activitypub/fetch_remote_status_service.rb +++ b/app/services/activitypub/fetch_remote_status_service.rb @@ -44,7 +44,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService # If we fetched a status that already exists, then we need to treat the # activity as an update rather than create - activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.where(uri: object_uri, account_id: actor.id).exists? + activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.exists?(uri: object_uri, account_id: actor.id) with_redis do |redis| discoveries = redis.incr("status_discovery_per_request:#{@request_id}") diff --git a/app/services/vote_service.rb b/app/services/vote_service.rb index 3e92a1690..878350388 100644 --- a/app/services/vote_service.rb +++ b/app/services/vote_service.rb @@ -19,7 +19,7 @@ class VoteService < BaseService already_voted = true with_redis_lock("vote:#{@poll.id}:#{@account.id}") do - already_voted = @poll.votes.where(account: @account).exists? + already_voted = @poll.votes.exists?(account: @account) ApplicationRecord.transaction do @choices.each do |choice| From c0e8e457abee9d6f6dd20338bdaac90cb9e1f7bc Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 06:41:54 -0500 Subject: [PATCH 52/55] Eager loading fixes for `api/` controllers (#28848) --- .../api/v1/accounts/follower_accounts_controller.rb | 2 +- .../api/v1/accounts/following_accounts_controller.rb | 2 +- app/controllers/api/v1/blocks_controller.rb | 2 +- app/controllers/api/v1/directories_controller.rb | 2 +- app/controllers/api/v1/endorsements_controller.rb | 2 +- app/controllers/api/v1/follow_requests_controller.rb | 2 +- app/controllers/api/v1/lists/accounts_controller.rb | 4 ++-- app/controllers/api/v1/mutes_controller.rb | 2 +- .../api/v1/statuses/favourited_by_accounts_controller.rb | 2 +- .../api/v1/statuses/reblogged_by_accounts_controller.rb | 2 +- app/controllers/api/v2/filters_controller.rb | 2 +- app/models/account_suggestions.rb | 2 +- app/models/report.rb | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/api/v1/accounts/follower_accounts_controller.rb b/app/controllers/api/v1/accounts/follower_accounts_controller.rb index d6a5a7176..f60181f1e 100644 --- a/app/controllers/api/v1/accounts/follower_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/follower_accounts_controller.rb @@ -30,7 +30,7 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController end def default_accounts - Account.includes(:active_relationships, :account_stat).references(:active_relationships) + Account.includes(:active_relationships, :account_stat, :user).references(:active_relationships) end def paginated_follows diff --git a/app/controllers/api/v1/accounts/following_accounts_controller.rb b/app/controllers/api/v1/accounts/following_accounts_controller.rb index b8578ef53..3ab8c1efd 100644 --- a/app/controllers/api/v1/accounts/following_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/following_accounts_controller.rb @@ -30,7 +30,7 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController end def default_accounts - Account.includes(:passive_relationships, :account_stat).references(:passive_relationships) + Account.includes(:passive_relationships, :account_stat, :user).references(:passive_relationships) end def paginated_follows diff --git a/app/controllers/api/v1/blocks_controller.rb b/app/controllers/api/v1/blocks_controller.rb index 06a8bfa89..0934622f8 100644 --- a/app/controllers/api/v1/blocks_controller.rb +++ b/app/controllers/api/v1/blocks_controller.rb @@ -17,7 +17,7 @@ class Api::V1::BlocksController < Api::BaseController end def paginated_blocks - @paginated_blocks ||= Block.eager_load(target_account: :account_stat) + @paginated_blocks ||= Block.eager_load(target_account: [:account_stat, :user]) .joins(:target_account) .merge(Account.without_suspended) .where(account: current_account) diff --git a/app/controllers/api/v1/directories_controller.rb b/app/controllers/api/v1/directories_controller.rb index e79b20ce4..6c540404e 100644 --- a/app/controllers/api/v1/directories_controller.rb +++ b/app/controllers/api/v1/directories_controller.rb @@ -27,7 +27,7 @@ class Api::V1::DirectoriesController < Api::BaseController scope.merge!(local_account_scope) if local_accounts? scope.merge!(account_exclusion_scope) if current_account scope.merge!(account_domain_block_scope) if current_account && !local_accounts? - end + end.includes(:account_stat, user: :role) end def local_accounts? diff --git a/app/controllers/api/v1/endorsements_controller.rb b/app/controllers/api/v1/endorsements_controller.rb index 46e3fcd64..2216a9860 100644 --- a/app/controllers/api/v1/endorsements_controller.rb +++ b/app/controllers/api/v1/endorsements_controller.rb @@ -25,7 +25,7 @@ class Api::V1::EndorsementsController < Api::BaseController end def endorsed_accounts - current_account.endorsed_accounts.includes(:account_stat).without_suspended + current_account.endorsed_accounts.includes(:account_stat, :user).without_suspended end def insert_pagination_headers diff --git a/app/controllers/api/v1/follow_requests_controller.rb b/app/controllers/api/v1/follow_requests_controller.rb index ee717ebbc..87f6df5f9 100644 --- a/app/controllers/api/v1/follow_requests_controller.rb +++ b/app/controllers/api/v1/follow_requests_controller.rb @@ -37,7 +37,7 @@ class Api::V1::FollowRequestsController < Api::BaseController end def default_accounts - Account.without_suspended.includes(:follow_requests, :account_stat).references(:follow_requests) + Account.without_suspended.includes(:follow_requests, :account_stat, :user).references(:follow_requests) end def paginated_follow_requests diff --git a/app/controllers/api/v1/lists/accounts_controller.rb b/app/controllers/api/v1/lists/accounts_controller.rb index 8e12cb7b6..0604ad60f 100644 --- a/app/controllers/api/v1/lists/accounts_controller.rb +++ b/app/controllers/api/v1/lists/accounts_controller.rb @@ -37,9 +37,9 @@ class Api::V1::Lists::AccountsController < Api::BaseController def load_accounts if unlimited? - @list.accounts.without_suspended.includes(:account_stat).all + @list.accounts.without_suspended.includes(:account_stat, :user).all else - @list.accounts.without_suspended.includes(:account_stat).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id]) + @list.accounts.without_suspended.includes(:account_stat, :user).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id]) end end diff --git a/app/controllers/api/v1/mutes_controller.rb b/app/controllers/api/v1/mutes_controller.rb index 555485823..2fb685ac3 100644 --- a/app/controllers/api/v1/mutes_controller.rb +++ b/app/controllers/api/v1/mutes_controller.rb @@ -17,7 +17,7 @@ class Api::V1::MutesController < Api::BaseController end def paginated_mutes - @paginated_mutes ||= Mute.eager_load(:target_account) + @paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user]) .joins(:target_account) .merge(Account.without_suspended) .where(account: current_account) diff --git a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb index 98b69c347..069ad37cb 100644 --- a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb @@ -21,7 +21,7 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::V1::Statuses::Bas def default_accounts Account .without_suspended - .includes(:favourites, :account_stat) + .includes(:favourites, :account_stat, :user) .references(:favourites) .where(favourites: { status_id: @status.id }) end diff --git a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb index aacab5f8f..b8a997518 100644 --- a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb @@ -19,7 +19,7 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::V1::Statuses::Base end def default_accounts - Account.without_suspended.includes(:statuses, :account_stat).references(:statuses) + Account.without_suspended.includes(:statuses, :account_stat, :user).references(:statuses) end def paginated_statuses diff --git a/app/controllers/api/v2/filters_controller.rb b/app/controllers/api/v2/filters_controller.rb index 2fcdeeae4..09d4813f3 100644 --- a/app/controllers/api/v2/filters_controller.rb +++ b/app/controllers/api/v2/filters_controller.rb @@ -35,7 +35,7 @@ class Api::V2::FiltersController < Api::BaseController private def set_filters - @filters = current_account.custom_filters.includes(:keywords) + @filters = current_account.custom_filters.includes(:keywords, :statuses) end def set_filter diff --git a/app/models/account_suggestions.rb b/app/models/account_suggestions.rb index d62176c7c..25c8b04d5 100644 --- a/app/models/account_suggestions.rb +++ b/app/models/account_suggestions.rb @@ -29,7 +29,7 @@ class AccountSuggestions # a complicated query on this end. account_ids = account_ids_with_sources[offset, limit] - accounts_map = Account.where(id: account_ids.map(&:first)).includes(:account_stat).index_by(&:id) + accounts_map = Account.where(id: account_ids.map(&:first)).includes(:account_stat, :user).index_by(&:id) account_ids.filter_map do |(account_id, source)| next unless accounts_map.key?(account_id) diff --git a/app/models/report.rb b/app/models/report.rb index 126701b3d..38da26d7b 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -41,7 +41,7 @@ class Report < ApplicationRecord scope :unresolved, -> { where(action_taken_at: nil) } scope :resolved, -> { where.not(action_taken_at: nil) } - scope :with_accounts, -> { includes([:account, :target_account, :action_taken_by_account, :assigned_account].index_with({ user: [:invite_request, :invite] })) } + scope :with_accounts, -> { includes([:account, :target_account, :action_taken_by_account, :assigned_account].index_with([:account_stat, { user: [:invite_request, :invite, :ips] }])) } # A report is considered local if the reporter is local delegate :local?, to: :account From 61a0ec69fcf5565a96c2cc53167f74e6ff0391d8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:44:50 +0100 Subject: [PATCH 53/55] chore(deps): update devdependencies (non-major) (#28840) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renaud Chaput --- .devcontainer/codespaces/devcontainer.json | 18 ++++----- .devcontainer/devcontainer.json | 16 ++++---- jsconfig.json | 4 +- streaming/tsconfig.json | 4 +- tsconfig.json | 8 ++-- yarn.lock | 46 +++++++++++----------- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.devcontainer/codespaces/devcontainer.json b/.devcontainer/codespaces/devcontainer.json index ca9156fda..b32e4026d 100644 --- a/.devcontainer/codespaces/devcontainer.json +++ b/.devcontainer/codespaces/devcontainer.json @@ -5,7 +5,7 @@ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { - "ghcr.io/devcontainers/features/sshd:1": {} + "ghcr.io/devcontainers/features/sshd:1": {}, }, "runServices": ["app", "db", "redis"], @@ -15,16 +15,16 @@ "portsAttributes": { "3000": { "label": "web", - "onAutoForward": "notify" + "onAutoForward": "notify", }, "4000": { "label": "stream", - "onAutoForward": "silent" - } + "onAutoForward": "silent", + }, }, "otherPortsAttributes": { - "onAutoForward": "silent" + "onAutoForward": "silent", }, "remoteEnv": { @@ -33,7 +33,7 @@ "STREAMING_API_BASE_URL": "https://${localEnv:CODESPACE_NAME}-4000.app.github.dev", "DISABLE_FORGERY_REQUEST_PROTECTION": "true", "ES_ENABLED": "", - "LIBRE_TRANSLATE_ENDPOINT": "" + "LIBRE_TRANSLATE_ENDPOINT": "", }, "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", @@ -43,7 +43,7 @@ "customizations": { "vscode": { "settings": {}, - "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"] - } - } + "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"], + }, + }, } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fa8d6542c..ed71235b3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { - "ghcr.io/devcontainers/features/sshd:1": {} + "ghcr.io/devcontainers/features/sshd:1": {}, }, "forwardPorts": [3000, 4000], @@ -14,17 +14,17 @@ "3000": { "label": "web", "onAutoForward": "notify", - "requireLocalPort": true + "requireLocalPort": true, }, "4000": { "label": "stream", "onAutoForward": "silent", - "requireLocalPort": true - } + "requireLocalPort": true, + }, }, "otherPortsAttributes": { - "onAutoForward": "silent" + "onAutoForward": "silent", }, "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", @@ -34,7 +34,7 @@ "customizations": { "vscode": { "settings": {}, - "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"] - } - } + "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"], + }, + }, } diff --git a/jsconfig.json b/jsconfig.json index d52816a98..7b710de83 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -11,7 +11,7 @@ "noEmit": true, "resolveJsonModule": true, "strict": false, - "target": "ES2022" + "target": "ES2022", }, - "exclude": ["**/build/*", "**/node_modules/*", "**/public/*", "**/vendor/*"] + "exclude": ["**/build/*", "**/node_modules/*", "**/public/*", "**/vendor/*"], } diff --git a/streaming/tsconfig.json b/streaming/tsconfig.json index f7bb711b9..a0cf68ef9 100644 --- a/streaming/tsconfig.json +++ b/streaming/tsconfig.json @@ -6,7 +6,7 @@ "moduleResolution": "node", "noUnusedParameters": false, "tsBuildInfoFile": "../tmp/cache/streaming/tsconfig.tsbuildinfo", - "paths": {} + "paths": {}, }, - "include": ["./*.js", "./.eslintrc.js"] + "include": ["./*.js", "./.eslintrc.js"], } diff --git a/tsconfig.json b/tsconfig.json index a193ea35f..dc71fc4a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,12 +15,12 @@ "paths": { "mastodon": ["app/javascript/mastodon"], "mastodon/*": ["app/javascript/mastodon/*"], - "@/*": ["app/javascript/*"] - } + "@/*": ["app/javascript/*"], + }, }, "include": [ "app/javascript/mastodon", "app/javascript/packs", - "app/javascript/types" - ] + "app/javascript/types", + ], } diff --git a/yarn.lock b/yarn.lock index aca2278f9..61f699d19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1538,7 +1538,7 @@ __metadata: languageName: node linkType: hard -"@csstools/css-parser-algorithms@npm:^2.4.0": +"@csstools/css-parser-algorithms@npm:^2.5.0": version: 2.5.0 resolution: "@csstools/css-parser-algorithms@npm:2.5.0" peerDependencies: @@ -1547,14 +1547,14 @@ __metadata: languageName: node linkType: hard -"@csstools/css-tokenizer@npm:^2.2.2": +"@csstools/css-tokenizer@npm:^2.2.3": version: 2.2.3 resolution: "@csstools/css-tokenizer@npm:2.2.3" checksum: 557266ec52e8b36c19008a5bbd7151effba085cdd6d68270c01afebf914981caac698eda754b2a530a8a9947a3dd70e3f3a39a5e037c4170bb2a055a92754acb languageName: node linkType: hard -"@csstools/media-query-list-parser@npm:^2.1.6": +"@csstools/media-query-list-parser@npm:^2.1.7": version: 2.1.7 resolution: "@csstools/media-query-list-parser@npm:2.1.7" peerDependencies: @@ -1777,8 +1777,8 @@ __metadata: linkType: hard "@formatjs/cli@npm:^6.1.1": - version: 6.2.4 - resolution: "@formatjs/cli@npm:6.2.4" + version: 6.2.6 + resolution: "@formatjs/cli@npm:6.2.6" peerDependencies: vue: ^3.3.4 peerDependenciesMeta: @@ -1786,7 +1786,7 @@ __metadata: optional: true bin: formatjs: bin/formatjs - checksum: 3f6bbbc633a3a6ebd4e6fcfc3a9f889bc044043452cbc8f81abcaee97aaef991a778ae785d3b9d21ecc5f55b147eb0009b44520bb895fe244b4c14a36d9b05bd + checksum: f8b0bc45c72b83437f0dc91a2d3ea513852c11bfd8eedbc2f255b19552f153bccb4d38fcd281f897ca60d0dfddf2b99de22e5a87cb1e173ca11df88c61cde2e4 languageName: node linkType: hard @@ -11330,10 +11330,10 @@ __metadata: languageName: node linkType: hard -"meow@npm:^13.0.0": - version: 13.0.0 - resolution: "meow@npm:13.0.0" - checksum: fab0f91578154c048e792a81704f3f28099ffff900f364df8a85f6e770a57e1c124859a25e186186e149dad30692c7893af0dfd71517bea343bfe5d749b1fa04 +"meow@npm:^13.1.0": + version: 13.1.0 + resolution: "meow@npm:13.1.0" + checksum: 2dac9dbf99a17ce29618fe5919072a9b28e2aedb9547f9b1f15d046d5501dd6c14fe1f35f7a5665d0ee7111c98c4d359fcf3f985463ec5896dd50177363f442d languageName: node linkType: hard @@ -13200,7 +13200,7 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.32": +"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.33": version: 8.4.33 resolution: "postcss@npm:8.4.33" dependencies: @@ -13295,11 +13295,11 @@ __metadata: linkType: hard "prettier@npm:^3.0.0": - version: 3.2.2 - resolution: "prettier@npm:3.2.2" + version: 3.2.4 + resolution: "prettier@npm:3.2.4" bin: prettier: bin/prettier.cjs - checksum: e84d0d2a4ce2b88ee1636904effbdf68b59da63d9f887128f2ed5382206454185432e7c0a9578bc4308bc25d099cfef47fd0b9c211066777854e23e65e34044d + checksum: 88dfeb78ac6096522c9a5b81f1413d875f568420d9bb6a5e5103527912519b993f2bcdcac311fcff5718d5869671d44e4f85827d3626f3a6ce32b9abc65d88e0 languageName: node linkType: hard @@ -15785,12 +15785,12 @@ __metadata: linkType: hard "stylelint@npm:^16.0.2": - version: 16.1.0 - resolution: "stylelint@npm:16.1.0" + version: 16.2.0 + resolution: "stylelint@npm:16.2.0" dependencies: - "@csstools/css-parser-algorithms": "npm:^2.4.0" - "@csstools/css-tokenizer": "npm:^2.2.2" - "@csstools/media-query-list-parser": "npm:^2.1.6" + "@csstools/css-parser-algorithms": "npm:^2.5.0" + "@csstools/css-tokenizer": "npm:^2.2.3" + "@csstools/media-query-list-parser": "npm:^2.1.7" "@csstools/selector-specificity": "npm:^3.0.1" balanced-match: "npm:^2.0.0" colord: "npm:^2.9.3" @@ -15810,14 +15810,14 @@ __metadata: is-plain-object: "npm:^5.0.0" known-css-properties: "npm:^0.29.0" mathml-tag-names: "npm:^2.1.3" - meow: "npm:^13.0.0" + meow: "npm:^13.1.0" micromatch: "npm:^4.0.5" normalize-path: "npm:^3.0.0" picocolors: "npm:^1.0.0" - postcss: "npm:^8.4.32" + postcss: "npm:^8.4.33" postcss-resolve-nested-selector: "npm:^0.1.1" postcss-safe-parser: "npm:^7.0.0" - postcss-selector-parser: "npm:^6.0.13" + postcss-selector-parser: "npm:^6.0.15" postcss-value-parser: "npm:^4.2.0" resolve-from: "npm:^5.0.0" string-width: "npm:^4.2.3" @@ -15828,7 +15828,7 @@ __metadata: write-file-atomic: "npm:^5.0.1" bin: stylelint: bin/stylelint.mjs - checksum: 765eea0b07319d1e7989502c07b8b5794938e5a8542bec00990b09ec10c3f7006891689930099e948d06c9ef9982066edb98b1ea64a435138a6b0f0905eb2b87 + checksum: 6fdf0451833c11b18c9aa502f687febd6881a912ac94f39d509b894b0f74ccb636f3dac2991c69cc82dc6190731cc2fa48e307fed477d2a0fce57067cd22b572 languageName: node linkType: hard From 01ce9df88008cee705b7e02a4581802afa07c3df Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 Jan 2024 08:03:30 +0100 Subject: [PATCH 54/55] Fix search form re-rendering spuriously in web UI (#28876) --- .../features/compose/containers/search_container.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/compose/containers/search_container.js b/app/javascript/mastodon/features/compose/containers/search_container.js index 758b6b07d..616b91369 100644 --- a/app/javascript/mastodon/features/compose/containers/search_container.js +++ b/app/javascript/mastodon/features/compose/containers/search_container.js @@ -1,3 +1,4 @@ +import { createSelector } from '@reduxjs/toolkit'; import { connect } from 'react-redux'; import { @@ -12,10 +13,15 @@ import { import Search from '../components/search'; +const getRecentSearches = createSelector( + state => state.getIn(['search', 'recent']), + recent => recent.reverse(), +); + const mapStateToProps = state => ({ value: state.getIn(['search', 'value']), submitted: state.getIn(['search', 'submitted']), - recent: state.getIn(['search', 'recent']).reverse(), + recent: getRecentSearches(state), }); const mapDispatchToProps = dispatch => ({ From 5b1eb09d546120cb456990e15a740d994011013f Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 Jan 2024 10:38:10 +0100 Subject: [PATCH 55/55] Add annual reports for accounts (#28693) --- .../api/v1/annual_reports_controller.rb | 30 +++++++++ app/lib/annual_report.rb | 43 +++++++++++++ app/lib/annual_report/archetype.rb | 49 +++++++++++++++ .../commonly_interacted_with_accounts.rb | 22 +++++++ .../annual_report/most_reblogged_accounts.rb | 22 +++++++ app/lib/annual_report/most_used_apps.rb | 22 +++++++ app/lib/annual_report/percentiles.rb | 62 +++++++++++++++++++ app/lib/annual_report/source.rb | 16 +++++ app/lib/annual_report/time_series.rb | 30 +++++++++ app/lib/annual_report/top_hashtags.rb | 22 +++++++ app/lib/annual_report/top_statuses.rb | 21 +++++++ app/lib/annual_report/type_distribution.rb | 20 ++++++ app/models/generated_annual_report.rb | 37 +++++++++++ app/presenters/annual_reports_presenter.rb | 23 +++++++ .../rest/annual_report_serializer.rb | 5 ++ .../rest/annual_reports_serializer.rb | 7 +++ app/workers/generate_annual_report_worker.rb | 11 ++++ app/workers/scheduler/indexing_scheduler.rb | 2 + config/routes/api.rb | 6 ++ ...1033014_create_generated_annual_reports.rb | 17 +++++ db/schema.rb | 14 ++++- 21 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 app/controllers/api/v1/annual_reports_controller.rb create mode 100644 app/lib/annual_report.rb create mode 100644 app/lib/annual_report/archetype.rb create mode 100644 app/lib/annual_report/commonly_interacted_with_accounts.rb create mode 100644 app/lib/annual_report/most_reblogged_accounts.rb create mode 100644 app/lib/annual_report/most_used_apps.rb create mode 100644 app/lib/annual_report/percentiles.rb create mode 100644 app/lib/annual_report/source.rb create mode 100644 app/lib/annual_report/time_series.rb create mode 100644 app/lib/annual_report/top_hashtags.rb create mode 100644 app/lib/annual_report/top_statuses.rb create mode 100644 app/lib/annual_report/type_distribution.rb create mode 100644 app/models/generated_annual_report.rb create mode 100644 app/presenters/annual_reports_presenter.rb create mode 100644 app/serializers/rest/annual_report_serializer.rb create mode 100644 app/serializers/rest/annual_reports_serializer.rb create mode 100644 app/workers/generate_annual_report_worker.rb create mode 100644 db/migrate/20240111033014_create_generated_annual_reports.rb diff --git a/app/controllers/api/v1/annual_reports_controller.rb b/app/controllers/api/v1/annual_reports_controller.rb new file mode 100644 index 000000000..9bc8e68ac --- /dev/null +++ b/app/controllers/api/v1/annual_reports_controller.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class Api::V1::AnnualReportsController < Api::BaseController + before_action -> { doorkeeper_authorize! :read, :'read:accounts' }, only: :index + before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, except: :index + before_action :require_user! + before_action :set_annual_report, except: :index + + def index + with_read_replica do + @presenter = AnnualReportsPresenter.new(GeneratedAnnualReport.where(account_id: current_account.id).pending) + @relationships = StatusRelationshipsPresenter.new(@presenter.statuses, current_account.id) + end + + render json: @presenter, + serializer: REST::AnnualReportsSerializer, + relationships: @relationships + end + + def read + @annual_report.view! + render_empty + end + + private + + def set_annual_report + @annual_report = GeneratedAnnualReport.find_by!(account_id: current_account.id, year: params[:id]) + end +end diff --git a/app/lib/annual_report.rb b/app/lib/annual_report.rb new file mode 100644 index 000000000..cf4297f2a --- /dev/null +++ b/app/lib/annual_report.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +class AnnualReport + include DatabaseHelper + + SOURCES = [ + AnnualReport::Archetype, + AnnualReport::TypeDistribution, + AnnualReport::TopStatuses, + AnnualReport::MostUsedApps, + AnnualReport::CommonlyInteractedWithAccounts, + AnnualReport::TimeSeries, + AnnualReport::TopHashtags, + AnnualReport::MostRebloggedAccounts, + AnnualReport::Percentiles, + ].freeze + + SCHEMA = 1 + + def initialize(account, year) + @account = account + @year = year + end + + def generate + return if GeneratedAnnualReport.exists?(account: @account, year: @year) + + GeneratedAnnualReport.create( + account: @account, + year: @year, + schema_version: SCHEMA, + data: data + ) + end + + private + + def data + with_read_replica do + SOURCES.each_with_object({}) { |klass, hsh| hsh.merge!(klass.new(@account, @year).generate) } + end + end +end diff --git a/app/lib/annual_report/archetype.rb b/app/lib/annual_report/archetype.rb new file mode 100644 index 000000000..ea9ef366d --- /dev/null +++ b/app/lib/annual_report/archetype.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +class AnnualReport::Archetype < AnnualReport::Source + # Average number of posts (including replies and reblogs) made by + # each active user in a single year (2023) + AVERAGE_PER_YEAR = 113 + + def generate + { + archetype: archetype, + } + end + + private + + def archetype + if (standalone_count + replies_count + reblogs_count) < AVERAGE_PER_YEAR + :lurker + elsif reblogs_count > (standalone_count * 2) + :booster + elsif polls_count > (standalone_count * 0.1) # standalone_count includes posts with polls + :pollster + elsif replies_count > (standalone_count * 2) + :replier + else + :oracle + end + end + + def polls_count + @polls_count ||= base_scope.where.not(poll_id: nil).count + end + + def reblogs_count + @reblogs_count ||= base_scope.where.not(reblog_of_id: nil).count + end + + def replies_count + @replies_count ||= base_scope.where.not(in_reply_to_id: nil).where.not(in_reply_to_account_id: @account.id).count + end + + def standalone_count + @standalone_count ||= base_scope.without_replies.without_reblogs.count + end + + def base_scope + @account.statuses.where(id: year_as_snowflake_range) + end +end diff --git a/app/lib/annual_report/commonly_interacted_with_accounts.rb b/app/lib/annual_report/commonly_interacted_with_accounts.rb new file mode 100644 index 000000000..af5e854c2 --- /dev/null +++ b/app/lib/annual_report/commonly_interacted_with_accounts.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AnnualReport::CommonlyInteractedWithAccounts < AnnualReport::Source + SET_SIZE = 40 + + def generate + { + commonly_interacted_with_accounts: commonly_interacted_with_accounts.map do |(account_id, count)| + { + account_id: account_id, + count: count, + } + end, + } + end + + private + + def commonly_interacted_with_accounts + @account.statuses.reorder(nil).where(id: year_as_snowflake_range).where.not(in_reply_to_account_id: @account.id).group(:in_reply_to_account_id).having('count(*) > 1').order(total: :desc).limit(SET_SIZE).pluck(Arel.sql('in_reply_to_account_id, count(*) AS total')) + end +end diff --git a/app/lib/annual_report/most_reblogged_accounts.rb b/app/lib/annual_report/most_reblogged_accounts.rb new file mode 100644 index 000000000..e3e8a7c90 --- /dev/null +++ b/app/lib/annual_report/most_reblogged_accounts.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AnnualReport::MostRebloggedAccounts < AnnualReport::Source + SET_SIZE = 10 + + def generate + { + most_reblogged_accounts: most_reblogged_accounts.map do |(account_id, count)| + { + account_id: account_id, + count: count, + } + end, + } + end + + private + + def most_reblogged_accounts + @account.statuses.reorder(nil).where(id: year_as_snowflake_range).where.not(reblog_of_id: nil).joins(reblog: :account).group('accounts.id').having('count(*) > 1').order(total: :desc).limit(SET_SIZE).pluck(Arel.sql('accounts.id, count(*) as total')) + end +end diff --git a/app/lib/annual_report/most_used_apps.rb b/app/lib/annual_report/most_used_apps.rb new file mode 100644 index 000000000..85ff1ff86 --- /dev/null +++ b/app/lib/annual_report/most_used_apps.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AnnualReport::MostUsedApps < AnnualReport::Source + SET_SIZE = 10 + + def generate + { + most_used_apps: most_used_apps.map do |(name, count)| + { + name: name, + count: count, + } + end, + } + end + + private + + def most_used_apps + @account.statuses.reorder(nil).where(id: year_as_snowflake_range).joins(:application).group('oauth_applications.name').order(total: :desc).limit(SET_SIZE).pluck(Arel.sql('oauth_applications.name, count(*) as total')) + end +end diff --git a/app/lib/annual_report/percentiles.rb b/app/lib/annual_report/percentiles.rb new file mode 100644 index 000000000..9fe4698ee --- /dev/null +++ b/app/lib/annual_report/percentiles.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +class AnnualReport::Percentiles < AnnualReport::Source + def generate + { + percentiles: { + followers: (total_with_fewer_followers / (total_with_any_followers + 1.0)) * 100, + statuses: (total_with_fewer_statuses / (total_with_any_statuses + 1.0)) * 100, + }, + } + end + + private + + def followers_gained + @followers_gained ||= @account.passive_relationships.where("date_part('year', follows.created_at) = ?", @year).count + end + + def statuses_created + @statuses_created ||= @account.statuses.where(id: year_as_snowflake_range).count + end + + def total_with_fewer_followers + @total_with_fewer_followers ||= Follow.find_by_sql([<<~SQL.squish, { year: @year, comparison: followers_gained }]).first.total + WITH tmp0 AS ( + SELECT follows.target_account_id + FROM follows + INNER JOIN accounts ON accounts.id = follows.target_account_id + WHERE date_part('year', follows.created_at) = :year + AND accounts.domain IS NULL + GROUP BY follows.target_account_id + HAVING COUNT(*) < :comparison + ) + SELECT count(*) AS total + FROM tmp0 + SQL + end + + def total_with_fewer_statuses + @total_with_fewer_statuses ||= Status.find_by_sql([<<~SQL.squish, { comparison: statuses_created, min_id: year_as_snowflake_range.first, max_id: year_as_snowflake_range.last }]).first.total + WITH tmp0 AS ( + SELECT statuses.account_id + FROM statuses + INNER JOIN accounts ON accounts.id = statuses.account_id + WHERE statuses.id BETWEEN :min_id AND :max_id + AND accounts.domain IS NULL + GROUP BY statuses.account_id + HAVING count(*) < :comparison + ) + SELECT count(*) AS total + FROM tmp0 + SQL + end + + def total_with_any_followers + @total_with_any_followers ||= Follow.where("date_part('year', follows.created_at) = ?", @year).joins(:target_account).merge(Account.local).count('distinct follows.target_account_id') + end + + def total_with_any_statuses + @total_with_any_statuses ||= Status.where(id: year_as_snowflake_range).joins(:account).merge(Account.local).count('distinct statuses.account_id') + end +end diff --git a/app/lib/annual_report/source.rb b/app/lib/annual_report/source.rb new file mode 100644 index 000000000..1ccb62267 --- /dev/null +++ b/app/lib/annual_report/source.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AnnualReport::Source + attr_reader :account, :year + + def initialize(account, year) + @account = account + @year = year + end + + protected + + def year_as_snowflake_range + (Mastodon::Snowflake.id_at(DateTime.new(year, 1, 1))..Mastodon::Snowflake.id_at(DateTime.new(year, 12, 31))) + end +end diff --git a/app/lib/annual_report/time_series.rb b/app/lib/annual_report/time_series.rb new file mode 100644 index 000000000..a144bac0d --- /dev/null +++ b/app/lib/annual_report/time_series.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class AnnualReport::TimeSeries < AnnualReport::Source + def generate + { + time_series: (1..12).map do |month| + { + month: month, + statuses: statuses_per_month[month] || 0, + following: following_per_month[month] || 0, + followers: followers_per_month[month] || 0, + } + end, + } + end + + private + + def statuses_per_month + @statuses_per_month ||= @account.statuses.reorder(nil).where(id: year_as_snowflake_range).group(:period).pluck(Arel.sql("date_part('month', created_at)::int AS period, count(*)")).to_h + end + + def following_per_month + @following_per_month ||= @account.active_relationships.where("date_part('year', created_at) = ?", @year).group(:period).pluck(Arel.sql("date_part('month', created_at)::int AS period, count(*)")).to_h + end + + def followers_per_month + @followers_per_month ||= @account.passive_relationships.where("date_part('year', created_at) = ?", @year).group(:period).pluck(Arel.sql("date_part('month', created_at)::int AS period, count(*)")).to_h + end +end diff --git a/app/lib/annual_report/top_hashtags.rb b/app/lib/annual_report/top_hashtags.rb new file mode 100644 index 000000000..488dacb1b --- /dev/null +++ b/app/lib/annual_report/top_hashtags.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AnnualReport::TopHashtags < AnnualReport::Source + SET_SIZE = 40 + + def generate + { + top_hashtags: top_hashtags.map do |(name, count)| + { + name: name, + count: count, + } + end, + } + end + + private + + def top_hashtags + Tag.joins(:statuses).where(statuses: { id: @account.statuses.where(id: year_as_snowflake_range).reorder(nil).select(:id) }).group(:id).having('count(*) > 1').order(total: :desc).limit(SET_SIZE).pluck(Arel.sql('COALESCE(tags.display_name, tags.name), count(*) AS total')) + end +end diff --git a/app/lib/annual_report/top_statuses.rb b/app/lib/annual_report/top_statuses.rb new file mode 100644 index 000000000..112e5591c --- /dev/null +++ b/app/lib/annual_report/top_statuses.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AnnualReport::TopStatuses < AnnualReport::Source + def generate + top_reblogs = base_scope.order(reblogs_count: :desc).first&.id + top_favourites = base_scope.where.not(id: top_reblogs).order(favourites_count: :desc).first&.id + top_replies = base_scope.where.not(id: [top_reblogs, top_favourites]).order(replies_count: :desc).first&.id + + { + top_statuses: { + by_reblogs: top_reblogs, + by_favourites: top_favourites, + by_replies: top_replies, + }, + } + end + + def base_scope + @account.statuses.with_public_visibility.joins(:status_stat).where(id: year_as_snowflake_range).reorder(nil) + end +end diff --git a/app/lib/annual_report/type_distribution.rb b/app/lib/annual_report/type_distribution.rb new file mode 100644 index 000000000..fc12a6f1f --- /dev/null +++ b/app/lib/annual_report/type_distribution.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AnnualReport::TypeDistribution < AnnualReport::Source + def generate + { + type_distribution: { + total: base_scope.count, + reblogs: base_scope.where.not(reblog_of_id: nil).count, + replies: base_scope.where.not(in_reply_to_id: nil).where.not(in_reply_to_account_id: @account.id).count, + standalone: base_scope.without_replies.without_reblogs.count, + }, + } + end + + private + + def base_scope + @account.statuses.where(id: year_as_snowflake_range) + end +end diff --git a/app/models/generated_annual_report.rb b/app/models/generated_annual_report.rb new file mode 100644 index 000000000..43c97d710 --- /dev/null +++ b/app/models/generated_annual_report.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: generated_annual_reports +# +# id :bigint(8) not null, primary key +# account_id :bigint(8) not null +# year :integer not null +# data :jsonb not null +# schema_version :integer not null +# viewed_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# + +class GeneratedAnnualReport < ApplicationRecord + belongs_to :account + + scope :pending, -> { where(viewed_at: nil) } + + def viewed? + viewed_at.present? + end + + def view! + update!(viewed_at: Time.now.utc) + end + + def account_ids + data['most_reblogged_accounts'].pluck('account_id') + data['commonly_interacted_with_accounts'].pluck('account_id') + end + + def status_ids + data['top_statuses'].values + end +end diff --git a/app/presenters/annual_reports_presenter.rb b/app/presenters/annual_reports_presenter.rb new file mode 100644 index 000000000..001e1d37b --- /dev/null +++ b/app/presenters/annual_reports_presenter.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AnnualReportsPresenter + alias read_attribute_for_serialization send + + attr_reader :annual_reports + + def initialize(annual_reports) + @annual_reports = annual_reports + end + + def accounts + @accounts ||= Account.where(id: @annual_reports.flat_map(&:account_ids)).includes(:account_stat, :moved_to_account, user: :role) + end + + def statuses + @statuses ||= Status.where(id: @annual_reports.flat_map(&:status_ids)).with_includes + end + + def self.model_name + @model_name ||= ActiveModel::Name.new(self) + end +end diff --git a/app/serializers/rest/annual_report_serializer.rb b/app/serializers/rest/annual_report_serializer.rb new file mode 100644 index 000000000..1fb5ddb5c --- /dev/null +++ b/app/serializers/rest/annual_report_serializer.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class REST::AnnualReportSerializer < ActiveModel::Serializer + attributes :year, :data, :schema_version +end diff --git a/app/serializers/rest/annual_reports_serializer.rb b/app/serializers/rest/annual_reports_serializer.rb new file mode 100644 index 000000000..ea9572be1 --- /dev/null +++ b/app/serializers/rest/annual_reports_serializer.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class REST::AnnualReportsSerializer < ActiveModel::Serializer + has_many :annual_reports, serializer: REST::AnnualReportSerializer + has_many :accounts, serializer: REST::AccountSerializer + has_many :statuses, serializer: REST::StatusSerializer +end diff --git a/app/workers/generate_annual_report_worker.rb b/app/workers/generate_annual_report_worker.rb new file mode 100644 index 000000000..7094c1ab9 --- /dev/null +++ b/app/workers/generate_annual_report_worker.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class GenerateAnnualReportWorker + include Sidekiq::Worker + + def perform(account_id, year) + AnnualReport.new(Account.find(account_id), year).generate + rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordNotUnique + true + end +end diff --git a/app/workers/scheduler/indexing_scheduler.rb b/app/workers/scheduler/indexing_scheduler.rb index 5c985e25a..f52d0141d 100644 --- a/app/workers/scheduler/indexing_scheduler.rb +++ b/app/workers/scheduler/indexing_scheduler.rb @@ -24,6 +24,8 @@ class Scheduler::IndexingScheduler end end + private + def indexes [AccountsIndex, TagsIndex, PublicStatusesIndex, StatusesIndex] end diff --git a/config/routes/api.rb b/config/routes/api.rb index 0fe9f69ab..853a44e0e 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -51,6 +51,12 @@ namespace :api, format: false do resources :scheduled_statuses, only: [:index, :show, :update, :destroy] resources :preferences, only: [:index] + resources :annual_reports, only: [:index] do + member do + post :read + end + end + resources :announcements, only: [:index] do scope module: :announcements do resources :reactions, only: [:update, :destroy] diff --git a/db/migrate/20240111033014_create_generated_annual_reports.rb b/db/migrate/20240111033014_create_generated_annual_reports.rb new file mode 100644 index 000000000..2a755fb14 --- /dev/null +++ b/db/migrate/20240111033014_create_generated_annual_reports.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateGeneratedAnnualReports < ActiveRecord::Migration[7.1] + def change + create_table :generated_annual_reports do |t| + t.belongs_to :account, null: false, foreign_key: { on_cascade: :delete }, index: false + t.integer :year, null: false + t.jsonb :data, null: false + t.integer :schema_version, null: false + t.datetime :viewed_at + + t.timestamps + end + + add_index :generated_annual_reports, [:account_id, :year], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index cbe54c1db..50f4e7189 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do +ActiveRecord::Schema[7.1].define(version: 2024_01_11_033014) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -516,6 +516,17 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do t.index ["target_account_id"], name: "index_follows_on_target_account_id" end + create_table "generated_annual_reports", force: :cascade do |t| + t.bigint "account_id", null: false + t.integer "year", null: false + t.jsonb "data", null: false + t.integer "schema_version", null: false + t.datetime "viewed_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id", "year"], name: "index_generated_annual_reports_on_account_id_and_year", unique: true + end + create_table "identities", force: :cascade do |t| t.string "provider", default: "", null: false t.string "uid", default: "", null: false @@ -1226,6 +1237,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do add_foreign_key "follow_requests", "accounts", name: "fk_76d644b0e7", on_delete: :cascade add_foreign_key "follows", "accounts", column: "target_account_id", name: "fk_745ca29eac", on_delete: :cascade add_foreign_key "follows", "accounts", name: "fk_32ed1b5560", on_delete: :cascade + add_foreign_key "generated_annual_reports", "accounts" add_foreign_key "identities", "users", name: "fk_bea040f377", on_delete: :cascade add_foreign_key "imports", "accounts", name: "fk_6db1b6e408", on_delete: :cascade add_foreign_key "invites", "users", on_delete: :cascade