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
26 changes: 26 additions & 0 deletions apps/web/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ const nextConfig: NextConfig = {
transpilePackages: ["@msk-forms/ui", "@msk-forms/shared", "@msk-forms/db"],
// typedRoutes graduated out of `experimental` in Next.js 16.
typedRoutes: true,
// Metadata is resolved before the head is sent, for every user agent. Next
// streams it for anything outside its own bot list, and a canonical that
// resolves after the shell lands after </head>, where crawlers outside the
// list do not look for it. One regex for all turns streaming off.
htmlLimitedBots: /.*/,
// The proxy sets the security headers for documents but does not run for
// build assets (see the matcher in src/proxy.ts). Same values as there; the
// static files get a CSP that allows nothing, since they are no documents.
async headers() {
const base = [
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
];
return [
{
source: "/_next/static/:path*",
headers: [
...base,
{ key: "Content-Security-Policy", value: "default-src 'none'; frame-ancestors 'none'" },
],
},
{ source: "/_next/image", headers: base },
];
},
// sharp is a native module (logo re-encoding) — keep it external, don't bundle.
// stripe is a heavy server-only SDK — keep it external too. exceljs (XLSX
// export) is large with many deps — keep it external, don't bundle.
Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/app/(site)/pricing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { Button } from "@/components/ui/button";
import { botInviteUrl } from "@/lib/url";
import { getDict, getLocale } from "@/i18n";

export const metadata: Metadata = { title: "Pricing · MSK Forms" };
export const metadata: Metadata = {
title: "Pricing and plans · MSK Forms",
description:
"Start free with up to 3 forms and 100 submissions a month. Plans are per Discord server, and each guild can upgrade on its own when it outgrows the free limits.",
alternates: { canonical: "/pricing" },
};

type Cell = boolean | string;

Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/app/(site)/stats/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export const runtime = "nodejs";
// Public, anonymized aggregate counts — cache for 5 minutes to spare the DB.
export const revalidate = 300;

export const metadata: Metadata = { title: "Stats · MSK Forms" };
export const metadata: Metadata = {
title: "Platform statistics · MSK Forms",
description:
"MSK Forms in numbers: Discord servers, forms created, live forms and submissions received. Aggregate counts only, no server names or personal data.",
alternates: { canonical: "/stats" },
};

/**
* Platform statistics after the shop's statistics pages: the head on the
Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/app/(site)/terms/imprint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { imprint } from "@/content/legal/imprint";
import { renderMarkdown } from "@/lib/legal";
import { getDict, getLocale } from "@/i18n";

export const metadata: Metadata = { title: "Imprint · MSK Forms" };
export const metadata: Metadata = {
title: "Imprint and contact · MSK Forms",
description:
"Legal notice of MSK Forms by MSK Scripts: provider, postal address and contact details.",
alternates: { canonical: "/terms/imprint" },
};

export default async function ImprintPage() {
const locale = await getLocale();
Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/app/(site)/terms/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { terms } from "@/content/legal/terms";
import { renderMarkdown } from "@/lib/legal";
import { getDict, getLocale } from "@/i18n";

export const metadata: Metadata = { title: "Terms & Conditions · MSK Forms" };
export const metadata: Metadata = {
title: "Terms & Conditions · MSK Forms",
description:
"Terms and conditions for using MSK Forms, the application form service by MSK Scripts, and its Discord bot.",
alternates: { canonical: "/terms" },
};

export default async function TermsPage() {
const locale = await getLocale();
Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/app/(site)/terms/privacy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { privacy } from "@/content/legal/privacy";
import { renderMarkdown } from "@/lib/legal";
import { getDict, getLocale } from "@/i18n";

export const metadata: Metadata = { title: "Privacy Policy · MSK Forms" };
export const metadata: Metadata = {
title: "Privacy Policy (GDPR) · MSK Forms",
description:
"How MSK Forms handles personal data under the GDPR: what is stored for guilds and applicants, for how long, and which rights you have.",
alternates: { canonical: "/terms/privacy" },
};

export default async function PrivacyPage() {
const locale = await getLocale();
Expand Down
18 changes: 18 additions & 0 deletions apps/web/src/app/[handle]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isReservedHandle, normalizeHandle } from "@msk-forms/shared";
import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { GuildHub } from "@/components/public/guild-hub";
Expand All @@ -7,6 +8,23 @@ import { getGuildByHandle } from "@/lib/forms";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";

export async function generateMetadata({
params,
}: {
params: Promise<{ handle: string }>;
}): Promise<Metadata> {
const { handle: raw } = await params;
const handle = normalizeHandle(decodeURIComponent(raw));
if (!handle || isReservedHandle(handle)) return {};
const guild = await getGuildByHandle(handle);
if (!guild) return {};
return {
title: `${guild.name} · Application forms`,
description: `All open application forms of ${guild.name} in one place. Apply with your Discord account and follow your status live, on MSK Forms.`,
alternates: { canonical: `/${handle}` },
};
}

/**
* Public per-guild form hub at a vanity path on the primary domain, e.g.
* forms.msk-scripts.de/msk-forms. Explicit top-level routes (dashboard, f, s,
Expand Down
24 changes: 24 additions & 0 deletions apps/web/src/app/f/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from "next";
import { cookies, headers } from "next/headers";
import { notFound, redirect } from "next/navigation";
import Script from "next/script";
Expand Down Expand Up @@ -28,11 +29,34 @@ import { getGuildByDomain, isPrimaryHostname, requestHostname } from "@/lib/cust
import { isGuildPro } from "@/lib/plan";
import { captchaSiteKey } from "@/lib/captcha";
import { findActiveSubmissionId, getLiveFormBySlug } from "@/lib/forms";
import { metaExcerpt } from "@/lib/seo";
import { getDict, getLocale } from "@/i18n";

export const runtime = "nodejs";
export const dynamic = "force-dynamic";

/**
* Title, description and canonical from the form itself. Until 25.11.2026
* every form had the landing page's title and description, so all public
* forms looked like duplicates of the home page to a search engine.
*/
export async function generateMetadata({
params,
}: {
params: Promise<{ slug: string }>;
}): Promise<Metadata> {
const { slug } = await params;
const form = await getLiveFormBySlug(slug);
if (!form) return {};
return {
title: `${form.title} · ${form.guild.name}`,
description:
metaExcerpt(form.description) ||
`Application form "${form.title}" of ${form.guild.name}, on MSK Forms.`,
alternates: { canonical: `/f/${form.slug}` },
};
}

export default async function PublicFormPage({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const form = await getLiveFormBySlug(slug);
Expand Down
24 changes: 24 additions & 0 deletions apps/web/src/app/g/[guildId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import { prisma } from "@msk-forms/db";
import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { GuildHub } from "@/components/public/guild-hub";

export const runtime = "nodejs";
export const dynamic = "force-dynamic";

/**
* A guild with a handle has its hub twice on the primary domain, at /g/<id>
* and at /<handle>. The handle is the address the guild shares, so it is the
* canonical for both.
*/
export async function generateMetadata({
params,
}: {
params: Promise<{ guildId: string }>;
}): Promise<Metadata> {
const { guildId } = await params;
const guild = await prisma.guild.findUnique({
where: { id: guildId },
select: { id: true, name: true, handle: true },
});
if (!guild) return {};
return {
title: `${guild.name} · Application forms`,
description: `All open application forms of ${guild.name} in one place. Apply with your Discord account and follow your status live, on MSK Forms.`,
alternates: { canonical: guild.handle ? `/${guild.handle}` : `/g/${guild.id}` },
};
}

/**
* Public per-guild form hub on the primary domain, addressed by internal id.
* Lets a guild share one link to all its live forms (grouped by category)
Expand Down
10 changes: 8 additions & 2 deletions apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ErrorCopyProvider } from "@/components/site/error-copy";
import { ThemeProvider } from "@/components/theme-provider";
import { logoUrl, parseBranding, THEME_SURFACES } from "@/lib/branding";
import { getGuildByDomain, isPrimaryHostname, requestHostname } from "@/lib/custom-domain";
import { appBaseUrl } from "@/lib/url";
import { getDict, getDirection, getLocale } from "@/i18n";
// Fonts come from the @fontsource-variable packages and are served by this
// app, like in msk-shop: nothing is fetched from Google, neither at build time
Expand Down Expand Up @@ -53,15 +54,20 @@ export const viewport: Viewport = {
* guild's own site. Falls back to the MSK Forms defaults everywhere else.
*/
export async function generateMetadata(): Promise<Metadata> {
// The base for every relative canonical below: the public origin on the
// primary host, the guild's own domain on a verified custom domain, so each
// host names its own address as canonical.
const primary: Metadata = { ...DEFAULT_METADATA, metadataBase: new URL(appBaseUrl()) };
const host = await requestHostname();
if (!host || isPrimaryHostname(host)) return DEFAULT_METADATA;
if (!host || isPrimaryHostname(host)) return primary;

const guild = await getGuildByDomain(host);
if (!guild) return DEFAULT_METADATA;
if (!guild) return primary;

const logo = logoUrl(guild.id, parseBranding(guild.branding));
return {
...DEFAULT_METADATA,
metadataBase: new URL(`https://${host}`),
title: guild.name,
...(logo ? { icons: { icon: [{ url: logo, type: "image/webp" }], apple: logo } } : {}),
};
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { Notice } from "@/components/dashboard-kit/notice";
Expand All @@ -15,6 +16,10 @@ import { getDict } from "@/i18n";

export const dynamic = "force-dynamic";

// Relative to the metadataBase of the root layout: the landing page on the
// primary host, the form index of a guild on its custom domain.
export const metadata: Metadata = { alternates: { canonical: "/" } };

/**
* `/` is two pages. On a guild's verified custom domain it is that guild's
* branded form index, in the public frame and without msk-scripts.de's
Expand Down
17 changes: 15 additions & 2 deletions apps/web/src/components/public/public-frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ export async function PublicFrame({
<div className="public-column flex min-h-[var(--header-height)] items-center gap-3">
<a href={hubHref} className="flex min-h-11 min-w-0 items-center gap-3 text-foreground">
{logo ? (
<img src={logo} alt="" className="h-9 w-auto max-w-[7rem] shrink-0 object-contain" />
// The logo names the link, the written name next to it is only
// seen. Width and height give the img a size in the HTML; CSS
// keeps the logo's own aspect ratio once it has loaded.
<img
src={logo}
alt={guild.name}
width={36}
height={36}
className="h-9 w-auto max-w-[7rem] shrink-0 object-contain"
/>
) : (
<span
aria-hidden
Expand All @@ -84,7 +93,11 @@ export async function PublicFrame({
{guild.name.trim().charAt(0).toUpperCase()}
</span>
)}
<span translate="no" className="truncate font-display text-lead font-bold">
<span
translate="no"
aria-hidden={logo ? true : undefined}
className="truncate font-display text-lead font-bold"
>
{guild.name}
</span>
</a>
Expand Down
12 changes: 8 additions & 4 deletions apps/web/src/components/site/header-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,18 @@ export function HeaderBar({
<a href="/" className="flex min-h-11 shrink-0 items-center gap-2.5 text-foreground">
<img
src="/logo.png"
alt=""
alt="MSK Forms"
width={36}
height={36}
className="h-9 w-9 rounded-lg object-contain"
/>
{/* Below 360 px the name gives way to the buttons; it stays the
link's name for a screen reader. */}
<span className="sr-only font-display text-lead font-bold tracking-[-0.01em] [font-stretch:108%] min-[360px]:not-sr-only">
{/* The logo carries the link's name, so a screen reader hears it
once and it stays there below 360 px, where the written name
gives way to the buttons. */}
<span
aria-hidden
className="hidden font-display text-lead font-bold tracking-[-0.01em] [font-stretch:108%] min-[360px]:inline"
>
MSK Forms
</span>
</a>
Expand Down
11 changes: 4 additions & 7 deletions apps/web/src/components/site/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@ export function productLines(t: Dictionary["site"], locale: string): ProductLine
return [
{
id: "fivem",
href: shopUrl(locale, "/fivem"),
// Since 05.11.2026 every FiveM script is free on GitHub. The shop's menu
// has the free scripts and the statistics; the paid catalogue and the
// all-access subscription only redirect there.
href: shopUrl(locale, "/fivem/free"),
label: t.fivem,
current: false,
links: [
{ href: shopUrl(locale, "/fivem"), label: t.fivemPaid, description: t.fivemPaidDesc },
{ href: shopUrl(locale, "/fivem/free"), label: t.fivemFree, description: t.fivemFreeDesc },
{
href: shopUrl(locale, "/fivem/all-access"),
label: t.fivemAllAccess,
description: t.fivemAllAccessDesc,
},
{ href: shopUrl(locale, "/stats"), label: t.fivemStats, description: t.fivemStatsDesc },
],
},
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/site/site-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function SiteFooter() {
{ label: dict.stats.nav, href: "/stats" },
{ label: t.demoForm, href: "/f/demo-whitelist" },
{ label: "MSK Scripts Hub", href: `${FORMS_ORIGIN}/msk-forms` },
{ label: t.documentation, href: "https://docu.msk-scripts.de/ecosystem/msk-forms" },
{ label: t.documentation, href: "https://docu.msk-scripts.de/ecosystem/msk-forms/" },
{ label: t.github, href: "https://github.com/MSK-Scripts" },
],
},
Expand Down Expand Up @@ -90,12 +90,12 @@ export async function SiteFooter() {
>
<img
src="/logo.png"
alt=""
alt="MSK Forms"
width={32}
height={32}
className="h-8 w-8 rounded-lg object-contain"
/>
<span className="font-display text-lead font-bold [font-stretch:108%]">
<span aria-hidden className="font-display text-lead font-bold [font-stretch:108%]">
MSK Forms
</span>
</a>
Expand Down
Loading