File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,12 +10,7 @@ export function TurnstileWidget() {
1010 const data = useRouteLoaderData ( "root" ) as RootData | undefined ;
1111 const siteKey = data ?. publicConfig ?. turnstileSiteKey ;
1212 if ( ! siteKey ) return null ;
13- return (
14- < >
15- < script src = "https://challenges.cloudflare.com/turnstile/v0/api.js" async defer />
16- < div className = "cf-turnstile" data-sitekey = { siteKey } data-action = "turnstile-spin-v2" />
17- </ >
18- ) ;
13+ return < div className = "cf-turnstile" data-sitekey = { siteKey } data-action = "turnstile-spin-v2" /> ;
1914}
2015
2116export function getTurnstileToken ( ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export async function loader({ request }: { request: Request }) {
1717}
1818
1919export function Layout ( { children } : { children : React . ReactNode } ) {
20- const data = useRouteLoaderData ( "root" ) as { publicConfig ?: { apiBaseUrl ?: string } } | undefined ;
20+ const data = useRouteLoaderData ( "root" ) as { publicConfig ?: { apiBaseUrl ?: string ; turnstileSiteKey ?: string } } | undefined ;
2121 const publicConfig = data ?. publicConfig || { apiBaseUrl : "https://api.cnodejs.org" } ;
2222
2323 return (
@@ -32,6 +32,9 @@ export function Layout({ children }: { children: React.ReactNode }) {
3232 />
3333 < Meta />
3434 < Links />
35+ { publicConfig . turnstileSiteKey ? (
36+ < script src = "https://challenges.cloudflare.com/turnstile/v0/api.js" async defer />
37+ ) : null }
3538 </ head >
3639 < body >
3740 { children }
You can’t perform that action at this time.
0 commit comments