summary refs log tree commit diff
path: root/src/util/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/config')
-rw-r--r--src/util/config/Config.ts5
-rw-r--r--src/util/config/types/EmailConfiguration.ts32
-rw-r--r--src/util/config/types/LoginConfiguration.ts1
-rw-r--r--src/util/config/types/PasswordResetConfiguration.ts21
-rw-r--r--src/util/config/types/RegisterConfiguration.ts7
-rw-r--r--src/util/config/types/index.ts4
-rw-r--r--src/util/config/types/subconfigurations/email/MailGun.ts22
-rw-r--r--src/util/config/types/subconfigurations/email/MailJet.ts22
-rw-r--r--src/util/config/types/subconfigurations/email/SMTP.ts25
-rw-r--r--src/util/config/types/subconfigurations/email/SendGrid.ts21
-rw-r--r--src/util/config/types/subconfigurations/email/index.ts21
-rw-r--r--src/util/config/types/subconfigurations/register/Email.ts2
12 files changed, 178 insertions, 5 deletions
diff --git a/src/util/config/Config.ts b/src/util/config/Config.ts

index 122dadb5..c056d454 100644 --- a/src/util/config/Config.ts +++ b/src/util/config/Config.ts
@@ -21,6 +21,7 @@ import { CdnConfiguration, ClientConfiguration, DefaultsConfiguration, + EmailConfiguration, EndpointConfiguration, ExternalTokensConfiguration, GeneralConfiguration, @@ -30,6 +31,7 @@ import { LimitsConfiguration, LoginConfiguration, MetricsConfiguration, + PasswordResetConfiguration, RabbitMQConfiguration, RegionConfiguration, RegisterConfiguration, @@ -58,4 +60,7 @@ export class ConfigValue { sentry: SentryConfiguration = new SentryConfiguration(); defaults: DefaultsConfiguration = new DefaultsConfiguration(); external: ExternalTokensConfiguration = new ExternalTokensConfiguration(); + email: EmailConfiguration = new EmailConfiguration(); + password_reset: PasswordResetConfiguration = + new PasswordResetConfiguration(); } diff --git a/src/util/config/types/EmailConfiguration.ts b/src/util/config/types/EmailConfiguration.ts new file mode 100644
index 00000000..989d59eb --- /dev/null +++ b/src/util/config/types/EmailConfiguration.ts
@@ -0,0 +1,32 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +import { + MailGunConfiguration, + MailJetConfiguration, + SMTPConfiguration, +} from "./subconfigurations/email"; +import { SendGridConfiguration } from "./subconfigurations/email/SendGrid"; + +export class EmailConfiguration { + provider: string | null = null; + smtp: SMTPConfiguration = new SMTPConfiguration(); + mailgun: MailGunConfiguration = new MailGunConfiguration(); + mailjet: MailJetConfiguration = new MailJetConfiguration(); + sendgrid: SendGridConfiguration = new SendGridConfiguration(); +} diff --git a/src/util/config/types/LoginConfiguration.ts b/src/util/config/types/LoginConfiguration.ts
index 862bc185..1d5752fe 100644 --- a/src/util/config/types/LoginConfiguration.ts +++ b/src/util/config/types/LoginConfiguration.ts
@@ -18,4 +18,5 @@ export class LoginConfiguration { requireCaptcha: boolean = false; + requireVerification: boolean = false; } diff --git a/src/util/config/types/PasswordResetConfiguration.ts b/src/util/config/types/PasswordResetConfiguration.ts new file mode 100644
index 00000000..806d77be --- /dev/null +++ b/src/util/config/types/PasswordResetConfiguration.ts
@@ -0,0 +1,21 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export class PasswordResetConfiguration { + requireCaptcha: boolean = false; +} diff --git a/src/util/config/types/RegisterConfiguration.ts b/src/util/config/types/RegisterConfiguration.ts
index acbaa2d5..b8db0077 100644 --- a/src/util/config/types/RegisterConfiguration.ts +++ b/src/util/config/types/RegisterConfiguration.ts
@@ -18,12 +18,13 @@ import { DateOfBirthConfiguration, - EmailConfiguration, PasswordConfiguration, + RegistrationEmailConfiguration, } from "."; export class RegisterConfiguration { - email: EmailConfiguration = new EmailConfiguration(); + email: RegistrationEmailConfiguration = + new RegistrationEmailConfiguration(); dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration(); password: PasswordConfiguration = new PasswordConfiguration(); disabled: boolean = false; @@ -34,5 +35,5 @@ export class RegisterConfiguration { allowMultipleAccounts: boolean = true; blockProxies: boolean = true; incrementingDiscriminators: boolean = false; // random otherwise - defaultRights: string = "312119568366592"; // See `npm run generate:rights` + defaultRights: string = "875069521787904"; // See `npm run generate:rights` } diff --git a/src/util/config/types/index.ts b/src/util/config/types/index.ts
index 523ad186..510e19f8 100644 --- a/src/util/config/types/index.ts +++ b/src/util/config/types/index.ts
@@ -20,6 +20,7 @@ export * from "./ApiConfiguration"; export * from "./CdnConfiguration"; export * from "./ClientConfiguration"; export * from "./DefaultsConfiguration"; +export * from "./EmailConfiguration"; export * from "./EndpointConfiguration"; export * from "./ExternalTokensConfiguration"; export * from "./GeneralConfiguration"; @@ -29,10 +30,11 @@ export * from "./KafkaConfiguration"; export * from "./LimitConfigurations"; export * from "./LoginConfiguration"; export * from "./MetricsConfiguration"; +export * from "./PasswordResetConfiguration"; export * from "./RabbitMQConfiguration"; export * from "./RegionConfiguration"; export * from "./RegisterConfiguration"; export * from "./SecurityConfiguration"; export * from "./SentryConfiguration"; -export * from "./TemplateConfiguration"; export * from "./subconfigurations"; +export * from "./TemplateConfiguration"; diff --git a/src/util/config/types/subconfigurations/email/MailGun.ts b/src/util/config/types/subconfigurations/email/MailGun.ts new file mode 100644
index 00000000..52cd9069 --- /dev/null +++ b/src/util/config/types/subconfigurations/email/MailGun.ts
@@ -0,0 +1,22 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export class MailGunConfiguration { + apiKey: string | null = null; + domain: string | null = null; +} diff --git a/src/util/config/types/subconfigurations/email/MailJet.ts b/src/util/config/types/subconfigurations/email/MailJet.ts new file mode 100644
index 00000000..eccda8ac --- /dev/null +++ b/src/util/config/types/subconfigurations/email/MailJet.ts
@@ -0,0 +1,22 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export class MailJetConfiguration { + apiKey: string | null = null; + apiSecret: string | null = null; +} diff --git a/src/util/config/types/subconfigurations/email/SMTP.ts b/src/util/config/types/subconfigurations/email/SMTP.ts new file mode 100644
index 00000000..11eb9e14 --- /dev/null +++ b/src/util/config/types/subconfigurations/email/SMTP.ts
@@ -0,0 +1,25 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export class SMTPConfiguration { + host: string | null = null; + port: number | null = null; + secure: boolean | null = null; + username: string | null = null; + password: string | null = null; +} diff --git a/src/util/config/types/subconfigurations/email/SendGrid.ts b/src/util/config/types/subconfigurations/email/SendGrid.ts new file mode 100644
index 00000000..a4755dfb --- /dev/null +++ b/src/util/config/types/subconfigurations/email/SendGrid.ts
@@ -0,0 +1,21 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export class SendGridConfiguration { + apiKey: string | null = null; +} diff --git a/src/util/config/types/subconfigurations/email/index.ts b/src/util/config/types/subconfigurations/email/index.ts new file mode 100644
index 00000000..02cc564c --- /dev/null +++ b/src/util/config/types/subconfigurations/email/index.ts
@@ -0,0 +1,21 @@ +/* + Fosscord: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Fosscord and Fosscord Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export * from "./MailGun"; +export * from "./MailJet"; +export * from "./SMTP"; diff --git a/src/util/config/types/subconfigurations/register/Email.ts b/src/util/config/types/subconfigurations/register/Email.ts
index 478dc974..4f95caf1 100644 --- a/src/util/config/types/subconfigurations/register/Email.ts +++ b/src/util/config/types/subconfigurations/register/Email.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -export class EmailConfiguration { +export class RegistrationEmailConfiguration { required: boolean = false; allowlist: boolean = false; blocklist: boolean = true;