From 2bbcbfbb268c658c6b6297b2267f91c995370400 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Tue, 13 Feb 2024 23:40:26 +0100 Subject: [PATCH] Force SSR to include CSP nonces on page reload (#818) --- pages/email.js | 4 ++++ pages/invites/index.js | 4 ++++ pages/invoices/[id].js | 4 ++++ pages/live.js | 4 ++++ pages/withdrawals/[id].js | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/pages/email.js b/pages/email.js index edba132e..2e520cc9 100644 --- a/pages/email.js +++ b/pages/email.js @@ -1,5 +1,9 @@ import Image from 'react-bootstrap/Image' import { StaticLayout } from '../components/layout' +import { getGetServerSideProps } from '../api/ssrApollo' + +// force SSR to include CSP nonces +export const getServerSideProps = getGetServerSideProps({ query: null }) export default function Email () { return ( diff --git a/pages/invites/index.js b/pages/invites/index.js index fdb84c94..9189eff1 100644 --- a/pages/invites/index.js +++ b/pages/invites/index.js @@ -8,6 +8,10 @@ import styles from '../../styles/invites.module.css' import Invite from '../../components/invite' import { inviteSchema } from '../../lib/validate' import { SSR } from '../../lib/constants' +import { getGetServerSideProps } from '../../api/ssrApollo' + +// force SSR to include CSP nonces +export const getServerSideProps = getGetServerSideProps({ query: null }) function InviteForm () { const [createInvite] = useMutation( diff --git a/pages/invoices/[id].js b/pages/invoices/[id].js index 37457efd..734850a6 100644 --- a/pages/invoices/[id].js +++ b/pages/invoices/[id].js @@ -5,6 +5,10 @@ import { CenterLayout } from '../../components/layout' import { useRouter } from 'next/router' import { INVOICE } from '../../fragments/wallet' import { SSR } from '../../lib/constants' +import { getGetServerSideProps } from '../../api/ssrApollo' + +// force SSR to include CSP nonces +export const getServerSideProps = getGetServerSideProps({ query: null }) export default function FullInvoice () { const router = useRouter() diff --git a/pages/live.js b/pages/live.js index b314d497..38272eed 100644 --- a/pages/live.js +++ b/pages/live.js @@ -3,6 +3,10 @@ import { CenterLayout } from '../components/layout' import Snl from '../components/snl' import { gql } from 'graphql-tag' import { useMutation, useQuery } from '@apollo/client' +import { getGetServerSideProps } from '../api/ssrApollo' + +// force SSR to include CSP nonces +export const getServerSideProps = getGetServerSideProps({ query: null }) export default function Index () { const [toggle] = useMutation( diff --git a/pages/withdrawals/[id].js b/pages/withdrawals/[id].js index 37e2fea2..c4f50bdc 100644 --- a/pages/withdrawals/[id].js +++ b/pages/withdrawals/[id].js @@ -15,6 +15,10 @@ import { useToast } from '../../components/toast' import { gql } from 'graphql-tag' import { useShowModal } from '../../components/modal' import { DeleteConfirm } from '../../components/delete' +import { getGetServerSideProps } from '../../api/ssrApollo' + +// force SSR to include CSP nonces +export const getServerSideProps = getGetServerSideProps({ query: null }) export default function Withdrawl () { return (