Fix file redirection.

This was all my bad.
This commit is contained in:
Zixaphir 2013-05-12 15:34:29 -07:00
parent 249a739bfc
commit 36e11ff921
7 changed files with 32 additions and 28 deletions

View File

@ -6245,7 +6245,7 @@
ImageExpand.contract(post); ImageExpand.contract(post);
src = this.src.split('/'); src = this.src.split('/');
if (src[2] === 'images.4chan.org') { if (src[2] === 'images.4chan.org') {
URL = Redirect.to('image', { URL = Redirect.to('file', {
boardID: src[3], boardID: src[3],
filename: src[5] filename: src[5]
}); });
@ -6385,7 +6385,7 @@
post = g.posts[this.dataset.fullid]; post = g.posts[this.dataset.fullid];
src = this.src.split('/'); src = this.src.split('/');
if (src[2] === 'images.4chan.org') { if (src[2] === 'images.4chan.org') {
URL = Redirect.to('image', { URL = Redirect.to('file', {
boardID: src[3], boardID: src[3],
filename: src[5].replace(/\?.+$/, '') filename: src[5].replace(/\?.+$/, '')
}); });
@ -7754,7 +7754,7 @@
post: {}, post: {},
file: {}, file: {},
init: function() { init: function() {
var archive, arr, boardID, data, id, name, type, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3; var archive, arr, boardID, data, id, name, type, _i, _len, _ref, _ref1, _ref2, _ref3;
_ref = Conf['selectedArchives']; _ref = Conf['selectedArchives'];
for (boardID in _ref) { for (boardID in _ref) {
@ -7775,11 +7775,11 @@
} }
} }
_ref2 = Redirect.archives; _ref2 = Redirect.archives;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { for (name in _ref2) {
archive = _ref2[_i]; archive = _ref2[name];
_ref3 = archive.boards; _ref3 = archive.boards;
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
boardID = _ref3[_j]; boardID = _ref3[_i];
if (!(boardID in Redirect.thread)) { if (!(boardID in Redirect.thread)) {
Redirect.thread[boardID] = archive; Redirect.thread[boardID] = archive;
} }
@ -10052,7 +10052,8 @@
var url; var url;
if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') { if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') {
url = Redirect.to('image', { Redirect.init();
url = Redirect.to('file', {
boardID: pathname[1], boardID: pathname[1],
filename: pathname[3] filename: pathname[3]
}); });

View File

@ -6254,7 +6254,7 @@
ImageExpand.contract(post); ImageExpand.contract(post);
src = this.src.split('/'); src = this.src.split('/');
if (src[2] === 'images.4chan.org') { if (src[2] === 'images.4chan.org') {
URL = Redirect.to('image', { URL = Redirect.to('file', {
boardID: src[3], boardID: src[3],
filename: src[5] filename: src[5]
}); });
@ -6394,7 +6394,7 @@
post = g.posts[this.dataset.fullid]; post = g.posts[this.dataset.fullid];
src = this.src.split('/'); src = this.src.split('/');
if (src[2] === 'images.4chan.org') { if (src[2] === 'images.4chan.org') {
URL = Redirect.to('image', { URL = Redirect.to('file', {
boardID: src[3], boardID: src[3],
filename: src[5].replace(/\?.+$/, '') filename: src[5].replace(/\?.+$/, '')
}); });
@ -7763,7 +7763,7 @@
post: {}, post: {},
file: {}, file: {},
init: function() { init: function() {
var archive, arr, boardID, data, id, name, type, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3; var archive, arr, boardID, data, id, name, type, _i, _len, _ref, _ref1, _ref2, _ref3;
_ref = Conf['selectedArchives']; _ref = Conf['selectedArchives'];
for (boardID in _ref) { for (boardID in _ref) {
@ -7784,11 +7784,11 @@
} }
} }
_ref2 = Redirect.archives; _ref2 = Redirect.archives;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { for (name in _ref2) {
archive = _ref2[_i]; archive = _ref2[name];
_ref3 = archive.boards; _ref3 = archive.boards;
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
boardID = _ref3[_j]; boardID = _ref3[_i];
if (!(boardID in Redirect.thread)) { if (!(boardID in Redirect.thread)) {
Redirect.thread[boardID] = archive; Redirect.thread[boardID] = archive;
} }
@ -10063,7 +10063,8 @@
var url; var url;
if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') { if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') {
url = Redirect.to('image', { Redirect.init();
url = Redirect.to('file', {
boardID: pathname[1], boardID: pathname[1],
filename: pathname[3] filename: pathname[3]
}); });

View File

@ -6232,7 +6232,7 @@
ImageExpand.contract(post); ImageExpand.contract(post);
src = this.src.split('/'); src = this.src.split('/');
if (src[2] === 'images.4chan.org') { if (src[2] === 'images.4chan.org') {
URL = Redirect.to('image', { URL = Redirect.to('file', {
boardID: src[3], boardID: src[3],
filename: src[5] filename: src[5]
}); });
@ -6372,7 +6372,7 @@
post = g.posts[this.dataset.fullid]; post = g.posts[this.dataset.fullid];
src = this.src.split('/'); src = this.src.split('/');
if (src[2] === 'images.4chan.org') { if (src[2] === 'images.4chan.org') {
URL = Redirect.to('image', { URL = Redirect.to('file', {
boardID: src[3], boardID: src[3],
filename: src[5].replace(/\?.+$/, '') filename: src[5].replace(/\?.+$/, '')
}); });
@ -7746,7 +7746,7 @@
post: {}, post: {},
file: {}, file: {},
init: function() { init: function() {
var archive, arr, boardID, data, id, name, type, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3; var archive, arr, boardID, data, id, name, type, _i, _len, _ref, _ref1, _ref2, _ref3;
_ref = Conf['selectedArchives']; _ref = Conf['selectedArchives'];
for (boardID in _ref) { for (boardID in _ref) {
@ -7767,11 +7767,11 @@
} }
} }
_ref2 = Redirect.archives; _ref2 = Redirect.archives;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { for (name in _ref2) {
archive = _ref2[_i]; archive = _ref2[name];
_ref3 = archive.boards; _ref3 = archive.boards;
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
boardID = _ref3[_j]; boardID = _ref3[_i];
if (!(boardID in Redirect.thread)) { if (!(boardID in Redirect.thread)) {
Redirect.thread[boardID] = archive; Redirect.thread[boardID] = archive;
} }
@ -10044,7 +10044,8 @@
var url; var url;
if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') { if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') {
url = Redirect.to('image', { Redirect.init();
url = Redirect.to('file', {
boardID: pathname[1], boardID: pathname[1],
filename: pathname[3] filename: pathname[3]
}); });

View File

@ -13,7 +13,7 @@ Redirect =
else else
archive.boards archive.boards
Redirect[type][boardID] = archive if arr.contains boardID Redirect[type][boardID] = archive if arr.contains boardID
for archive in Redirect.archives for name, archive of Redirect.archives
for boardID in archive.boards for boardID in archive.boards
unless boardID of Redirect.thread unless boardID of Redirect.thread
Redirect.thread[boardID] = archive Redirect.thread[boardID] = archive

View File

@ -46,7 +46,8 @@ Main =
when 'images.4chan.org' when 'images.4chan.org'
$.ready -> $.ready ->
if Conf['404 Redirect'] and d.title is '4chan - 404 Not Found' if Conf['404 Redirect'] and d.title is '4chan - 404 Not Found'
url = Redirect.to 'image', Redirect.init()
url = Redirect.to 'file',
boardID: pathname[1] boardID: pathname[1]
filename: pathname[3] filename: pathname[3]
location.href = url if url location.href = url if url

View File

@ -137,7 +137,7 @@ ImageExpand =
src = @src.split '/' src = @src.split '/'
if src[2] is 'images.4chan.org' if src[2] is 'images.4chan.org'
URL = Redirect.to 'image', URL = Redirect.to 'file',
boardID: src[3] boardID: src[3]
filename: src[5] filename: src[5]
if URL if URL

View File

@ -28,7 +28,7 @@ ImageHover =
src = @src.split '/' src = @src.split '/'
if src[2] is 'images.4chan.org' if src[2] is 'images.4chan.org'
URL = Redirect.to 'image', URL = Redirect.to 'file',
boardID: src[3] boardID: src[3]
filename: src[5].replace /\?.+$/, '' filename: src[5].replace /\?.+$/, ''
if URL if URL