summary refs log tree commit diff
path: root/api/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/util')
-rw-r--r--api/src/util/entities/AssetCacheItem.ts3
-rw-r--r--api/src/util/handlers/Message.ts9
-rw-r--r--api/src/util/index.ts1
3 files changed, 10 insertions, 3 deletions
diff --git a/api/src/util/entities/AssetCacheItem.ts b/api/src/util/entities/AssetCacheItem.ts
new file mode 100644

index 00000000..160dece6 --- /dev/null +++ b/api/src/util/entities/AssetCacheItem.ts
@@ -0,0 +1,3 @@ +export class AssetCacheItem { + constructor(public Key: string, public FilePath: string = "", public Headers: any = null as any) {} +} \ No newline at end of file diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts
index e9f0ac55..48f87dfe 100644 --- a/api/src/util/handlers/Message.ts +++ b/api/src/util/handlers/Message.ts
@@ -38,7 +38,7 @@ const DEFAULT_FETCH_OPTIONS: any = { headers: { "user-agent": "Mozilla/5.0 (compatible; Fosscord/1.0; +https://github.com/fosscord/fosscord)" }, - size: 1024 * 1024 * 1, + // size: 1024 * 1024 * 5, // grabbed from config later compress: true, method: "GET" }; @@ -154,7 +154,10 @@ export async function postHandleMessage(message: Message) { for (const link of links) { try { - const request = await fetch(link, DEFAULT_FETCH_OPTIONS); + const request = await fetch(link, { + ...DEFAULT_FETCH_OPTIONS, + size: Config.get().limits.message.maxEmbedDownloadSize, + }); const text = await request.text(); const $ = cheerio.load(text); @@ -191,7 +194,7 @@ export async function postHandleMessage(message: Message) { channel_id: message.channel_id, data } as MessageUpdateEvent), - Message.update({ id: message.id, channel_id: message.channel_id }, data) + Message.update({ id: message.id, channel_id: message.channel_id }, { embeds: data.embeds }) ]); } diff --git a/api/src/util/index.ts b/api/src/util/index.ts
index ffbcf24e..ac439371 100644 --- a/api/src/util/index.ts +++ b/api/src/util/index.ts
@@ -6,3 +6,4 @@ export * from "./utility/RandomInviteID"; export * from "./handlers/route"; export * from "./utility/String"; export * from "./handlers/Voice"; +export * from "./entities/AssetCacheItem"; \ No newline at end of file