mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix(api): 🔒 Correctly put all URIs in profiles through proxy
This commit is contained in:
parent
bd1f09837b
commit
569ba8bf2d
3 changed files with 79 additions and 12 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { idValidator } from "@/api";
|
||||
import { localObjectUri } from "@/constants";
|
||||
import { proxyUrl } from "@/response";
|
||||
import { sanitizedHtmlStrip } from "@/sanitization";
|
||||
import { sentry } from "@/sentry";
|
||||
import { getLogger } from "@logtape/logtape";
|
||||
|
|
@ -902,17 +901,7 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
|
|||
(mention) => mention.instanceId === null,
|
||||
);
|
||||
|
||||
// Rewrite all src tags to go through proxy
|
||||
let replacedContent = new HTMLRewriter()
|
||||
.on("[src]", {
|
||||
element(element): void {
|
||||
element.setAttribute(
|
||||
"src",
|
||||
proxyUrl(element.getAttribute("src") ?? "") ?? "",
|
||||
);
|
||||
},
|
||||
})
|
||||
.transform(data.content);
|
||||
let replacedContent = data.content;
|
||||
|
||||
for (const mention of mentionedLocalUsers) {
|
||||
replacedContent = replacedContent.replace(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue