mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(api): 🐛 Enforce emoji shortcode filters
This commit is contained in:
parent
9eac364e01
commit
c737aeba8e
|
|
@ -113,8 +113,14 @@ export default apiRoute((app) => {
|
||||||
"json",
|
"json",
|
||||||
z
|
z
|
||||||
.object({
|
.object({
|
||||||
shortcode: CustomEmojiSchema.shape.shortcode.max(
|
shortcode: CustomEmojiSchema.shape.shortcode
|
||||||
config.validation.emojis.max_shortcode_characters,
|
.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
|
element: z
|
||||||
.string()
|
.string()
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,14 @@ export default apiRoute((app) =>
|
||||||
validator(
|
validator(
|
||||||
"json",
|
"json",
|
||||||
z.object({
|
z.object({
|
||||||
shortcode: CustomEmojiSchema.shape.shortcode.max(
|
shortcode: CustomEmojiSchema.shape.shortcode
|
||||||
config.validation.emojis.max_shortcode_characters,
|
.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
|
element: z
|
||||||
.string()
|
.string()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue