Skip to content

Commit 0f86cc5

Browse files
hh
1 parent d207284 commit 0f86cc5

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

components/Layout.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ export default function Layout( { children } ) {
7171
};
7272

7373
useEffect( () => {
74-
clearSlots();
7574
setIsSidebarOpen( false );
76-
}, [ clearSlots, router.asPath ] );
75+
}, [ router.asPath ] );
7776

7877
return (
7978
<ShellSlotsContext.Provider value={ contextValue }>

pages/_app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ function usePrevious( value ) {
2020
export default function App( { Component, pageProps, router } ) {
2121
let previousPathname = usePrevious( router.pathname );
2222
const getLayout = Component.getLayout ?? ( ( page ) => <Layout>{ page }</Layout> );
23+
const shouldRenderSpeedInsights =
24+
process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ||
25+
process.env.NEXT_PUBLIC_ENABLE_SPEED_INSIGHTS === "true";
2326

2427
return getLayout(
2528
<CardProvider>
2629
<MarketPriceProvider>
2730
<Component previousPathname={ previousPathname } { ...pageProps } />
28-
<SpeedInsights />
31+
{ shouldRenderSpeedInsights ? <SpeedInsights /> : null }
2932
</MarketPriceProvider>
3033
</CardProvider>
3134
);

pages/yugioh/my-collection.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,10 @@ const MyCollection = ( { initialAuthState = false } ) => {
514514
unmatchedCount > 0
515515
? `${ unmatchedCount } card${ unmatchedCount === 1 ? "" : "s" } in processed sets need manual review.`
516516
: "",
517-
].filter( Boolean ).join( " " );
517+
].filter( Boolean ).join( "\n" );
518518

519519
await refreshCollection();
520-
setNotification( {
521-
show: true,
522-
message: updateMessage,
523-
} );
520+
window.alert( updateMessage );
524521
} catch ( error ) {
525522
console.error( "Error updating card prices:", error );
526523
setNotification( { show: true, message: 'Failed to update card prices! Please try again!' } );

proxy.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const TOKEN_COOKIE = "token";
1212
const AUTH_USER_HEADER = "x-authenticated-user";
1313
const NONCE_HEADER = "x-nonce";
1414
const CSP_HEADER = "Content-Security-Policy";
15+
const STATIC_STYLE_HASHES = [
16+
"'sha256-wOOlbQsHffPa/XeSzb/hyZtdNuMNE9EDJ9dYETiwQ80='",
17+
"'sha256-C8S6dNMSWod6IgqRVGm5rD7fWajo34AG++yTnMbIeks='",
18+
"'sha256-Z5XTK23DFuEMs0PwnyZDO9SWxemQ5HxcpVaBNuUJyWY='",
19+
"'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='",
20+
];
1521
const isProduction = process.env.NODE_ENV === "production";
1622
const jwtSecret = process.env.JWT_SECRET;
1723

@@ -25,15 +31,19 @@ const buildContentSecurityPolicy = ( nonce: string ): string => {
2531
const scriptSrcElem = isDev
2632
? "'self' 'unsafe-inline' https://va.vercel-scripts.com"
2733
: `'self' 'nonce-${ nonce }' https://va.vercel-scripts.com`;
34+
const staticStyleHashes = STATIC_STYLE_HASHES.join( " " );
2835
const styleSrc = isDev
2936
? "'self' 'unsafe-inline'"
30-
: `'self' 'nonce-${ nonce }'`;
37+
: `'self' 'nonce-${ nonce }' ${ staticStyleHashes }`;
38+
const styleSrcElem = isDev
39+
? "'self' 'unsafe-inline'"
40+
: `'self' 'nonce-${ nonce }' ${ staticStyleHashes }`;
3141
const cspHeader = `
3242
default-src 'self';
3343
script-src ${ scriptSrc };
3444
script-src-elem ${ scriptSrcElem };
3545
style-src ${ styleSrc };
36-
style-src-elem ${ styleSrc };
46+
style-src-elem ${ styleSrcElem };
3747
style-src-attr 'unsafe-inline';
3848
img-src 'self' blob: data: https://images.ygoprodeck.com https://images.unsplash.com https://tailwindcss.com https://raw.githubusercontent.com;
3949
font-src 'self' data:;

0 commit comments

Comments
 (0)