Support reporting posts to fgts archive.

This commit is contained in:
ccd0 2015-04-14 23:19:13 -07:00
parent 5291ff87d1
commit 52dfc296cf
4 changed files with 36 additions and 14 deletions

View File

@ -4,15 +4,18 @@ Redirect =
thread: {} thread: {}
post: {} post: {}
file: {} file: {}
report: {}
archives = {} archives = {}
for data in Redirect.archives for data in Redirect.archives
{name, boards, files, software, withCredentials} = data {name, boards, files, software, withCredentials} = data
archives[name] = data archives[name] = data
for boardID in boards when !withCredentials for boardID in boards
o.thread[boardID] = data unless boardID of o.thread unless withCredentials
o.post[boardID] = data unless boardID of o.post or software isnt 'foolfuuka' o.thread[boardID] = data unless boardID of o.thread
o.file[boardID] = data unless boardID of o.file or boardID not in files 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'
for boardID, record of Conf['selectedArchives'] for boardID, record of Conf['selectedArchives']
for type, id of record for type, id of record
@ -84,6 +87,9 @@ Redirect =
"#{boardID}/?task=search2&search_#{if type is 'image' then 'media_hash' else type}=#{value}" "#{boardID}/?task=search2&search_#{if type is 'image' then 'media_hash' else type}=#{value}"
"#{Redirect.protocol archive}#{archive.domain}/#{path}" "#{Redirect.protocol archive}#{archive.domain}/#{path}"
report: (archive, {boardID, postID}) ->
"https://so.fgts.jp/report/?board=#{boardID}&no=#{postID}"
securityCheck: (URL) -> securityCheck: (URL) ->
/^https:\/\//.test(URL) or /^https:\/\//.test(URL) or
location.protocol is 'http:' or location.protocol is 'http:' or

View File

@ -35,6 +35,10 @@ Config =
true true
'Redirect dead threads and images to the archives.' 'Redirect dead threads and images to the archives.'
] ]
'Archive Report': [
true
'Enable reporting posts to supported archives.'
]
'Except Archives from Encryption': [ 'Except Archives from Encryption': [
false false
'Permit loading content from, and warningless redirects to, HTTP-only archives from HTTPS pages.' 'Permit loading content from, and warningless redirects to, HTTP-only archives from HTTPS pages.'

View File

@ -11,11 +11,14 @@ ReportLink =
el: a el: a
order: 10 order: 10
open: (post) -> open: (post) ->
ReportLink.post = post ReportLink.url = unless post.isDead
!post.isDead "//sys.4chan.org/#{post.board}/imgboard.php?mode=report&no=#{post}"
else if Conf['Archive Report']
Redirect.to 'report', {boardID: post.board.ID, postID: post.ID}
!!ReportLink.url
report: -> report: ->
{post} = ReportLink {url} = ReportLink
url = "//sys.4chan.org/#{post.board}/imgboard.php?mode=report&no=#{post}"
id = Date.now() id = Date.now()
set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=285" set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=320"
window.open url, id, set window.open url, id, set

View File

@ -1,8 +1,17 @@
Report = Report =
init: -> init: ->
return unless /report/.test(location.search) return unless Conf['Archive Report'] and /\bmode=report\b/.test(location.search)
$.asap (-> $.id 'recaptcha_response_field'), Report.ready return unless match = location.search.match /\bno=(\d+)/
postID = +match[1]
Redirect.init()
if @archive = Redirect.to 'report', {boardID: g.BOARD.ID, postID}
$.ready @ready
ready: -> ready: ->
field = $.id 'recaptcha_response_field' if (message = $ 'h3') and /Report submitted!/.test(message.textContent)
$.on field, 'keydown', (e) -> location.replace Report.archive
$.globalEval 'Recaptcha.reload()' if e.keyCode is 8 and not field.value return
link = $.el 'a',
href: Report.archive
textContent: 'Report to fgts'
$.add d.body, [$.tn(' ['), link, $.tn(']')]