From 43c311b3a101d7364f10365c1a7a19374d539e93 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 27 Nov 2018 18:13:36 +0100 Subject: Fix nil error when no DNS addresses are found for host (#9379) --- app/lib/request.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/lib/request.rb b/app/lib/request.rb index bb6ef4661..024fce88a 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -163,7 +163,11 @@ class Request end end - raise outer_e if outer_e + if outer_e + raise outer_e + else + raise SocketError, "No address for #{host}" + end end alias new open -- cgit From 81f96c973afab8b8357651dd55bc7b086d512935 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 27 Nov 2018 18:49:37 +0100 Subject: Don't count suspended users in user count (#9380) Fix #7637 --- app/presenters/instance_presenter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index 093c8ff32..dc77162d4 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -18,7 +18,7 @@ class InstancePresenter end def user_count - Rails.cache.fetch('user_count') { User.confirmed.count } + Rails.cache.fetch('user_count') { User.confirmed.joins(:account).merge(Account.without_suspended).count } end def status_count -- cgit From 11955600ad8ef1be41b01c5424a07975caeaaf51 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 27 Nov 2018 19:15:08 +0100 Subject: Skip deliveries to inboxes that have already been marked as unavailable (#9358) --- app/workers/activitypub/delivery_worker.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/workers/activitypub/delivery_worker.rb b/app/workers/activitypub/delivery_worker.rb index adbb496d9..f9c385ea3 100644 --- a/app/workers/activitypub/delivery_worker.rb +++ b/app/workers/activitypub/delivery_worker.rb @@ -11,6 +11,8 @@ class ActivityPub::DeliveryWorker HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze def perform(json, source_account_id, inbox_url, options = {}) + return if DeliveryFailureTracker.unavailable?(inbox_url) + @options = options.with_indifferent_access @json = json @source_account = Account.find(source_account_id) -- cgit From c39d7e7b2b80a23f8d4e1410bb1c2d6033f30af0 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 27 Nov 2018 19:46:05 +0100 Subject: Fix TLS handshake timeout not being enforced (#9381) Follow-up to #9329 --- app/lib/request.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/lib/request.rb b/app/lib/request.rb index 024fce88a..4a81773e3 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -4,6 +4,16 @@ require 'ipaddr' require 'socket' require 'resolv' +# Monkey-patch the HTTP.rb timeout class to avoid using a timeout block +# around the Socket#open method, since we use our own timeout blocks inside +# that method +class HTTP::Timeout::PerOperation + def connect(socket_class, host, port, nodelay = false) + @socket = socket_class.open(host, port) + @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if nodelay + end +end + class Request REQUEST_TARGET = '(request-target)' @@ -95,7 +105,11 @@ class Request end def timeout - { connect: nil, read: 10, write: 10 } + # We enforce a 1s timeout on DNS resolving, 10s timeout on socket opening + # and 5s timeout on the TLS handshake, meaning the worst case should take + # about 16s in total + + { connect: 5, read: 10, write: 10 } end def http_client -- cgit From fa9f28f52d38b5cf3184d6bc77f5554b74fca348 Mon Sep 17 00:00:00 2001 From: ThibG Date: Thu, 29 Nov 2018 02:56:09 +0100 Subject: Swap avatar and header input fields in profile page (#9271) Fixes #9211 --- app/views/settings/profiles/show.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index f5c50144b..4530ffae2 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -14,9 +14,10 @@ = render 'application/card', account: @account .fields-row__column.fields-group.fields-row__column-6 + = f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header', dimensions: '1500x500', size: number_to_human_size(AccountHeader::LIMIT)) + = f.input :avatar, wrapper: :with_label, input_html: { accept: AccountAvatar::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.avatar', dimensions: '400x400', size: number_to_human_size(AccountAvatar::LIMIT)) - = f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header', dimensions: '1500x500', size: number_to_human_size(AccountHeader::LIMIT)) %hr.spacer/ -- cgit