| 
						
						
						
					 | 
					 | 
					@ -1,6 +1,8 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					# frozen_string_literal: true
 | 
					 | 
					 | 
					 | 
					# frozen_string_literal: true
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					class FetchLinkCardService < BaseService
 | 
					 | 
					 | 
					 | 
					class FetchLinkCardService < BaseService
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  USER_AGENT = "#{HTTP::Request::USER_AGENT} (Mastodon; +http://#{Rails.configuration.x.local_domain}/)"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def call(status)
 | 
					 | 
					 | 
					 | 
					  def call(status)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # Get first http/https URL that isn't local
 | 
					 | 
					 | 
					 | 
					    # Get first http/https URL that isn't local
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    url = URI.extract(status.text).reject { |uri| (uri =~ /\Ahttps?:\/\//).nil? || TagManager.instance.local_url?(uri) }.first
 | 
					 | 
					 | 
					 | 
					    url = URI.extract(status.text).reject { |uri| (uri =~ /\Ahttps?:\/\//).nil? || TagManager.instance.local_url?(uri) }.first
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -26,7 +28,7 @@ class FetchLinkCardService < BaseService
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  private
 | 
					 | 
					 | 
					 | 
					  private
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def http_client
 | 
					 | 
					 | 
					 | 
					  def http_client
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    HTTP.timeout(:per_operation, write: 10, connect: 10, read: 10).follow
 | 
					 | 
					 | 
					 | 
					    HTTP.headers(user_agent: USER_AGENT).timeout(:per_operation, write: 10, connect: 10, read: 10).follow
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  end
 | 
					 | 
					 | 
					 | 
					  end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def meta_property(html, property)
 | 
					 | 
					 | 
					 | 
					  def meta_property(html, property)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |