mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 00:48:18 +01:00
feat(api): 🚩 Add emoji shortcode size controls
This commit is contained in:
parent
cfefd56a55
commit
8796f694bc
|
|
@ -35,6 +35,7 @@ remove_on_failure = 31536000
|
|||
|
||||
[validation]
|
||||
max_emoji_size = 1000000
|
||||
max_emoji_shortcode_size = 100
|
||||
max_emoji_description_size = 1000
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export const schemas = {
|
|||
.string()
|
||||
.trim()
|
||||
.min(1)
|
||||
.max(64)
|
||||
.max(config.validation.max_emoji_shortcode_size)
|
||||
.regex(
|
||||
emojiValidator,
|
||||
"Shortcode must only contain letters (any case), numbers, dashes or underscores.",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const schemas = {
|
|||
.string()
|
||||
.trim()
|
||||
.min(1)
|
||||
.max(64)
|
||||
.max(config.validation.max_emoji_shortcode_size)
|
||||
.regex(
|
||||
emojiValidator,
|
||||
"Shortcode must only contain letters (any case), numbers, dashes or underscores.",
|
||||
|
|
|
|||
|
|
@ -202,6 +202,8 @@ export default apiRoute((app) =>
|
|||
},
|
||||
emojis: {
|
||||
emoji_size_limit: config.validation.max_emoji_size,
|
||||
max_emoji_shortcode_characters:
|
||||
config.validation.max_emoji_shortcode_size,
|
||||
max_emoji_description_characters:
|
||||
config.validation.max_emoji_description_size,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ max_media_size = 40_000_000
|
|||
max_media_attachments = 10
|
||||
max_media_description_size = 1000
|
||||
max_emoji_size = 1000000
|
||||
max_emoji_shortcode_size = 100
|
||||
max_emoji_description_size = 1000
|
||||
max_poll_options = 20
|
||||
max_poll_option_size = 500
|
||||
|
|
|
|||
|
|
@ -534,6 +534,10 @@
|
|||
"type": "integer",
|
||||
"default": 1000000
|
||||
},
|
||||
"max_emoji_shortcode_size": {
|
||||
"type": "integer",
|
||||
"default": 100
|
||||
},
|
||||
"max_emoji_description_size": {
|
||||
"type": "integer",
|
||||
"default": 1000
|
||||
|
|
@ -1873,6 +1877,7 @@
|
|||
"max_media_attachments": 10,
|
||||
"max_media_description_size": 1000,
|
||||
"max_emoji_size": 1000000,
|
||||
"max_emoji_shortcode_size": 100,
|
||||
"max_emoji_description_size": 1000,
|
||||
"max_poll_options": 20,
|
||||
"max_poll_option_size": 500,
|
||||
|
|
|
|||
|
|
@ -315,12 +315,13 @@ Single Sign-On (SSO) settings for the instance. This object contains two fields:
|
|||
Extra attributes have been added to the `/api/v2/instance` endpoint. These are identical to the `/api/v1/instance` endpoint, except that the `banner` attribute uses the normal Mastodon API attribute.
|
||||
|
||||
```ts
|
||||
type ExtendedInstanceV2 = Instance & {
|
||||
type ExtendedInstanceV2 = InstanceV2 & {
|
||||
versia_version: string;
|
||||
configuration: Instance["configuration"] & {
|
||||
emojis: {
|
||||
// In bytes
|
||||
emoji_size_limit: number;
|
||||
max_emoji_shortcode_characters: number;
|
||||
max_emoji_description_characters: number;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ export const configValidator = z
|
|||
max_media_attachments: z.number().int().default(10),
|
||||
max_media_description_size: z.number().int().default(1000),
|
||||
max_emoji_size: z.number().int().default(1000000),
|
||||
max_emoji_shortcode_size: z.number().int().default(100),
|
||||
max_emoji_description_size: z.number().int().default(1000),
|
||||
max_poll_options: z.number().int().default(20),
|
||||
max_poll_option_size: z.number().int().default(500),
|
||||
|
|
@ -386,6 +387,7 @@ export const configValidator = z
|
|||
max_media_attachments: 10,
|
||||
max_media_description_size: 1000,
|
||||
max_emoji_size: 1000000,
|
||||
max_emoji_shortcode_size: 100,
|
||||
max_emoji_description_size: 1000,
|
||||
max_poll_options: 20,
|
||||
max_poll_option_size: 500,
|
||||
|
|
|
|||
Loading…
Reference in a new issue