diff options
Diffstat (limited to 'src/api/routes')
-rw-r--r-- | src/api/routes/applications/#id/bot/index.ts | 2 | ||||
-rw-r--r-- | src/api/routes/auth/login.ts | 8 | ||||
-rw-r--r-- | src/api/routes/auth/mfa/totp.ts | 2 | ||||
-rw-r--r-- | src/api/routes/auth/verify/view-backup-codes-challenge.ts | 8 | ||||
-rw-r--r-- | src/api/routes/guilds/#guild_id/member-verification.ts | 4 | ||||
-rw-r--r-- | src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts | 150 | ||||
-rw-r--r-- | src/api/routes/users/@me/mfa/codes-verification.ts | 20 | ||||
-rw-r--r-- | src/api/routes/users/@me/mfa/totp/disable.ts | 2 | ||||
-rw-r--r-- | src/api/routes/users/@me/mfa/totp/enable.ts | 2 |
9 files changed, 97 insertions, 101 deletions
diff --git a/src/api/routes/applications/#id/bot/index.ts b/src/api/routes/applications/#id/bot/index.ts index 2ac3523b..6d054c75 100644 --- a/src/api/routes/applications/#id/bot/index.ts +++ b/src/api/routes/applications/#id/bot/index.ts @@ -1,5 +1,5 @@ import { route } from "@fosscord/api"; -import { Application, Config, FieldErrors, generateToken, handleFile, OrmUtils, trimSpecial, User, HTTPError } from "@fosscord/util"; +import { Application, Config, FieldErrors, generateToken, handleFile, HTTPError, OrmUtils, trimSpecial, User } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { verifyToken } from "node-2fa"; diff --git a/src/api/routes/auth/login.ts b/src/api/routes/auth/login.ts index 68b2656a..045b86eb 100644 --- a/src/api/routes/auth/login.ts +++ b/src/api/routes/auth/login.ts @@ -1,7 +1,7 @@ -import { Request, Response, Router } from "express"; -import { route, getIpAdress, verifyCaptcha } from "@fosscord/api"; -import { Config, User, generateToken, adjustEmail, FieldErrors, LoginSchema } from "@fosscord/util"; +import { getIpAdress, route, verifyCaptcha } from "@fosscord/api"; +import { adjustEmail, Config, FieldErrors, generateToken, LoginSchema, User } from "@fosscord/util"; import crypto from "crypto"; +import { Request, Response, Router } from "express"; let bcrypt: any; try { @@ -38,7 +38,7 @@ router.post("/", route({ body: "LoginSchema" }), async (req: Request, res: Respo captcha_key: verify["error-codes"], captcha_sitekey: sitekey, captcha_service: service - }) + }); } } diff --git a/src/api/routes/auth/mfa/totp.ts b/src/api/routes/auth/mfa/totp.ts index 4b080af6..65ec7f2f 100644 --- a/src/api/routes/auth/mfa/totp.ts +++ b/src/api/routes/auth/mfa/totp.ts @@ -1,5 +1,5 @@ import { route } from "@fosscord/api"; -import { BackupCode, generateToken, TotpSchema, User, HTTPError } from "@fosscord/util"; +import { BackupCode, generateToken, HTTPError, TotpSchema, User } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { verifyToken } from "node-2fa"; const router = Router(); diff --git a/src/api/routes/auth/verify/view-backup-codes-challenge.ts b/src/api/routes/auth/verify/view-backup-codes-challenge.ts index d524e0f7..846e186b 100644 --- a/src/api/routes/auth/verify/view-backup-codes-challenge.ts +++ b/src/api/routes/auth/verify/view-backup-codes-challenge.ts @@ -1,6 +1,6 @@ -import { Router, Request, Response } from "express"; import { route } from "@fosscord/api"; -import { FieldErrors, User, BackupCodesChallengeSchema } from "@fosscord/util"; +import { BackupCodesChallengeSchema, FieldErrors, User } from "@fosscord/util"; +import { Request, Response, Router } from "express"; let bcrypt: any; try { @@ -17,13 +17,13 @@ router.post("/", route({ body: "BackupCodesChallengeSchema" }), async (req: Requ const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["data"] }); - if (!await bcrypt.compare(password, user.data.hash || "")) { + if (!(await bcrypt.compare(password, user.data.hash || ""))) { throw FieldErrors({ password: { message: req.t("auth:login.INVALID_PASSWORD"), code: "INVALID_PASSWORD" } }); } return res.json({ nonce: "NoncePlaceholder", - regenerate_nonce: "RegenNoncePlaceholder", + regenerate_nonce: "RegenNoncePlaceholder" }); }); diff --git a/src/api/routes/guilds/#guild_id/member-verification.ts b/src/api/routes/guilds/#guild_id/member-verification.ts index 265a1b35..bb3ffb0a 100644 --- a/src/api/routes/guilds/#guild_id/member-verification.ts +++ b/src/api/routes/guilds/#guild_id/member-verification.ts @@ -1,8 +1,8 @@ -import { Router, Request, Response } from "express"; import { route } from "@fosscord/api"; +import { Request, Response, Router } from "express"; const router = Router(); -router.get("/",route({}), async (req: Request, res: Response) => { +router.get("/", route({}), async (req: Request, res: Response) => { // TODO: member verification res.status(404).json({ diff --git a/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts b/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts index f8c78bc5..a5fe0cf2 100644 --- a/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts +++ b/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts @@ -134,159 +134,159 @@ const skus = new Map([ price: 0, price_tier: null } - ], + ] ], [ "978380684370378762", [ [ { - "id": "978380692553465866", - "name": "Premium Tier 0 Monthly", - "interval": 1, - "interval_count": 1, - "tax_inclusive": true, - "sku_id": "978380684370378762", - "currency": "usd", - "price": 299, - "price_tier": null, - "prices": { + id: "978380692553465866", + name: "Premium Tier 0 Monthly", + interval: 1, + interval_count: 1, + tax_inclusive: true, + sku_id: "978380684370378762", + currency: "usd", + price: 299, + price_tier: null, + prices: { "0": { - "country_prices": { - "country_code": "US", - "prices": [ + country_prices: { + country_code: "US", + prices: [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] }, - "payment_source_prices": { + payment_source_prices: { "775487223059316758": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "736345864146255982": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "683074999590060249": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] } }, "3": { - "country_prices": { - "country_code": "US", - "prices": [ + country_prices: { + country_code: "US", + prices: [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] }, - "payment_source_prices": { + payment_source_prices: { "775487223059316758": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "736345864146255982": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "683074999590060249": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] } }, "4": { - "country_prices": { - "country_code": "US", - "prices": [ + country_prices: { + country_code: "US", + prices: [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] }, - "payment_source_prices": { + payment_source_prices: { "775487223059316758": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "736345864146255982": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "683074999590060249": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] } }, "1": { - "country_prices": { - "country_code": "US", - "prices": [ + country_prices: { + country_code: "US", + prices: [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] }, - "payment_source_prices": { + payment_source_prices: { "775487223059316758": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "736345864146255982": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ], "683074999590060249": [ { - "currency": "usd", - "amount": 0, - "exponent": 2 + currency: "usd", + amount: 0, + exponent: 2 } ] } diff --git a/src/api/routes/users/@me/mfa/codes-verification.ts b/src/api/routes/users/@me/mfa/codes-verification.ts index 071c71fa..570606e0 100644 --- a/src/api/routes/users/@me/mfa/codes-verification.ts +++ b/src/api/routes/users/@me/mfa/codes-verification.ts @@ -1,6 +1,6 @@ -import { Router, Request, Response } from "express"; import { route } from "@fosscord/api"; -import { BackupCode, generateMfaBackupCodes, User, CodesVerificationSchema } from "@fosscord/util"; +import { BackupCode, CodesVerificationSchema, generateMfaBackupCodes, User } from "@fosscord/util"; +import { Request, Response, Router } from "express"; const router = Router(); @@ -14,27 +14,23 @@ router.post("/", route({ body: "CodesVerificationSchema" }), async (req: Request var codes: BackupCode[]; if (regenerate) { - await BackupCode.update( - { user: { id: req.user_id } }, - { expired: true } - ); + await BackupCode.update({ user: { id: req.user_id } }, { expired: true }); codes = generateMfaBackupCodes(req.user_id); - await Promise.all(codes.map(x => x.save())); - } - else { + await Promise.all(codes.map((x) => x.save())); + } else { codes = await BackupCode.find({ where: { user: { - id: req.user_id, + id: req.user_id }, - expired: false, + expired: false } }); } return res.json({ - backup_codes: codes.map(x => ({ ...x, expired: undefined })), + backup_codes: codes.map((x) => ({ ...x, expired: undefined })) }); }); diff --git a/src/api/routes/users/@me/mfa/totp/disable.ts b/src/api/routes/users/@me/mfa/totp/disable.ts index 07fdbb05..a53fa816 100644 --- a/src/api/routes/users/@me/mfa/totp/disable.ts +++ b/src/api/routes/users/@me/mfa/totp/disable.ts @@ -1,5 +1,5 @@ import { route } from "@fosscord/api"; -import { BackupCode, generateToken, TotpDisableSchema, User, HTTPError } from "@fosscord/util"; +import { BackupCode, generateToken, HTTPError, TotpDisableSchema, User } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { verifyToken } from "node-2fa"; diff --git a/src/api/routes/users/@me/mfa/totp/enable.ts b/src/api/routes/users/@me/mfa/totp/enable.ts index adf51d6e..0bf1a188 100644 --- a/src/api/routes/users/@me/mfa/totp/enable.ts +++ b/src/api/routes/users/@me/mfa/totp/enable.ts @@ -1,5 +1,5 @@ import { route } from "@fosscord/api"; -import { BackupCode, Config, generateMfaBackupCodes, generateToken, TotpEnableSchema, User, HTTPError } from "@fosscord/util"; +import { BackupCode, Config, generateMfaBackupCodes, generateToken, HTTPError, TotpEnableSchema, User } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { verifyToken } from "node-2fa"; |