Merge remote-tracking branch 'parent/main' into upstream-20250328
This commit is contained in:
commit
12ed20b6d5
257 changed files with 3505 additions and 2010 deletions
|
@ -37,7 +37,11 @@ class AccountReachFinder
|
|||
|
||||
def oldest_status_id
|
||||
Mastodon::Snowflake
|
||||
.id_at(STATUS_SINCE.ago, with_random: false)
|
||||
.id_at(oldest_status_date, with_random: false)
|
||||
end
|
||||
|
||||
def oldest_status_date
|
||||
@account.suspended? && @account.suspension_origin_local? ? @account.suspended_at - STATUS_SINCE : STATUS_SINCE.ago
|
||||
end
|
||||
|
||||
def recent_statuses
|
||||
|
|
|
@ -10,7 +10,7 @@ class ContentSecurityPolicy
|
|||
end
|
||||
|
||||
def media_hosts
|
||||
[assets_host, cdn_host_value, paperclip_root_url].compact
|
||||
[assets_host, cdn_host_value, paperclip_root_url].concat(extra_media_hosts).compact
|
||||
end
|
||||
|
||||
def sso_host
|
||||
|
@ -31,6 +31,10 @@ class ContentSecurityPolicy
|
|||
|
||||
private
|
||||
|
||||
def extra_media_hosts
|
||||
ENV.fetch('EXTRA_MEDIA_HOSTS', '').split(/(?:\s*,\s*|\s+)/)
|
||||
end
|
||||
|
||||
def url_from_configured_asset_host
|
||||
Rails.configuration.action_controller.asset_host
|
||||
end
|
||||
|
|
|
@ -24,7 +24,15 @@ class EmojiFormatter
|
|||
def to_s
|
||||
return html if custom_emojis.empty? || html.blank?
|
||||
|
||||
tree = Nokogiri::HTML5.fragment(html)
|
||||
begin
|
||||
tree = Nokogiri::HTML5.fragment(html)
|
||||
rescue ArgumentError
|
||||
# This can happen if one of the Nokogumbo limits is encountered
|
||||
# Unfortunately, it does not use a more precise error class
|
||||
# nor allows more graceful handling
|
||||
return ''
|
||||
end
|
||||
|
||||
tree.xpath('./text()|.//text()[not(ancestor[@class="invisible"])]').to_a.each do |node|
|
||||
i = -1
|
||||
inside_shortname = false
|
||||
|
|
|
@ -16,7 +16,15 @@ class PlainTextFormatter
|
|||
if local?
|
||||
text
|
||||
else
|
||||
node = Nokogiri::HTML5.fragment(insert_newlines)
|
||||
begin
|
||||
node = Nokogiri::HTML5.fragment(insert_newlines)
|
||||
rescue ArgumentError
|
||||
# This can happen if one of the Nokogumbo limits is encountered
|
||||
# Unfortunately, it does not use a more precise error class
|
||||
# nor allows more graceful handling
|
||||
return ''
|
||||
end
|
||||
|
||||
# Elements that are entirely removed with our Sanitize config
|
||||
node.xpath('.//iframe|.//math|.//noembed|.//noframes|.//noscript|.//plaintext|.//script|.//style|.//svg|.//xmp').remove
|
||||
node.text.chomp
|
||||
|
|
|
@ -260,7 +260,7 @@ class Request
|
|||
outer_e = nil
|
||||
port = args.first
|
||||
|
||||
addresses = [] # rubocop:disable Lint/UselessAssignment -- TODO: https://github.com/rubocop/rubocop/issues/13395
|
||||
addresses = []
|
||||
begin
|
||||
addresses = [IPAddr.new(host)]
|
||||
rescue IPAddr::InvalidAddressError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue