diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-12-19 16:51:24 +1100 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-12-19 16:51:24 +1100 |
commit | 518fc966c9156f27124c595d8b371394b8f9b4a3 (patch) | |
tree | 40d087bc8439f9d647fcae82a88ae7dc23107aea /src/util | |
parent | Make ConfigValue a directory, move defaults to those classes instead of a sep... (diff) | |
download | server-518fc966c9156f27124c595d8b371394b8f9b4a3.tar.xz |
Add additional config
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/config/Config.ts | 25 | ||||
-rw-r--r-- | src/util/config/index.ts | 2 | ||||
-rw-r--r-- | src/util/config/types/CdnConfiguration.ts | 7 | ||||
-rw-r--r-- | src/util/config/types/ClientConfiguration.ts | 2 | ||||
-rw-r--r-- | src/util/config/types/ExternalTokensConfiguration.ts | 3 | ||||
-rw-r--r-- | src/util/config/types/GeneralConfiguration.ts | 4 | ||||
-rw-r--r-- | src/util/config/types/GuildConfiguration.ts | 1 | ||||
-rw-r--r-- | src/util/config/types/RegisterConfiguration.ts | 4 | ||||
-rw-r--r-- | src/util/config/types/SecurityConfiguration.ts | 2 | ||||
-rw-r--r-- | src/util/config/types/index.ts | 4 | ||||
-rw-r--r-- | src/util/config/types/subconfigurations/index.ts | 16 | ||||
-rw-r--r-- | src/util/entities/User.ts | 2 | ||||
-rw-r--r-- | src/util/index.ts | 1 |
13 files changed, 51 insertions, 22 deletions
diff --git a/src/util/config/Config.ts b/src/util/config/Config.ts index b703040f..b6c725f5 100644 --- a/src/util/config/Config.ts +++ b/src/util/config/Config.ts @@ -1,8 +1,28 @@ -import { ApiConfiguration, ClientConfiguration, DefaultsConfiguration, EndpointConfiguration, GeneralConfiguration, GifConfiguration, GuildConfiguration, KafkaConfiguration, LimitsConfiguration, LoginConfiguration, MetricsConfiguration, RabbitMQConfiguration, RegionConfiguration, RegisterConfiguration, SecurityConfiguration, SentryConfiguration, TemplateConfiguration } from "../config"; +import { + ApiConfiguration, + CdnConfiguration, + ClientConfiguration, + DefaultsConfiguration, + EndpointConfiguration, + ExternalTokensConfiguration, + GeneralConfiguration, + GifConfiguration, + GuildConfiguration, + KafkaConfiguration, + LimitsConfiguration, + LoginConfiguration, + MetricsConfiguration, + RabbitMQConfiguration, + RegionConfiguration, + RegisterConfiguration, + SecurityConfiguration, + SentryConfiguration, + TemplateConfiguration +} from "../config"; export class ConfigValue { gateway: EndpointConfiguration = new EndpointConfiguration(); - cdn: EndpointConfiguration = new EndpointConfiguration(); + cdn: CdnConfiguration = new CdnConfiguration(); api: ApiConfiguration = new ApiConfiguration(); general: GeneralConfiguration = new GeneralConfiguration(); limits: LimitsConfiguration = new LimitsConfiguration(); @@ -19,4 +39,5 @@ export class ConfigValue { metrics: MetricsConfiguration = new MetricsConfiguration(); sentry: SentryConfiguration = new SentryConfiguration(); defaults: DefaultsConfiguration = new DefaultsConfiguration(); + external: ExternalTokensConfiguration = new ExternalTokensConfiguration(); } \ No newline at end of file diff --git a/src/util/config/index.ts b/src/util/config/index.ts index 0a9b58ae..adb6984c 100644 --- a/src/util/config/index.ts +++ b/src/util/config/index.ts @@ -1,2 +1,2 @@ export * from "./Config"; -export * from "./types/index"; +export * from "./types"; diff --git a/src/util/config/types/CdnConfiguration.ts b/src/util/config/types/CdnConfiguration.ts new file mode 100644 index 00000000..f58c1c64 --- /dev/null +++ b/src/util/config/types/CdnConfiguration.ts @@ -0,0 +1,7 @@ +import { EndpointConfiguration } from "./EndpointConfiguration"; + +export class CdnConfiguration extends EndpointConfiguration { + resizeHeightMax: number = 1000; + resizeWidthMax: number = 1000; + imagorServerUrl: string | null = null; +} \ No newline at end of file diff --git a/src/util/config/types/ClientConfiguration.ts b/src/util/config/types/ClientConfiguration.ts index 1adda1e2..69b5e154 100644 --- a/src/util/config/types/ClientConfiguration.ts +++ b/src/util/config/types/ClientConfiguration.ts @@ -1,8 +1,6 @@ import { ClientReleaseConfiguration } from "."; export class ClientConfiguration { - //classes releases: ClientReleaseConfiguration = new ClientReleaseConfiguration(); - //base types useTestClient: boolean = true; } \ No newline at end of file diff --git a/src/util/config/types/ExternalTokensConfiguration.ts b/src/util/config/types/ExternalTokensConfiguration.ts new file mode 100644 index 00000000..5c020745 --- /dev/null +++ b/src/util/config/types/ExternalTokensConfiguration.ts @@ -0,0 +1,3 @@ +export class ExternalTokensConfiguration { + twitter: string | null = null; +} \ No newline at end of file diff --git a/src/util/config/types/GeneralConfiguration.ts b/src/util/config/types/GeneralConfiguration.ts index 55848b44..7c0ffa66 100644 --- a/src/util/config/types/GeneralConfiguration.ts +++ b/src/util/config/types/GeneralConfiguration.ts @@ -1,11 +1,11 @@ -import { Snowflake } from "../../util"; +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"; frontPage: string | null = null; tosPage: string | null = null; - correspondenceEmail: string | null = "noreply@localhost.local"; + correspondenceEmail: string | null = null; correspondenceUserID: string | null = null; image: string | null = null; instanceId: string = Snowflake.generate(); diff --git a/src/util/config/types/GuildConfiguration.ts b/src/util/config/types/GuildConfiguration.ts index 3d43b368..e77d3fce 100644 --- a/src/util/config/types/GuildConfiguration.ts +++ b/src/util/config/types/GuildConfiguration.ts @@ -3,4 +3,5 @@ import { DiscoveryConfiguration, AutoJoinConfiguration } from "."; export class GuildConfiguration { discovery: DiscoveryConfiguration = new DiscoveryConfiguration(); autoJoin: AutoJoinConfiguration = new AutoJoinConfiguration(); + defaultFeatures: string[] = []; } diff --git a/src/util/config/types/RegisterConfiguration.ts b/src/util/config/types/RegisterConfiguration.ts index a0dc97c5..75b40417 100644 --- a/src/util/config/types/RegisterConfiguration.ts +++ b/src/util/config/types/RegisterConfiguration.ts @@ -1,11 +1,9 @@ import { DateOfBirthConfiguration, EmailConfiguration, PasswordConfiguration } from "."; export class RegisterConfiguration { - //classes email: EmailConfiguration = new EmailConfiguration(); dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration(); password: PasswordConfiguration = new PasswordConfiguration(); - //base types disabled: boolean = false; requireCaptcha: boolean = true; requireInvite: boolean = false; @@ -14,5 +12,5 @@ export class RegisterConfiguration { allowMultipleAccounts: boolean = true; blockProxies: boolean = true; incrementingDiscriminators: boolean = false; // random otherwise - defaultRights: string = "0"; + defaultRights: string = "30644591655940"; // See `npm run generate:rights` } diff --git a/src/util/config/types/SecurityConfiguration.ts b/src/util/config/types/SecurityConfiguration.ts index 405b86ac..60f4a9c8 100644 --- a/src/util/config/types/SecurityConfiguration.ts +++ b/src/util/config/types/SecurityConfiguration.ts @@ -2,10 +2,8 @@ import crypto from "crypto"; import { CaptchaConfiguration, TwoFactorConfiguration } from "."; export class SecurityConfiguration { - //classes captcha: CaptchaConfiguration = new CaptchaConfiguration(); twoFactor: TwoFactorConfiguration = new TwoFactorConfiguration(); - //base types autoUpdate: boolean | number = true; requestSignature: string = crypto.randomBytes(32).toString("base64"); jwtSecret: string = crypto.randomBytes(256).toString("base64"); diff --git a/src/util/config/types/index.ts b/src/util/config/types/index.ts index 608503a0..f20fe121 100644 --- a/src/util/config/types/index.ts +++ b/src/util/config/types/index.ts @@ -1,7 +1,9 @@ export * from "./ApiConfiguration"; +export * from "./CdnConfiguration"; export * from "./ClientConfiguration"; export * from "./DefaultsConfiguration"; export * from "./EndpointConfiguration"; +export * from "./ExternalTokensConfiguration"; export * from "./GeneralConfiguration"; export * from "./GifConfiguration"; export * from "./GuildConfiguration"; @@ -15,4 +17,4 @@ export * from "./RegisterConfiguration"; export * from "./SecurityConfiguration"; export * from "./SentryConfiguration"; export * from "./TemplateConfiguration"; -export * from "./subconfigurations/index"; +export * from "./subconfigurations"; \ No newline at end of file diff --git a/src/util/config/types/subconfigurations/index.ts b/src/util/config/types/subconfigurations/index.ts index bfbadc92..5bd60911 100644 --- a/src/util/config/types/subconfigurations/index.ts +++ b/src/util/config/types/subconfigurations/index.ts @@ -1,8 +1,8 @@ -export * from "./client/index"; -export * from "./defaults/index"; -export * from "./guild/index"; -export * from "./kafka/index"; -export * from "./limits/index"; -export * from "./region/index"; -export * from "./register/index"; -export * from "./security/index"; +export * from "./client"; +export * from "./defaults"; +export * from "./guild"; +export * from "./kafka"; +export * from "./limits"; +export * from "./region"; +export * from "./register"; +export * from "./security"; diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index 577e13f7..ea726368 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -344,7 +344,7 @@ export class User extends BaseClass { disabled: false, deleted: false, email: email, - rights: Config.get().security.defaultRights, + rights: Config.get().register.defaultRights, nsfw_allowed: true, // TODO: depending on age public_flags: 0, flags: "0", // TODO: generate diff --git a/src/util/index.ts b/src/util/index.ts index 3773c275..7b4dc936 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -6,3 +6,4 @@ export * from "./entities/index"; export * from "./dtos/index"; export * from "./schemas"; export * from "./imports"; +export * from "./config" \ No newline at end of file |