2021-12-03 07:00:40 -06:00
|
|
|
import express from 'express'
|
|
|
|
import { getResumableUploadPath } from '@server/helpers/upload'
|
|
|
|
import { Uploadx } from '@uploadx/core'
|
|
|
|
|
2021-12-17 08:49:52 -06:00
|
|
|
const uploadx = new Uploadx({
|
|
|
|
directory: getResumableUploadPath(),
|
2022-04-19 04:44:03 -05:00
|
|
|
|
|
|
|
expiration: { maxAge: undefined, rolling: true },
|
|
|
|
|
2021-12-17 08:49:52 -06:00
|
|
|
// Could be big with thumbnails/previews
|
2022-01-18 02:29:46 -06:00
|
|
|
maxMetadataSize: '10MB',
|
2022-04-19 04:44:03 -05:00
|
|
|
|
2022-01-18 02:29:46 -06:00
|
|
|
userIdentifier: (_, res: express.Response) => {
|
|
|
|
if (!res.locals.oauth) return undefined
|
|
|
|
|
|
|
|
return res.locals.oauth.token.user.id + ''
|
|
|
|
}
|
2021-12-17 08:49:52 -06:00
|
|
|
})
|
2021-12-03 07:00:40 -06:00
|
|
|
|
|
|
|
export {
|
|
|
|
uploadx
|
|
|
|
}
|