diff --git a/src/pages/[page].tsx b/src/pages/[page].tsx index 31aa72a3..7e99356a 100644 --- a/src/pages/[page].tsx +++ b/src/pages/[page].tsx @@ -9,13 +9,17 @@ export const getStaticPaths = async () => { }; }; +// Every return carries the home page interval on purpose. The framework keys +// refresh timings by route with a trailing /index stripped, so a request for +// /index answered here without an interval overwrote the home page timing and +// the home page then shipped a one-year shared cache header until a restart. export const getStaticProps: GetStaticProps = async ({ params, locale }) => { const { page } = params as { page: string }; const map = await getArticleRedirects(locale ?? 'en'); if (page.startsWith('articles/')) { - return { notFound: true }; + return { notFound: true, revalidate: 10 }; } const resolvedNewUrl = map[page]; @@ -26,10 +30,11 @@ export const getStaticProps: GetStaticProps = async ({ params, locale }) => { destination: `/${resolvedNewUrl}`, permanent: true, }, + revalidate: 10, }; } - return { notFound: true }; + return { notFound: true, revalidate: 10 }; }; export default function LegacyRedirectPage() { diff --git a/src/pages/user/[userId]/certificate.tsx b/src/pages/user/[userId]/certificate.tsx index 277756bd..ede7b73e 100644 --- a/src/pages/user/[userId]/certificate.tsx +++ b/src/pages/user/[userId]/certificate.tsx @@ -1,21 +1,22 @@ import { getCertificate } from '@uxcore/api/uxcat/certificate'; -import { GlobalContext } from '@uxcore/components/Context/GlobalContext'; import Spinner from '@uxcore/components/Spinner'; import pageNotFoundData from '@uxcore/data/404'; import CertificateLayout from '@uxcore/layouts/CertificateLayout'; import type { TRouter } from '@uxcore/local-types/global'; import { useRouter } from 'next/router'; -import React, { useContext } from 'react'; +import React from 'react'; import NotFoundPage from '../../404'; const Certificate = ({ userId, certificate }) => { const router = useRouter(); const { locale } = router as TRouter; - const { uxcatUserInfo } = useContext(GlobalContext); + // One holder asked for the full legal name on the certificate. It is tied to + // the certificate's own address, so every viewer reads the same name and no + // other certificate carries it. const name = - uxcatUserInfo?.user?.id === 1034 + String(userId).toLowerCase() === 'tufuka48' ? 'Кузнецов Тимофей Юрьевич' : `${certificate?.name} ${certificate?.surname}`; const date = new Date(certificate?.certificatedAt); diff --git a/src/pages/uxcore-api/index.tsx b/src/pages/uxcore-api/index.tsx index 269e5e3f..9237a624 100644 --- a/src/pages/uxcore-api/index.tsx +++ b/src/pages/uxcore-api/index.tsx @@ -38,7 +38,9 @@ const API: FC = ({ mainSeo }) => { }; export const getStaticProps: GetStaticProps = async () => { const mainSeo = await getUXCoreApiSeo(); - return { props: { mainSeo } }; + // Without an interval the HTML ships a one-year shared cache header and a + // CDN keeps serving it across releases, pointing at assets that are gone. + return { props: { mainSeo }, revalidate: 60 }; }; export default API;