mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-05 18:32:33 +01:00
Add additional config
This commit is contained in:
parent
bc669ea9e1
commit
d407d8ebe7
@ -18,7 +18,7 @@ export const DEFAULT_FETCH_OPTIONS: any = {
|
|||||||
|
|
||||||
export const getProxyUrl = (url: URL, width: number, height: number): string => {
|
export const getProxyUrl = (url: URL, width: number, height: number): string => {
|
||||||
const { resizeWidthMax, resizeHeightMax, imagorServerUrl } = Config.get().cdn;
|
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);
|
width = Math.min(width || 500, resizeWidthMax || width);
|
||||||
height = Math.min(height || 500, resizeHeightMax || width);
|
height = Math.min(height || 500, resizeHeightMax || width);
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import {
|
|||||||
VoiceState,
|
VoiceState,
|
||||||
VoiceStateUpdateEvent,
|
VoiceStateUpdateEvent,
|
||||||
VoiceStateUpdateSchema,
|
VoiceStateUpdateSchema,
|
||||||
|
Region,
|
||||||
} from "@fosscord/util";
|
} from "@fosscord/util";
|
||||||
import { Region } from "@fosscord/util/src/config";
|
|
||||||
// TODO: check if a voice server is setup
|
// TODO: check if a voice server is setup
|
||||||
|
|
||||||
// Notice: Bot users respect the voice channel's user limit, if set.
|
// Notice: Bot users respect the voice channel's user limit, if set.
|
||||||
|
@ -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 {
|
export class ConfigValue {
|
||||||
gateway: EndpointConfiguration = new EndpointConfiguration();
|
gateway: EndpointConfiguration = new EndpointConfiguration();
|
||||||
cdn: EndpointConfiguration = new EndpointConfiguration();
|
cdn: CdnConfiguration = new CdnConfiguration();
|
||||||
api: ApiConfiguration = new ApiConfiguration();
|
api: ApiConfiguration = new ApiConfiguration();
|
||||||
general: GeneralConfiguration = new GeneralConfiguration();
|
general: GeneralConfiguration = new GeneralConfiguration();
|
||||||
limits: LimitsConfiguration = new LimitsConfiguration();
|
limits: LimitsConfiguration = new LimitsConfiguration();
|
||||||
@ -19,4 +39,5 @@ export class ConfigValue {
|
|||||||
metrics: MetricsConfiguration = new MetricsConfiguration();
|
metrics: MetricsConfiguration = new MetricsConfiguration();
|
||||||
sentry: SentryConfiguration = new SentryConfiguration();
|
sentry: SentryConfiguration = new SentryConfiguration();
|
||||||
defaults: DefaultsConfiguration = new DefaultsConfiguration();
|
defaults: DefaultsConfiguration = new DefaultsConfiguration();
|
||||||
|
external: ExternalTokensConfiguration = new ExternalTokensConfiguration();
|
||||||
}
|
}
|
@ -1,2 +1,2 @@
|
|||||||
export * from "./Config";
|
export * from "./Config";
|
||||||
export * from "./types/index";
|
export * from "./types";
|
||||||
|
7
src/util/config/types/CdnConfiguration.ts
Normal file
7
src/util/config/types/CdnConfiguration.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { EndpointConfiguration } from "./EndpointConfiguration";
|
||||||
|
|
||||||
|
export class CdnConfiguration extends EndpointConfiguration {
|
||||||
|
resizeHeightMax: number = 1000;
|
||||||
|
resizeWidthMax: number = 1000;
|
||||||
|
imagorServerUrl: string | null = null;
|
||||||
|
}
|
@ -1,8 +1,6 @@
|
|||||||
import { ClientReleaseConfiguration } from ".";
|
import { ClientReleaseConfiguration } from ".";
|
||||||
|
|
||||||
export class ClientConfiguration {
|
export class ClientConfiguration {
|
||||||
//classes
|
|
||||||
releases: ClientReleaseConfiguration = new ClientReleaseConfiguration();
|
releases: ClientReleaseConfiguration = new ClientReleaseConfiguration();
|
||||||
//base types
|
|
||||||
useTestClient: boolean = true;
|
useTestClient: boolean = true;
|
||||||
}
|
}
|
3
src/util/config/types/ExternalTokensConfiguration.ts
Normal file
3
src/util/config/types/ExternalTokensConfiguration.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export class ExternalTokensConfiguration {
|
||||||
|
twitter: string | null = null;
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
import { Snowflake } from "../../util";
|
import { Snowflake } from "@fosscord/util";
|
||||||
|
|
||||||
export class GeneralConfiguration {
|
export class GeneralConfiguration {
|
||||||
instanceName: string = "Fosscord Instance";
|
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;
|
frontPage: string | null = null;
|
||||||
tosPage: string | null = null;
|
tosPage: string | null = null;
|
||||||
correspondenceEmail: string | null = "noreply@localhost.local";
|
correspondenceEmail: string | null = null;
|
||||||
correspondenceUserID: string | null = null;
|
correspondenceUserID: string | null = null;
|
||||||
image: string | null = null;
|
image: string | null = null;
|
||||||
instanceId: string = Snowflake.generate();
|
instanceId: string = Snowflake.generate();
|
||||||
|
@ -3,4 +3,5 @@ import { DiscoveryConfiguration, AutoJoinConfiguration } from ".";
|
|||||||
export class GuildConfiguration {
|
export class GuildConfiguration {
|
||||||
discovery: DiscoveryConfiguration = new DiscoveryConfiguration();
|
discovery: DiscoveryConfiguration = new DiscoveryConfiguration();
|
||||||
autoJoin: AutoJoinConfiguration = new AutoJoinConfiguration();
|
autoJoin: AutoJoinConfiguration = new AutoJoinConfiguration();
|
||||||
|
defaultFeatures: string[] = [];
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import { DateOfBirthConfiguration, EmailConfiguration, PasswordConfiguration } from ".";
|
import { DateOfBirthConfiguration, EmailConfiguration, PasswordConfiguration } from ".";
|
||||||
|
|
||||||
export class RegisterConfiguration {
|
export class RegisterConfiguration {
|
||||||
//classes
|
|
||||||
email: EmailConfiguration = new EmailConfiguration();
|
email: EmailConfiguration = new EmailConfiguration();
|
||||||
dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration();
|
dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration();
|
||||||
password: PasswordConfiguration = new PasswordConfiguration();
|
password: PasswordConfiguration = new PasswordConfiguration();
|
||||||
//base types
|
|
||||||
disabled: boolean = false;
|
disabled: boolean = false;
|
||||||
requireCaptcha: boolean = true;
|
requireCaptcha: boolean = true;
|
||||||
requireInvite: boolean = false;
|
requireInvite: boolean = false;
|
||||||
@ -14,5 +12,5 @@ export class RegisterConfiguration {
|
|||||||
allowMultipleAccounts: boolean = true;
|
allowMultipleAccounts: boolean = true;
|
||||||
blockProxies: boolean = true;
|
blockProxies: boolean = true;
|
||||||
incrementingDiscriminators: boolean = false; // random otherwise
|
incrementingDiscriminators: boolean = false; // random otherwise
|
||||||
defaultRights: string = "0";
|
defaultRights: string = "30644591655940"; // See `npm run generate:rights`
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,8 @@ import crypto from "crypto";
|
|||||||
import { CaptchaConfiguration, TwoFactorConfiguration } from ".";
|
import { CaptchaConfiguration, TwoFactorConfiguration } from ".";
|
||||||
|
|
||||||
export class SecurityConfiguration {
|
export class SecurityConfiguration {
|
||||||
//classes
|
|
||||||
captcha: CaptchaConfiguration = new CaptchaConfiguration();
|
captcha: CaptchaConfiguration = new CaptchaConfiguration();
|
||||||
twoFactor: TwoFactorConfiguration = new TwoFactorConfiguration();
|
twoFactor: TwoFactorConfiguration = new TwoFactorConfiguration();
|
||||||
//base types
|
|
||||||
autoUpdate: boolean | number = true;
|
autoUpdate: boolean | number = true;
|
||||||
requestSignature: string = crypto.randomBytes(32).toString("base64");
|
requestSignature: string = crypto.randomBytes(32).toString("base64");
|
||||||
jwtSecret: string = crypto.randomBytes(256).toString("base64");
|
jwtSecret: string = crypto.randomBytes(256).toString("base64");
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
export * from "./ApiConfiguration";
|
export * from "./ApiConfiguration";
|
||||||
|
export * from "./CdnConfiguration";
|
||||||
export * from "./ClientConfiguration";
|
export * from "./ClientConfiguration";
|
||||||
export * from "./DefaultsConfiguration";
|
export * from "./DefaultsConfiguration";
|
||||||
export * from "./EndpointConfiguration";
|
export * from "./EndpointConfiguration";
|
||||||
|
export * from "./ExternalTokensConfiguration";
|
||||||
export * from "./GeneralConfiguration";
|
export * from "./GeneralConfiguration";
|
||||||
export * from "./GifConfiguration";
|
export * from "./GifConfiguration";
|
||||||
export * from "./GuildConfiguration";
|
export * from "./GuildConfiguration";
|
||||||
@ -15,4 +17,4 @@ export * from "./RegisterConfiguration";
|
|||||||
export * from "./SecurityConfiguration";
|
export * from "./SecurityConfiguration";
|
||||||
export * from "./SentryConfiguration";
|
export * from "./SentryConfiguration";
|
||||||
export * from "./TemplateConfiguration";
|
export * from "./TemplateConfiguration";
|
||||||
export * from "./subconfigurations/index";
|
export * from "./subconfigurations";
|
@ -1,8 +1,8 @@
|
|||||||
export * from "./client/index";
|
export * from "./client";
|
||||||
export * from "./defaults/index";
|
export * from "./defaults";
|
||||||
export * from "./guild/index";
|
export * from "./guild";
|
||||||
export * from "./kafka/index";
|
export * from "./kafka";
|
||||||
export * from "./limits/index";
|
export * from "./limits";
|
||||||
export * from "./region/index";
|
export * from "./region";
|
||||||
export * from "./register/index";
|
export * from "./register";
|
||||||
export * from "./security/index";
|
export * from "./security";
|
||||||
|
@ -344,7 +344,7 @@ export class User extends BaseClass {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
deleted: false,
|
deleted: false,
|
||||||
email: email,
|
email: email,
|
||||||
rights: Config.get().security.defaultRights,
|
rights: Config.get().register.defaultRights,
|
||||||
nsfw_allowed: true, // TODO: depending on age
|
nsfw_allowed: true, // TODO: depending on age
|
||||||
public_flags: 0,
|
public_flags: 0,
|
||||||
flags: "0", // TODO: generate
|
flags: "0", // TODO: generate
|
||||||
|
@ -6,3 +6,4 @@ export * from "./entities/index";
|
|||||||
export * from "./dtos/index";
|
export * from "./dtos/index";
|
||||||
export * from "./schemas";
|
export * from "./schemas";
|
||||||
export * from "./imports";
|
export * from "./imports";
|
||||||
|
export * from "./config"
|
Loading…
Reference in New Issue
Block a user