This commit is contained in:
Madeline
2023-01-05 17:16:55 +11:00
parent a665a39523
commit df449169bd
124 changed files with 3639 additions and 1697 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ import {
RegisterConfiguration,
SecurityConfiguration,
SentryConfiguration,
TemplateConfiguration
TemplateConfiguration,
} from "../config";
export class ConfigValue {
@@ -40,4 +40,4 @@ export class ConfigValue {
sentry: SentryConfiguration = new SentryConfiguration();
defaults: DefaultsConfiguration = new DefaultsConfiguration();
external: ExternalTokensConfiguration = new ExternalTokensConfiguration();
}
}
+1 -1
View File
@@ -2,4 +2,4 @@ export class ApiConfiguration {
defaultVersion: string = "9";
activeVersions: string[] = ["6", "7", "8", "9"];
useFosscordEnhancements: boolean = true;
}
}
+1 -1
View File
@@ -7,4 +7,4 @@ export class CdnConfiguration extends EndpointConfiguration {
endpointPublic: string | null = "http://localhost:3001";
endpointPrivate: string | null = "http://localhost:3001";
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
import { ClientReleaseConfiguration } from ".";
export class ClientConfiguration {
releases: ClientReleaseConfiguration = new ClientReleaseConfiguration();
useTestClient: boolean = false;
}
releases: ClientReleaseConfiguration = new ClientReleaseConfiguration();
useTestClient: boolean = false;
}
@@ -1,6 +1,6 @@
import { GuildDefaults, UserDefaults } from ".";
export class DefaultsConfiguration {
guild: GuildDefaults = new GuildDefaults();
user: UserDefaults = new UserDefaults();
}
guild: GuildDefaults = new GuildDefaults();
user: UserDefaults = new UserDefaults();
}
@@ -2,4 +2,4 @@ export class EndpointConfiguration {
endpointClient: string | null = null;
endpointPrivate: string | null = null;
endpointPublic: string | null = null;
}
}
@@ -1,3 +1,3 @@
export class ExternalTokensConfiguration {
twitter: string | null = null;
}
}
@@ -2,11 +2,12 @@ import { Snowflake } from "@fosscord/util";
export class GeneralConfiguration {
instanceName: string = "Fosscord Instance";
instanceDescription: string | null = "This is a Fosscord instance made in the pre-release days";
instanceDescription: string | null =
"This is a Fosscord instance made in the pre-release days";
frontPage: string | null = null;
tosPage: string | null = null;
correspondenceEmail: string | null = null;
correspondenceUserID: string | null = null;
image: string | null = null;
instanceId: string = Snowflake.generate();
}
}
+4 -4
View File
@@ -1,5 +1,5 @@
export class GifConfiguration {
enabled: boolean = true;
provider: "tenor" = "tenor"; // more coming soon
apiKey?: string = "LIVDSRZULELA";
}
enabled: boolean = true;
provider: "tenor" = "tenor"; // more coming soon
apiKey?: string = "LIVDSRZULELA";
}
+2 -2
View File
@@ -1,7 +1,7 @@
import { DiscoveryConfiguration, AutoJoinConfiguration } from ".";
export class GuildConfiguration {
discovery: DiscoveryConfiguration = new DiscoveryConfiguration();
autoJoin: AutoJoinConfiguration = new AutoJoinConfiguration();
discovery: DiscoveryConfiguration = new DiscoveryConfiguration();
autoJoin: AutoJoinConfiguration = new AutoJoinConfiguration();
defaultFeatures: string[] = [];
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { KafkaBroker } from ".";
export class KafkaConfiguration {
brokers: KafkaBroker[] | null = null;
}
brokers: KafkaBroker[] | null = null;
}
+8 -1
View File
@@ -1,4 +1,11 @@
import { ChannelLimits, GlobalRateLimits, GuildLimits, MessageLimits, RateLimits, UserLimits } from ".";
import {
ChannelLimits,
GlobalRateLimits,
GuildLimits,
MessageLimits,
RateLimits,
UserLimits,
} from ".";
export class LimitsConfiguration {
user: UserLimits = new UserLimits();
+2 -2
View File
@@ -1,3 +1,3 @@
export class LoginConfiguration {
requireCaptcha: boolean = false;
}
requireCaptcha: boolean = false;
}
@@ -1,3 +1,3 @@
export class MetricsConfiguration {
timeout: number = 30000;
}
timeout: number = 30000;
}
@@ -1,3 +1,3 @@
export class RabbitMQConfiguration {
host: string | null = null;
}
host: string | null = null;
}
+13 -13
View File
@@ -1,16 +1,16 @@
import { Region } from ".";
export class RegionConfiguration {
default: string = "fosscord";
useDefaultAsOptimal: boolean = true;
available: Region[] = [
{
id: "fosscord",
name: "Fosscord",
endpoint: "127.0.0.1:3004",
vip: false,
custom: false,
deprecated: false,
},
];
}
default: string = "fosscord";
useDefaultAsOptimal: boolean = true;
available: Region[] = [
{
id: "fosscord",
name: "Fosscord",
endpoint: "127.0.0.1:3004",
vip: false,
custom: false,
deprecated: false,
},
];
}
+17 -13
View File
@@ -1,16 +1,20 @@
import { DateOfBirthConfiguration, EmailConfiguration, PasswordConfiguration } from ".";
import {
DateOfBirthConfiguration,
EmailConfiguration,
PasswordConfiguration,
} from ".";
export class RegisterConfiguration {
email: EmailConfiguration = new EmailConfiguration();
dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration();
password: PasswordConfiguration = new PasswordConfiguration();
disabled: boolean = false;
requireCaptcha: boolean = true;
requireInvite: boolean = false;
guestsRequireInvite: boolean = true;
allowNewRegistration: boolean = true;
allowMultipleAccounts: boolean = true;
blockProxies: boolean = true;
incrementingDiscriminators: boolean = false; // random otherwise
defaultRights: string = "30644591655940"; // See `npm run generate:rights`
email: EmailConfiguration = new EmailConfiguration();
dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration();
password: PasswordConfiguration = new PasswordConfiguration();
disabled: boolean = false;
requireCaptcha: boolean = true;
requireInvite: boolean = false;
guestsRequireInvite: boolean = true;
allowNewRegistration: boolean = true;
allowMultipleAccounts: boolean = true;
blockProxies: boolean = true;
incrementingDiscriminators: boolean = false; // random otherwise
defaultRights: string = "30644591655940"; // See `npm run generate:rights`
}
@@ -11,7 +11,8 @@ export class SecurityConfiguration {
// X-Forwarded-For for nginx/reverse proxies
// CF-Connecting-IP for cloudflare
forwadedFor: string | null = null;
ipdataApiKey: string | null = "eca677b284b3bac29eb72f5e496aa9047f26543605efe99ff2ce35c9";
ipdataApiKey: string | null =
"eca677b284b3bac29eb72f5e496aa9047f26543605efe99ff2ce35c9";
mfaBackupCodeCount: number = 10;
statsWorldReadable: boolean = true;
defaultRegistrationTokenExpiration: number = 1000 * 60 * 60 * 24 * 7; //1 week
+6 -5
View File
@@ -1,8 +1,9 @@
import { hostname } from "os";
export class SentryConfiguration {
enabled: boolean = false;
endpoint: string = "https://05e8e3d005f34b7d97e920ae5870a5e5@sentry.thearcanebrony.net/6";
traceSampleRate: number = 1.0;
environment: string = hostname();
}
enabled: boolean = false;
endpoint: string =
"https://05e8e3d005f34b7d97e920ae5870a5e5@sentry.thearcanebrony.net/6";
traceSampleRate: number = 1.0;
environment: string = hostname();
}
@@ -1,6 +1,6 @@
export class TemplateConfiguration {
enabled: boolean = true;
allowTemplateCreation: boolean = true;
allowDiscordTemplates: boolean = true;
allowRaws: boolean = true;
}
enabled: boolean = true;
allowTemplateCreation: boolean = true;
allowDiscordTemplates: boolean = true;
allowRaws: boolean = true;
}
+1 -1
View File
@@ -17,4 +17,4 @@ export * from "./RegisterConfiguration";
export * from "./SecurityConfiguration";
export * from "./SentryConfiguration";
export * from "./TemplateConfiguration";
export * from "./subconfigurations";
export * from "./subconfigurations";
@@ -1,4 +1,4 @@
export class ClientReleaseConfiguration {
useLocalRelease: boolean = true; //TODO
upstreamVersion: string = "0.0.264";
}
useLocalRelease: boolean = true; //TODO
upstreamVersion: string = "0.0.264";
}
@@ -1,7 +1,7 @@
export class GuildDefaults {
maxPresences: number = 250000;
maxVideoChannelUsers: number = 200;
afkTimeout: number = 300;
defaultMessageNotifications: number = 1;
explicitContentFilter: number = 0;
}
maxPresences: number = 250000;
maxVideoChannelUsers: number = 200;
afkTimeout: number = 300;
defaultMessageNotifications: number = 1;
explicitContentFilter: number = 0;
}
@@ -1,5 +1,5 @@
export class UserDefaults {
premium: boolean = true;
premiumType: number = 2;
verified: boolean = true;
}
premium: boolean = true;
premiumType: number = 2;
verified: boolean = true;
}
@@ -1,5 +1,5 @@
export class AutoJoinConfiguration {
enabled: boolean = true;
guilds: string[] = [];
canLeave: boolean = true;
}
enabled: boolean = true;
guilds: string[] = [];
canLeave: boolean = true;
}
@@ -1,6 +1,6 @@
export class DiscoveryConfiguration {
showAllGuilds: boolean = false;
useRecommendation: boolean = false; // TODO: Recommendation, privacy concern?
offset: number = 0;
limit: number = 24;
}
showAllGuilds: boolean = false;
useRecommendation: boolean = false; // TODO: Recommendation, privacy concern?
offset: number = 0;
limit: number = 24;
}
@@ -1,4 +1,4 @@
export interface KafkaBroker {
ip: string;
port: number;
}
}
@@ -1,5 +1,5 @@
export class ChannelLimits {
maxPins: number = 500;
maxTopic: number = 1024;
maxWebhooks: number = 100;
}
maxPins: number = 500;
maxTopic: number = 1024;
maxWebhooks: number = 100;
}
@@ -1,6 +1,14 @@
export class GlobalRateLimits {
register: GlobalRateLimit = { limit: 25, window: 60 * 60 * 1000, enabled: true };
sendMessage: GlobalRateLimit = { limit: 200, window: 60 * 1000, enabled: true };
register: GlobalRateLimit = {
limit: 25,
window: 60 * 60 * 1000,
enabled: true,
};
sendMessage: GlobalRateLimit = {
limit: 200,
window: 60 * 1000,
enabled: true,
};
}
export class GlobalRateLimit {
@@ -1,7 +1,7 @@
export class GuildLimits {
maxRoles: number = 1000;
maxEmojis: number = 2000;
maxMembers: number = 25000000;
maxChannels: number = 65535;
maxChannelsInCategory: number = 65535;
}
maxRoles: number = 1000;
maxEmojis: number = 2000;
maxMembers: number = 25000000;
maxChannels: number = 65535;
maxChannelsInCategory: number = 65535;
}
@@ -1,8 +1,8 @@
export class MessageLimits {
maxCharacters: number = 1048576;
maxTTSCharacters: number = 160;
maxReactions: number = 2048;
maxAttachmentSize: number = 1024 * 1024 * 1024;
maxBulkDelete: number = 1000;
maxEmbedDownloadSize: number = 1024 * 1024 * 5;
}
maxCharacters: number = 1048576;
maxTTSCharacters: number = 160;
maxReactions: number = 2048;
maxAttachmentSize: number = 1024 * 1024 * 1024;
maxBulkDelete: number = 1000;
maxEmbedDownloadSize: number = 1024 * 1024 * 5;
}
@@ -4,15 +4,15 @@ export class RateLimits {
enabled: boolean = false;
ip: Omit<RateLimitOptions, "bot_count"> = {
count: 500,
window: 5
window: 5,
};
global: RateLimitOptions = {
count: 250,
window: 5
window: 5,
};
error: RateLimitOptions = {
count: 10,
window: 5
window: 5,
};
routes: RouteRateLimit = new RouteRateLimit();
}
@@ -1,5 +1,5 @@
export class UserLimits {
maxGuilds: number = 1048576;
maxUsername: number = 127;
maxFriends: number = 5000;
}
maxGuilds: number = 1048576;
maxUsername: number = 127;
maxFriends: number = 5000;
}
@@ -1,12 +1,12 @@
import { RateLimitOptions } from "./RateLimitOptions";
export class AuthRateLimit {
login: RateLimitOptions = {
count: 5,
window: 60
};
register: RateLimitOptions = {
count: 2,
window: 60 * 60 * 12
};
}
login: RateLimitOptions = {
count: 5,
window: 60,
};
register: RateLimitOptions = {
count: 2,
window: 60 * 60 * 12,
};
}
@@ -3,4 +3,4 @@ export interface RateLimitOptions {
count: number;
window: number;
onyIp?: boolean;
}
}
@@ -4,15 +4,15 @@ import { RateLimitOptions } from "./RateLimitOptions";
export class RouteRateLimit {
guild: RateLimitOptions = {
count: 5,
window: 5
window: 5,
};
webhook: RateLimitOptions = {
count: 10,
window: 5
window: 5,
};
channel: RateLimitOptions = {
count: 10,
window: 5
window: 5,
};
auth: AuthRateLimit = new AuthRateLimit();
// TODO: rate limit configuration for all routes
@@ -9,4 +9,4 @@ export interface Region {
vip: boolean;
custom: boolean;
deprecated: boolean;
}
}
@@ -1,4 +1,4 @@
export class DateOfBirthConfiguration {
required: boolean = true;
minimum: number = 13; // in years
}
required: boolean = true;
minimum: number = 13; // in years
}
@@ -1,7 +1,7 @@
export class EmailConfiguration {
required: boolean = false;
allowlist: boolean = false;
blocklist: boolean = true;
domains: string[] = [];// TODO: efficiently save domain blocklist in database
// domains: fs.readFileSync(__dirname + "/blockedEmailDomains.txt", { encoding: "utf8" }).split("\n"),
}
required: boolean = false;
allowlist: boolean = false;
blocklist: boolean = true;
domains: string[] = []; // TODO: efficiently save domain blocklist in database
// domains: fs.readFileSync(__dirname + "/blockedEmailDomains.txt", { encoding: "utf8" }).split("\n"),
}
@@ -1,7 +1,7 @@
export class PasswordConfiguration {
required: boolean = false;
minLength: number = 8;
minNumbers: number = 2;
minUpperCase: number =2;
minSymbols: number = 0;
}
required: boolean = false;
minLength: number = 8;
minNumbers: number = 2;
minUpperCase: number = 2;
minSymbols: number = 0;
}
@@ -1,6 +1,6 @@
export class CaptchaConfiguration {
enabled: boolean = false;
service: "recaptcha" | "hcaptcha" | null = null; // TODO: hcaptcha, custom
sitekey: string | null = null;
secret: string | null = null;
}
enabled: boolean = false;
service: "recaptcha" | "hcaptcha" | null = null; // TODO: hcaptcha, custom
sitekey: string | null = null;
secret: string | null = null;
}
@@ -1,3 +1,3 @@
export class TwoFactorConfiguration {
generateBackupCodes: boolean = true;
}
generateBackupCodes: boolean = true;
}