moebooru: delegate to substrategy based on post source (#3911).
If the yande.re or konachan.com post has a source from a supported site, for example Pixiv or Twitter, then delegate the artist and commentary lookup to that substrategy. Only do this for sources from recognized sites, not the null strategy.
This commit is contained in:
@@ -12,15 +12,12 @@ module Sources
|
||||
Strategies::Nijie,
|
||||
Strategies::Pawoo,
|
||||
Strategies::Moebooru,
|
||||
|
||||
Strategies::Null # MUST BE LAST!
|
||||
]
|
||||
end
|
||||
|
||||
def self.find(url, referer=nil)
|
||||
all
|
||||
.detect { |strategy| strategy.match?(url, referer) }
|
||||
.new(url, referer)
|
||||
def self.find(url, referer=nil, default: Strategies::Null)
|
||||
strategy = all.detect { |strategy| strategy.match?(url, referer) } || default
|
||||
strategy&.new(url, referer)
|
||||
end
|
||||
|
||||
def self.canonical(url, referer)
|
||||
|
||||
Reference in New Issue
Block a user