import Link from 'next/link' import { redirect } from 'next/navigation' import { getCurrentUser } from '@/lib/session' import { execAgent } from '@/lib/agent-client' import UnitDetail from './_components/unit-detail' export const dynamic = 'force-dynamic' type Props = { params: Promise<{ unit: string }> } function getAllowedUnits(): string[] { return (process.env.SYSTEMD_UNITS ?? '') .split(',') .map((u) => u.trim()) .filter(Boolean) } export default async function SystemdUnitPage({ params }: Props) { const user = await getCurrentUser() if (!user) redirect('/login') const { unit } = await params const unitName = decodeURIComponent(unit) if (!getAllowedUnits().includes(unitName)) { return (