From 3986298f4f06cc1fa0ffbf12bf16752b9a85db0a Mon Sep 17 00:00:00 2001 From: Kabir Sala Date: Thu, 20 Feb 2014 20:56:49 +0100 Subject: [PATCH] Copy fix from Mayhem, hopefully I didn't break anything --- src/Archive/Redirect.coffee | 21 ++++++++++----------- src/Posting/QR.coffee | 14 ++------------ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index b7f1d1540..8ebabce20 100755 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -1,12 +1,18 @@ Redirect = - init: -> o = thread: {} - post: {} - file: {} + post: {} + file: {} - {archives} = Redirect + archives = {} + for {name, boards, files, data} in Redirect.archives + archives[name] = {boards, files, data} + {software} = data + for boardID in boards + o.thread[boardID] = data unless boardID of o.thread + o.post[boardID] = data unless boardID of o.post or software isnt 'foolfuuka' + o.file[boardID] = data unless boardID of o.file or boardID not in files for boardID, record of Conf['selectedArchives'] for type, id of record when (archive = archives[id]) @@ -14,13 +20,6 @@ Redirect = continue unless boardID in boards o[type][boardID] = archive.data - for name, {data, boards, files} of archives - {software} = data - for boardID in boards - o.thread[boardID] = data unless boardID of o.thread - o.post[boardID] = data unless boardID of o.post or software isnt 'foolfuuka' - o.file[boardID] = data unless boardID of o.file or boardID not in files - Redirect.data = o archives: diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 5f665796d..1ddb35940 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -429,19 +429,9 @@ QR = status: '[type=submit]' fileInput: '[type=file]' } - - check = - jpg: 'image/jpeg' - pdf: 'application/pdf' - swf: 'application/x-shockwave-flash' - + # Allow only this board's supported files. - mimeTypes = $('ul.rules > li').textContent.trim().match(/: (.+)/)[1].toLowerCase().replace /\w+/g, (type) -> - check[type] or "image/#{type}" - - QR.mimeTypes = mimeTypes.split ', ' - # Add empty mimeType to avoid errors with URLs selected in Window's file dialog. - QR.mimeTypes.push '' + mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''] nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value QR.spoiler = !!$ 'input[name=spoiler]'