File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,13 @@ export default async function handler(
5454 return ;
5555 }
5656
57+ // If transaction doesn't exist, expire it on CoinPayments (in case it's been cancelled)
58+ const key = getTransactionRedisKey ( txn_id ) ;
59+ if ( ! ( await get ( key ) ) ) {
60+ res . status ( 400 ) . json ( { error : "Invalid transaction!" } ) ;
61+ return ;
62+ }
63+
5764 // Generate giftcard if applicable
5865 const cardObj =
5966 status === "2" || status === "100"
@@ -64,13 +71,6 @@ export default async function handler(
6471 }
6572 : undefined ;
6673
67- // If transaction doesn't exist, expire it on CoinPayments (in case it's been cancelled)
68- const key = getTransactionRedisKey ( txn_id ) ;
69- if ( ! ( await get ( key ) ) ) {
70- res . status ( 400 ) . json ( { error : "Invalid transaction!" } ) ;
71- return ;
72- }
73-
7474 // Update status
7575 redisClient . set (
7676 key ,
Original file line number Diff line number Diff line change @@ -354,7 +354,7 @@ const Home: NextPage<{ hasTransaction: boolean }> = ({ hasTransaction }) => {
354354 < FontAwesomeIcon className = "text-xl lg:text-4xl" icon = { faCopyright } />
355355 < div className = "flex flex-col" >
356356 < span className = "ml-4 text-sm md:text-md" >
357- COPYRIGHT 2021 < b > Liam</ b >
357+ COPYRIGHT { new Date ( ) . getFullYear ( ) } < b > Liam</ b >
358358 < br />
359359 WE ARE NOT AFFILIATED WITH MOJANG AB.
360360 </ span >
Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ import {
1313
1414export const getServerSideProps : GetServerSideProps = async ( context ) => {
1515 // Get transaction status from session token
16- const transactionStatus = ( await fetchTransactionStatus (
17- context . req . cookies . session
18- ) ) as any ;
16+ let transactionStatus ;
17+
18+ try {
19+ transactionStatus = ( await fetchTransactionStatus (
20+ context . req . cookies . session
21+ ) ) as any ;
22+ } catch ( err ) { }
1923
2024 // If no transaction status, redirect to home
2125 if ( ! transactionStatus || transactionStatus . error ) {
You can’t perform that action at this time.
0 commit comments