mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
feat(config): 🚩 Add emoji size/description size controls
This commit is contained in:
parent
5074ac788f
commit
b14fa17e1a
|
|
@ -32,6 +32,10 @@ remove_on_failure = 31536000
|
||||||
remove_on_complete = 31536000
|
remove_on_complete = 31536000
|
||||||
# Time in seconds to remove failed jobs
|
# Time in seconds to remove failed jobs
|
||||||
remove_on_failure = 31536000
|
remove_on_failure = 31536000
|
||||||
|
|
||||||
|
[validation]
|
||||||
|
max_emoji_size = 1000000
|
||||||
|
max_emoji_description_size = 1000
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configuration Changes
|
### Configuration Changes
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,19 @@ export const schemas = {
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(2000)
|
.max(2000)
|
||||||
.url()
|
.url()
|
||||||
.or(z.instanceof(File)),
|
.or(
|
||||||
|
z
|
||||||
|
.instanceof(File)
|
||||||
|
.refine(
|
||||||
|
(v) => v.size <= config.validation.max_emoji_size,
|
||||||
|
`Emoji must be less than ${config.validation.max_emoji_size} bytes`,
|
||||||
|
),
|
||||||
|
),
|
||||||
category: z.string().max(64).optional(),
|
category: z.string().max(64).optional(),
|
||||||
alt: z.string().max(1000).optional(),
|
alt: z
|
||||||
|
.string()
|
||||||
|
.max(config.validation.max_emoji_description_size)
|
||||||
|
.optional(),
|
||||||
global: z
|
global: z
|
||||||
.string()
|
.string()
|
||||||
.transform((v) => ["true", "1", "on"].includes(v.toLowerCase()))
|
.transform((v) => ["true", "1", "on"].includes(v.toLowerCase()))
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,19 @@ export const schemas = {
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(2000)
|
.max(2000)
|
||||||
.url()
|
.url()
|
||||||
.or(z.instanceof(File)),
|
.or(
|
||||||
|
z
|
||||||
|
.instanceof(File)
|
||||||
|
.refine(
|
||||||
|
(v) => v.size <= config.validation.max_emoji_size,
|
||||||
|
`Emoji must be less than ${config.validation.max_emoji_size} bytes`,
|
||||||
|
),
|
||||||
|
),
|
||||||
category: z.string().max(64).optional(),
|
category: z.string().max(64).optional(),
|
||||||
alt: z.string().max(1000).optional(),
|
alt: z
|
||||||
|
.string()
|
||||||
|
.max(config.validation.max_emoji_description_size)
|
||||||
|
.optional(),
|
||||||
global: z
|
global: z
|
||||||
.string()
|
.string()
|
||||||
.transform((v) => ["true", "1", "on"].includes(v.toLowerCase()))
|
.transform((v) => ["true", "1", "on"].includes(v.toLowerCase()))
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,8 @@ max_header_size = 5_000_000
|
||||||
max_media_size = 40_000_000
|
max_media_size = 40_000_000
|
||||||
max_media_attachments = 10
|
max_media_attachments = 10
|
||||||
max_media_description_size = 1000
|
max_media_description_size = 1000
|
||||||
|
max_emoji_size = 1000000
|
||||||
|
max_emoji_description_size = 1000
|
||||||
max_poll_options = 20
|
max_poll_options = 20
|
||||||
max_poll_option_size = 500
|
max_poll_option_size = 500
|
||||||
min_poll_duration = 60 # Seconds
|
min_poll_duration = 60 # Seconds
|
||||||
|
|
|
||||||
|
|
@ -530,6 +530,14 @@
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default": 1000
|
"default": 1000
|
||||||
},
|
},
|
||||||
|
"max_emoji_size": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1000000
|
||||||
|
},
|
||||||
|
"max_emoji_description_size": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1000
|
||||||
|
},
|
||||||
"max_poll_options": {
|
"max_poll_options": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default": 20
|
"default": 20
|
||||||
|
|
@ -1864,6 +1872,8 @@
|
||||||
"max_media_size": 40000000,
|
"max_media_size": 40000000,
|
||||||
"max_media_attachments": 10,
|
"max_media_attachments": 10,
|
||||||
"max_media_description_size": 1000,
|
"max_media_description_size": 1000,
|
||||||
|
"max_emoji_size": 1000000,
|
||||||
|
"max_emoji_description_size": 1000,
|
||||||
"max_poll_options": 20,
|
"max_poll_options": 20,
|
||||||
"max_poll_option_size": 500,
|
"max_poll_option_size": 500,
|
||||||
"min_poll_duration": 60,
|
"min_poll_duration": 60,
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,8 @@ export const configValidator = z
|
||||||
max_media_size: z.number().int().default(40000000),
|
max_media_size: z.number().int().default(40000000),
|
||||||
max_media_attachments: z.number().int().default(10),
|
max_media_attachments: z.number().int().default(10),
|
||||||
max_media_description_size: z.number().int().default(1000),
|
max_media_description_size: z.number().int().default(1000),
|
||||||
|
max_emoji_size: z.number().int().default(1000000),
|
||||||
|
max_emoji_description_size: z.number().int().default(1000),
|
||||||
max_poll_options: z.number().int().default(20),
|
max_poll_options: z.number().int().default(20),
|
||||||
max_poll_option_size: z.number().int().default(500),
|
max_poll_option_size: z.number().int().default(500),
|
||||||
min_poll_duration: z.number().int().default(60),
|
min_poll_duration: z.number().int().default(60),
|
||||||
|
|
@ -383,6 +385,8 @@ export const configValidator = z
|
||||||
max_media_size: 40000000,
|
max_media_size: 40000000,
|
||||||
max_media_attachments: 10,
|
max_media_attachments: 10,
|
||||||
max_media_description_size: 1000,
|
max_media_description_size: 1000,
|
||||||
|
max_emoji_size: 1000000,
|
||||||
|
max_emoji_description_size: 1000,
|
||||||
max_poll_options: 20,
|
max_poll_options: 20,
|
||||||
max_poll_option_size: 500,
|
max_poll_option_size: 500,
|
||||||
min_poll_duration: 60,
|
min_poll_duration: 60,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue