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:
@@ -53,8 +53,8 @@ module Sources
|
||||
FILENAME = %r!(?:(?<illust_id>\d+)_(?<page>\d+_))?(?<artist_id>\d+)_(?<timestamp>\d{14})(?:_\d+)?!i
|
||||
IMAGE_URL = %r!\Ahttps?://pic\d+\.nijie\.info/#{DIR}/#{FILENAME}\.\w+\z!i
|
||||
|
||||
def self.match?(*urls)
|
||||
urls.compact.any? { |x| x.match?(BASE_URL) }
|
||||
def domains
|
||||
["nijie.info"]
|
||||
end
|
||||
|
||||
def site_name
|
||||
|
||||
Reference in New Issue
Block a user