Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { Metadata } from 'next'
import { Footer, Header } from '@/components/chrome'
import { PitFooter } from '@/components/pit-footer'
import { SITE } from '@/lib/site'
import './globals.css'
import Script from "next/script";

/**
* ISR for every prerendered page: re-rendered at most hourly, so a new
* @profullstack/footer template release reaches them without a redeploy.
* ISR for every prerendered page: re-rendered at most hourly, so a change to
* the pit.world network footer reaches them without a redeploy.
*/
export const revalidate = 3600

Expand Down Expand Up @@ -96,6 +97,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
<Footer />
<Script data-site="4f356371-83a0-4cb2-b570-75b961e6ddcb" src="https://crawlproof.com/stats.js" strategy="afterInteractive" />
<Script src="https://crawlproof.com/ad.js" strategy="afterInteractive" />
<PitFooter />
</body>
</html>
)
Expand Down
21 changes: 21 additions & 0 deletions apps/web/components/pit-footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* The pit.world network footer, fetched server-side and cached for an hour.
* Any failure (timeout, non-200, network) renders nothing: the page never
* depends on pit.world being up.
*/
const PIT_FOOTER_URL = 'https://pit.world/snippets/footer.html?site=diskpush.com'

export async function PitFooter() {
try {
const res = await fetch(PIT_FOOTER_URL, {
next: { revalidate: 3600 },
signal: AbortSignal.timeout(3000),
})
if (!res.ok) return null
const html = await res.text()
if (!html.includes('data-pit-footer')) return null
return <div dangerouslySetInnerHTML={{ __html: html }} />
} catch {
return null
}
}
Loading