mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 02:13:00 +00:00
✨ add option to disable all rate limits
This commit is contained in:
1 parent
40ae2d6267
commit
022e82023d
6 files changed
+10
-6
No files matched your search
@@ -77,6 +77,7 @@ export interface ConfigValue {
|
||||
maxWebhooks: number;
|
||||
};
|
||||
rate: {
|
||||
disabled: boolean;
|
||||
ip: Omit<RateLimitOptions, "bot_count">;
|
||||
global: RateLimitOptions;
|
||||
error: RateLimitOptions;
|
||||
@@ -188,6 +189,7 @@ export const DefaultConfigOptions: ConfigValue = {
|
||||
maxWebhooks: 10,
|
||||
},
|
||||
rate: {
|
||||
disabled: true,
|
||||
ip: {
|
||||
count: 500,
|
||||
window: 5,
|
||||
|
||||
@@ -161,15 +161,13 @@ export class User extends BaseClass {
|
||||
}
|
||||
|
||||
static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) {
|
||||
const user = await User.findOne(
|
||||
return await User.findOneOrFail(
|
||||
{ id: user_id },
|
||||
{
|
||||
...opts,
|
||||
select: [...PublicUserProjection, ...(opts?.select || [])],
|
||||
}
|
||||
);
|
||||
if (!user) throw new HTTPError("User not found", 404);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export const Config = {
|
||||
get: function get() {
|
||||
return config.value as ConfigValue;
|
||||
},
|
||||
set: function set(val: any) {
|
||||
set: function set(val: Partial<ConfigValue>) {
|
||||
if (!config) return;
|
||||
config.value = val.merge(config?.value || {});
|
||||
return config.save();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import path from "path";
|
||||
import "reflect-metadata";
|
||||
import { Connection, createConnection, ValueTransformer } from "typeorm";
|
||||
import * as Models from "../entities";
|
||||
@@ -15,7 +16,7 @@ export function initDatabase() {
|
||||
// @ts-ignore
|
||||
promise = createConnection({
|
||||
type: "sqlite",
|
||||
database: "database.db",
|
||||
database: path.join(process.cwd(), "database.db"),
|
||||
// type: "postgres",
|
||||
// url: "postgres://fosscord:wb94SmuURM2Syv&@localhost/fosscord",
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user