From 0a75402cc75b75f6025222a3f98508bbefda7385 Mon Sep 17 00:00:00 2001 From: Toks Date: Thu, 8 May 2014 20:25:11 -0400 Subject: [PATCH] Support referrer matching for seiga and da --- app/logical/sources/strategies/deviant_art.rb | 8 ++++++++ app/logical/sources/strategies/nico_seiga.rb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/app/logical/sources/strategies/deviant_art.rb b/app/logical/sources/strategies/deviant_art.rb index 11a463282..cd7193a65 100644 --- a/app/logical/sources/strategies/deviant_art.rb +++ b/app/logical/sources/strategies/deviant_art.rb @@ -5,6 +5,14 @@ module Sources url =~ /^https?:\/\/(?:.+?\.)?deviantart\.(?:com|net)/ end + def referer_url(template) + if template.params[:ref] =~ /deviantart\.com\/art\// + template.params[:ref] + else + template.params[:url] + end + end + def site_name "Deviant Art" end diff --git a/app/logical/sources/strategies/nico_seiga.rb b/app/logical/sources/strategies/nico_seiga.rb index e58a7dffc..32f5cad7c 100644 --- a/app/logical/sources/strategies/nico_seiga.rb +++ b/app/logical/sources/strategies/nico_seiga.rb @@ -5,6 +5,14 @@ module Sources url =~ /^https?:\/\/(?:\w+\.)?nico(?:seiga|video)\.jp/ end + def referer_url(template) + if template.params[:ref] =~ /seiga\.nicovideo\.jp\/seiga\/im\d+/ + template.params[:ref] + else + template.params[:url] + end + end + def site_name "Nico Seiga" end