mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix(api): 🐛 Enforce emoji shortcode filters
This commit is contained in:
parent
9eac364e01
commit
c737aeba8e
2 changed files with 18 additions and 6 deletions
|
|
@ -113,8 +113,14 @@ export default apiRoute((app) => {
|
|||
"json",
|
||||
z
|
||||
.object({
|
||||
shortcode: CustomEmojiSchema.shape.shortcode.max(
|
||||
config.validation.emojis.max_shortcode_characters,
|
||||
shortcode: CustomEmojiSchema.shape.shortcode
|
||||
.max(config.validation.emojis.max_shortcode_characters)
|
||||
.refine(
|
||||
(s) =>
|
||||
!config.validation.filters.emoji_shortcode.some(
|
||||
(filter) => filter.test(s),
|
||||
),
|
||||
"Shortcode contains blocked words",
|
||||
),
|
||||
element: z
|
||||
.string()
|
||||
|
|
|
|||
|
|
@ -45,8 +45,14 @@ export default apiRoute((app) =>
|
|||
validator(
|
||||
"json",
|
||||
z.object({
|
||||
shortcode: CustomEmojiSchema.shape.shortcode.max(
|
||||
config.validation.emojis.max_shortcode_characters,
|
||||
shortcode: CustomEmojiSchema.shape.shortcode
|
||||
.max(config.validation.emojis.max_shortcode_characters)
|
||||
.refine(
|
||||
(s) =>
|
||||
!config.validation.filters.emoji_shortcode.some(
|
||||
(filter) => filter.test(s),
|
||||
),
|
||||
"Shortcode contains blocked words",
|
||||
),
|
||||
element: z
|
||||
.string()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue