fixes #827
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module Sources
|
||||
class Site
|
||||
attr_reader :url, :strategy
|
||||
delegate :get, :site_name, :artist_name, :profile_url, :image_url, :tags, :artist_record, :unique_id, :to => :strategy
|
||||
delegate :get, :referer_url, :site_name, :artist_name, :profile_url, :image_url, :tags, :artist_record, :unique_id, :to => :strategy
|
||||
|
||||
def self.strategies
|
||||
[Strategies::NicoSeiga, Strategies::Pixiv]
|
||||
|
||||
@@ -33,6 +33,10 @@ module Sources
|
||||
end
|
||||
end
|
||||
|
||||
def referer_url(template)
|
||||
template.params[:ref] || template.params[:url]
|
||||
end
|
||||
|
||||
protected
|
||||
def agent
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -5,6 +5,14 @@ module Sources
|
||||
url =~ /^https?:\/\/(?:\w+\.)?pixiv\.net/
|
||||
end
|
||||
|
||||
def referer_url(template)
|
||||
if template.params[:ref] =~ /pixiv\.net\/member_illust/ && template.params[:ref] !~ /mode=manga/
|
||||
template.params[:ref]
|
||||
else
|
||||
template.params[:url]
|
||||
end
|
||||
end
|
||||
|
||||
def site_name
|
||||
"Pixiv"
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<% if source.try(:available?) %>
|
||||
<div id="source-info">
|
||||
<p>This looks like a <%= source.site_name %> upload. <%= link_to "Fetch data", source_path(:format => "json", :url => params[:ref] || params[:url]), :id => "fetch-data" %>.</p>
|
||||
<p>This looks like a <%= source.site_name %> upload. <%= link_to "Fetch data", source_path(:format => "json", :url => source.referer_url(self)), :id => "fetch-data" %>.</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>Artist</strong>: <span id="source-artist"></span></li>
|
||||
|
||||
Reference in New Issue
Block a user