Support reporting posts to fgts archive.
This commit is contained in:
parent
5291ff87d1
commit
52dfc296cf
@ -4,15 +4,18 @@ Redirect =
|
||||
thread: {}
|
||||
post: {}
|
||||
file: {}
|
||||
report: {}
|
||||
|
||||
archives = {}
|
||||
for data in Redirect.archives
|
||||
{name, boards, files, software, withCredentials} = data
|
||||
archives[name] = data
|
||||
for boardID in boards when !withCredentials
|
||||
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 in boards
|
||||
unless withCredentials
|
||||
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'
|
||||
|
||||
for boardID, record of Conf['selectedArchives']
|
||||
for type, id of record
|
||||
@ -84,6 +87,9 @@ Redirect =
|
||||
"#{boardID}/?task=search2&search_#{if type is 'image' then 'media_hash' else type}=#{value}"
|
||||
"#{Redirect.protocol archive}#{archive.domain}/#{path}"
|
||||
|
||||
report: (archive, {boardID, postID}) ->
|
||||
"https://so.fgts.jp/report/?board=#{boardID}&no=#{postID}"
|
||||
|
||||
securityCheck: (URL) ->
|
||||
/^https:\/\//.test(URL) or
|
||||
location.protocol is 'http:' or
|
||||
|
||||
@ -35,6 +35,10 @@ Config =
|
||||
true
|
||||
'Redirect dead threads and images to the archives.'
|
||||
]
|
||||
'Archive Report': [
|
||||
true
|
||||
'Enable reporting posts to supported archives.'
|
||||
]
|
||||
'Except Archives from Encryption': [
|
||||
false
|
||||
'Permit loading content from, and warningless redirects to, HTTP-only archives from HTTPS pages.'
|
||||
|
||||
@ -11,11 +11,14 @@ ReportLink =
|
||||
el: a
|
||||
order: 10
|
||||
open: (post) ->
|
||||
ReportLink.post = post
|
||||
!post.isDead
|
||||
ReportLink.url = unless 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: ->
|
||||
{post} = ReportLink
|
||||
url = "//sys.4chan.org/#{post.board}/imgboard.php?mode=report&no=#{post}"
|
||||
{url} = ReportLink
|
||||
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
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
Report =
|
||||
init: ->
|
||||
return unless /report/.test(location.search)
|
||||
$.asap (-> $.id 'recaptcha_response_field'), Report.ready
|
||||
return unless Conf['Archive Report'] and /\bmode=report\b/.test(location.search)
|
||||
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: ->
|
||||
field = $.id 'recaptcha_response_field'
|
||||
$.on field, 'keydown', (e) ->
|
||||
$.globalEval 'Recaptcha.reload()' if e.keyCode is 8 and not field.value
|
||||
if (message = $ 'h3') and /Report submitted!/.test(message.textContent)
|
||||
location.replace Report.archive
|
||||
return
|
||||
link = $.el 'a',
|
||||
href: Report.archive
|
||||
textContent: 'Report to fgts'
|
||||
$.add d.body, [$.tn(' ['), link, $.tn(']')]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user