summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 13:40:38 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 13:40:38 +1000
commit8b105e19d495c715ff7f26d0cbd992b697b729b6 (patch)
tree49e5a80ad2cf90d5733c3fe750bcc6a7964e5273
parentMerge branch 'feat/multiUploads' into feat/latestWebClient (diff)
parentRelax some of the limits (diff)
downloadserver-8b105e19d495c715ff7f26d0cbd992b697b729b6.tar.xz
Merge branch 'master' into feat/latestWebClient
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts2
-rw-r--r--api/src/util/handlers/Message.ts9
-rw-r--r--util/src/entities/Config.ts37
3 files changed, 26 insertions, 22 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 })
 	]);
 }
 
diff --git a/util/src/entities/Config.ts b/util/src/entities/Config.ts
index 063a4d4d..3756d686 100644
--- a/util/src/entities/Config.ts
+++ b/util/src/entities/Config.ts
@@ -85,6 +85,7 @@ export interface ConfigValue {
 			maxReactions: number;
 			maxAttachmentSize: number;
 			maxBulkDelete: number;
+			maxEmbedDownloadSize: number;
 		};
 		channel: {
 			maxPins: number;
@@ -232,29 +233,30 @@ export const DefaultConfigOptions: ConfigValue = {
 	},
 	limits: {
 		user: {
-			maxGuilds: 100,
-			maxUsername: 32,
-			maxFriends: 1000,
+			maxGuilds: 1048576,
+			maxUsername: 127,
+			maxFriends: 5000,
 		},
 		guild: {
-			maxRoles: 250,
-			maxEmojis: 50, // TODO: max emojis per guild per nitro level
-			maxMembers: 250000,
-			maxChannels: 500,
-			maxChannelsInCategory: 50,
-			hideOfflineMember: 1000,
+			maxRoles: 1000,
+			maxEmojis: 2000,
+			maxMembers: 25000000,
+			maxChannels: 65535,
+			maxChannelsInCategory: 65535,
+			hideOfflineMember: 3,
 		},
 		message: {
-			maxCharacters: 2000,
-			maxTTSCharacters: 200,
-			maxReactions: 20,
-			maxAttachmentSize: 8388608,
-			maxBulkDelete: 100,
+			maxCharacters: 1048576,
+			maxTTSCharacters: 160,
+			maxReactions: 2048,
+			maxAttachmentSize: 1024 * 1024 * 1024,
+			maxEmbedDownloadSize: 1024 * 1024 * 5,
+			maxBulkDelete: 1000,
 		},
 		channel: {
-			maxPins: 50,
+			maxPins: 500,
 			maxTopic: 1024,
-			maxWebhooks: 10,
+			maxWebhooks: 100,
 		},
 		rate: {
 			disabled: true,
@@ -263,9 +265,8 @@ export const DefaultConfigOptions: ConfigValue = {
 				window: 5,
 			},
 			global: {
-				count: 20,
+				count: 250,
 				window: 5,
-				bot: 250,
 			},
 			error: {
 				count: 10,