From 16e28677e31ba08f3c3f409d0c7e846954030222 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 21 Jan 2017 23:27:17 -0800 Subject: [PATCH] Support setting reports endpoint through archive JSON data. #1260 --- src/Archive/Redirect.coffee | 8 +++++--- src/Miscellaneous/Report.coffee | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 5eb934fa9..0769cec62 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -24,14 +24,14 @@ Redirect = for data in Conf['archives'] for key in ['boards', 'files'] data[key] = [] unless data[key] instanceof Array - {uid, name, boards, files, software} = data + {uid, name, boards, files, software, report} = data continue unless software in ['fuuka', 'foolfuuka'] archives[JSON.stringify(uid ? name)] = 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 - o.report[boardID] = data if name is 'fgts' + o.report[boardID] = data unless boardID of o.report or not report for boardID, record of Conf['selectedArchives'] for type, id of record when (archive = archives[JSON.stringify id]) @@ -155,7 +155,9 @@ Redirect = "#{Redirect.protocol archive}#{archive.domain}/#{path}" report: (archive, {boardID, postID}) -> - "https://so.fgts.jp/report/?board=#{boardID}&no=#{postID}" + {report} = archive + return '' unless /^https?:\/\//.test(report) + "#{report}?board=#{boardID}&no=#{postID}" securityCheck: (url) -> /^https:\/\//.test(url) or diff --git a/src/Miscellaneous/Report.coffee b/src/Miscellaneous/Report.coffee index c170f4e7c..429bac735 100644 --- a/src/Miscellaneous/Report.coffee +++ b/src/Miscellaneous/Report.coffee @@ -34,7 +34,7 @@ Report = if location.hash is '#redirect' $.globalEval 'self.close = function(){};' window.resizeTo 700, 475 - location.replace url + Redirect.navigate 'report', {boardID: g.BOARD.ID, postID: Report.postID} return link = $.el 'a',