35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { listAccessApps, filterSshApps, type SshApp } from "@/lib/cloudflare";
|
|
import Dashboard from "@/components/Dashboard";
|
|
import { AlertTriangle } from "lucide-react";
|
|
|
|
export const revalidate = 60;
|
|
|
|
export default async function Home() {
|
|
let apps: SshApp[] = [];
|
|
let error: string | null = null;
|
|
|
|
try {
|
|
const allApps = await listAccessApps();
|
|
apps = filterSshApps(allApps);
|
|
} catch (e) {
|
|
error = e instanceof Error ? e.message : "Unknown error";
|
|
apps = [];
|
|
}
|
|
|
|
if (error) {
|
|
return (
|
|
<div className="min-h-screen flex items-center justify-center p-4">
|
|
<div className="max-w-md w-full rounded-2xl border border-red-500/20 bg-red-500/5 p-8 text-center">
|
|
<AlertTriangle className="w-10 h-10 text-red-400 mx-auto mb-4" />
|
|
<h2 className="text-lg font-semibold text-red-300 mb-2">
|
|
Failed to load applications
|
|
</h2>
|
|
<p className="text-sm text-red-400/80 break-words">{error}</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return <Dashboard apps={apps} />;
|
|
}
|