Fix upload source fetcher fetching from wrong work page for all sites

e.g. If you were on an html work page on pixiv, clicked a link to a
different html work page on pixiv, and then clicked the bookmarklet,
then it used to fetch the source from the FIRST work you were on instead
of the second.
This commit is contained in:
Toks
2015-06-03 20:59:24 -04:00
parent 04d6640792
commit 854d587373
5 changed files with 5 additions and 5 deletions

View File

@@ -70,7 +70,7 @@ module Sources
end
def referer_url(template)
template.params[:ref] || template.params[:url]
raise NotImplementedError
end
def image_urls

View File

@@ -6,7 +6,7 @@ module Sources
end
def referer_url(template)
if template.params[:ref] =~ /deviantart\.com\/art\//
if template.params[:ref] =~ /deviantart\.com\/art\// && template.params[:url] =~ /https?:\/\/(?:fc|th|pre|orig|img)\d{2}\.deviantart\.net\//
template.params[:ref]
else
template.params[:url]

View File

@@ -6,7 +6,7 @@ module Sources
end
def referer_url(template)
if template.params[:ref] =~ /seiga\.nicovideo\.jp\/seiga\/im\d+/
if template.params[:ref] =~ /seiga\.nicovideo\.jp\/seiga\/im\d+/ && template.params[:url] =~ /http:\/\/lohas\.nicoseiga\.jp\/priv\//
template.params[:ref]
else
template.params[:url]

View File

@@ -6,7 +6,7 @@ module Sources
end
def referer_url(template)
if template.params[:ref] =~ /nijie\.info\/view\.php/ && template.params[:ref] =~ /id=\d+/
if template.params[:ref] =~ /nijie\.info\/view\.php.+id=\d+/ && template.params[:url] =~ /pic\d+\.nijie.info\/nijie_picture\//
template.params[:ref]
else
template.params[:url]

View File

@@ -20,7 +20,7 @@ module Sources
end
def referer_url(template)
if template.params[:ref] =~ /pixiv\.net\/member_illust/ && template.params[:ref] =~ /mode=medium/
if template.params[:ref] =~ /pixiv\.net\/member_illust.+mode=medium/ && template.params[:url] =~ /#{IMG}|#{I12}/
template.params[:ref]
else
template.params[:url]