import { Model } from 'sequelize-typescript'
import { ResultList } from '../../shared'
import { VideoResolution } from '../../shared/models/videos'
-import { CONFIG, REMOTE_SCHEME, VIDEO_MIMETYPE_EXT } from '../initializers'
+import { CONFIG, REMOTE_SCHEME } from '../initializers'
import { UserModel } from '../models/account/user'
import { ActorModel } from '../models/activitypub/actor'
import { ApplicationModel } from '../models/application/application'
return res.type('json').status(400).end()
}
-function createReqFiles (fieldName: string, storageDir: string, mimeTypes: { [ id: string ]: string }) {
+function createReqFiles (
+ fieldNames: string[],
+ mimeTypes: { [ id: string ]: string },
+ destinations: { [ fieldName: string ]: string }
+) {
const storage = multer.diskStorage({
destination: (req, file, cb) => {
- cb(null, storageDir)
+ cb(null, destinations[file.fieldname])
},
filename: async (req, file, cb) => {
}
})
- return multer({ storage }).fields([{ name: fieldName, maxCount: 1 }])
+ const fields = []
+ for (const fieldName of fieldNames) {
+ fields.push({
+ name: fieldName,
+ maxCount: 1
+ })
+ }
+
+ return multer({ storage }).fields(fields)
}
async function generateRandomString (size: number) {
]
for (const resolution of resolutions) {
- if (configResolutions[resolution.toString()] === true && videoFileHeight > resolution) {
+ if (configResolutions[resolution + 'p'] === true && videoFileHeight > resolution) {
resolutionsEnabled.push(resolution)
}
}