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: 5 additions & 1 deletion app/imprint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { SiteFrame } from '@/components/site/SiteFrame'

export async function generateMetadata() {
const t = await getTranslations('imprintPage')
return { title: t('title') }
return {
title: t('metaTitle'),
description: t('metaDescription'),
alternates: { canonical: '/imprint' },
}
}

export default async function ImprintPage() {
Expand Down
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ThemeProvider } from '@/components/theme/ThemeProvider'
export const metadata: Metadata = {
metadataBase: new URL(process.env.NEXT_PUBLIC_BASE_URL ?? 'https://paste.msk-scripts.de'),
title: {
default: 'MSK Paste – Self-hosted Pastebin',
default: 'MSK Paste: pastebin with syntax highlighting',
template: '%s | MSK Paste',
},
description:
Expand Down
4 changes: 4 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Metadata } from 'next'
import Link from 'next/link'
import Script from 'next/script'
import { headers } from 'next/headers'
Expand All @@ -16,6 +17,9 @@ export const dynamic = 'force-dynamic'

const FACTS = ['highlight', 'expiry', 'protect', 'raw'] as const

// The home page names itself; metadataBase in the root layout makes it absolute.
export const metadata: Metadata = { alternates: { canonical: '/' } }

export default async function HomePage() {
const t = await getTranslations('home')
const nonce = (await headers()).get('x-nonce') ?? undefined
Expand Down
9 changes: 9 additions & 0 deletions app/privacy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ const SECTIONS = [
'contact',
] as const

export async function generateMetadata() {
const t = await getTranslations('privacy')
return {
title: t('metaTitle'),
description: t('metaDescription'),
alternates: { canonical: '/privacy' },
}
}

export default async function PrivacyPage() {
const t = await getTranslations('privacy')

Expand Down
9 changes: 9 additions & 0 deletions app/stats/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import { getGlobalStats } from '@/lib/stats'
// Always fetch the latest numbers — caching happens in the API layer.
export const dynamic = 'force-dynamic'

export async function generateMetadata() {
const t = await getTranslations('stats')
return {
title: t('metaTitle'),
description: t('metaDescription'),
alternates: { canonical: '/stats' },
}
}

export default async function StatsPage() {
const t = await getTranslations('stats')

Expand Down
10 changes: 6 additions & 4 deletions messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"optional": "optional"
},
"imprintPage": {
"metaTitle": "Impressum und Kontakt",
"metaDescription": "Impressum von MSK Paste, einem Dienst von MSK Scripts: Anbieter nach § 5 DDG, Anschrift und Kontakt.",
"title": "Impressum",
"section1Title": "Angaben gemäß § 5 DDG",
"addressName": "Moritz Kohm",
Expand Down Expand Up @@ -155,6 +157,8 @@
"backHome": "Zurück zur Startseite"
},
"stats": {
"metaTitle": "Statistik aller Pastes",
"metaDescription": "Globale Auswertung über alle Pastes von MSK Paste: Pastes insgesamt, heute und in dieser Woche, dazu die meistgenutzten Programmiersprachen.",
"title": "Statistik",
"subtitle": "Globale Auswertung über alle Pastes.",
"totalPastes": "Pastes insgesamt",
Expand All @@ -164,6 +168,8 @@
"noData": "Noch keine Daten verfügbar"
},
"privacy": {
"metaTitle": "Datenschutzerklärung",
"metaDescription": "Wie MSK Paste mit Daten umgeht: was beim Erstellen einer Paste gespeichert wird, wann es gelöscht wird, kein Tracking, und deine Rechte nach der DSGVO.",
"title": "Datenschutzerklärung",
"lastUpdated": "Stand: {date}",
"intro": {
Expand Down Expand Up @@ -278,12 +284,8 @@
"submenu": "Mehr unter {name}",
"newTab": "(öffnet in neuem Tab)",
"fivem": "FiveM-Scripts",
"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",
"discord": "Discord-Bots",
Expand Down
10 changes: 6 additions & 4 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"optional": "optional"
},
"imprintPage": {
"metaTitle": "Imprint and contact",
"metaDescription": "Legal notice of MSK Paste, a service by MSK Scripts: provider under § 5 DDG, postal address and contact details.",
"title": "Legal Notice",
"section1Title": "Information according to § 5 DDG",
"addressName": "Moritz Kohm",
Expand Down Expand Up @@ -155,6 +157,8 @@
"backHome": "Back to home"
},
"stats": {
"metaTitle": "Statistics of all pastes",
"metaDescription": "Global figures across all pastes on MSK Paste: pastes in total, today and this week, plus the most used programming languages.",
"title": "Statistics",
"subtitle": "Global overview across all pastes.",
"totalPastes": "Total pastes",
Expand All @@ -164,6 +168,8 @@
"noData": "No data available yet"
},
"privacy": {
"metaTitle": "Privacy Policy",
"metaDescription": "How MSK Paste handles data: what is stored when you create a paste, when it is deleted, no tracking, and your rights under the GDPR.",
"title": "Privacy policy",
"lastUpdated": "Last updated: {date}",
"intro": {
Expand Down Expand Up @@ -278,12 +284,8 @@
"submenu": "More in {name}",
"newTab": "(opens in a new tab)",
"fivem": "FiveM scripts",
"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",
"discord": "Discord bots",
Expand Down
24 changes: 24 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts')
const nextConfig: NextConfig = {
reactStrictMode: true,
poweredByHeader: false,
// 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>. One regex for all turns
// streaming off.
htmlLimitedBots: /.*/,
// The proxy sets the security headers for documents but does not run for
// build assets (see its matcher). These static headers are no duplicate of
// it: the paths below never reach the proxy. 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 },
]
},
}

export default withNextIntl(nextConfig)
12 changes: 8 additions & 4 deletions src/components/site/HeaderBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,14 @@ export function HeaderBar({
<header ref={headerRef} className="sticky top-0 z-50 border-t-4 border-b border-t-brand border-b-border bg-card">
<div className="container-page flex min-h-[var(--header-height)] items-center gap-[clamp(1rem,2vw,2.5rem)]">
<Link href="/" className="flex min-h-11 shrink-0 items-center gap-2.5 text-foreground">
<Image src="/logo.png" alt="" width={36} height={36} loading="eager" 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">
<Image src="/logo.png" alt={TOOL.name} width={36} height={36} loading="eager" className="h-9 w-9 rounded-lg object-contain" />
{/* 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="true"
className="hidden font-display text-lead font-bold tracking-[-0.01em] [font-stretch:108%] min-[360px]:inline"
>
{TOOL.name}
</span>
</Link>
Expand Down
4 changes: 2 additions & 2 deletions src/components/site/SiteFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function SiteFooter() {
title: t('footerProduct'),
links: [
{ label: t('stats'), href: '/stats' },
{ label: t('documentation'), href: 'https://docu.msk-scripts.de/paste' },
{ label: t('documentation'), href: 'https://docu.msk-scripts.de/ecosystem/msk-paste/' },
{ label: t('github'), href: 'https://github.com/MSK-Scripts/msk-paste' },
],
},
Expand Down Expand Up @@ -118,7 +118,7 @@ export async function SiteFooter() {
<span>
{t('builtBy')}{' '}
<a
href="https://www.musiker15.de"
href={`https://www.musiker15.de/${locale === 'de' ? 'de' : 'en'}`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex min-h-11 items-center underline-offset-4 hover:text-band-foreground hover:underline"
Expand Down
4 changes: 2 additions & 2 deletions src/components/site/SiteHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { HeaderBar } from './HeaderBar'
import { aboutLink, productLines, sectionLinks, type SiteCopy } from './navigation'

const COPY_KEYS = [
'mainNav', 'submenu', 'newTab', 'menu', 'language', 'fivem', 'fivemPaid', 'fivemPaidDesc',
'fivemFree', 'fivemFreeDesc', 'fivemAllAccess', 'fivemAllAccessDesc', 'fivemStats',
'mainNav', 'submenu', 'newTab', 'menu', 'language', 'fivem',
'fivemFree', 'fivemFreeDesc', 'fivemStats',
'fivemStatsDesc', 'discord', 'ticketDesc', 'giveawayDesc', 'tools', 'images', 'imagesDesc',
'formsDesc', 'pasteDesc', 'shortenerDesc', 'about', 'stats',
] as const satisfies readonly (keyof SiteCopy)[]
Expand Down
39 changes: 39 additions & 0 deletions src/components/site/navigation.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { describe, expect, it } from 'vitest'

import de from '../../../messages/de.json'
import en from '../../../messages/en.json'
import nextConfig from '../../../next.config'

import { productLines, type SiteCopy } from './navigation'

/**
* Crawl of 25.11.2026: metadata streamed after </head> for user agents outside
* Next's bot list, the build assets had none of the security headers, and the
* shop menu linked two addresses that only redirect since the scripts went free.
*/
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', () => {
for (const [locale, messages] of [['en', en], ['de', de]] as const) {
const fivem = productLines(messages.site as unknown as SiteCopy, 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)
}
})
})
11 changes: 4 additions & 7 deletions src/components/site/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ export interface SiteCopy {
menu: string
language: string
fivem: string
fivemPaid: string
fivemPaidDesc: string
fivemFree: string
fivemFreeDesc: string
fivemAllAccess: string
fivemAllAccessDesc: string
fivemStats: string
fivemStatsDesc: string
discord: string
Expand All @@ -64,13 +60,14 @@ export function productLines(t: SiteCopy, 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
2 changes: 0 additions & 2 deletions src/lib/shopUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,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',
Expand Down