Merge commit 'fe2667bb0d3487a32b9da5250402a90482a85fe2' into glitch-soc/merge-upstream

Conflicts:
- `app/lib/content_security_policy.rb`:
  Conflict caused by glitch-soc's support for the extra `EXTRA_DATA_HOSTS`
  environment variable.
  Ported upstream's changes while keeping support for `EXTRA_DATA_HOSTS`.
pull/2559/head
Claire 2024-01-10 17:51:12 +01:00
commit 0b2c7cdb02
116 changed files with 873 additions and 518 deletions

View File

@ -70,7 +70,7 @@ services:
hard: -1
libretranslate:
image: libretranslate/libretranslate:v1.5.2
image: libretranslate/libretranslate:v1.5.3
restart: unless-stopped
volumes:
- lt-data:/home/libretranslate/.local

View File

@ -118,15 +118,10 @@ Rails/UnusedIgnoredColumns:
Rails/NegateInclude:
Enabled: false
# Reason: Some single letter camel case files shouldn't be split
# Reason: Deprecated cop, will be removed in 3.0, replaced by SpecFilePathFormat
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath
RSpec/FilePath:
CustomTransform:
ActivityPub: activitypub
DeepL: deepl
FetchOEmbedService: fetch_oembed_service
OEmbedController: oembed_controller
OStatus: ostatus
Enabled: false
# Reason:
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecnamedsubject

View File

@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 1.57.2.
# using RuboCop version 1.59.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@ -26,7 +26,7 @@ Lint/NonLocalExitFromIterator:
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 100
Max: 82
# Configuration parameters: CountBlocks, Max.
Metrics/BlockNesting:
@ -50,7 +50,7 @@ RSpec/MultipleExpectations:
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 21
Max: 17
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
@ -66,7 +66,6 @@ Rails/ApplicationController:
Rails/HasAndBelongsToMany:
Exclude:
- 'app/models/concerns/account/associations.rb'
- 'app/models/preview_card.rb'
- 'app/models/status.rb'
- 'app/models/tag.rb'
@ -144,7 +143,6 @@ Rails/WhereExists:
Exclude:
- 'app/controllers/activitypub/inboxes_controller.rb'
- 'app/controllers/admin/email_domain_blocks_controller.rb'
- 'app/controllers/auth/registrations_controller.rb'
- 'app/lib/activitypub/activity/create.rb'
- 'app/lib/delivery_failure_tracker.rb'
- 'app/lib/feed_manager.rb'
@ -160,24 +158,16 @@ Rails/WhereExists:
- 'app/serializers/rest/announcement_serializer.rb'
- 'app/serializers/rest/tag_serializer.rb'
- 'app/services/activitypub/fetch_remote_status_service.rb'
- 'app/services/app_sign_up_service.rb'
- 'app/services/vote_service.rb'
- 'app/validators/reaction_validator.rb'
- 'app/validators/vote_validator.rb'
- 'app/workers/move_worker.rb'
- 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.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'
- 'spec/services/unallow_domain_service_spec.rb'
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowOnConstant, AllowOnSelfClass.
Style/CaseEquality:
Exclude:
- 'config/initializers/trusted_proxies.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods, AllowedPatterns.
# AllowedMethods: ==, equal?, eql?
@ -205,8 +195,8 @@ Style/FetchEnvVar:
- 'config/initializers/devise.rb'
- 'config/initializers/paperclip.rb'
- 'config/initializers/vapid.rb'
- 'lib/premailer_webpack_strategy.rb'
- 'lib/mastodon/redis_config.rb'
- 'lib/premailer_webpack_strategy.rb'
- 'lib/tasks/repo.rake'
- 'spec/features/profile_spec.rb'
@ -223,7 +213,6 @@ Style/FormatStringToken:
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'config/boot.rb'
- 'config/environments/development.rb'
- 'config/environments/production.rb'
@ -253,8 +242,6 @@ Style/GuardClause:
- 'app/workers/redownload_media_worker.rb'
- 'app/workers/remote_account_refresh_worker.rb'
- 'config/initializers/devise.rb'
- 'db/migrate/20170901141119_truncate_preview_cards.rb'
- 'db/post_migrate/20220704024901_migrate_settings_to_user_roles.rb'
- 'lib/devise/strategies/two_factor_ldap_authenticatable.rb'
- 'lib/devise/strategies/two_factor_pam_authenticatable.rb'
- 'lib/mastodon/cli/accounts.rb'
@ -275,7 +262,6 @@ Style/HashAsLastArrayItem:
- 'app/models/status.rb'
- 'app/services/batched_remove_status_service.rb'
- 'app/services/notify_service.rb'
- 'db/migrate/20181024224956_migrate_account_conversations.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/HashTransformValues:
@ -415,8 +401,8 @@ Style/TrailingCommaInHashLiteral:
- 'config/environments/test.rb'
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
# Configuration parameters: WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
Exclude:
- 'app/helpers/languages_helper.rb'
EnforcedStyle: percent
MinSize: 3

View File

@ -90,7 +90,7 @@ gem 'sidekiq-bulk', '~> 0.2.0'
gem 'simple-navigation', '~> 4.4'
gem 'simple_form', '~> 5.2'
gem 'stoplight', '~> 3.0.1'
gem 'strong_migrations', '1.6.4'
gem 'strong_migrations', '1.7.0'
gem 'tty-prompt', '~> 0.23', require: false
gem 'twitter-text', '~> 3.1.0'
gem 'tzinfo-data', '~> 1.2023'

View File

@ -467,14 +467,14 @@ GEM
multi_json (1.15.0)
multipart-post (2.3.0)
mutex_m (0.2.0)
net-http (0.4.0)
net-http (0.4.1)
uri
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.4)
date
net-protocol
net-ldap (0.18.0)
net-ldap (0.19.0)
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
@ -544,7 +544,7 @@ GEM
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.1)
puma (6.4.2)
nio4r (~> 2.0)
pundit (2.3.1)
activesupport (>= 3.0.0)
@ -676,11 +676,11 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop-factory_bot (2.25.0)
rubocop (~> 1.33)
rubocop-performance (1.20.1)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1)
@ -688,7 +688,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.25.0)
rubocop-rspec (2.26.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
@ -748,7 +748,7 @@ GEM
stoplight (3.0.2)
redlock (~> 1.0)
stringio (3.1.0)
strong_migrations (1.6.4)
strong_migrations (1.7.0)
activerecord (>= 5.2)
swd (1.3.0)
activesupport (>= 3)
@ -952,7 +952,7 @@ DEPENDENCIES
simplecov-lcov (~> 0.8)
stackprof
stoplight (~> 3.0.1)
strong_migrations (= 1.6.4)
strong_migrations (= 1.7.0)
test-prof
thor (~> 1.2)
tty-prompt (~> 0.23)

View File

@ -40,7 +40,7 @@ module Admin
(@email_domain_block.other_domains || []).uniq.each do |domain|
next if EmailDomainBlock.where(domain: domain).exists?
other_email_domain_block = EmailDomainBlock.create!(domain: domain, parent: @email_domain_block)
other_email_domain_block = EmailDomainBlock.create!(domain: domain, allow_with_approval: @email_domain_block.allow_with_approval, parent: @email_domain_block)
log_action :create, other_email_domain_block
end
end
@ -65,7 +65,7 @@ module Admin
end
def resource_params
params.require(:email_domain_block).permit(:domain, other_domains: [])
params.require(:email_domain_block).permit(:domain, :allow_with_approval, other_domains: [])
end
def form_email_domain_block_batch_params

View File

@ -55,7 +55,7 @@ class Api::V1::Admin::EmailDomainBlocksController < Api::BaseController
end
def resource_params
params.permit(:domain)
params.permit(:domain, :allow_with_approval)
end
def insert_pagination_headers

View File

@ -3,150 +3,6 @@
module CacheConcern
extend ActiveSupport::Concern
module ActiveRecordCoder
EMPTY_HASH = {}.freeze
class << self
def dump(record)
instances = InstanceTracker.new
serialized_associations = serialize_associations(record, instances)
serialized_records = instances.map { |r| serialize_record(r) }
[serialized_associations, *serialized_records]
end
def load(payload)
instances = InstanceTracker.new
serialized_associations, *serialized_records = payload
serialized_records.each { |attrs| instances.push(deserialize_record(*attrs)) }
deserialize_associations(serialized_associations, instances)
end
private
# Records without associations, or which have already been visited before,
# are serialized by their id alone.
#
# Records with associations are serialized as a two-element array including
# their id and the record's association cache.
#
def serialize_associations(record, instances)
return unless record
if (id = instances.lookup(record))
payload = id
else
payload = instances.push(record)
cached_associations = record.class.reflect_on_all_associations.select do |reflection|
record.association_cached?(reflection.name)
end
unless cached_associations.empty?
serialized_associations = cached_associations.map do |reflection|
association = record.association(reflection.name)
serialized_target = if reflection.collection?
association.target.map { |target_record| serialize_associations(target_record, instances) }
else
serialize_associations(association.target, instances)
end
[reflection.name, serialized_target]
end
payload = [payload, serialized_associations]
end
end
payload
end
def deserialize_associations(payload, instances)
return unless payload
id, associations = payload
record = instances.fetch(id)
associations&.each do |name, serialized_target|
begin
association = record.association(name)
rescue ActiveRecord::AssociationNotFoundError
raise AssociationMissingError, "undefined association: #{name}"
end
target = if association.reflection.collection?
serialized_target.map! { |serialized_record| deserialize_associations(serialized_record, instances) }
else
deserialize_associations(serialized_target, instances)
end
association.target = target
end
record
end
def serialize_record(record)
arguments = [record.class.name, attributes_for_database(record)]
arguments << true if record.new_record?
arguments
end
def attributes_for_database(record)
attributes = record.attributes_for_database
attributes.transform_values! { |attr| attr.is_a?(::ActiveModel::Type::Binary::Data) ? attr.to_s : attr }
attributes
end
def deserialize_record(class_name, attributes_from_database, new_record = false) # rubocop:disable Style/OptionalBooleanParameter
begin
klass = Object.const_get(class_name)
rescue NameError
raise ClassMissingError, "undefined class: #{class_name}"
end
# Ideally we'd like to call `klass.instantiate`, however it doesn't allow to pass
# wether the record was persisted or not.
attributes = klass.attributes_builder.build_from_database(attributes_from_database, EMPTY_HASH)
klass.allocate.init_with_attributes(attributes, new_record)
end
end
class Error < StandardError
end
class ClassMissingError < Error
end
class AssociationMissingError < Error
end
class InstanceTracker
def initialize
@instances = []
@ids = {}.compare_by_identity
end
def map(&block)
@instances.map(&block)
end
def fetch(...)
@instances.fetch(...)
end
def push(instance)
id = @ids[instance] = @instances.size
@instances << instance
id
end
def lookup(instance)
@ids[instance]
end
end
end
class_methods do
def vary_by(value, **kwargs)
before_action(**kwargs) do |controller|
@ -196,11 +52,7 @@ module CacheConcern
raw = raw.cache_ids.to_a if raw.is_a?(ActiveRecord::Relation)
return [] if raw.empty?
cached_keys_with_value = begin
Rails.cache.read_multi(*raw).transform_keys(&:id).transform_values { |r| ActiveRecordCoder.load(r) }
rescue ActiveRecordCoder::Error
{} # The serialization format may have changed, let's pretend it's a cache miss.
end
cached_keys_with_value = Rails.cache.read_multi(*raw).transform_keys(&:id)
uncached_ids = raw.map(&:id) - cached_keys_with_value.keys
@ -208,10 +60,7 @@ module CacheConcern
unless uncached_ids.empty?
uncached = klass.where(id: uncached_ids).with_includes.index_by(&:id)
uncached.each_value do |item|
Rails.cache.write(item, ActiveRecordCoder.dump(item))
end
Rails.cache.write_multi(uncached.values.to_h { |i| [i, i] })
end
raw.filter_map { |item| cached_keys_with_value[item.id] || uncached[item.id] }

View File

@ -21,7 +21,7 @@ module WellKnown
username = username_from_resource
@account = begin
if username == Rails.configuration.x.local_domain
if username == Rails.configuration.x.local_domain || username == Rails.configuration.x.web_domain
Account.representative
else
Account.find_local!(username)

View File

@ -582,16 +582,20 @@ class Status extends ImmutablePureComponent {
));
}
setRef = c => {
setContainerRef = c => {
this.node = c;
};
setStatusRef = c => {
this.statusNode = c;
};
_scrollStatusIntoView () {
const { status, multiColumn } = this.props;
if (status) {
window.requestAnimationFrame(() => {
this.node?.querySelector('.detailed-status__wrapper')?.scrollIntoView(true);
requestIdleCallback(() => {
this.statusNode?.scrollIntoView(true);
// In the single-column interface, `scrollIntoView` will put the post behind the header,
// so compensate for that.
@ -629,9 +633,8 @@ class Status extends ImmutablePureComponent {
}
// Scroll to focused post if it is loaded
const child = this.node?.querySelector('.detailed-status__wrapper');
if (child) {
return [0, child.offsetTop];
if (this.statusNode) {
return [0, this.statusNode.offsetTop];
}
// Do not scroll otherwise, `componentDidUpdate` will take care of that
@ -692,11 +695,11 @@ class Status extends ImmutablePureComponent {
/>
<ScrollContainer scrollKey='thread' shouldUpdateScroll={this.shouldUpdateScroll}>
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef}>
<div className={classNames('scrollable', { fullscreen })} ref={this.setContainerRef}>
{ancestors}
<HotKeys handlers={handlers}>
<div className={classNames('focusable', 'detailed-status__wrapper', `detailed-status__wrapper-${status.get('visibility')}`)} tabIndex={0} aria-label={textForScreenReader(intl, status, false)}>
<div className={classNames('focusable', 'detailed-status__wrapper', `detailed-status__wrapper-${status.get('visibility')}`)} tabIndex={0} aria-label={textForScreenReader(intl, status, false)} ref={this.setStatusRef}>
<DetailedStatus
key={`details-${status.get('id')}`}
status={status}

View File

@ -260,6 +260,9 @@
"filter_modal.select_filter.subtitle": "Χρησιμοποιήστε μια υπάρχουσα κατηγορία ή δημιουργήστε μια νέα",
"filter_modal.select_filter.title": "Φιλτράρισμα αυτής της ανάρτησης",
"filter_modal.title.status": "Φιλτράρισμα μιας ανάρτησης",
"firehose.all": "Όλα",
"firehose.local": "Αυτός ο διακομιστής",
"firehose.remote": "Άλλοι διακομιστές",
"follow_request.authorize": "Εξουσιοδότησε",
"follow_request.reject": "Απέρριψε",
"follow_requests.unlocked_explanation": "Παρόλο που ο λογαριασμός σου δεν είναι κλειδωμένος, το προσωπικό του {domain} θεώρησαν πως ίσως να θέλεις να ελέγξεις χειροκίνητα αυτά τα αιτήματα ακολούθησης.",
@ -285,11 +288,15 @@
"hashtag.column_settings.tag_toggle": "Προσθήκη επιπλέον ταμπελών για την κολώνα",
"hashtag.follow": "Παρακολούθηση ετικέτας",
"hashtag.unfollow": "Διακοπή παρακολούθησης ετικέτας",
"home.actions.go_to_suggestions": "Βρείτε άτομα για να ακολουθήσετε",
"home.column_settings.basic": "Βασικές ρυθμίσεις",
"home.column_settings.show_reblogs": "Εμφάνιση προωθήσεων",
"home.column_settings.show_replies": "Εμφάνιση απαντήσεων",
"home.explore_prompt.body": "Your home feed will have a mix of posts from the hashtags you've chosen to follow, the people you've chosen to follow, and the posts they boost. If that feels too quiet, you may want to:\nΗ τροφοδοσία της αρχικής σελίδας σας είναι ένα μίγμα από αναρτήσεις με τις ετικέτες και τα άτομα που επιλέξατε να ακολουθείτε, και τις αναρτήσεις που προωθούν. Εάν αυτό σας φαίνεται πολύ ήσυχο, μπορεί να θέλετε:",
"home.explore_prompt.title": "Αυτό είναι το σπίτι σας στο Mastodon.",
"home.hide_announcements": "Απόκρυψη ανακοινώσεων",
"home.pending_critical_update.link": "Δείτε ενημερώσεις",
"home.pending_critical_update.title": "Κρίσιμη ενημέρωση ασφαλείας διαθέσιμη!",
"home.show_announcements": "Εμφάνιση ανακοινώσεων",
"interaction_modal.description.follow": "Με έναν λογαριασμό Mastodon, μπορείς να ακολουθήσεις τον/την {name} ώστε να λαμβάνεις τις αναρτήσεις του/της στη δική σου ροή.",
"interaction_modal.description.reblog": "Με ένα λογαριασμό Mastodon, μπορείς να ενισχύσεις αυτή την ανάρτηση για να τη μοιραστείς με τους δικούς σου ακολούθους.",
@ -314,6 +321,7 @@
"keyboard_shortcuts.direct": "για το άνοιγμα της στήλης ιδιωτικών επισημάνσεων",
"keyboard_shortcuts.down": "κίνηση προς τα κάτω στη λίστα",
"keyboard_shortcuts.enter": "Εμφάνιση ανάρτησης",
"keyboard_shortcuts.favourite": "Αγαπημένη δημοσίευση",
"keyboard_shortcuts.federated": "Άνοιγμα ροής συναλλαγών",
"keyboard_shortcuts.heading": "Συντομεύσεις πληκτρολογίου",
"keyboard_shortcuts.home": "Άνοιγμα ροής αρχικής σελίδας",
@ -358,6 +366,7 @@
"lists.search": "Αναζήτησε μεταξύ των ανθρώπων που ακουλουθείς",
"lists.subheading": "Οι λίστες σου",
"load_pending": "{count, plural, one {# νέο στοιχείο} other {# νέα στοιχεία}}",
"loading_indicator.label": "Φόρτωση…",
"media_gallery.toggle_visible": "{number, plural, one {Απόκρυψη εικόνας} other {Απόκρυψη εικόνων}}",
"moved_to_account_banner.text": "Ο λογαριασμός σου {disabledAccount} είναι προσωρινά απενεργοποιημένος επειδή μεταφέρθηκες στον {movedToAccount}.",
"mute_modal.duration": "Διάρκεια",
@ -380,6 +389,7 @@
"navigation_bar.lists": "Λίστες",
"navigation_bar.logout": "Αποσύνδεση",
"navigation_bar.mutes": "Αποσιωπημένοι χρήστες",
"navigation_bar.opened_in_classic_interface": "Δημοσιεύσεις, λογαριασμοί και άλλες συγκεκριμένες σελίδες ανοίγονται από προεπιλογή στην κλασική διεπαφή ιστού.",
"navigation_bar.personal": "Προσωπικά",
"navigation_bar.pins": "Καρφιτσωμένες αναρτήσεις",
"navigation_bar.preferences": "Προτιμήσεις",
@ -403,6 +413,7 @@
"notifications.column_settings.admin.report": "Νέες αναφορές:",
"notifications.column_settings.admin.sign_up": "Νέες εγγραφές:",
"notifications.column_settings.alert": "Ειδοποιήσεις επιφάνειας εργασίας",
"notifications.column_settings.favourite": "Αγαπημένα:",
"notifications.column_settings.filter_bar.advanced": "Εμφάνιση όλων των κατηγοριών",
"notifications.column_settings.filter_bar.category": "Μπάρα γρήγορου φίλτρου",
"notifications.column_settings.filter_bar.show_bar": "Εμφάνιση μπάρας φίλτρου",

View File

@ -1,4 +1,8 @@
{
"about.blocks": "Servitores moderate",
"about.contact": "Contacto:",
"about.disclaimer": "Mastodon es software libere, de codice aperte, e un marca de Mastodon gGmbH.",
"account.account_note_header": "Nota",
"account.add_or_remove_from_list": "Adder o remover ab listas",
"account.badges.group": "Gruppo",
"account.block": "Blocar @{name}",
@ -21,9 +25,12 @@
"bundle_column_error.return": "Retornar al initio",
"bundle_modal_error.close": "Clauder",
"bundle_modal_error.retry": "Tentar novemente",
"column.about": "A proposito de",
"column.blocks": "Usatores blocate",
"column.bookmarks": "Marcapaginas",
"column.directory": "Navigar profilos",
"column.favourites": "Favoritos",
"column.firehose": "Fluxos in directe",
"column.home": "Initio",
"column.lists": "Listas",
"column.notifications": "Notificationes",
@ -33,23 +40,28 @@
"compose.language.change": "Cambiar le lingua",
"compose.language.search": "Cercar linguas...",
"compose.published.open": "Aperir",
"compose_form.direct_message_warning_learn_more": "Apprender plus",
"compose_form.poll.add_option": "Adder un option",
"compose_form.poll.remove_option": "Remover iste option",
"confirmation_modal.cancel": "Cancellar",
"confirmations.delete.confirm": "Deler",
"confirmations.delete_list.confirm": "Deler",
"confirmations.edit.confirm": "Modificar",
"confirmations.logout.confirm": "Clauder le session",
"copy_icon_button.copied": "Copiate al area de transferentia",
"copypaste.copied": "Copiate",
"copypaste.copy_to_clipboard": "Copiar al area de transferentia",
"disabled_account_banner.account_settings": "Parametros de conto",
"dismissable_banner.dismiss": "Dimitter",
"emoji_button.activity": "Activitate",
"emoji_button.clear": "Rader",
"emoji_button.custom": "Personalisate",
"emoji_button.search_results": "Resultatos de recerca",
"empty_column.account_unavailable": "Profilo non disponibile",
"errors.unexpected_crash.report_issue": "Signalar un defecto",
"explore.search_results": "Resultatos de recerca",
"explore.trending_links": "Novas",
"filter_modal.select_filter.prompt_new": "Nove categoria: {name}",
"firehose.all": "Toto",
"firehose.local": "Iste servitor",
"firehose.remote": "Altere servitores",
@ -62,23 +74,50 @@
"keyboard_shortcuts.my_profile": "Aperir tu profilo",
"lightbox.close": "Clauder",
"lightbox.next": "Sequente",
"lightbox.previous": "Precedente",
"link_preview.author": "Per {name}",
"lists.account.add": "Adder al lista",
"lists.delete": "Deler lista",
"lists.edit": "Modificar lista",
"lists.new.create": "Adder lista",
"lists.subheading": "Tu listas",
"mute_modal.duration": "Duration",
"mute_modal.hide_notifications": "Celar notificationes de iste usator?",
"navigation_bar.about": "A proposito de",
"navigation_bar.advanced_interface": "Aperir in un interfacie web avantiate",
"navigation_bar.blocks": "Usatores blocate",
"navigation_bar.discover": "Discoperir",
"navigation_bar.edit_profile": "Modificar profilo",
"navigation_bar.favourites": "Favoritos",
"navigation_bar.lists": "Listas",
"navigation_bar.logout": "Clauder le session",
"navigation_bar.preferences": "Preferentias",
"navigation_bar.search": "Cercar",
"navigation_bar.security": "Securitate",
"notifications.column_settings.alert": "Notificationes de scriptorio",
"notifications.column_settings.filter_bar.advanced": "Monstrar tote le categorias",
"notifications.column_settings.sound": "Reproducer sono",
"notifications.filter.all": "Toto",
"notifications.filter.favourites": "Favoritos",
"notifications.grant_permission": "Conceder permission.",
"notifications.group": "{count} notificationes",
"onboarding.compose.template": "Salute #Mastodon!",
"onboarding.profile.save_and_continue": "Salvar e continuar",
"onboarding.share.title": "Compartir tu profilo"
"onboarding.share.title": "Compartir tu profilo",
"onboarding.steps.share_profile.title": "Compartir tu profilo de Mastodon",
"relative_time.just_now": "ora",
"relative_time.today": "hodie",
"reply_indicator.cancel": "Cancellar",
"report.next": "Sequente",
"report.placeholder": "Commentos additional",
"report.reasons.dislike": "Non me place",
"search.quick_action.go_to_account": "Vader al profilo {x}",
"search_results.accounts": "Profilos",
"search_results.see_all": "Vider toto",
"status.delete": "Deler",
"status.share": "Compartir",
"status.translate": "Traducer",
"status.translated_from_with": "Traducite ab {lang} usante {provider}",
"tabs_bar.home": "Initio",
"tabs_bar.notifications": "Notificationes"
}

View File

@ -501,6 +501,7 @@
"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",
"password_confirmation.mismatching": "Los dos kodes son desferentes",
"picture_in_picture.restore": "Restora",
"poll.closed": "Serrado",
"poll.refresh": "Arefreska",

View File

@ -606,7 +606,7 @@
"search.quick_action.status_search": "Innlegg som samsvarer med {x}",
"search.search_or_paste": "Søk eller lim inn URL",
"search_popout.full_text_search_disabled_message": "Ikkje tilgjengeleg på {domain}.",
"search_popout.full_text_search_logged_out_message": "Bare tilgjengelig ved innlogging.",
"search_popout.full_text_search_logged_out_message": "Bare tilgjengelig når man er logget inn.",
"search_popout.language_code": "ISO-språkkode",
"search_popout.options": "Søkjealternativ",
"search_popout.quick_actions": "Hurtighandlinger",

View File

@ -606,7 +606,7 @@
"search.quick_action.status_search": "Innlegg som samsvarer med {x}",
"search.search_or_paste": "Søk eller lim inn URL",
"search_popout.full_text_search_disabled_message": "Ikke tilgjengelig på {domain}.",
"search_popout.full_text_search_logged_out_message": "Bare tilgjengelig ved innlogging.",
"search_popout.full_text_search_logged_out_message": "Bare tilgjengelig når man er logget inn.",
"search_popout.language_code": "ISO språkkode",
"search_popout.options": "Alternativer for søk",
"search_popout.quick_actions": "Hurtighandlinger",

View File

@ -32,6 +32,7 @@
"account.featured_tags.last_status_never": "Pa postime",
"account.featured_tags.title": "Hashtagë të zgjedhur të {name}",
"account.follow": "Ndiqeni",
"account.follow_back": "Ndiqe gjithashtu",
"account.followers": "Ndjekës",
"account.followers.empty": "Këtë përdorues ende se ndjek kush.",
"account.followers_counter": "{count, plural, one {{counter} Ndjekës} other {{counter} Ndjekës}}",
@ -52,6 +53,7 @@
"account.mute_notifications_short": "Mos shfaq njoftime",
"account.mute_short": "Mos i shfaq",
"account.muted": "Heshtuar",
"account.mutual": "Reciproke",
"account.no_bio": "Su dha përshkrim.",
"account.open_original_page": "Hap faqen origjinale",
"account.posts": "Mesazhe",

View File

@ -53,7 +53,7 @@
"account.mute_notifications_short": "关闭通知",
"account.mute_short": "隐藏",
"account.muted": "已隐藏",
"account.mutual": "互相关注",
"account.mutual": "互粉好友",
"account.no_bio": "未提供描述。",
"account.open_original_page": "打开原始页面",
"account.posts": "嘟文",
@ -446,7 +446,7 @@
"notifications.column_settings.filter_bar.advanced": "显示所有类别",
"notifications.column_settings.filter_bar.category": "快速过滤栏",
"notifications.column_settings.filter_bar.show_bar": "显示过滤栏",
"notifications.column_settings.follow": "新关注者",
"notifications.column_settings.follow": "新粉丝",
"notifications.column_settings.follow_request": "新关注请求:",
"notifications.column_settings.mention": "提及:",
"notifications.column_settings.poll": "投票结果:",
@ -700,7 +700,7 @@
"time_remaining.moments": "即将结束",
"time_remaining.seconds": "剩余 {number, plural, one {# 秒} other {# 秒}}",
"timeline_hint.remote_resource_not_displayed": "不会显示来自其它服务器的{resource}",
"timeline_hint.resources.followers": "关注者",
"timeline_hint.resources.followers": "粉丝",
"timeline_hint.resources.follows": "关注",
"timeline_hint.resources.statuses": "更早的嘟文",
"trends.counter_by_accounts": "过去 {days, plural, other {{days} 天}}有{count, plural, other { {counter} 人}}讨论",

View File

@ -10,7 +10,7 @@ class ContentSecurityPolicy
end
def media_hosts
[assets_host, cdn_host_value].concat(extra_data_hosts).compact
[assets_host, cdn_host_value, paperclip_root_url].concat(extra_data_hosts).compact
end
private
@ -27,6 +27,15 @@ class ContentSecurityPolicy
s3_alias_host || s3_cloudfront_host || azure_alias_host || s3_hostname_host
end
def paperclip_root_url
root_url = ENV.fetch('PAPERCLIP_ROOT_URL', nil)
return if root_url.blank?
(Addressable::URI.parse(assets_host) + root_url).tap do |uri|
uri.path += '/' unless uri.path.blank? || uri.path.end_with?('/')
end.to_s
end
def url_from_base_host
host_to_url(base_host)
end

View File

@ -11,11 +11,12 @@ module Attachmentable
# For some file extensions, there exist different content
# type variants, and browsers often send the wrong one,
# for example, sending an audio .ogg file as video/ogg,
# likewise, MimeMagic also misreports them as such. For
# likewise, kt-paperclip also misreports them as such. For
# those files, it is necessary to use the output of the
# `file` utility instead
INCORRECT_CONTENT_TYPES = %w(
audio/vorbis
audio/opus
video/ogg
video/webm
).freeze

View File

@ -17,23 +17,8 @@
class CustomFilter < ApplicationRecord
self.ignored_columns += %w(whole_word irreversible)
# NOTE: We previously used `alias_attribute` but this does not play nicely
# with cache
def title
phrase
end
def title=(value)
self.phrase = value
end
def filter_action
action
end
def filter_action=(value)
self.action = value
end
alias_attribute :title, :phrase
alias_attribute :filter_action, :action
VALID_CONTEXTS = %w(
home
@ -143,6 +128,10 @@ class CustomFilter < ApplicationRecord
end
def context_must_be_valid
errors.add(:context, I18n.t('filters.errors.invalid_context')) if context.empty? || context.any? { |c| !VALID_CONTEXTS.include?(c) }
errors.add(:context, I18n.t('filters.errors.invalid_context')) if invalid_context_value?
end
def invalid_context_value?
context.blank? || context.difference(VALID_CONTEXTS).any?
end
end

View File

@ -17,15 +17,7 @@ class CustomFilterKeyword < ApplicationRecord
validates :keyword, presence: true
# NOTE: We previously used `alias_attribute` but this does not play nicely
# with cache
def phrase
keyword
end
def phrase=(value)
self.keyword = value
end
alias_attribute :phrase, :keyword
before_save :prepare_cache_invalidation!
before_destroy :prepare_cache_invalidation!

View File

@ -4,11 +4,12 @@
#
# Table name: email_domain_blocks
#
# id :bigint(8) not null, primary key
# domain :string default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
# parent_id :bigint(8)
# id :bigint(8) not null, primary key
# domain :string default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
# parent_id :bigint(8)
# allow_with_approval :boolean default(FALSE), not null
#
class EmailDomainBlock < ApplicationRecord
@ -42,8 +43,8 @@ class EmailDomainBlock < ApplicationRecord
@attempt_ip = attempt_ip
end
def match?
blocking? || invalid_uri?
def match?(...)
blocking?(...) || invalid_uri?
end
private
@ -52,8 +53,8 @@ class EmailDomainBlock < ApplicationRecord
@uris.any?(&:nil?)
end
def blocking?
blocks = EmailDomainBlock.where(domain: domains_with_variants).order(Arel.sql('char_length(domain) desc'))
def blocking?(allow_with_approval: false)
blocks = EmailDomainBlock.where(domain: domains_with_variants, allow_with_approval: allow_with_approval).order(Arel.sql('char_length(domain) desc'))
blocks.each { |block| block.history.add(@attempt_ip) } if @attempt_ip.present?
blocks.any?
end
@ -86,4 +87,8 @@ class EmailDomainBlock < ApplicationRecord
def self.block?(domain_or_domains, attempt_ip: nil)
Matcher.new(domain_or_domains, attempt_ip: attempt_ip).match?
end
def self.requires_approval?(domain_or_domains, attempt_ip: nil)
Matcher.new(domain_or_domains, attempt_ip: attempt_ip).match?(allow_with_approval: true)
end
end

View File

@ -418,7 +418,7 @@ class User < ApplicationRecord
def set_approved
self.approved = begin
if sign_up_from_ip_requires_approval?
if sign_up_from_ip_requires_approval? || sign_up_email_requires_approval?
false
else
open_registrations? || valid_invitation? || external?
@ -430,6 +430,12 @@ class User < ApplicationRecord
!sign_up_ip.nil? && IpBlock.where(severity: :sign_up_requires_approval).where('ip >>= ?', sign_up_ip.to_s).exists?
end
def sign_up_email_requires_approval?
return false unless email.present? || unconfirmed_email.present?
EmailDomainBlock.requires_approval?(email.presence || unconfirmed_email, attempt_ip: sign_up_ip)
end
def open_registrations?
Setting.registrations_mode == 'open'
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class REST::Admin::EmailDomainBlockSerializer < ActiveModel::Serializer
attributes :id, :domain, :created_at, :history
attributes :id, :domain, :created_at, :history, :allow_with_approval
def id
object.id.to_s

View File

@ -47,6 +47,7 @@ class EmailMxValidator < ActiveModel::Validator
dns.timeouts = 5
records = dns.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }
next if records == [''] # This domain explicitly rejects emails
([domain] + records).uniq.each do |hostname|
ips.concat(dns.getresources(hostname, Resolv::DNS::Resource::IN::A).to_a.map { |e| e.address.to_s })

View File

@ -12,3 +12,7 @@
·
= t('admin.email_domain_blocks.attempts_over_week', count: email_domain_block.history.reduce(0) { |sum, day| sum + day.accounts })
- if email_domain_block.allow_with_approval?
·
= t('admin.email_domain_blocks.allow_registrations_with_approval')

View File

@ -7,6 +7,9 @@
.fields-group
= f.input :domain, wrapper: :with_block_label, label: t('admin.email_domain_blocks.domain'), input_html: { readonly: defined?(@resolved_records) }
.fields-group
= f.input :allow_with_approval, wrapper: :with_label, hint: false, label: I18n.t('admin.email_domain_blocks.allow_registrations_with_approval')
- if defined?(@resolved_records)
%p.hint= t('admin.email_domain_blocks.resolved_dns_records_hint_html')

View File

@ -63,6 +63,8 @@ module Mastodon
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.active_record.marshalling_format_version = 7.1
# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.

View File

@ -1,10 +0,0 @@
# frozen_string_literal: true
# TODO
# The Rails 7.0 framework default here is to set this true. However, we have a
# location in devise that redirects where we don't have an easy ability to
# override a method or set a config option, but where the redirect does not
# provide this option.
# https://github.com/heartcombo/devise/blob/v4.9.2/app/controllers/devise/confirmations_controller.rb#L28
# Once a solution is found, this line can be removed.
Rails.application.config.action_controller.raise_on_open_redirects = false

View File

@ -158,15 +158,6 @@ Rails.application.config.add_autoload_paths_to_load_path = false
# rather than to rely on a global default.
# Rails.application.config.active_record.default_column_serializer = nil
# Enable a performance optimization that serializes Active Record models
# in a faster and more compact way.
#
# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
# not yet been upgraded must be able to read caches from upgraded servers,
# leave this optimization off on the first deploy, then enable it on a
# subsequent deploy.
# Rails.application.config.active_record.marshalling_format_version = 7.1
# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
# This matches the behaviour of all other callbacks.
# In previous versions of Rails, they ran in the inverse order.

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
# TODO
# Starting with Rails 7.0, the framework default here is to set this true.
# However, we have a location in devise that redirects where we don't have an
# easy ability to override the method or set a config option, and where the
# redirect does not supply this option itself.
# https://github.com/heartcombo/devise/blob/v4.9.2/app/controllers/devise/confirmations_controller.rb#L28
# Once a solution is found, this line can be removed.
Rails.application.config.action_controller.raise_on_open_redirects = false

View File

@ -3,6 +3,7 @@ ia:
activerecord:
attributes:
user:
email: Adresse de e-mail
password: Contrasigno
user/account:
username: Nomine de usator

View File

@ -19,6 +19,7 @@ ie:
account:
attributes:
username:
invalid: deve contener solmen lítteres, númeres e sublineas
reserved: es reservat
admin/webhook:
attributes:
@ -39,6 +40,7 @@ ie:
user:
attributes:
email:
blocked: usa un ne-permisset provisor de e-posta
unreachable: sembla ne exister
role_id:
elevated: ne posse esser plu alt quam tui actual rol

View File

@ -439,6 +439,7 @@ be:
view: Праглядзець новы блок дамену
email_domain_blocks:
add_new: Дадаць
allow_registrations_with_approval: Дазволіць рэгістрацыю з дазволам
attempts_over_week:
few: "%{count} спробы рэгіістрацыі за апошні тыдзень"
many: "%{count} спроб рэгіістрацыі за апошні тыдзень"

View File

@ -425,6 +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ó
attempts_over_week:
one: "%{count} intent en la darrera setmana"
other: "%{count} intents de registre en la darrera setmana"

View File

@ -453,6 +453,7 @@ cy:
view: Gweld bloc parth
email_domain_blocks:
add_new: Ychwanegu
allow_registrations_with_approval: Caniatáu cofrestriadau wedi'u cymeradwyo
attempts_over_week:
few: "%{count} ymgais i gofrestru dros yr wythnos ddiwethaf"
many: "%{count} ymgais i gofrestru dros yr wythnos ddiwethaf"

View File

@ -425,6 +425,7 @@ da:
view: Vis domæneblokering
email_domain_blocks:
add_new: Tilføj ny
allow_registrations_with_approval: Tillad registreringer med godkendelse
attempts_over_week:
one: "%{count} tilmeldingsforsøg over den seneste uge"
other: "%{count} tilmeldingsforsøg over den seneste uge"

View File

@ -34,7 +34,7 @@ el:
explanation: Το συνθηματικό του λογαριασμού σου άλλαξε.
extra: Αν δεν άλλαξες εσύ το συνθηματικό σου, ίσως κάποιος να έχει αποκτήσει πρόσβαση στο λογαριασμό σου. Παρακαλούμε άλλαξε το συνθηματικό σου άμεσα ή επικοινώνησε με τον διαχειριστή του κόμβου σου αν έχεις κλειδωθεί απ' έξω.
subject: 'Mastodon: Αλλαγή συνθηματικού'
title: Αλλαγή συνθηματικού
title: Ο κωδικός άλλαξε
reconfirmation_instructions:
explanation: Επιβεβαίωσε τη νέα διεύθυνση για να αλλάξεις το email σου.
extra: Αν δεν ζήτησες εσύ αυτή την αλλαγή, παρακαλούμε αγνόησε αυτό το email. Η διεύθυνση email για τον λογαριασμό σου στο Mastodon δεν θα αλλάξει μέχρι να επισκεφτείς τον παραπάνω σύνδεσμο.

View File

@ -1 +1,25 @@
---
ia:
devise:
mailer:
confirmation_instructions:
action: Verificar adresse de e-mail
action_with_app: Confirmar e retornar a %{app}
title: Verificar adresse de e-mail
email_changed:
title: Nove adresse de e-mail
reconfirmation_instructions:
title: Verificar adresse de e-mail
reset_password_instructions:
action: Cambiar contrasigno
title: Reinitialisar contrasigno
two_factor_disabled:
title: 2FA disactivate
registrations:
updated: Tu conto ha essite actualisate con successo.
unlocks:
unlocked: Tu conto ha essite disblocate con successo. Initia session a continuar.
errors:
messages:
already_confirmed: jam esseva confirmate, tenta initiar session
not_found: non trovate

View File

@ -46,17 +46,26 @@ ie:
title: 2FA desvalidat
two_factor_enabled:
title: 2FA permisset
two_factor_recovery_codes_changed:
explanation: Li anteyan codes de recuperation ha esset ínvalidat, e novis generat.
subject: 'Mastodon: 2-factor codes de recuperation regenerat'
title: 2FA codes de recuperation changeat
unlock_instructions:
subject: 'Mastodon: Desserral instructiones'
webauthn_credential:
added:
subject: 'Mastodon: Nov clave de securitá'
title: Un nov clave de securitá ha esset adjuntet
deleted:
subject: 'Mastodon: Clave de securitá deletet'
webauthn_disabled:
subject: 'Mastodon: Autentication con claves de securitá desactivisat'
title: Claves de securitá desactivisat
webauthn_enabled:
title: Claves de securitá activisat
omniauth_callbacks:
failure: Ne posset autenticar te de %{kind} pro "%{reason}".
success: Successosimen autenticat de conto %{kind}.
passwords:
no_token: Tu ne posse accessar ti-ci págine sin venir de un email pri reiniciar li passa-parol. Si tu ha venit de un email pri reiniciar li passa-parol, ples far cert que tu usat li complet URL providet.
send_instructions: Si tui email-adresse existe in nor database, tu va reciver un ligament por recuperar li passa-parol a tui email-adresse in quelc minutes. Ples vider tui spam-emails si tu ne recivet ti email.
@ -77,3 +86,6 @@ ie:
expired: ha expirat, ples demandar un nov
not_found: ne trovat
not_locked: ne esset serrat
not_saved:
one: '1 error prohibit ti %{resource} de esser conservat:'
other: "%{count} errores prohibit ti %{resource} de esser conservat:"

View File

@ -127,6 +127,7 @@ el:
bookmarks: Σελιδοδείκτες
conversations: Συνομιλίες
crypto: Κρυπτογράφηση από άκρο σε άκρο
favourites: Αγαπημένα
filters: Φίλτρα
follow: Ακολουθείτε, σε Σίγαση και Αποκλεισμοί
follows: Ακολουθείτε
@ -169,9 +170,10 @@ el:
read:accounts: να βλέπει τα στοιχεία λογαριασμών
read:blocks: να βλέπει τους αποκλεισμένους σου
read:bookmarks: εμφάνιση των σελιδοδεικτών σας
read:favourites: δείτε τα αγαπημένα σας
read:filters: να βλέπει τα φίλτρα σου
read:follows: να βλέπει ποιους ακολουθείς
read:lists: να βλέπει τις λίστες σου
read:follows: δές ποιους ακολουθείς