summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-19 16:51:24 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-19 16:51:24 +1100
commitd407d8ebe7ce34f3f85b5241ea6a1d0381b74e09 (patch)
tree099f8af27e5f7b27f0cfd43cc5c2bba0505b9957 /src
parentMake ConfigValue a directory, move defaults to those classes instead of a sep... (diff)
downloadserver-d407d8ebe7ce34f3f85b5241ea6a1d0381b74e09.tar.xz
Add additional config
Diffstat (limited to 'src')
-rw-r--r--src/api/util/utility/EmbedHandlers.ts2
-rw-r--r--src/gateway/opcodes/VoiceStateUpdate.ts2
-rw-r--r--src/util/config/Config.ts25
-rw-r--r--src/util/config/index.ts2
-rw-r--r--src/util/config/types/CdnConfiguration.ts7
-rw-r--r--src/util/config/types/ClientConfiguration.ts2
-rw-r--r--src/util/config/types/ExternalTokensConfiguration.ts3
-rw-r--r--src/util/config/types/GeneralConfiguration.ts4
-rw-r--r--src/util/config/types/GuildConfiguration.ts1
-rw-r--r--src/util/config/types/RegisterConfiguration.ts4
-rw-r--r--src/util/config/types/SecurityConfiguration.ts2
-rw-r--r--src/util/config/types/index.ts4
-rw-r--r--src/util/config/types/subconfigurations/index.ts16
-rw-r--r--src/util/entities/User.ts2
-rw-r--r--src/util/index.ts1
15 files changed, 53 insertions, 24 deletions
diff --git a/src/api/util/utility/EmbedHandlers.ts b/src/api/util/utility/EmbedHandlers.ts
index a8738a4a..dca264d0 100644
--- a/src/api/util/utility/EmbedHandlers.ts
+++ b/src/api/util/utility/EmbedHandlers.ts
@@ -18,7 +18,7 @@ export const DEFAULT_FETCH_OPTIONS: any = {
 
 export const getProxyUrl = (url: URL, width: number, height: number): string => {
 	const { resizeWidthMax, resizeHeightMax, imagorServerUrl } = Config.get().cdn;
-	const secret = Config.get().security.jwtSecret;	// maybe shouldn't use this?
+	const secret = Config.get().security.requestSignature;
 	width = Math.min(width || 500, resizeWidthMax || width);
 	height = Math.min(height || 500, resizeHeightMax || width);
 
diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts
index 479efec3..94cdef44 100644
--- a/src/gateway/opcodes/VoiceStateUpdate.ts
+++ b/src/gateway/opcodes/VoiceStateUpdate.ts
@@ -10,8 +10,8 @@ import {
 	VoiceState,
 	VoiceStateUpdateEvent,
 	VoiceStateUpdateSchema,
+	Region,
 } from "@fosscord/util";
-import { Region } from "@fosscord/util/src/config";
 // TODO: check if a voice server is setup
 
 // Notice: Bot users respect the voice channel's user limit, if set.
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