forked from treehouse/mastodon
Catching more exceptions that slipped through, removing AR logging from
production as it's very verbose and not very usefulsignup-info-prompt
parent
b078885414
commit
fe77921e47
|
@ -18,6 +18,10 @@ class ApiController < ApplicationController
|
||||||
render json: { error: 'Remote data could not be fetched' }, status: 503
|
render json: { error: 'Remote data could not be fetched' }, status: 503
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rescue_from OpenSSL::SSL::SSLError do
|
||||||
|
render json: { error: 'Remote SSL certificate could not be verified' }, status: 503
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def current_resource_owner
|
def current_resource_owner
|
||||||
|
|
|
@ -30,6 +30,12 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gone
|
||||||
|
respond_to do |format|
|
||||||
|
format.any { head 410 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def current_account
|
def current_account
|
||||||
current_user.try(:account)
|
current_user.try(:account)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,13 +8,16 @@ class StreamEntriesController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@type = @stream_entry.activity_type.downcase
|
@type = @stream_entry.activity_type.downcase
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html do
|
||||||
|
return gone if @stream_entry.activity.nil?
|
||||||
|
|
||||||
if @stream_entry.activity_type == 'Status'
|
if @stream_entry.activity_type == 'Status'
|
||||||
@ancestors = @stream_entry.activity.ancestors
|
@ancestors = @stream_entry.activity.ancestors
|
||||||
@descendants = @stream_entry.activity.descendants
|
@descendants = @stream_entry.activity.descendants
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.atom
|
format.atom
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,9 @@ class FetchAtomService < BaseService
|
||||||
else
|
else
|
||||||
return process_html(fetch(url))
|
return process_html(fetch(url))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rescue OpenSSL::SSL::SSLError => e
|
||||||
|
Rails.logger.debug "SSL error: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -19,5 +19,7 @@ class FetchRemoteAccountService < BaseService
|
||||||
Rails.logger.debug "Going to webfinger #{username}@#{domain}"
|
Rails.logger.debug "Going to webfinger #{username}@#{domain}"
|
||||||
|
|
||||||
return FollowRemoteAccountService.new.call("#{username}@#{domain}")
|
return FollowRemoteAccountService.new.call("#{username}@#{domain}")
|
||||||
|
rescue Nokogiri::XML::XPath::SyntaxError
|
||||||
|
Rails.logger.debug "Invalid XML or missing namespace"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,5 +31,8 @@ class FetchRemoteStatusService < BaseService
|
||||||
Rails.logger.debug "Going to webfinger #{username}@#{domain}"
|
Rails.logger.debug "Going to webfinger #{username}@#{domain}"
|
||||||
|
|
||||||
return FollowRemoteAccountService.new.call("#{username}@#{domain}")
|
return FollowRemoteAccountService.new.call("#{username}@#{domain}")
|
||||||
|
rescue Nokogiri::XML::XPath::SyntaxError
|
||||||
|
Rails.logger.debug "Invalid XML or missing namespace"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,4 +85,6 @@ Rails.application.configure do
|
||||||
config.action_mailer.delivery_method = :smtp
|
config.action_mailer.delivery_method = :smtp
|
||||||
|
|
||||||
config.react.variant = :production
|
config.react.variant = :production
|
||||||
|
|
||||||
|
config.active_record.logger = nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue