Merge pull request #4135 from brunnre8/master
Add prefetchMaxSearchSize to override limit for link previews
This commit is contained in:
commit
5329483a40
@ -150,6 +150,15 @@ module.exports = {
|
|||||||
// This value is set to `2048` kilobytes by default.
|
// This value is set to `2048` kilobytes by default.
|
||||||
prefetchMaxImageSize: 2048,
|
prefetchMaxImageSize: 2048,
|
||||||
|
|
||||||
|
// ### prefetchMaxSearchSize
|
||||||
|
//
|
||||||
|
// This value sets the maximum request size made to find the Open Graph tags
|
||||||
|
// for link previews. For some sites like YouTube this can easily exceed 300
|
||||||
|
// kilobytes.
|
||||||
|
//
|
||||||
|
// This value is set to `50` kilobytes by default.
|
||||||
|
prefetchMaxSearchSize: 50,
|
||||||
|
|
||||||
// ### `fileUpload`
|
// ### `fileUpload`
|
||||||
//
|
//
|
||||||
// Allow uploading files to the server hosting The Lounge.
|
// Allow uploading files to the server hosting The Lounge.
|
||||||
|
@ -407,9 +407,14 @@ function fetch(uri, headers) {
|
|||||||
// We don't need to download the file any further after we received content-type header
|
// We don't need to download the file any further after we received content-type header
|
||||||
gotStream.destroy();
|
gotStream.destroy();
|
||||||
} else {
|
} else {
|
||||||
// if not image, limit download to 50kb, since we need only meta tags
|
// if not image, limit download to the max search size, since we need only meta tags
|
||||||
// twitter.com sends opengraph meta tags within ~20kb of data for individual tweets
|
// twitter.com sends opengraph meta tags within ~20kb of data for individual tweets, the default is set to 50.
|
||||||
limit = 1024 * 50;
|
// for sites like Youtube the og tags are in the first 300K and hence this is configurable by the admin
|
||||||
|
limit =
|
||||||
|
"prefetchMaxSearchSize" in Helper.config
|
||||||
|
? Helper.config.prefetchMaxSearchSize * 1024
|
||||||
|
: // set to the previous size if config option is unset
|
||||||
|
50 * 1024;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on("error", (e) => reject(e))
|
.on("error", (e) => reject(e))
|
||||||
|
Loading…
Reference in New Issue
Block a user