summary refs log tree commit diff
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-27 04:03:18 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-27 04:03:18 +0200
commit2a559166bb976ce48cd21c7d8dddbd5193e2b39a (patch)
tree93eb0e2a8dc3cbb0e21254b94cdebcbe6fc03a69
parentMerge remote-tracking branch 'Maddy/fix/sendMemberInProfile' into staging (diff)
parentConfigurable backup code length (diff)
downloadserver-2a559166bb976ce48cd21c7d8dddbd5193e2b39a.tar.xz
Merge remote-tracking branch 'upstream/dev/staging_2' into staging
-rw-r--r--src/api/middlewares/TestClient.ts3
-rw-r--r--src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts176
-rw-r--r--src/util/config/types/SecurityConfiguration.ts2
-rw-r--r--src/util/util/MFA.ts5
4 files changed, 176 insertions, 10 deletions
diff --git a/src/api/middlewares/TestClient.ts b/src/api/middlewares/TestClient.ts
index 2784c8ab..2c195994 100644
--- a/src/api/middlewares/TestClient.ts
+++ b/src/api/middlewares/TestClient.ts
@@ -45,6 +45,9 @@ export default function TestClient(app: Application) {
 				res.set(name, value);
 			});
 		} else {
+			if(req.params.file.endsWith(".map")) {
+				return res.status(404).send("Not found");	
+			}
 			console.log(`[TestClient] Downloading file not yet cached! Asset file: ${req.params.file}`);
 			response = await fetch(`https://discord.com/assets/${req.params.file}`, {
 				agent,
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 fdd775b7..f8c78bc5 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
@@ -9,7 +9,7 @@ const skus = new Map([
 		[
 			{
 				id: "511651856145973248",
-				name: "Individual Premium Tier 2 Monthly (Legacy)",
+				name: "Individual Premium Tier 3 Monthly (Legacy)",
 				interval: 1,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -20,7 +20,7 @@ const skus = new Map([
 			},
 			{
 				id: "511651860671627264",
-				name: "Individiual Premium Tier 2 Yearly (Legacy)",
+				name: "Individiual Premium Tier 3 Yearly (Legacy)",
 				interval: 2,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -36,7 +36,7 @@ const skus = new Map([
 		[
 			{
 				id: "511651871736201216",
-				name: "Individual Premium Tier 1 Monthly",
+				name: "Individual Premium Tier 2 Monthly",
 				interval: 1,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -47,7 +47,7 @@ const skus = new Map([
 			},
 			{
 				id: "511651876987469824",
-				name: "Individual Premum Tier 1 Yearly",
+				name: "Individual Premum Tier 2 Yearly",
 				interval: 2,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -58,7 +58,7 @@ const skus = new Map([
 			},
 			{
 				id: "978380684370378761",
-				name: "Individual Premum Tier 0",
+				name: "Individual Premum Tier 1",
 				interval: 2,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -74,7 +74,7 @@ const skus = new Map([
 		[
 			{
 				id: "642251038925127690",
-				name: "Individual Premium Tier 2 Quarterly",
+				name: "Individual Premium Tier 3 Quarterly",
 				interval: 1,
 				interval_count: 3,
 				tax_inclusive: true,
@@ -85,7 +85,7 @@ const skus = new Map([
 			},
 			{
 				id: "511651880837840896",
-				name: "Individual Premium Tier 2 Monthly",
+				name: "Individual Premium Tier 3 Monthly",
 				interval: 1,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -96,7 +96,7 @@ const skus = new Map([
 			},
 			{
 				id: "511651885459963904",
-				name: "Individual Premium Tier 2 Yearly",
+				name: "Individual Premium Tier 3 Yearly",
 				interval: 2,
 				interval_count: 1,
 				tax_inclusive: true,
@@ -134,6 +134,166 @@ 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": {
+						"0": {
+							"country_prices": {
+								"country_code": "US",
+								"prices": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							},
+							"payment_source_prices": {
+								"775487223059316758": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"736345864146255982": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"683074999590060249": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							}
+						},
+						"3": {
+							"country_prices": {
+								"country_code": "US",
+								"prices": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							},
+							"payment_source_prices": {
+								"775487223059316758": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"736345864146255982": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"683074999590060249": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							}
+						},
+						"4": {
+							"country_prices": {
+								"country_code": "US",
+								"prices": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							},
+							"payment_source_prices": {
+								"775487223059316758": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"736345864146255982": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"683074999590060249": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							}
+						},
+						"1": {
+							"country_prices": {
+								"country_code": "US",
+								"prices": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							},
+							"payment_source_prices": {
+								"775487223059316758": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"736345864146255982": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								],
+								"683074999590060249": [
+									{
+										"currency": "usd",
+										"amount": 0,
+										"exponent": 2
+									}
+								]
+							}
+						}
+					}
+				}
+			]
 		]
 	]
 ]);
diff --git a/src/util/config/types/SecurityConfiguration.ts b/src/util/config/types/SecurityConfiguration.ts
index 98c04c99..a2cebbd3 100644
--- a/src/util/config/types/SecurityConfiguration.ts
+++ b/src/util/config/types/SecurityConfiguration.ts
@@ -14,4 +14,6 @@ export class SecurityConfiguration {
 	// CF-Connecting-IP for cloudflare
 	forwadedFor: string | null = null;
 	ipdataApiKey: string | null = "eca677b284b3bac29eb72f5e496aa9047f26543605efe99ff2ce35c9";
+	mfaBackupCodeCount: number = 10;
+	mfaBackupCodeBytes: number = 4;
 }
diff --git a/src/util/util/MFA.ts b/src/util/util/MFA.ts
index a2afcad6..b9af6d23 100644
--- a/src/util/util/MFA.ts
+++ b/src/util/util/MFA.ts
@@ -1,12 +1,13 @@
 import crypto from "crypto";
+import { Config } from ".";
 import { BackupCode } from "../entities/BackupCodes";
 
 export function generateMfaBackupCodes(user_id: string) {
 	let backup_codes: BackupCode[] = [];
-	for (let i = 0; i < 10; i++) {
+	for (let i = 0; i < Config.get().security.mfaBackupCodeCount; i++) {
 		const code = BackupCode.create({
 			user: { id: user_id },
-			code: crypto.randomBytes(4).toString("hex"), // 8 characters
+			code: crypto.randomBytes(Config.get().security.mfaBackupCodeBytes).toString("hex"), // 8 characters
 			consumed: false,
 			expired: false
 		});