diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 859683e..85b2292 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -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 , 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. diff --git a/apps/web/src/app/(site)/pricing/page.tsx b/apps/web/src/app/(site)/pricing/page.tsx index 774671a..6c61e37 100644 --- a/apps/web/src/app/(site)/pricing/page.tsx +++ b/apps/web/src/app/(site)/pricing/page.tsx @@ -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; diff --git a/apps/web/src/app/(site)/stats/page.tsx b/apps/web/src/app/(site)/stats/page.tsx index d1fa7a7..94dc4a9 100644 --- a/apps/web/src/app/(site)/stats/page.tsx +++ b/apps/web/src/app/(site)/stats/page.tsx @@ -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 diff --git a/apps/web/src/app/(site)/terms/imprint/page.tsx b/apps/web/src/app/(site)/terms/imprint/page.tsx index abcbb36..7ee0e62 100644 --- a/apps/web/src/app/(site)/terms/imprint/page.tsx +++ b/apps/web/src/app/(site)/terms/imprint/page.tsx @@ -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(); diff --git a/apps/web/src/app/(site)/terms/page.tsx b/apps/web/src/app/(site)/terms/page.tsx index 7f60402..6cbcfb1 100644 --- a/apps/web/src/app/(site)/terms/page.tsx +++ b/apps/web/src/app/(site)/terms/page.tsx @@ -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(); diff --git a/apps/web/src/app/(site)/terms/privacy/page.tsx b/apps/web/src/app/(site)/terms/privacy/page.tsx index 4702f9a..e2d03b5 100644 --- a/apps/web/src/app/(site)/terms/privacy/page.tsx +++ b/apps/web/src/app/(site)/terms/privacy/page.tsx @@ -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(); diff --git a/apps/web/src/app/[handle]/page.tsx b/apps/web/src/app/[handle]/page.tsx index 1f33e21..76cbf57 100644 --- a/apps/web/src/app/[handle]/page.tsx +++ b/apps/web/src/app/[handle]/page.tsx @@ -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"; @@ -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 { + 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, diff --git a/apps/web/src/app/f/[slug]/page.tsx b/apps/web/src/app/f/[slug]/page.tsx index 8d9d38c..7a4d579 100644 --- a/apps/web/src/app/f/[slug]/page.tsx +++ b/apps/web/src/app/f/[slug]/page.tsx @@ -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"; @@ -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 { + 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); diff --git a/apps/web/src/app/g/[guildId]/page.tsx b/apps/web/src/app/g/[guildId]/page.tsx index 330bff9..1ee4f0e 100644 --- a/apps/web/src/app/g/[guildId]/page.tsx +++ b/apps/web/src/app/g/[guildId]/page.tsx @@ -1,4 +1,5 @@ import { prisma } from "@msk-forms/db"; +import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { GuildHub } from "@/components/public/guild-hub"; @@ -6,6 +7,29 @@ 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/ + * and at /. 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 { + 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) diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 1b27c3c..b7e0d50 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -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 @@ -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 { + // 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 } } : {}), }; diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 4b9e9a0..5ac9cc5 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -1,3 +1,4 @@ +import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { Notice } from "@/components/dashboard-kit/notice"; @@ -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 diff --git a/apps/web/src/components/public/public-frame.tsx b/apps/web/src/components/public/public-frame.tsx index 2a76dbc..2d7205f 100644 --- a/apps/web/src/components/public/public-frame.tsx +++ b/apps/web/src/components/public/public-frame.tsx @@ -75,7 +75,16 @@ export async function PublicFrame({
{logo ? ( - + // 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. + {guild.name} ) : ( )} - + {guild.name} diff --git a/apps/web/src/components/site/header-bar.tsx b/apps/web/src/components/site/header-bar.tsx index 3d2dd0d..0a4cb48 100644 --- a/apps/web/src/components/site/header-bar.tsx +++ b/apps/web/src/components/site/header-bar.tsx @@ -221,14 +221,18 @@ export function HeaderBar({ - {/* Below 360 px the name gives way to the buttons; it stays the - link's name for a screen reader. */} - + {/* 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. */} + MSK Forms diff --git a/apps/web/src/components/site/navigation.ts b/apps/web/src/components/site/navigation.ts index ecc9f00..da42518 100644 --- a/apps/web/src/components/site/navigation.ts +++ b/apps/web/src/components/site/navigation.ts @@ -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 }, ], }, diff --git a/apps/web/src/components/site/site-footer.tsx b/apps/web/src/components/site/site-footer.tsx index 2a3ce44..3e16c28 100644 --- a/apps/web/src/components/site/site-footer.tsx +++ b/apps/web/src/components/site/site-footer.tsx @@ -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" }, ], }, @@ -90,12 +90,12 @@ export async function SiteFooter() { > - + MSK Forms diff --git a/apps/web/src/i18n/dictionaries.ts b/apps/web/src/i18n/dictionaries.ts index bfd70d3..5befc8b 100644 --- a/apps/web/src/i18n/dictionaries.ts +++ b/apps/web/src/i18n/dictionaries.ts @@ -41,12 +41,8 @@ const en = { discord: "Discord bots", tools: "Web tools", about: "About", - fivemPaid: "Paid scripts", - fivemPaidDesc: "Every script as Encrypted or Source", fivemFree: "Free scripts", fivemFreeDesc: "Open source on GitHub, msk_core included", - fivemAllAccess: "All-access subscription", - fivemAllAccessDesc: "Access to every resource, cancel monthly", fivemStats: "Server statistics", fivemStatsDesc: "Live server counts per script", ticketDesc: "Tickets with hosted transcripts and a dashboard", @@ -1382,12 +1378,8 @@ const de: Dictionary = { discord: "Discord-Bots", tools: "Web-Tools", about: "Über MSK", - fivemPaid: "Bezahl-Scripts", - fivemPaidDesc: "Jedes Script als Encrypted oder Source", fivemFree: "Kostenlose Scripts", fivemFreeDesc: "Open Source auf GitHub, samt msk_core", - fivemAllAccess: "Alle Scripts im Abo", - fivemAllAccessDesc: "Zugriff auf sämtliche Ressourcen, monatlich kündbar", fivemStats: "Serverstatistiken", fivemStatsDesc: "Live-Serverzahlen je Script", ticketDesc: "Tickets mit gehosteten Transkripten und Dashboard", @@ -2742,12 +2734,8 @@ const hu: Dictionary = { discord: "Discord botok", tools: "Webes eszközök", about: "Rólunk", - fivemPaid: "Fizetős szkriptek", - fivemPaidDesc: "Minden szkript Encrypted vagy Source változatban", fivemFree: "Ingyenes szkriptek", fivemFreeDesc: "Nyílt forráskód a GitHubon, az msk_core-ral együtt", - fivemAllAccess: "Minden szkript előfizetéssel", - fivemAllAccessDesc: "Hozzáférés minden erőforráshoz, havonta lemondható", fivemStats: "Szerverstatisztikák", fivemStatsDesc: "Élő szerverszámok szkriptenként", ticketDesc: "Jegykezelés tárolt átiratokkal és vezérlőpulttal", @@ -4082,12 +4070,8 @@ const fr: Dictionary = { discord: "Bots Discord", tools: "Outils web", about: "À propos", - fivemPaid: "Scripts payants", - fivemPaidDesc: "Chaque script en version Encrypted ou Source", fivemFree: "Scripts gratuits", fivemFreeDesc: "Open source sur GitHub, msk_core compris", - fivemAllAccess: "Abonnement tout compris", - fivemAllAccessDesc: "Accès à toutes les ressources, résiliable chaque mois", fivemStats: "Statistiques des serveurs", fivemStatsDesc: "Nombre de serveurs en direct par script", ticketDesc: "Tickets avec transcriptions hébergées et tableau de bord", @@ -5438,12 +5422,8 @@ const es: Dictionary = { discord: "Bots de Discord", tools: "Herramientas web", about: "Acerca de", - fivemPaid: "Scripts de pago", - fivemPaidDesc: "Cada script en versión Encrypted o Source", fivemFree: "Scripts gratuitos", fivemFreeDesc: "Código abierto en GitHub, msk_core incluido", - fivemAllAccess: "Suscripción con acceso total", - fivemAllAccessDesc: "Acceso a todos los recursos, cancelable cada mes", fivemStats: "Estadísticas de servidores", fivemStatsDesc: "Servidores en directo por script", ticketDesc: "Tickets con transcripciones alojadas y panel", @@ -6778,12 +6758,8 @@ const pt: Dictionary = { discord: "Bots de Discord", tools: "Ferramentas web", about: "Sobre", - fivemPaid: "Scripts pagos", - fivemPaidDesc: "Cada script como Encrypted ou Source", fivemFree: "Scripts gratuitos", fivemFreeDesc: "Código aberto no GitHub, msk_core incluído", - fivemAllAccess: "Assinatura com acesso total", - fivemAllAccessDesc: "Acesso a todos os recursos, cancelável mensalmente", fivemStats: "Estatísticas de servidores", fivemStatsDesc: "Servidores ao vivo por script", ticketDesc: "Tickets com transcrições hospedadas e painel", @@ -8121,12 +8097,8 @@ const pl: Dictionary = { discord: "Boty Discord", tools: "Narzędzia webowe", about: "O nas", - fivemPaid: "Skrypty płatne", - fivemPaidDesc: "Każdy skrypt jako Encrypted lub Source", fivemFree: "Skrypty darmowe", fivemFreeDesc: "Open source na GitHubie, razem z msk_core", - fivemAllAccess: "Subskrypcja z pełnym dostępem", - fivemAllAccessDesc: "Dostęp do wszystkich zasobów, z miesięcznym wypowiedzeniem", fivemStats: "Statystyki serwerów", fivemStatsDesc: "Liczba serwerów na żywo dla każdego skryptu", ticketDesc: "Zgłoszenia z hostowanymi transkrypcjami i panelem", diff --git a/apps/web/src/lib/seo.test.ts b/apps/web/src/lib/seo.test.ts new file mode 100644 index 0000000..bbcc217 --- /dev/null +++ b/apps/web/src/lib/seo.test.ts @@ -0,0 +1,67 @@ +import { describe, expect, it } from "vitest"; + +import { dictionaries } from "@/i18n/dictionaries"; +import { productLines } from "@/components/site/navigation"; +import nextConfig from "../../next.config"; + +import { META_DESCRIPTION_MAX, metaExcerpt } from "./seo"; + +describe("metaExcerpt", () => { + it("turns Markdown into plain text", () => { + expect(metaExcerpt("## Apply **now**\n\nSee [the rules](https://x.test).")).toBe( + "Apply now See the rules.", + ); + }); + + it("stays inside what a search result shows", () => { + const long = "word ".repeat(80); + const text = metaExcerpt(long); + expect(text.length).toBeLessThanOrEqual(META_DESCRIPTION_MAX); + expect(text.endsWith("…")).toBe(true); + }); + + it("gives an empty string for nothing, so the caller's fallback applies", () => { + expect(metaExcerpt(null)).toBe(""); + expect(metaExcerpt(" ")).toBe(""); + }); +}); + +/** + * Crawl of 25.11.2026: metadata streamed after for user agents outside + * Next's bot list, and the build assets had none of the security headers. + */ +describe("next.config", () => { + it("blocks on metadata for every user agent", () => { + const bots = nextConfig.htmlLimitedBots as RegExp; + for (const ua of ["Mozilla/5.0 Chrome/142.0", "OpenSpider/1.0", ""]) + expect(bots.test(ua)).toBe(true); + }); + + it("sends the security headers with static files and optimised images", async () => { + const rules = await nextConfig.headers!(); + for (const source of ["/_next/static/:path*", "/_next/image"]) { + const keys = rules.find((r) => r.source === source)?.headers.map((h) => h.key) ?? []; + expect(keys, source).toEqual( + expect.arrayContaining([ + "Strict-Transport-Security", + "X-Content-Type-Options", + "X-Frame-Options", + "Referrer-Policy", + ]), + ); + } + }); +}); + +describe("shop navigation", () => { + it("links no shop address that only redirects since the scripts went free", () => { + for (const locale of ["en", "de"] as const) { + const fivem = productLines(dictionaries[locale].site, locale).find((l) => l.id === "fivem")!; + const hrefs = [fivem.href, ...fivem.links.map((l) => l.href)]; + expect( + hrefs.some((h) => /\/fivem$|all-access|alle-scripts/.test(h)), + hrefs.join(" "), + ).toBe(false); + } + }); +}); diff --git a/apps/web/src/lib/seo.ts b/apps/web/src/lib/seo.ts new file mode 100644 index 0000000..656dcd9 --- /dev/null +++ b/apps/web/src/lib/seo.ts @@ -0,0 +1,20 @@ +/** Longest meta description a search result shows. */ +export const META_DESCRIPTION_MAX = 155; + +/** + * Plain text for a meta description from text a guild wrote, which may carry + * Markdown: marks removed, whitespace collapsed, cut at a word boundary with + * an ellipsis when it runs past `max`. Empty input gives an empty string. + */ +export function metaExcerpt(text: string | null | undefined, max = META_DESCRIPTION_MAX): string { + if (!text) return ""; + const plain = text + .replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1") + .replace(/[*_`#>~|]+/g, "") + .replace(/\s+/g, " ") + .trim(); + if (plain.length <= max) return plain; + const cut = plain.slice(0, max - 1); + const space = cut.lastIndexOf(" "); + return `${(space > max * 0.6 ? cut.slice(0, space) : cut).trimEnd()}…`; +} diff --git a/apps/web/src/lib/shop-url.ts b/apps/web/src/lib/shop-url.ts index af0ee73..fc91c1d 100644 --- a/apps/web/src/lib/shop-url.ts +++ b/apps/web/src/lib/shop-url.ts @@ -15,9 +15,7 @@ export const SHOP_ORIGIN = "https://www.msk-scripts.de"; /** Internal path on the shop, with its German public form. */ const SHOP_ROUTES = { "/": "/", - "/fivem": "/fivem", "/fivem/free": "/fivem/kostenlos", - "/fivem/all-access": "/fivem/alle-scripts", "/stats": "/statistiken", "/discord": "/discord", "/discord/ticket-bot": "/discord/ticket-bot",