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,9 +113,15 @@ 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()
|
||||||
.url()
|
.url()
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,15 @@ 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()
|
||||||
.url()
|
.url()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue