Merge pull request #15080 from overleaf/msm-configurable-upload-timeout

[web] Add configurable project upload timeout

GitOrigin-RevId: da26d7edbce9169c92cc3bc8746cb42e5c0e4919
This commit is contained in:
Miguel Serrano 2023-10-16 11:38:15 +02:00 committed by Copybot
parent e8dcef50db
commit 22531969f6
5 changed files with 11 additions and 2 deletions

View file

@ -393,6 +393,7 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
emailConfirmationDisabled: Settings.emailConfirmationDisabled,
maxEntitiesPerProject: Settings.maxEntitiesPerProject,
maxUploadSize: Settings.maxUploadSize,
projectUploadTimeout: Settings.projectUploadTimeout,
recaptchaSiteKey: Settings.recaptcha?.siteKey,
recaptchaSiteKeyV3: Settings.recaptcha?.siteKeyV3,
recaptchaDisabled: Settings.recaptcha?.disabled,

View file

@ -306,6 +306,10 @@ module.exports = {
maxEntitiesPerProject: 2000,
projectUploadTimeout: parseInt(
process.env.PROJECT_UPLOAD_TIMEOUT || '120000',
10
),
maxUploadSize: 50 * 1024 * 1024, // 50 MB
multerOptions: {
preservePath: process.env.MULTER_PRESERVE_PATH,

View file

@ -22,7 +22,9 @@ type UploadProjectModalProps = {
function UploadProjectModal({ onHide }: UploadProjectModalProps) {
const { t } = useTranslation()
const { maxUploadSize } = getMeta('ol-ExposedSettings') as ExposedSettings
const { maxUploadSize, projectUploadTimeout } = getMeta(
'ol-ExposedSettings'
) as ExposedSettings
const [ableToUpload, setAbleToUpload] = useState(false)
const location = useLocation()
@ -42,7 +44,7 @@ function UploadProjectModal({ onHide }: UploadProjectModalProps) {
},
limit: 1,
fieldName: 'qqfile', // "qqfile" is needed for our express multer middleware
timeout: 120000,
timeout: projectUploadTimeout,
})
.on('file-added', () => {
// this function can be invoked multiple times depending on maxNumberOfFiles

View file

@ -188,6 +188,7 @@ const initialize = () => {
],
editableFilenames: ['latexmkrc', '.latexmkrc', 'makefile', 'gnumakefile'],
validRootDocExtensions: ['tex', 'Rtex', 'ltx', 'Rnw'],
projectUploadTimeout: 12000,
}
window.project_id = project._id

View file

@ -21,6 +21,7 @@ export type ExposedSettings = {
hasSamlFeature: boolean
isOverleaf: boolean
maxEntitiesPerProject: number
projectUploadTimeout: number
maxUploadSize: number
recaptchaDisabled: {
invite: boolean