mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Updated uploadController.js
Added DuckDuckGo's proxy support for "Upload by URLs". Make sure you add the new option in config.sample.js into your config.js. This may be considered a hack and not supported by DuckDuckGo, so USE AT YOUR OWN RISK. Credits to Proxy#1337.
This commit is contained in:
parent
369b1137a7
commit
57834dd362
@ -84,6 +84,13 @@ module.exports = {
|
||||
*/
|
||||
urlMaxSize: '32MB',
|
||||
|
||||
/*
|
||||
Use DuckDuckGo's proxy when fetching any URL uploads.
|
||||
This may be considered a hack and not supported by DuckDuckGo, so USE AT YOUR OWN RISK.
|
||||
This have only been tested with pictures, GIFs, WEBMs and MP4s.
|
||||
*/
|
||||
urlDuckDuckGoProxy: false,
|
||||
|
||||
/*
|
||||
Chunk size for chunk uploads. Needs to be in MB.
|
||||
If this is enabled, every files uploaded from the homepage uploader will forcibly be chunked
|
||||
|
@ -198,9 +198,14 @@ uploadsController.actuallyUploadByUrl = async (req, res, user, albumid) => {
|
||||
|
||||
if (!config.uploads.urlMaxSize) { return erred('Upload by URLs is disabled at the moment.') }
|
||||
|
||||
const urls = req.body.urls
|
||||
let urls = req.body.urls
|
||||
if (!urls || !(urls instanceof Array)) { return erred('Missing "urls" property (Array).') }
|
||||
|
||||
// DuckDuckGo's proxy
|
||||
if (config.uploads.urlDuckDuckGoProxy) {
|
||||
urls = urls.map(url => `https://proxy.duckduckgo.com/iur/?f=1&image_host=${encodeURIComponent(url)}&u=${url}`)
|
||||
}
|
||||
|
||||
let iteration = 0
|
||||
const infoMap = []
|
||||
for (const url of urls) {
|
||||
|
Loading…
Reference in New Issue
Block a user