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
9 changes: 7 additions & 2 deletions src/pages/[page].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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() {
Expand Down
9 changes: 5 additions & 4 deletions src/pages/user/[userId]/certificate.tsx
Original file line number Diff line number Diff line change
@@ -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'
? 'Кузнецов Тимофей Юрьевич'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commits a private person's full legal name and their account handle to a public repo (CLAUDE.md: "This repository is public"; the name stays fetchable by SHA even after a force-push). The old id check carried the same name, but moving it next to the public handle makes the pairing explicit. Better to store the override in the CMS (a displayName field on the certificate) so the name never enters the tree. If it has to stay in code, get the holder's consent for publishing it and confirm Wolf accepts this.

Minor: String(userId).toLowerCase() is fine, but make sure the route param is the handle and not the numeric id, otherwise this never matches.

: `${certificate?.name} ${certificate?.surname}`;
const date = new Date(certificate?.certificatedAt);
Expand Down
4 changes: 3 additions & 1 deletion src/pages/uxcore-api/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const API: FC<ApiProps> = ({ 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;
Loading