diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-10 13:40:38 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-10 13:40:38 +1000 |
commit | e7c8b7f1f14ffef09c534a85f19d230bc063a4ea (patch) | |
tree | 182db02a82a9eab65470adfdd20e00403c91869f /api/src | |
parent | Merge branch 'feat/multiUploads' into feat/latestWebClient (diff) | |
parent | Relax some of the limits (diff) | |
download | server-e7c8b7f1f14ffef09c534a85f19d230bc063a4ea.tar.xz |
Merge branch 'master' into feat/latestWebClient
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/routes/channels/#channel_id/messages/index.ts | 2 | ||||
-rw-r--r-- | api/src/util/handlers/Message.ts | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts index fc2e4575..54e6edcc 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts @@ -17,7 +17,7 @@ import { } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { handleMessage, postHandleMessage, route } from "@fosscord/api"; -import multer, { Multer } from "multer"; +import multer from "multer"; import { FindManyOptions, LessThan, MoreThan } from "typeorm"; import { URL } from "url"; 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 }) ]); } |