1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-06 02:42:37 +01:00

Merge branch 'master' into feat/latestWebClient

This commit is contained in:
Madeline 2022-07-10 13:40:38 +10:00
commit 8b105e19d4
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
3 changed files with 26 additions and 22 deletions

View File

@ -17,7 +17,7 @@ import {
} from "@fosscord/util"; } from "@fosscord/util";
import { HTTPError } from "lambert-server"; import { HTTPError } from "lambert-server";
import { handleMessage, postHandleMessage, route } from "@fosscord/api"; import { handleMessage, postHandleMessage, route } from "@fosscord/api";
import multer, { Multer } from "multer"; import multer from "multer";
import { FindManyOptions, LessThan, MoreThan } from "typeorm"; import { FindManyOptions, LessThan, MoreThan } from "typeorm";
import { URL } from "url"; import { URL } from "url";

View File

@ -38,7 +38,7 @@ const DEFAULT_FETCH_OPTIONS: any = {
headers: { headers: {
"user-agent": "Mozilla/5.0 (compatible; Fosscord/1.0; +https://github.com/fosscord/fosscord)" "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, compress: true,
method: "GET" method: "GET"
}; };
@ -154,7 +154,10 @@ export async function postHandleMessage(message: Message) {
for (const link of links) { for (const link of links) {
try { 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 text = await request.text();
const $ = cheerio.load(text); const $ = cheerio.load(text);
@ -191,7 +194,7 @@ export async function postHandleMessage(message: Message) {
channel_id: message.channel_id, channel_id: message.channel_id,
data data
} as MessageUpdateEvent), } 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 })
]); ]);
} }

View File

@ -85,6 +85,7 @@ export interface ConfigValue {
maxReactions: number; maxReactions: number;
maxAttachmentSize: number; maxAttachmentSize: number;
maxBulkDelete: number; maxBulkDelete: number;
maxEmbedDownloadSize: number;
}; };
channel: { channel: {
maxPins: number; maxPins: number;
@ -232,29 +233,30 @@ export const DefaultConfigOptions: ConfigValue = {
}, },
limits: { limits: {
user: { user: {
maxGuilds: 100, maxGuilds: 1048576,
maxUsername: 32, maxUsername: 127,
maxFriends: 1000, maxFriends: 5000,
}, },
guild: { guild: {
maxRoles: 250, maxRoles: 1000,
maxEmojis: 50, // TODO: max emojis per guild per nitro level maxEmojis: 2000,
maxMembers: 250000, maxMembers: 25000000,
maxChannels: 500, maxChannels: 65535,
maxChannelsInCategory: 50, maxChannelsInCategory: 65535,
hideOfflineMember: 1000, hideOfflineMember: 3,
}, },
message: { message: {
maxCharacters: 2000, maxCharacters: 1048576,
maxTTSCharacters: 200, maxTTSCharacters: 160,
maxReactions: 20, maxReactions: 2048,
maxAttachmentSize: 8388608, maxAttachmentSize: 1024 * 1024 * 1024,
maxBulkDelete: 100, maxEmbedDownloadSize: 1024 * 1024 * 5,
maxBulkDelete: 1000,
}, },
channel: { channel: {
maxPins: 50, maxPins: 500,
maxTopic: 1024, maxTopic: 1024,
maxWebhooks: 10, maxWebhooks: 100,
}, },
rate: { rate: {
disabled: true, disabled: true,
@ -263,9 +265,8 @@ export const DefaultConfigOptions: ConfigValue = {
window: 5, window: 5,
}, },
global: { global: {
count: 20, count: 250,
window: 5, window: 5,
bot: 250,
}, },
error: { error: {
count: 10, count: 10,