853 B25 lines
Blame
1import type { Metadata } from "next";
2import { cookies } from "next/headers";
3import { headers } from "next/headers";
4import { RingInstanceList } from "./ring-instance-list";
5
6export const metadata: Metadata = {
7 title: "Ring",
8};
9
10export default async function RingHomePage() {
11 const cookieStore = await cookies();
12 const signedIn = cookieStore.has("grove_hub_token");
13 const headerStore = await headers();
14 const host =
15 headerStore.get("x-forwarded-host") ??
16 headerStore.get("host") ??
17 "";
18 const protocol = headerStore.get("x-forwarded-proto") ?? "http";
19 const canonicalHost = host.split(",")[0]?.trim() ?? "";
20 const groveHost = canonicalHost.replace(/^(canopy|ring)\./, "");
21 const groveOrigin = groveHost ? `${protocol}://${groveHost}` : "";
22
23 return <RingInstanceList signedOut={!signedIn} groveOrigin={groveOrigin} />;
24}
25