Skip to content

Commit 95f2588

Browse files
committed
use prerender only for htmlparser
1 parent 78f3f63 commit 95f2588

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

lib/plugins/system/htmlparser/htmlparser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export default {
2020

2121
var options2 = {...options, ...{
2222
followRedirect: !!options.followHTTPRedirect,
23-
reuseCookies: !!options.followHTTPRedirect
23+
reuseCookies: !!options.followHTTPRedirect,
24+
allowPrerender: true
2425
}};
2526

2627
options.registerFetch({

lib/plugins/system/oembed/oembedUtils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ export function findOembedLinks(uri, meta) {
238238
url: uri
239239
});
240240

241-
getUrlFunctional(uri, {
242-
prevent_prerender: true
243-
}, {
241+
getUrlFunctional(uri, {}, {
244242
onError: function(error) {
245243

246244
options && options.registerFetchError({

lib/request.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ export default function(options, iframely_options, callback) {
163163
});
164164

165165
fetchData(utils.prepareRequestOptions(options, {
166-
...iframely_options,
167-
prevent_prerender: true
166+
...iframely_options
168167
}))
169168
.then(result => {
170169
finish(null, result);

lib/utils.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ export function prepareRequestOptions(request_options, options) {
9595

9696
var proxy = (options && options.proxy) || getCustomProxyForUri(uri, options);
9797
if (proxy) {
98-
if (proxy.prerender && CONFIG.PRERENDER_URL && !options?.prevent_prerender) {
98+
if (proxy.prerender && CONFIG.PRERENDER_URL && options?.allowPrerender) {
9999
request_options.uri = CONFIG.PRERENDER_URL + encodeURIComponent(uri);
100100

101-
if (proxy.prerender === 'iframes') {
102-
request_options.uri += (request_options.uri.indexOf('?') > -1 ? '&' : '?' ) + 'allow=iframes';
101+
// Use string `proxy.prerender` as additional prerender param.
102+
if (typeof proxy.prerender === 'string') {
103+
request_options.uri += (request_options.uri.indexOf('?') > -1 ? '&' : '?' ) + `prerender=${proxy.prerender}`;
103104
}
104105

105106
} else if (proxy.proxy && CONFIG.PROXY_URL) {
@@ -283,8 +284,7 @@ var getHead = function(url, options, callbacks) {
283284
follow: follow
284285
// No abort controller for head.
285286
}, {
286-
...options,
287-
prevent_prerender: true
287+
...options
288288
});
289289

290290
try {
@@ -633,7 +633,7 @@ export function findMainLdObjectWithVideo(ld) {
633633
}
634634

635635
getUrlFunctional(uri, {
636-
prevent_prerender: true,
636+
637637
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT,
638638
asBuffer: true
639639
}, {
@@ -823,8 +823,7 @@ export function getContentType(uriForCache, uriOriginal, options, cb) {
823823
var methodCaller = method && method === 'GET' ? getUrlFunctional : getHeadFunctional;
824824

825825
methodCaller(uri, {
826-
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT,
827-
prevent_prerender: true
826+
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT
828827
}, {
829828
onResponse: function(res, request_options) {
830829

@@ -1239,8 +1238,6 @@ var getUriStatusPrivate = function(uri, options, cb) {
12391238
},
12401239
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT,
12411240
follow: CONFIG.MAX_REDIRECTS
1242-
}, {
1243-
prevent_prerender: true
12441241
});
12451242

12461243
try {

0 commit comments

Comments
 (0)