Update upload limits
This commit is contained in:
parent
5bcc18594c
commit
619461c15d
@ -1,5 +1,5 @@
|
|||||||
import { GraphQLError } from 'graphql'
|
import { GraphQLError } from 'graphql'
|
||||||
import { ANON_USER_ID, IMAGE_PIXELS_MAX, UPLOAD_SIZE_MAX, UPLOAD_TYPES_ALLOW } from '../../lib/constants'
|
import { ANON_USER_ID, IMAGE_PIXELS_MAX, UPLOAD_SIZE_MAX, UPLOAD_SIZE_MAX_AVATAR, UPLOAD_TYPES_ALLOW } from '../../lib/constants'
|
||||||
import { createPresignedPost } from '../s3'
|
import { createPresignedPost } from '../s3'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -10,8 +10,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (size > UPLOAD_SIZE_MAX) {
|
if (size > UPLOAD_SIZE_MAX) {
|
||||||
const UPLOAD_SIZE_MAX_MB = UPLOAD_SIZE_MAX / 1024 / 1024
|
throw new GraphQLError(`image must be less than ${UPLOAD_SIZE_MAX / (1024 ** 2)} megabytes`, { extensions: { code: 'BAD_INPUT' } })
|
||||||
throw new GraphQLError(`image must be less than ${UPLOAD_SIZE_MAX_MB} megabytes`, { extensions: { code: 'BAD_INPUT' } })
|
}
|
||||||
|
|
||||||
|
if (avatar && size > UPLOAD_SIZE_MAX_AVATAR) {
|
||||||
|
throw new GraphQLError(`image must be less than ${UPLOAD_SIZE_MAX_AVATAR / (1024 ** 2)} megabytes`, { extensions: { code: 'BAD_INPUT' } })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width * height > IMAGE_PIXELS_MAX) {
|
if (width * height > IMAGE_PIXELS_MAX) {
|
||||||
|
@ -6,7 +6,8 @@ export const SUBS_NO_JOBS = SUBS.filter(s => s !== 'jobs')
|
|||||||
export const NOFOLLOW_LIMIT = 1000
|
export const NOFOLLOW_LIMIT = 1000
|
||||||
export const BOOST_MULT = 5000
|
export const BOOST_MULT = 5000
|
||||||
export const BOOST_MIN = BOOST_MULT * 5
|
export const BOOST_MIN = BOOST_MULT * 5
|
||||||
export const UPLOAD_SIZE_MAX = 10 * 1024 * 1024
|
export const UPLOAD_SIZE_MAX = 25 * 1024 * 1024
|
||||||
|
export const UPLOAD_SIZE_MAX_AVATAR = 5 * 1024 * 1024
|
||||||
export const IMAGE_PIXELS_MAX = 35000000
|
export const IMAGE_PIXELS_MAX = 35000000
|
||||||
export const AWS_S3_URL_REGEXP = new RegExp(`https://${process.env.NEXT_PUBLIC_AWS_UPLOAD_BUCKET}.s3.amazonaws.com/([0-9]+)`, 'g')
|
export const AWS_S3_URL_REGEXP = new RegExp(`https://${process.env.NEXT_PUBLIC_AWS_UPLOAD_BUCKET}.s3.amazonaws.com/([0-9]+)`, 'g')
|
||||||
export const UPLOAD_TYPES_ALLOW = [
|
export const UPLOAD_TYPES_ALLOW = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user