Merge commit '425d77f8124a50fc033e8fb3bdf7b89a6a25f4fa' into glitch-soc/merge-upstream

Conflicts:
- `.rubocop_todo.yml`:
  Upstream regenerated this file, glitch-soc had a specific ignore.
- `README.md`:
  Upstream updated its README, but glitch-soc has a completely different one.
  Kept glitch-soc's README
This commit is contained in:
Claire
2023-08-11 22:15:41 +02:00
130 changed files with 1818 additions and 1188 deletions

View File

@@ -23,6 +23,6 @@ module Payloadable
end
def signing_enabled?
ENV['AUTHORIZED_FETCH'] != 'true' && !Rails.configuration.x.whitelist_mode
ENV['AUTHORIZED_FETCH'] != 'true' && !Rails.configuration.x.limited_federation_mode
end
end

View File

@@ -45,20 +45,18 @@ class FetchLinkCardService < BaseService
def html
return @html if defined?(@html)
Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => "#{Mastodon::Version.user_agent} Bot").perform do |res|
@html = Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => "#{Mastodon::Version.user_agent} Bot").perform do |res|
next unless res.code == 200 && res.mime_type == 'text/html'
# We follow redirects, and ideally we want to save the preview card for
# the destination URL and not any link shortener in-between, so here
# we set the URL to the one of the last response in the redirect chain
@url = res.request.uri.to_s
@card = PreviewCard.find_or_initialize_by(url: @url) if @card.url != @url
if res.code == 200 && res.mime_type == 'text/html'
@html_charset = res.charset
@html = res.body_with_limit
else
@html_charset = nil
@html = nil
end
@html_charset = res.charset
res.body_with_limit
end
end

View File

@@ -4,7 +4,7 @@ class UnallowDomainService < BaseService
include DomainControlHelper
def call(domain_allow)
suspend_accounts!(domain_allow.domain) if whitelist_mode?
suspend_accounts!(domain_allow.domain) if limited_federation_mode?
domain_allow.destroy
end