nose-pluto/bin/apps.tsx
2025-10-10 15:40:40 -07:00

19 lines
570 B
TypeScript

// Show the webapps hosted on this NOSEputer.
import { $ } from "bun"
import { apps } from "@/webapp/utils"
const devMode = process.env.NODE_ENV !== "production"
export default async function () {
const { stdout: hostname } = await $`hostname`.quiet()
let domain = (devMode ? "localhost" : hostname.toString()).trim()
if (!devMode && !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>)}
</>
}