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,4 @@
|
|||
import { proxyUrl } from "@response";
|
||||
import type { Config } from "config-manager";
|
||||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import type * as Lysand from "lysand-types";
|
||||
|
|
@ -25,9 +26,9 @@ export const attachmentToAPI = (
|
|||
return {
|
||||
id: attachment.id,
|
||||
type: type as "image" | "video" | "audio" | "unknown",
|
||||
url: attachment.url,
|
||||
remote_url: attachment.remoteUrl,
|
||||
preview_url: attachment.thumbnailUrl || attachment.url,
|
||||
url: proxyUrl(attachment.url) ?? "",
|
||||
remote_url: proxyUrl(attachment.remoteUrl),
|
||||
preview_url: proxyUrl(attachment.thumbnailUrl || attachment.url),
|
||||
text_url: null,
|
||||
meta: {
|
||||
width: attachment.width || undefined,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { proxyUrl } from "@response";
|
||||
import { type InferSelectModel, and, eq } from "drizzle-orm";
|
||||
import type * as Lysand from "lysand-types";
|
||||
import { db } from "~drizzle/db";
|
||||
|
|
@ -93,8 +94,8 @@ export const fetchEmoji = async (
|
|||
export const emojiToAPI = (emoji: EmojiWithInstance): APIEmoji => {
|
||||
return {
|
||||
shortcode: emoji.shortcode,
|
||||
static_url: emoji.url, // TODO: Add static version
|
||||
url: emoji.url,
|
||||
static_url: proxyUrl(emoji.url) ?? "", // TODO: Add static version
|
||||
url: proxyUrl(emoji.url) ?? "",
|
||||
visible_in_picker: emoji.visibleInPicker,
|
||||
category: undefined,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue