Merge pull request #2719 from ClearlyClaire/glitch-soc/merge-upstream

Merge upstream changes up to ccb6aeddac
main-rebase-security-fix
Claire 2024-05-25 19:26:23 +02:00 committed by GitHub
commit 60c2310fd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 745 additions and 703 deletions

View File

@ -103,6 +103,8 @@ gem 'rdf-normalize', '~> 0.5'
gem 'private_address_check', '~> 0.5' gem 'private_address_check', '~> 0.5'
gem 'opentelemetry-api', '~> 1.2.5'
group :opentelemetry do group :opentelemetry do
gem 'opentelemetry-exporter-otlp', '~> 0.26.3', require: false gem 'opentelemetry-exporter-otlp', '~> 0.26.3', require: false
gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false

View File

@ -726,7 +726,7 @@ GEM
rspec-mocks (~> 3.0) rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8) sidekiq (>= 5, < 8)
rspec-support (3.13.1) rspec-support (3.13.1)
rubocop (1.63.5) rubocop (1.64.0)
json (~> 2.3) json (~> 2.3)
language_server-protocol (>= 3.17.0) language_server-protocol (>= 3.17.0)
parallel (~> 1.10) parallel (~> 1.10)
@ -877,7 +877,7 @@ GEM
webfinger (1.2.0) webfinger (1.2.0)
activesupport activesupport
httpclient (>= 2.4) httpclient (>= 2.4)
webmock (3.23.0) webmock (3.23.1)
addressable (>= 2.8.0) addressable (>= 2.8.0)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
@ -975,6 +975,7 @@ DEPENDENCIES
omniauth-rails_csrf_protection (~> 1.0) omniauth-rails_csrf_protection (~> 1.0)
omniauth-saml (~> 2.0) omniauth-saml (~> 2.0)
omniauth_openid_connect (~> 0.6.1) omniauth_openid_connect (~> 0.6.1)
opentelemetry-api (~> 1.2.5)
opentelemetry-exporter-otlp (~> 0.26.3) opentelemetry-exporter-otlp (~> 0.26.3)
opentelemetry-instrumentation-active_job (~> 0.7.1) opentelemetry-instrumentation-active_job (~> 0.7.1)
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1) opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)

View File

@ -44,7 +44,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
end end
def build_resource(hash = nil) def build_resource(hash = nil)
super(hash) super
resource.locale = I18n.locale resource.locale = I18n.locale
resource.invite_code = @invite&.code if resource.invite_code.blank? resource.invite_code = @invite&.code if resource.invite_code.blank?

View File

@ -15,7 +15,7 @@ const mapStateToProps = (state, { columnId }) => {
return { return {
settings: columns.get(index).get('params'), settings: columns.get(index).get('params'),
onLoad (value) { onLoad (value) {
return api(() => state).get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => { return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return (response.data.hashtags || []).map((tag) => { return (response.data.hashtags || []).map((tag) => {
return { value: tag.name, label: `#${tag.name}` }; return { value: tag.name, label: `#${tag.name}` };
}); });

View File

@ -15,7 +15,7 @@ const mapStateToProps = (state, { columnId }) => {
return { return {
settings: columns.get(index).get('params'), settings: columns.get(index).get('params'),
onLoad (value) { onLoad (value) {
return api(() => state).get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => { return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return (response.data.hashtags || []).map((tag) => { return (response.data.hashtags || []).map((tag) => {
return { value: tag.name, label: `#${tag.name}` }; return { value: tag.name, label: `#${tag.name}` };
}); });

View File

@ -234,7 +234,7 @@
"embed.preview": "이렇게 표시됩니다:", "embed.preview": "이렇게 표시됩니다:",
"emoji_button.activity": "활동", "emoji_button.activity": "활동",
"emoji_button.clear": "지우기", "emoji_button.clear": "지우기",
"emoji_button.custom": "사용자 지정", "emoji_button.custom": "커스텀",
"emoji_button.flags": "깃발", "emoji_button.flags": "깃발",
"emoji_button.food": "음식과 마실것", "emoji_button.food": "음식과 마실것",
"emoji_button.label": "에모지 추가", "emoji_button.label": "에모지 추가",

View File

@ -297,6 +297,7 @@
"filter_modal.select_filter.subtitle": "Bruk ein eksisterande kategori eller opprett ein ny", "filter_modal.select_filter.subtitle": "Bruk ein eksisterande kategori eller opprett ein ny",
"filter_modal.select_filter.title": "Filtrer dette innlegget", "filter_modal.select_filter.title": "Filtrer dette innlegget",
"filter_modal.title.status": "Filtrer eit innlegg", "filter_modal.title.status": "Filtrer eit innlegg",
"filtered_notifications_banner.mentions": "{count, plural, one {omtale} other {omtaler}}",
"filtered_notifications_banner.pending_requests": "Varsel frå {count, plural, =0 {ingen} one {ein person} other {# folk}} du kanskje kjenner", "filtered_notifications_banner.pending_requests": "Varsel frå {count, plural, =0 {ingen} one {ein person} other {# folk}} du kanskje kjenner",
"filtered_notifications_banner.title": "Filtrerte varslingar", "filtered_notifications_banner.title": "Filtrerte varslingar",
"firehose.all": "Alle", "firehose.all": "Alle",
@ -307,6 +308,8 @@
"follow_requests.unlocked_explanation": "Sjølv om kontoen din ikkje er låst tenkte dei som driv {domain} at du kanskje ville gå gjennom førespurnadar frå desse kontoane manuelt.", "follow_requests.unlocked_explanation": "Sjølv om kontoen din ikkje er låst tenkte dei som driv {domain} at du kanskje ville gå gjennom førespurnadar frå desse kontoane manuelt.",
"follow_suggestions.curated_suggestion": "Utvalt av staben", "follow_suggestions.curated_suggestion": "Utvalt av staben",
"follow_suggestions.dismiss": "Ikkje vis igjen", "follow_suggestions.dismiss": "Ikkje vis igjen",
"follow_suggestions.featured_longer": "Hanplukka av gjengen på {domain}",
"follow_suggestions.friends_of_friends_longer": "Populært hjå dei du fylgjer",
"follow_suggestions.hints.featured": "Denne profilen er handplukka av folka på {domain}.", "follow_suggestions.hints.featured": "Denne profilen er handplukka av folka på {domain}.",
"follow_suggestions.hints.friends_of_friends": "Denne profilen er populær hjå dei du fylgjer.", "follow_suggestions.hints.friends_of_friends": "Denne profilen er populær hjå dei du fylgjer.",
"follow_suggestions.hints.most_followed": "Mange på {domain} fylgjer denne profilen.", "follow_suggestions.hints.most_followed": "Mange på {domain} fylgjer denne profilen.",
@ -314,6 +317,8 @@
"follow_suggestions.hints.similar_to_recently_followed": "Denne profilen liknar på dei andre profilane du har fylgt i det siste.", "follow_suggestions.hints.similar_to_recently_followed": "Denne profilen liknar på dei andre profilane du har fylgt i det siste.",
"follow_suggestions.personalized_suggestion": "Personleg forslag", "follow_suggestions.personalized_suggestion": "Personleg forslag",
"follow_suggestions.popular_suggestion": "Populært forslag", "follow_suggestions.popular_suggestion": "Populært forslag",
"follow_suggestions.popular_suggestion_longer": "Populært på {domain}",
"follow_suggestions.similar_to_recently_followed_longer": "Liknar på profilar du har fylgt i det siste",
"follow_suggestions.view_all": "Vis alle", "follow_suggestions.view_all": "Vis alle",
"follow_suggestions.who_to_follow": "Kven du kan fylgja", "follow_suggestions.who_to_follow": "Kven du kan fylgja",
"followed_tags": "Fylgde emneknaggar", "followed_tags": "Fylgde emneknaggar",

View File

@ -33,6 +33,6 @@ class ActivityPub::Serializer < ActiveModel::Serializer
adapter_options[:named_contexts].merge!(_named_contexts) adapter_options[:named_contexts].merge!(_named_contexts)
adapter_options[:context_extensions].merge!(_context_extensions) adapter_options[:context_extensions].merge!(_context_extensions)
end end
super(adapter_options, options, adapter_instance) super
end end
end end

View File

@ -31,7 +31,7 @@ class AdvancedTextFormatter < TextFormatter
# @option options [String] :content_type # @option options [String] :content_type
def initialize(text, options = {}) def initialize(text, options = {})
@content_type = options.delete(:content_type) @content_type = options.delete(:content_type)
super(text, options) super
@text = format_markdown(text) if content_type == 'text/markdown' @text = format_markdown(text) if content_type == 'text/markdown'
end end

View File

@ -5,7 +5,7 @@ require_relative 'shared_timed_stack'
class ConnectionPool::SharedConnectionPool < ConnectionPool class ConnectionPool::SharedConnectionPool < ConnectionPool
def initialize(options = {}, &block) def initialize(options = {}, &block)
super(options, &block) super
@available = ConnectionPool::SharedTimedStack.new(@size, &block) @available = ConnectionPool::SharedTimedStack.new(@size, &block)
end end

View File

@ -2,7 +2,7 @@
class RSS::Channel < RSS::Element class RSS::Channel < RSS::Element
def initialize def initialize
super() super
@root = create_element('channel') @root = create_element('channel')
end end

View File

@ -2,7 +2,7 @@
class RSS::Item < RSS::Element class RSS::Item < RSS::Element
def initialize def initialize
super() super
@root = create_element('item') @root = create_element('item')
end end

View File

@ -23,7 +23,7 @@ module Attachmentable
included do included do
def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicateName def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicateName
super(name, options) super
send(:"before_#{name}_validate", prepend: true) do send(:"before_#{name}_validate", prepend: true) do
attachment = send(name) attachment = send(name)

View File

@ -151,13 +151,23 @@ class AccountSearchService < BaseService
end end
def call(query, account = nil, options = {}) def call(query, account = nil, options = {})
@query = query&.strip&.gsub(/\A@/, '') MastodonOTELTracer.in_span('AccountSearchService#call') do |span|
@limit = options[:limit].to_i @query = query&.strip&.gsub(/\A@/, '')
@offset = options[:offset].to_i @limit = options[:limit].to_i
@options = options @offset = options[:offset].to_i
@account = account @options = options
@account = account
search_service_results.compact.uniq span.add_attributes(
'search.offset' => @offset,
'search.limit' => @limit,
'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'
)
search_service_results.compact.uniq.tap do |results|
span.set_attribute('search.results.count', results.size)
end
end
end end
private private

View File

@ -2,14 +2,24 @@
class StatusesSearchService < BaseService class StatusesSearchService < BaseService
def call(query, account = nil, options = {}) def call(query, account = nil, options = {})
@query = query&.strip MastodonOTELTracer.in_span('StatusesSearchService#call') do |span|
@account = account @query = query&.strip
@options = options @account = account
@limit = options[:limit].to_i @options = options
@offset = options[:offset].to_i @limit = options[:limit].to_i
@offset = options[:offset].to_i
convert_deprecated_options!
convert_deprecated_options! span.add_attributes(
status_search_results 'search.offset' => @offset,
'search.limit' => @limit,
'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'
)
status_search_results.tap do |results|
span.set_attribute('search.results.count', results.size)
end
end
end end
private private

View File

@ -2,15 +2,25 @@
class TagSearchService < BaseService class TagSearchService < BaseService
def call(query, options = {}) def call(query, options = {})
@query = query.strip.delete_prefix('#') MastodonOTELTracer.in_span('TagSearchService#call') do |span|
@offset = options.delete(:offset).to_i @query = query.strip.delete_prefix('#')
@limit = options.delete(:limit).to_i @offset = options.delete(:offset).to_i
@options = options @limit = options.delete(:limit).to_i
@options = options
results = from_elasticsearch if Chewy.enabled? span.add_attributes(
results ||= from_database 'search.offset' => @offset,
'search.limit' => @limit,
'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'
)
results results = from_elasticsearch if Chewy.enabled?
results ||= from_database
span.set_attribute('search.results.count', results.size)
results
end
end end
private private

View File

@ -38,7 +38,7 @@ module ActiveRecord
end end
end end
super(direction, migrations, schema_migration, internal_metadata, target_version) super
end end
end end

View File

@ -66,3 +66,5 @@ if ENV.keys.any? { |name| name.match?(/OTEL_.*_ENDPOINT/) }
c.service_version = Mastodon::Version.to_s c.service_version = Mastodon::Version.to_s
end end
end end
MastodonOTELTracer = OpenTelemetry.tracer_provider.tracer('mastodon')

View File

@ -951,6 +951,7 @@ fi:
delete: Poista delete: Poista
edit_preset: Muokkaa varoituksen esiasetusta edit_preset: Muokkaa varoituksen esiasetusta
empty: Et ole vielä määrittänyt yhtäkään varoitusten esiasetusta. empty: Et ole vielä määrittänyt yhtäkään varoitusten esiasetusta.
title: Varoituksen esiasetukset
webhooks: webhooks:
add_new: Lisää päätepiste add_new: Lisää päätepiste
delete: Poista delete: Poista

View File

@ -285,6 +285,7 @@ nn:
update_custom_emoji_html: "%{name} oppdaterte emojien %{target}" update_custom_emoji_html: "%{name} oppdaterte emojien %{target}"
update_domain_block_html: "%{name} oppdaterte domeneblokkeringa for %{target}" update_domain_block_html: "%{name} oppdaterte domeneblokkeringa for %{target}"
update_ip_block_html: "%{name} endret regel for IP %{target}" update_ip_block_html: "%{name} endret regel for IP %{target}"
update_report_html: "%{name} oppdaterte rapporten %{target}"
update_status_html: "%{name} oppdaterte innlegg av %{target}" update_status_html: "%{name} oppdaterte innlegg av %{target}"
update_user_role_html: "%{name} endret %{target} -rolle" update_user_role_html: "%{name} endret %{target} -rolle"
deleted_account: sletta konto deleted_account: sletta konto
@ -950,6 +951,7 @@ nn:
delete: Slett delete: Slett
edit_preset: Endr åtvaringsoppsett edit_preset: Endr åtvaringsoppsett
empty: Du har ikke definert noen forhåndsinnstillinger for advarsler enda. empty: Du har ikke definert noen forhåndsinnstillinger for advarsler enda.
title: Førehandsinnstillingar for varsel
webhooks: webhooks:
add_new: Legg til endepunkt add_new: Legg til endepunkt
delete: Slett delete: Slett

1339
yarn.lock

File diff suppressed because it is too large Load Diff