diff --git a/src/api/routes/applications/#application_id/bot/index.ts b/src/api/routes/applications/#application_id/bot/index.ts
index e6f1522cc..ad4918406 100644
--- a/src/api/routes/applications/#application_id/bot/index.ts
+++ b/src/api/routes/applications/#application_id/bot/index.ts
@@ -71,11 +71,7 @@ router.post(
if (owner.id != req.user_id) throw DiscordApiErrors.ACTION_NOT_AUTHORIZED_ON_APPLICATION;
- if (
- owner.totp_secret &&
- (!req.body.code || verifyToken(owner.totp_secret, req.body.code))
- )
- throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008);
+ if (owner.totp_secret && (!req.body.code || verifyToken(owner.totp_secret, req.body.code))) throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008);
bot.data = { hash: undefined, valid_tokens_since: new Date() };
diff --git a/src/api/routes/guilds/#guild_id/members/index.ts b/src/api/routes/guilds/#guild_id/members/index.ts
index 490d5b5e4..a047472c8 100644
--- a/src/api/routes/guilds/#guild_id/members/index.ts
+++ b/src/api/routes/guilds/#guild_id/members/index.ts
@@ -34,8 +34,7 @@ router.get(
query: {
limit: {
type: "number",
- description:
- "max number of members to return (1-1000). default 1",
+ description: "max number of members to return (1-1000). default 1",
},
after: {
type: "string",
@@ -53,8 +52,7 @@ router.get(
async (req: Request, res: Response) => {
const { guild_id } = req.params;
const limit = Number(req.query.limit) || 1;
- if (limit > 1000 || limit < 1)
- throw new HTTPError("Limit must be between 1 and 1000");
+ if (limit > 1000 || limit < 1) throw new HTTPError("Limit must be between 1 and 1000");
const after = `${req.query.after}`;
const query = after ? { id: MoreThan(after) } : {};
diff --git a/src/util/config/types/EmailConfiguration.ts b/src/util/config/types/EmailConfiguration.ts
index 62305d10b..a430cb17d 100644
--- a/src/util/config/types/EmailConfiguration.ts
+++ b/src/util/config/types/EmailConfiguration.ts
@@ -16,11 +16,7 @@
along with this program. If not, see .
*/
-import {
- MailGunConfiguration,
- MailJetConfiguration,
- SMTPConfiguration,
-} from "./subconfigurations/email";
+import { MailGunConfiguration, MailJetConfiguration, SMTPConfiguration } from "./subconfigurations/email";
import { SendGridConfiguration } from "./subconfigurations/email/SendGrid";
export class EmailConfiguration {
diff --git a/src/util/entities/UserSettings.ts b/src/util/entities/UserSettings.ts
index f1fc78b48..eac09a95e 100644
--- a/src/util/entities/UserSettings.ts
+++ b/src/util/entities/UserSettings.ts
@@ -18,7 +18,7 @@
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import { BaseClassWithoutId } from "./BaseClass";
-import { CustomStatus, FriendSourceFlags, GuildFolder } from "@spacebar/schemas"
+import { CustomStatus, FriendSourceFlags, GuildFolder } from "@spacebar/schemas";
@Entity({
name: "user_settings",
@@ -128,9 +128,7 @@ export class UserSettings extends BaseClassWithoutId {
public static async getOrDefault(userId: string) {
// raw sql query
- const userSettingsIndex = (
- await this.getRepository().query("SELECT \"settingsIndex\" FROM users WHERE id = $1", [userId])
- )[0]?.settingsIndex as string | null;
+ const userSettingsIndex = (await this.getRepository().query('SELECT "settingsIndex" FROM users WHERE id = $1', [userId]))[0]?.settingsIndex as string | null;
console.log(`[INFO/UserSettings] Fetched settings index for user ${userId}:`, userSettingsIndex);
diff --git a/src/util/util/JSON.ts b/src/util/util/JSON.ts
index c7dcf47e7..767fc618d 100644
--- a/src/util/util/JSON.ts
+++ b/src/util/util/JSON.ts
@@ -18,11 +18,7 @@
// Discord.com sends ISO strings with +00:00 extension, not Z
// This causes issues with Python bot libs
-const JSONReplacer = function (
- this: { [key: string]: unknown },
- key: string,
- value: unknown,
-) {
+const JSONReplacer = function (this: { [key: string]: unknown }, key: string, value: unknown) {
if (this[key] instanceof Date) {
return (this[key] as Date).toISOString().replace("Z", "+00:00");
}
diff --git a/src/util/util/email/clients/IEmailClient.ts b/src/util/util/email/clients/IEmailClient.ts
index 01329e84f..261bffae7 100644
--- a/src/util/util/email/clients/IEmailClient.ts
+++ b/src/util/util/email/clients/IEmailClient.ts
@@ -25,9 +25,7 @@ export interface IEmail {
}
export interface IEmailClient {
init: () => Promise;
- sendMail: (
- email: IEmail,
- ) => Promise;
+ sendMail: (email: IEmail) => Promise;
}
export class BaseEmailClient implements IEmailClient {
@@ -37,4 +35,4 @@ export class BaseEmailClient implements IEmailClient {
sendMail(email: IEmail): Promise {
throw new Error("Method not implemented.");
}
-}
\ No newline at end of file
+}
diff --git a/src/util/util/email/index.ts b/src/util/util/email/index.ts
index d66bbc381..4773b0db2 100644
--- a/src/util/util/email/index.ts
+++ b/src/util/util/email/index.ts
@@ -27,14 +27,7 @@ import { SMTPEmailClient } from "./clients/SMTPEmailClient";
import { MailGunEmailClient } from "./clients/MailGunEmailClient";
import { MailJetEmailClient } from "./clients/MailJetEmailClient";
-const ASSET_FOLDER_PATH = path.join(
- __dirname,
- "..",
- "..",
- "..",
- "..",
- "assets",
-);
+const ASSET_FOLDER_PATH = path.join(__dirname, "..", "..", "..", "..", "assets");
export enum MailTypes {
verifyEmail = "verifyEmail",
@@ -45,21 +38,11 @@ export enum MailTypes {
export const Email: {
transporter: IEmailClient | null;
init: () => Promise;
- generateLink: (
- type: Omit,
- id: string,
- ) => Promise;
- sendMail: (
- type: MailTypes,
- user: User,
- email: string,
- ) => Promise;
+ generateLink: (type: Omit, id: string) => Promise;
+ sendMail: (type: MailTypes, user: User, email: string) => Promise;
sendVerifyEmail: (user: User, email: string) => Promise;
sendResetPassword: (user: User, email: string) => Promise;
- sendPasswordChanged: (
- user: User,
- email: string,
- ) => Promise;
+ sendPasswordChanged: (user: User, email: string) => Promise;
doReplacements: (
template: string,
user: User,
@@ -95,8 +78,7 @@ export const Email: {
return;
}
- if (!this.transporter)
- return console.error(`[Email] Invalid provider: ${provider}`);
+ if (!this.transporter) return console.error(`[Email] Invalid provider: ${provider}`);
console.log(`[Email] Initializing ${provider} transport...`);
await this.transporter.init();
console.log(`[Email] ${provider} transport initialized.`);
@@ -148,9 +130,7 @@ export const Email: {
generateLink: async function (type, id) {
const token = (await generateToken(id)) as string;
// puyodead1: this is set to api endpoint because the verification page is on the server since no clients have one, and not all 3rd party clients will have one
- const instanceUrl =
- Config.get().api.endpointPublic?.replace("/api", "") ||
- "http://localhost:3001";
+ const instanceUrl = Config.get().api.endpointPublic?.replace("/api", "") || "http://localhost:3001";
const dashedType = type.replace(/([A-Z])/g, "-$1").toLowerCase();
const link = `${instanceUrl}/${dashedType}#token=${token}`;
return link;
@@ -178,51 +158,30 @@ export const Email: {
changePassword: "password_changed.txt",
};
- const htmlTemplate = await fs.readFile(
- path.join(
- ASSET_FOLDER_PATH,
- "email_templates",
- htmlTemplateNames[type],
- ),
- { encoding: "utf-8" },
- );
+ const htmlTemplate = await fs.readFile(path.join(ASSET_FOLDER_PATH, "email_templates", htmlTemplateNames[type]), { encoding: "utf-8" });
- const textTemplate = await fs.readFile(
- path.join(
- ASSET_FOLDER_PATH,
- "email_templates",
- textTemplateNames[type],
- ),
- { encoding: "utf-8" },
- );
+ const textTemplate = await fs.readFile(path.join(ASSET_FOLDER_PATH, "email_templates", textTemplateNames[type]), { encoding: "utf-8" });
// replace email template placeholders
const html = this.doReplacements(
htmlTemplate,
user,
// password change emails don't have links
- type != MailTypes.changePassword
- ? await this.generateLink(type, user.id)
- : undefined,
+ type != MailTypes.changePassword ? await this.generateLink(type, user.id) : undefined,
);
const text = this.doReplacements(
textTemplate,
user,
// password change emails don't have links
- type != MailTypes.changePassword
- ? await this.generateLink(type, user.id)
- : undefined,
+ type != MailTypes.changePassword ? await this.generateLink(type, user.id) : undefined,
);
// extract the title from the email template to use as the email subject
const subject = html.match(/(.*)<\/title>/)?.[1] || "";
const message: IEmail = {
- from:
- Config.get().email.senderAddress ||
- Config.get().general.correspondenceEmail ||
- "noreply@localhost",
+ from: Config.get().email.senderAddress || Config.get().general.correspondenceEmail || "noreply@localhost",
to: email,
subject,
text,