Fix image error handling on Tinyboard/vichan sites; don't try to redirect to 4chan archives.
This commit is contained in:
parent
28ba2df7d4
commit
6387eb4ad1
@ -34,27 +34,30 @@ ImageCommon =
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
isFromArchive: (file) ->
|
isFromArchive: (file) ->
|
||||||
!ImageHost.test(file.src.split('/')[2])
|
g.SITE.software is 'yotsuba' and !ImageHost.test(file.src.split('/')[2])
|
||||||
|
|
||||||
error: (file, post, delay, cb) ->
|
error: (file, post, delay, cb) ->
|
||||||
src = post.file.url.split '/'
|
src = post.file.url.split '/'
|
||||||
URL = Redirect.to 'file', {
|
url = null
|
||||||
boardID: post.board.ID
|
if g.SITE.software is 'yotsuba' and Conf['404 Redirect']
|
||||||
filename: src[src.length - 1]
|
url = Redirect.to 'file', {
|
||||||
}
|
boardID: post.board.ID
|
||||||
unless Conf['404 Redirect'] and URL and Redirect.securityCheck URL
|
filename: src[src.length - 1]
|
||||||
URL = null
|
}
|
||||||
|
url = null unless url and Redirect.securityCheck(url)
|
||||||
|
|
||||||
return cb URL if (post.isDead or post.file.isDead) and not ImageCommon.isFromArchive file
|
return cb url if (post.isDead or post.file.isDead) and not ImageCommon.isFromArchive(file)
|
||||||
|
|
||||||
timeoutID = setTimeout (-> cb URL), delay if delay?
|
timeoutID = setTimeout (-> cb url), delay if delay?
|
||||||
return if post.isDead or post.file.isDead
|
return if post.isDead or post.file.isDead
|
||||||
redirect = ->
|
redirect = ->
|
||||||
unless ImageCommon.isFromArchive file
|
unless ImageCommon.isFromArchive file
|
||||||
clearTimeout timeoutID if delay?
|
clearTimeout timeoutID if delay?
|
||||||
cb URL
|
cb url
|
||||||
|
|
||||||
$.ajax g.SITE.urls.threadJSON({boardID: post.boardID, threadID: post.threadID}), onloadend: ->
|
threadJSON = g.SITE.urls.threadJSON?(post)
|
||||||
|
return unless threadJSON
|
||||||
|
$.ajax threadJSON, onloadend: ->
|
||||||
post.kill !post.isClone if @status is 404
|
post.kill !post.isClone if @status is 404
|
||||||
return redirect() if @status isnt 200
|
return redirect() if @status isnt 200
|
||||||
for postObj in @response.posts
|
for postObj in @response.posts
|
||||||
@ -66,7 +69,7 @@ ImageCommon =
|
|||||||
post.kill true
|
post.kill true
|
||||||
redirect()
|
redirect()
|
||||||
else
|
else
|
||||||
URL = post.file.url
|
url = post.file.url
|
||||||
|
|
||||||
# Add controls, but not until the mouse is moved over the video.
|
# Add controls, but not until the mouse is moved over the video.
|
||||||
addControls: (video) ->
|
addControls: (video) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user