sources: fix sources sometimes choosing wrong strategy (fix #3968)
Fix sources choosing the wrong strategy when the referer belongs to a different site (for example, when uploading a twitter post with a pixiv referer). * Fix `match?` to only consider the main url, not the referer. * Change `match?` to match against a list of domains given by the `domains` method. * Change `match?` to an instance method.
This commit is contained in:
@@ -9,10 +9,6 @@ module Sources::Strategies
|
||||
|
||||
attr_reader :json, :image_urls
|
||||
|
||||
def self.match?(*urls)
|
||||
urls.compact.any? { |x| x.match?(PROJECT) || x.match?(ASSET) || x.match?(PROFILE)}
|
||||
end
|
||||
|
||||
# https://www.artstation.com/artwork/04XA4
|
||||
# https://www.artstation.com/artwork/cody-from-sf
|
||||
# https://sa-dui.artstation.com/projects/DVERn
|
||||
@@ -24,6 +20,10 @@ module Sources::Strategies
|
||||
end
|
||||
end
|
||||
|
||||
def domains
|
||||
["artstation.com"]
|
||||
end
|
||||
|
||||
def site_name
|
||||
"ArtStation"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user