From c1b213b1006b17d31efb7206d6cf85306fe6bf78 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 30 Apr 2013 04:03:17 +0200 Subject: [PATCH] Update archive redirection for many boards. --- 4chan_x.user.js | 63 ++++++++++++++++++++++++++++++++----------------- changelog | 2 ++ script.coffee | 52 ++++++++++++++++++++++++++++------------ 3 files changed, 80 insertions(+), 37 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 082a82d61..2fc5742f6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4930,7 +4930,6 @@ case 'm': case 'q': case 'tg': - case 'vg': case 'vp': case 'vr': case 'wsg': @@ -4939,6 +4938,17 @@ return "//nsfw.foolz.us/" + board + "/full_image/" + filename; case 'po': return "//archive.thedarkcave.org/" + board + "/full_image/" + filename; + case 'hr': + case 'tv': + return "http://archive.4plebs.org/" + board + "/full_image/" + filename; + case 'c': + case 'w': + case 'wg': + return "//archive.nyafuu.org/" + board + "/full_image/" + filename; + case 'vg': + return "http://archive.nihil-ad-rem.net/" + board + "/full_image/" + filename; + case 'd': + return "//loveisover.me/" + board + "/full_image/" + filename; case 'ck': case 'fa': case 'lit': @@ -4947,15 +4957,12 @@ case 'cgl': case 'g': case 'mu': - case 'w': return "//rbt.asia/" + board + "/full_image/" + filename; case 'an': case 'k': case 'toy': case 'x': return "http://archive.heinessen.com/" + board + "/full_image/" + filename; - case 'c': - return "//archive.nyafuu.org/" + board + "/full_image/" + filename; } }, post: function(board, postID) { @@ -4969,22 +4976,28 @@ case 'sp': case 'tg': case 'tv': - case 'v': - case 'vg': case 'vp': case 'vr': case 'wsg': - case 'dev': - case 'foolz': - return "//archive.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; + return "https://archive.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; case 'u': - case 'kuku': - return "//nsfw.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; - case 'c': + return "https://nsfw.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; case 'int': case 'out': case 'po': return "//archive.thedarkcave.org/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'hr': + case 'x': + return "http://archive.4plebs.org/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'c': + case 'w': + case 'wg': + return "//archive.nyafuu.org/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'v': + case 'vg': + return "http://archive.nihil-ad-rem.net/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'd': + return "//loveisover.me/_/api/chan/post/?board=" + board + "&num=" + postID; } }, to: function(data) { @@ -5003,17 +5016,12 @@ case 'sp': case 'tg': case 'tv': - case 'v': - case 'vg': case 'vp': case 'vr': case 'wsg': - case 'dev': - case 'foolz': url = Redirect.path('//archive.foolz.us', 'foolfuuka', data); break; case 'u': - case 'kuku': url = Redirect.path('//nsfw.foolz.us', 'foolfuuka', data); break; case 'int': @@ -5021,6 +5029,21 @@ case 'po': url = Redirect.path('//archive.thedarkcave.org', 'foolfuuka', data); break; + case 'hr': + url = Redirect.path('http://archive.4plebs.org', 'foolfuuka', data); + break; + case 'c': + case 'w': + case 'wg': + url = Redirect.path('//archive.nyafuu.org', 'foolfuuka', data); + break; + case 'v': + case 'vg': + url = Redirect.path('http://archive.nihil-ad-rem.net', 'foolfuuka', data); + break; + case 'd': + url = Redirect.path('//loveisover.me', 'foolfuuka', data); + break; case 'ck': case 'fa': case 'lit': @@ -5028,13 +5051,12 @@ url = Redirect.path('//fuuka.warosu.org', 'fuuka', data); break; case 'diy': + case 'g': case 'sci': url = Redirect.path('//archive.installgentoo.net', 'fuuka', data); break; case 'cgl': - case 'g': case 'mu': - case 'w': url = Redirect.path('//rbt.asia', 'fuuka', data); break; case 'an': @@ -5046,9 +5068,6 @@ case 'x': url = Redirect.path('http://archive.heinessen.com', 'fuuka', data); break; - case 'c': - url = Redirect.path('//archive.nyafuu.org', 'fuuka', data); - break; default: if (threadID) { url = "//boards.4chan.org/" + board + "/"; diff --git a/changelog b/changelog index 668d9c853..d8fdec0da 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Update archive redirection for many boards. 2.39.3 - Mayhem diff --git a/script.coffee b/script.coffee index 96cb6bb09..c3439588b 100644 --- a/script.coffee +++ b/script.coffee @@ -4086,49 +4086,71 @@ Redirect = image: (board, filename) -> # Do not use g.BOARD, the image url can originate from a cross-quote. switch board - when 'a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg' + when 'a', 'gd', 'jp', 'm', 'q', 'tg', 'vp', 'vr', 'wsg' "//archive.foolz.us/#{board}/full_image/#{filename}" when 'u' "//nsfw.foolz.us/#{board}/full_image/#{filename}" when 'po' "//archive.thedarkcave.org/#{board}/full_image/#{filename}" + when 'hr', 'tv' + "http://archive.4plebs.org/#{board}/full_image/#{filename}" + when 'c', 'w', 'wg' + "//archive.nyafuu.org/#{board}/full_image/#{filename}" + when 'vg' + "http://archive.nihil-ad-rem.net/#{board}/full_image/#{filename}" + when 'd' + "//loveisover.me/#{board}/full_image/#{filename}" when 'ck', 'fa', 'lit', 's4s' "//fuuka.warosu.org/#{board}/full_image/#{filename}" - when 'cgl', 'g', 'mu', 'w' + when 'cgl', 'g', 'mu' "//rbt.asia/#{board}/full_image/#{filename}" when 'an', 'k', 'toy', 'x' "http://archive.heinessen.com/#{board}/full_image/#{filename}" - when 'c' - "//archive.nyafuu.org/#{board}/full_image/#{filename}" post: (board, postID) -> + # XXX foolz had HSTS set for 120 days, which broke XHR+CORS+Redirection when on HTTP. + # Remove necessary HTTPS procotol in September 2013. switch board - when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg', 'dev', 'foolz' - "//archive.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" - when 'u', 'kuku' - "//nsfw.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" - when 'c', 'int', 'out', 'po' + when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vp', 'vr', 'wsg' + "https://archive.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'u' + "https://nsfw.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'int', 'out', 'po' "//archive.thedarkcave.org/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'hr', 'x' + "http://archive.4plebs.org/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'c', 'w', 'wg' + "//archive.nyafuu.org/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'v', 'vg' + "http://archive.nihil-ad-rem.net/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'd' + "//loveisover.me/_/api/chan/post/?board=#{board}&num=#{postID}" to: (data) -> unless data.isSearch {threadID} = data {board} = data switch board - when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg', 'dev', 'foolz' + when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vp', 'vr', 'wsg' url = Redirect.path '//archive.foolz.us', 'foolfuuka', data - when 'u', 'kuku' + when 'u' url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data when 'int', 'out', 'po' url = Redirect.path '//archive.thedarkcave.org', 'foolfuuka', data + when 'hr' + url = Redirect.path 'http://archive.4plebs.org', 'foolfuuka', data + when 'c', 'w', 'wg' + url = Redirect.path '//archive.nyafuu.org', 'foolfuuka', data + when 'v', 'vg' + url = Redirect.path 'http://archive.nihil-ad-rem.net', 'foolfuuka', data + when 'd' + url = Redirect.path '//loveisover.me', 'foolfuuka', data when 'ck', 'fa', 'lit', 's4s' url = Redirect.path '//fuuka.warosu.org', 'fuuka', data - when 'diy', 'sci' + when 'diy', 'g', 'sci' url = Redirect.path '//archive.installgentoo.net', 'fuuka', data - when 'cgl', 'g', 'mu', 'w' + when 'cgl', 'mu' url = Redirect.path '//rbt.asia', 'fuuka', data when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x' url = Redirect.path 'http://archive.heinessen.com', 'fuuka', data - when 'c' - url = Redirect.path '//archive.nyafuu.org', 'fuuka', data else if threadID url = "//boards.4chan.org/#{board}/"