import { $ } from "bun"
import { apps } from "@/webapp"

export default async function () {
  const hostname = await $`hostname`.quiet()
  let domain = process.env.BUN_HOT ? "localhost" : hostname.toString()
  if (!domain.endsWith(".local")) domain += ".local"

  let port = process.env.PORT || "3000"
  port = port === "80" ? "" : `:${port}`

  return <>
    {apps().map(app => <><a href={`http://${app}.${domain}${port}`}>{app}</a>{" "}</>)}
  </>
}