From e4c9bc494044d6abc8cf53f1a269b5c21245923c Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Fri, 8 Feb 2019 19:07:26 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82=D1=8B=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D1=83\=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=D1=87=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=B4=D0=BE=2050=D0=9C=D0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/api/reader.js | 2 +- server/core/FileDownloader.js | 3 ++- server/routes.js | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/api/reader.js b/client/api/reader.js index 1088cf26..d8ca7348 100644 --- a/client/api/reader.js +++ b/client/api/reader.js @@ -1,7 +1,7 @@ import axios from 'axios'; import {sleep} from '../share/utils'; -const maxFileUploadSize = 10*1024*1024; +const maxFileUploadSize = 50*1024*1024; const api = axios.create({ baseURL: '/api/reader' }); diff --git a/server/core/FileDownloader.js b/server/core/FileDownloader.js index 5e2a24cc..d816b07c 100644 --- a/server/core/FileDownloader.js +++ b/server/core/FileDownloader.js @@ -1,11 +1,12 @@ const got = require('got'); +const maxDownloadSize = 50*1024*1024; + class FileDownloader { constructor() { } async load(url, callback) { - const maxDownloadSize = 10*1024*1024; let errMes = ''; const response = await got(url, {method: 'HEAD'}); diff --git a/server/routes.js b/server/routes.js index 1bee3b3a..aa6014c0 100644 --- a/server/routes.js +++ b/server/routes.js @@ -2,6 +2,8 @@ const c = require('./controllers'); const utils = require('./core/utils'); const multer = require('multer'); +const maxUploadSize = 50*1024*1024; + function initRoutes(app, connPool, config) { const misc = new c.MiscController(connPool, config); const reader = new c.ReaderController(connPool, config); @@ -20,7 +22,7 @@ function initRoutes(app, connPool, config) { cb(null, utils.randomHexString(30)); } }); - const upload = multer({ storage, limits: {fileSize: 10*1024*1024} }); + const upload = multer({ storage, limits: {fileSize: maxUploadSize} }); //routes const routes = [