Use CrossOrigin.json to fetch posts from archives due to blocking of ordinary third-party AJAX requests.
This commit is contained in:
parent
ed01e4ca5f
commit
78dd2a9639
2
Makefile
2
Makefile
@ -195,7 +195,7 @@ testbuilds/$(name)$1.crx.zip : \
|
||||
testbuilds/$(name)$1.crx : testbuilds/$(name)$1.crx.zip package.json tools/sign.js node_modules/node-rsa/package.json
|
||||
node tools/sign.js $1
|
||||
|
||||
testbuilds/$(name)$1.meta.js : src/meta/metadata.js src/meta/icon48.png version.json $(template_deps) | testbuilds
|
||||
testbuilds/$(name)$1.meta.js : src/meta/metadata.js src/meta/icon48.png version.json src/Archive/archives.json $(template_deps) | testbuilds
|
||||
$(template) $$< $$@ type=userscript channel=$1
|
||||
|
||||
testbuilds/$(name)$1.user.js : testbuilds/$(name)$1.meta.js tmp/meta-newline.js $$(call pieces,userscript) | .events/compile
|
||||
|
||||
@ -104,17 +104,11 @@ class Fetcher
|
||||
return false unless Conf['Resurrect Quotes']
|
||||
return false if not (url = Redirect.to 'post', {@boardID, @postID})
|
||||
archive = Redirect.data.post[@boardID]
|
||||
if /^https:\/\//.test(url) or location.protocol is 'http:'
|
||||
$.cache url, (e) =>
|
||||
@parseArchivedPost e.target.response, url, archive
|
||||
,
|
||||
responseType: 'json'
|
||||
withCredentials: archive.withCredentials
|
||||
return true
|
||||
else if Conf['Exempt Archives from Encryption']
|
||||
encryptionOK = /^https:\/\//.test(url) or location.protocol is 'http:'
|
||||
if encryptionOK or Conf['Exempt Archives from Encryption']
|
||||
CrossOrigin.json url, (response) =>
|
||||
{media} = response
|
||||
if media then for key of media when /_link$/.test key
|
||||
if !encryptionOK and 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 an HTTP host so that no referrer is sent to them from an HTTPS page.
|
||||
delete media[key] unless media[key]?.match /^http:\/\//
|
||||
|
||||
@ -36,6 +36,11 @@
|
||||
%>
|
||||
// @connect 4chan.org
|
||||
// @connect 4cdn.org
|
||||
<%=
|
||||
readJSON('/src/Archive/archives.json').map(function(archive) {
|
||||
return '// @connect ' + archive.domain;
|
||||
}).join('\n')
|
||||
%>
|
||||
// @connect *
|
||||
<%=
|
||||
meta.grants.map(function(grant) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user