mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): 🔒 Make all media be proxied through an internal proxy
This commit is contained in:
parent
9547cd097a
commit
ead34b818f
8 changed files with 54 additions and 18 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { config } from "~packages/config-manager";
|
||||
|
||||
export const response = (
|
||||
data: BodyInit | null = null,
|
||||
status = 200,
|
||||
|
|
@ -69,3 +71,12 @@ export const redirect = (url: string | URL, status = 302) => {
|
|||
Location: url.toString(),
|
||||
});
|
||||
};
|
||||
|
||||
export const proxyUrl = (url: string | null) => {
|
||||
return url
|
||||
? new URL(
|
||||
`/media/proxy?url=${encodeURIComponent(url)}`,
|
||||
config.http.base_url,
|
||||
).toString()
|
||||
: url;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import xss, { type IFilterXSSOptions } from "xss";
|
||||
import { stringifyEntitiesLight } from "stringify-entities";
|
||||
import xss, { type IFilterXSSOptions } from "xss";
|
||||
|
||||
export const sanitizedHtmlStrip = (html: string) => {
|
||||
return sanitizeHtml(html, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue