---
export function getStaticPaths() {
	const redirects = {
		AJAX_SPIDER: 'scanning/ajax-spider/',
		API_SCHEMA_IMPORTS: 'scanning/api-schema-imports/',
		ABUSE_PROTECTION: 'operations/abuse-protection/',
		AUTOMATION_FRAMEWORK: 'scanning/automation-framework/',
		AUTHENTICATED_SCANNING_BEST_PRACTICES: 'scanning/authenticated-scanning-best-practices/',
		AUTHENTICATION_QUICK_START: 'getting-started/authentication-quick-start/',
		FINDINGS_AND_REPORTS: 'scanning/findings-and-reports/',
		JWT_AUTHENTICATION: 'security-modes/jwt-authentication/',
		JWT_IMPLEMENTATION_SUMMARY: 'security-modes/jwt-implementation-summary/',
		JWT_KEY_ROTATION_RUNBOOK: 'security-modes/jwt-key-rotation-runbook/',
		LOCAL_HA_COMPOSE: 'operations/local-ha-compose/',
		MCP_CLIENT_AUTHENTICATION: 'getting-started/mcp-client-authentication/',
		NATIVE_IMAGE_PERFORMANCE: 'operations/native-image-performance/',
		OBSERVABILITY: 'operations/observability/',
		PASSIVE_SCAN: 'scanning/passive-scan/',
		PRODUCTION_CHECKLIST: 'operations/production-checklist/',
		QUEUE_COORDINATOR_LEADER_ELECTION: 'operations/queue-coordinator-leader-election/',
		QUICK_START_JWT: 'getting-started/jwt-quick-start/',
		SCAN_EXECUTION_MODES: 'scanning/scan-execution-modes/',
		SCAN_POLICY_CONTROLS: 'scanning/scan-policy-controls/',
		SCAN_QUEUE_RETRY_POLICY: 'operations/scan-queue-retry-policy/',
		SECURITY_MODES: 'security-modes/',
		SECURITY_MODES_IMPLEMENTATION_SUMMARY: 'security-modes/implementation-summary/',
		SECURITY_MODE_EXAMPLES: 'security-modes/examples/',
		STRUCTURED_LOGGING: 'operations/structured-logging/',
		TOOL_SCOPE_AUTHORIZATION: 'getting-started/tool-scope-authorization/',
	};

	const basePath = '/mcp-zap-server/';
	const siteUrl = 'https://danieltse.org';

	return Object.entries(redirects).map(([legacy, target]) => ({
		params: { legacy },
		props: {
			target: `${basePath}${target}`,
			canonical: `${siteUrl}${basePath}${target}`,
		},
	}));
}

const { canonical, target } = Astro.props;
---

<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>Redirecting...</title>
		<meta http-equiv="refresh" content={`0; url=${target}`} />
		<meta name="robots" content="noindex" />
		<link rel="canonical" href={canonical} />
	</head>
	<body>
		<p>Redirecting to <a href={target}>{target}</a>...</p>
		<script is:inline define:vars={{ target }}>
			window.location.replace(target);
		</script>
	</body>
</html>
