Get rid of String as constructor.

This commit is contained in:
ccd0 2015-11-01 02:44:35 -08:00
parent 62bfe0e5dd
commit 0eb8ba6408
3 changed files with 4 additions and 5 deletions

View File

@ -300,7 +300,6 @@ module.exports = (grunt) ->
nonstandard: true
# XXX Temporarily suppress lots of existing warnings until we fix them.
'-W018': true
'-W053': true
'-W084': true
'-W083': true
'-W093': true

View File

@ -59,10 +59,9 @@ Redirect =
# For fuuka-based archives:
# https://github.com/eksopl/fuuka/issues/27
protocol = Redirect.protocol archive
URL = new String "#{protocol}#{archive.domain}/_/api/chan/post/?board=#{boardID}&num=#{postID}"
URL = "#{protocol}#{archive.domain}/_/api/chan/post/?board=#{boardID}&num=#{postID}"
return '' unless Redirect.securityCheck URL
URL.archive = archive
URL
file: (archive, {boardID, filename}) ->

View File

@ -79,12 +79,13 @@ class Fetcher
archivedPost: ->
return false unless Conf['Resurrect Quotes']
return false unless url = Redirect.to 'post', {@boardID, @postID}
archive = Redirect.data.post[@boardID]
if /^https:\/\//.test(url) or location.protocol is 'http:'
$.cache url,
do (self = @) -> -> self.parseArchivedPost @response, url
,
responseType: 'json'
withCredentials: url.archive.withCredentials
withCredentials: archive.withCredentials
return true
else if Conf['Except Archives from Encryption']
CrossOrigin.json url, (response) =>
@ -92,7 +93,7 @@ class Fetcher
if media then for key of media when /_link$/.test key
# Image/thumbnail URLs loaded over HTTP can be modified in transit.
# Require them to be from a known HTTP host so that no referrer is sent to them from an HTTPS page.
delete media[key] unless media[key]? and media[key].match(/^(http:\/\/[^\/]+\/)?/)[0] in url.archive.imagehosts
delete media[key] unless media[key]? and media[key].match(/^(http:\/\/[^\/]+\/)?/)[0] in archive.imagehosts
@parseArchivedPost response, url
return true
return false