Follow up to #38711 - support instances running on subdomains (#39379)

This commit is contained in:
Shlee 2026-06-11 23:28:19 +09:30 committed by GitHub
parent 90438e9b2e
commit 1f84b98292
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,14 +23,14 @@ class ProcessLinksService < BaseService
def scan_text!
urls = @status.text.scan(FetchLinkCardService::URL_PATTERN).map { |array| Addressable::URI.parse(array[1]).normalize }
domains = urls.map(&:domain).uniq
domains = urls.map(&:host).uniq
valid_domains = Instance.searchable.where(domain: domains).pluck(:domain)
urls.each do |url|
# We only support `FeaturedCollection` at this time
object = ActivityPub::TagManager.instance.uri_to_resource(url.to_s, Collection)
object ||= ResolveURLService.new.call(url.to_s) if valid_domains.include?(url.domain)
object ||= ResolveURLService.new.call(url.to_s) if valid_domains.include?(url.host)
next unless object.is_a?(Collection)
tagged_object = @previous_objects.find { |x| x.object == object || x.uri == url }