mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-02-20 12:19:03 +00:00
Updated uploadController.js
DuckDuckGo's proxy is no longer supported as it stops reporting Content-Length header, which is crucial so that the safe could predict the actual file size before downloading it. If you have it enabled in your config file, it will now close the safe with error code 1. You can either disable url uploads completely or just disable duckduckgo's proxy (though I believe not many will choose the latter as to begin with it was implemented to hide origin IP).
This commit is contained in:
parent
9eb9ac288d
commit
53789a20c2
@ -228,12 +228,13 @@ uploadsController.actuallyUploadByUrl = async (req, res, user, albumid) => {
|
||||
|
||||
if (!config.uploads.urlMaxSize) { return erred('Upload by URLs is disabled at the moment.') }
|
||||
|
||||
let urls = req.body.urls
|
||||
const 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}`)
|
||||
return erred('URL uploads unavailable. Please contact the site owner.')
|
||||
// urls = urls.map(url => `https://proxy.duckduckgo.com/iu/?u=${encodeURIComponent(url)}&f=1`)
|
||||
}
|
||||
|
||||
let iteration = 0
|
||||
|
@ -101,6 +101,11 @@ safe.use((error, req, res, next) => {
|
||||
})
|
||||
|
||||
const start = async () => {
|
||||
if (config.uploads.urlDuckDuckGoProxy) {
|
||||
console.warn('Warning: DuckDuckGo\'s proxy is no longer supported as it stops reporting Content-Length header.')
|
||||
return process.exit(1)
|
||||
}
|
||||
|
||||
if (config.showGitHash) {
|
||||
const gitHash = await new Promise((resolve, reject) => {
|
||||
require('child_process').exec('git rev-parse HEAD', (error, stdout) => {
|
||||
|
@ -353,7 +353,7 @@ page.uploadUrls = function (button) {
|
||||
}).catch(function (error) {
|
||||
return posted({
|
||||
success: false,
|
||||
description: error.toString()
|
||||
description: error.response ? error.response.data.description : error.toString()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user