From 141b50e15e31e8442a67b97039a91c64f2e68a83 Mon Sep 17 00:00:00 2001 From: ghostrigger Date: Mon, 23 Jun 2014 19:43:28 +0800 Subject: [PATCH] #1866: support e-shuushuu source redirection * currently, e-shuushuu already redirects some posts to their landing pages (http://e-shuushuu.net/image/?image_id=$id), particularly those ending in 'jpg' * for some reason, e-shuushuu doesn't natively support other formats even the uppercased 'JPG' * the following lines aim to address this issue to redirect to http://e-shuushuu.net/image/$id * http://e-shuushuu.net/image.php?mode=view&image_id=$id is also a valid alternative but is not used --- app/models/post.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index 1a692236c..9bfbeb28b 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -336,6 +336,9 @@ class Post < ActiveRecord::Base sha1hash = $1 filename = $2 "http://g.e-hentai.org/?f_shash=#{sha1hash}&fs_from=#{filename}" + + when %r{\Ahttp://e-shuushuu.net/images/\d{4}-(?:\d{2}-){2}(\d+)}i + "http://e-shuushuu.net/image/#{$1}" else source