From 0b8c7bd59fd0e3225c7a2c39f05cac8da04dd1e6 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Thu, 17 Apr 2025 15:14:52 +0200 Subject: [PATCH] bugfixing --- src/routes/etf/[tickerID]/+page.svelte | 6 +++--- src/routes/index/[tickerID]/+page.svelte | 6 +++--- src/routes/payment/discord/+server.ts | 12 ++++++++++++ src/routes/stocks/[tickerID]/+page.svelte | 6 +++--- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/routes/etf/[tickerID]/+page.svelte b/src/routes/etf/[tickerID]/+page.svelte index b310a13a..343150a0 100644 --- a/src/routes/etf/[tickerID]/+page.svelte +++ b/src/routes/etf/[tickerID]/+page.svelte @@ -35,7 +35,7 @@ $: previousClose = data?.getStockQuote?.previousClose; //============================================// - const intervals = ["1D", "1W", "1M", "YTD", "6M", "1Y", "MAX"]; + const intervals = ["1D", "1W", "1M", "6M", "YTD", "1Y", "MAX"]; let config = null; let output = null; @@ -717,12 +717,12 @@ class="cursor-pointer" > - {$screenWidth < 640 + {$screenWidth < 1200 ? interval : convertPeriodString(interval)} diff --git a/src/routes/index/[tickerID]/+page.svelte b/src/routes/index/[tickerID]/+page.svelte index 783a1005..c0cb0399 100644 --- a/src/routes/index/[tickerID]/+page.svelte +++ b/src/routes/index/[tickerID]/+page.svelte @@ -33,7 +33,7 @@ $: previousClose = data?.getStockQuote?.previousClose; //============================================// - const intervals = ["1D", "1W", "1M", "YTD", "6M", "1Y", "MAX"]; + const intervals = ["1D", "1W", "1M", "6M", "YTD", "1Y", "MAX"]; let config = null; let output = null; @@ -718,12 +718,12 @@ class="cursor-pointer" > - {$screenWidth < 640 + {$screenWidth < 1200 ? interval : convertPeriodString(interval)} diff --git a/src/routes/payment/discord/+server.ts b/src/routes/payment/discord/+server.ts index 7f7ad7cf..0629c290 100644 --- a/src/routes/payment/discord/+server.ts +++ b/src/routes/payment/discord/+server.ts @@ -63,6 +63,7 @@ export const POST = async ({ request, locals }) => { const payload = JSON.parse(bodyText); const userId = payload?.meta?.custom_data?.userId; const { status, refunded } = payload?.data?.attributes || {}; + const productName = payload?.data?.attributes?.first_order_item?.product_name; if (!userId || status === undefined) { @@ -76,6 +77,17 @@ export const POST = async ({ request, locals }) => { ); } + if (!productName?.includes('Discord')) { + console.error("Not a discord product", payload); + return new Response( + JSON.stringify({ error: "Invalid payload structure" }), + { + status: 400, + headers: { "Content-Type": "application/json" }, + } + ); + } + try { diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index c4c0550f..09300df6 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -37,7 +37,7 @@ $: previousClose = data?.getStockQuote?.previousClose; //============================================// - const intervals = ["1D", "1W", "1M", "YTD", "6M", "1Y", "MAX"]; + const intervals = ["1D", "1W", "1M", "6M", "YTD", "1Y", "MAX"]; let config = null; let output = null; @@ -723,12 +723,12 @@ class="cursor-pointer" > - {$screenWidth < 640 + {$screenWidth < 1200 ? interval : convertPeriodString(interval)}