X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fuploadx.ts;h=9484eff7552886c18b32309cdba03cdfe8124cac;hb=3545e72c686ff1725bbdfd8d16d693e2f4aa75a3;hp=11b1044db48f5fac6589baf3e96cf57d8bb88e05;hpb=636d73c58866ed235c207719e41fdde3c2d6c969;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/uploadx.ts b/server/lib/uploadx.ts index 11b1044db..9484eff75 100644 --- a/server/lib/uploadx.ts +++ b/server/lib/uploadx.ts @@ -2,8 +2,20 @@ import express from 'express' import { getResumableUploadPath } from '@server/helpers/upload' import { Uploadx } from '@uploadx/core' -const uploadx = new Uploadx({ directory: getResumableUploadPath() }) -uploadx.getUserId = (_, res: express.Response) => res.locals.oauth?.token.user.id +const uploadx = new Uploadx({ + directory: getResumableUploadPath(), + + expiration: { maxAge: undefined, rolling: true }, + + // Could be big with thumbnails/previews + maxMetadataSize: '10MB', + + userIdentifier: (_, res: express.Response) => { + if (!res.locals.oauth) return undefined + + return res.locals.oauth.token.user.id + '' + } +}) export { uploadx