From 98e1a182a1beaadce35ecd92501fab4ea20f3f80 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 19 Jun 2026 10:57:36 +0000 Subject: [PATCH] enhance: accept WebP as profile avatar/banner images --- src/api/v1/accounts.ts | 7 ++++++- src/pages/accounts.tsx | 15 ++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/api/v1/accounts.ts b/src/api/v1/accounts.ts index e35a946b..7646474f 100644 --- a/src/api/v1/accounts.ts +++ b/src/api/v1/accounts.ts @@ -50,7 +50,12 @@ import { isUuid, type Uuid } from "../../uuid"; import { timelineQuerySchema } from "./timelines"; const app = new Hono<{ Variables: AccountOwnerVariables }>(); -const allowedImageMimeTypes = ["image/gif", "image/jpeg", "image/png"]; +const allowedImageMimeTypes = [ + "image/gif", + "image/jpeg", + "image/png", + "image/webp", +]; app.get( "/verify_credentials", diff --git a/src/pages/accounts.tsx b/src/pages/accounts.tsx index 1715f469..6403fcaa 100644 --- a/src/pages/accounts.tsx +++ b/src/pages/accounts.tsx @@ -63,7 +63,12 @@ const HOLLO_OFFICIAL_ACCOUNT = "@hollo@hollo.social"; const logger = getLogger(["hollo", "pages", "accounts"]); -const allowedImageMimeTypes = ["image/gif", "image/jpeg", "image/png"]; +const allowedImageMimeTypes = [ + "image/gif", + "image/jpeg", + "image/png", + "image/webp", +]; export function parseFields( form: FormData, @@ -194,7 +199,7 @@ accounts.post("/", async (c) => { news, fields: parsedFields, }} - errors={{ avatar: "Avatar must be a JPEG, PNG, or GIF." }} + errors={{ avatar: "Avatar must be a JPEG, PNG, WEBP, or GIF." }} officialAccount={HOLLO_OFFICIAL_ACCOUNT} host={getInstanceHost(new URL(c.req.url))} />, @@ -222,7 +227,7 @@ accounts.post("/", async (c) => { news, fields: parsedFields, }} - errors={{ header: "Header image must be a JPEG, PNG, or GIF." }} + errors={{ header: "Header image must be a JPEG, PNG, WEBP, or GIF." }} officialAccount={HOLLO_OFFICIAL_ACCOUNT} host={getInstanceHost(new URL(c.req.url))} />, @@ -596,7 +601,7 @@ accounts.post("/:id", async (c) => { coverUrl: accountOwner.account.coverUrl, fields: parsedFields, }} - errors={{ avatar: "Avatar must be a JPEG, PNG, or GIF." }} + errors={{ avatar: "Avatar must be a JPEG, PNG, WEBP, or GIF." }} officialAccount={HOLLO_OFFICIAL_ACCOUNT} host={getInstanceHost(new URL(c.req.url))} />, @@ -627,7 +632,7 @@ accounts.post("/:id", async (c) => { coverUrl: accountOwner.account.coverUrl, fields: parsedFields, }} - errors={{ header: "Header image must be a JPEG, PNG, or GIF." }} + errors={{ header: "Header image must be a JPEG, PNG, WEBP, or GIF." }} officialAccount={HOLLO_OFFICIAL_ACCOUNT} host={getInstanceHost(new URL(c.req.url))} />,