fixes #827
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
module Sources
|
module Sources
|
||||||
class Site
|
class Site
|
||||||
attr_reader :url, :strategy
|
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
|
def self.strategies
|
||||||
[Strategies::NicoSeiga, Strategies::Pixiv]
|
[Strategies::NicoSeiga, Strategies::Pixiv]
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ module Sources
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def referer_url(template)
|
||||||
|
template.params[:ref] || template.params[:url]
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def agent
|
def agent
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ module Sources
|
|||||||
url =~ /^https?:\/\/(?:\w+\.)?pixiv\.net/
|
url =~ /^https?:\/\/(?:\w+\.)?pixiv\.net/
|
||||||
end
|
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
|
def site_name
|
||||||
"Pixiv"
|
"Pixiv"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<% if source.try(:available?) %>
|
<% if source.try(:available?) %>
|
||||||
<div id="source-info">
|
<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>
|
<ul>
|
||||||
<li><strong>Artist</strong>: <span id="source-artist"></span></li>
|
<li><strong>Artist</strong>: <span id="source-artist"></span></li>
|
||||||
|
|||||||
Reference in New Issue
Block a user