diff --git a/server/api/api/v1/accounts/update_credentials/index.ts b/server/api/api/v1/accounts/update_credentials/index.ts index 56f4b5e3..8b5b999e 100644 --- a/server/api/api/v1/accounts/update_credentials/index.ts +++ b/server/api/api/v1/accounts/update_credentials/index.ts @@ -1,7 +1,7 @@ import { applyConfig, auth, handleZodError, qs } from "@api"; import { zValidator } from "@hono/zod-validator"; import { errorResponse, jsonResponse } from "@response"; -import { sanitizeHtml, sanitizedHtmlStrip } from "@sanitization"; +import { sanitizedHtmlStrip } from "@sanitization"; import { config } from "config-manager"; import { and, eq } from "drizzle-orm"; import type { Hono } from "hono"; @@ -224,17 +224,25 @@ export default (app: Hono) => self.source.fields = []; for (const field of fields_attributes) { // Can be Markdown or plaintext, also has emojis - const parsedName = await contentToHtml({ - "text/markdown": { - content: field.name, + const parsedName = await contentToHtml( + { + "text/markdown": { + content: field.name, + }, }, - }); + undefined, + true, + ); - const parsedValue = await contentToHtml({ - "text/markdown": { - content: field.value, + const parsedValue = await contentToHtml( + { + "text/markdown": { + content: field.value, + }, }, - }); + undefined, + true, + ); // Parse emojis const nameEmojis = await parseEmojis(parsedName); diff --git a/server/api/api/v1/statuses/index.test.ts b/server/api/api/v1/statuses/index.test.ts index 06b8fff9..041dc4a5 100644 --- a/server/api/api/v1/statuses/index.test.ts +++ b/server/api/api/v1/statuses/index.test.ts @@ -394,5 +394,37 @@ describe(meta.route, () => { "uwu <script>alert('Hello, world!');</script>", ); }); + + test("should rewrite all image and video src to go through proxy", async () => { + const response = await sendTestRequest( + new Request(new URL(meta.route, config.http.base_url), { + method: "POST", + headers: { + Authorization: `Bearer ${tokens[0].accessToken}`, + }, + body: new URLSearchParams({ + status: "