Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
"use client";
import Link from "next/link";
import dynamic from "next/dynamic";
import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { useActiveShell } from "@/features/appshell";
import { useSession } from "@/features/auth";
import { DevicesPanel } from "@/features/auth/panels";
import { SettingsSection } from "@/features/shell-settings";
import { cn } from "@/lib/utils";
import { Lock, ShieldCheck } from "lucide-react";
import { settingsSection, type SectionId } from "../lib/sections";
import { AutoLockRow } from "./auto-lock-row";
// Metadata/navigation and access checks stay eager. No private panel mounts or
// fetches before its existing role gate allows it; inactive sections stay deferred.
const loadingSection = () => <p role="status" className="p-3 text-sm text-muted-foreground">Loading settings…</p>;
const A2ASection = dynamic(() => import("./a2a-section").then((module) => module.A2ASection), { loading: loadingSection });
const AccountSection = dynamic(() => import("./account-section").then((module) => module.AccountSection), { loading: loadingSection });
const AboutSection = dynamic(() => import("./about-section").then((module) => module.AboutSection), { loading: loadingSection });
const AiSection = dynamic(() => import("./ai-section").then((module) => module.AiSection), { loading: loadingSection });
const AppearanceSection = dynamic(() => import("./appearance-section").then((module) => module.AppearanceSection), { loading: loadingSection });
const BackupSection = dynamic(() => import("./backup-section").then((module) => module.BackupSection), { loading: loadingSection });
const CleanupSection = dynamic(() => import("./cleanup-section").then((module) => module.CleanupSection), { loading: loadingSection });
const McpSection = dynamic(() => import("./mcp-section").then((module) => module.McpSection), { loading: loadingSection });
const MemorySection = dynamic(() => import("./memory-section").then((module) => module.MemorySection), { loading: loadingSection });
const QuicklinksSection = dynamic(() => import("./quicklinks-section").then((module) => module.QuicklinksSection), { loading: loadingSection });
const DevicesHostCard = dynamic(() => import("./devices-host-card").then((module) => module.DevicesHostCard), { loading: loadingSection });
const ThemeSection = dynamic(() => import("./theme-section").then((module) => module.ThemeSection), { loading: loadingSection });
const UpdateSection = dynamic(() => import("./update-section").then((module) => module.UpdateSection), { loading: loadingSection });
// The section content — one functional panel per SectionId, shared verbatim by
// every shell's Settings layout (the per-shell seam only swaps the navigation
// chrome around these, never the bodies).
const OWNER_ONLY = new Set<SectionId>([
"appearance",
"theme",
"ai",
"quicklinks",
"mcp",
"a2a",
"devices",
"cleanup",
"backup",
"updates",
]);
export function SettingsSectionBody({ id, onOpen }: { id: SectionId; onOpen?: (id: SectionId) => void }) {
const { status, role } = useSession();
const privateSection = ["a2a", "devices", "cleanup", "ai", "updates"].includes(id);
if (privateSection && status !== "in") return <SettingsSection icon={<Lock />} title="Sign in to manage this section">
<p className="mb-3 text-sm text-muted-foreground">These controls require an Owner device on this server.</p>
{status === "loading" ? <p role="status">Checking access…</p> : <Button asChild className="min-h-11"><Link prefetch={false} href="/login?returnTo=%2Fsettings">Sign in</Link></Button>}
</SettingsSection>;
if (status === "in" && role !== "owner" && OWNER_ONLY.has(id)) {
return (
<SettingsSection icon={<Lock />} title="Owner access required">
<p className="text-sm leading-relaxed text-muted-foreground">
This section changes shared workspace preferences, credentials, host
state, access policy, or owner backups. The current{" "}
<strong className="text-foreground">{role ?? "viewer"}</strong> device
can use read-only workspace features but cannot open this control
surface.
</p>
</SettingsSection>
);
}
switch (id) {
case "account":
return <AccountSection onOpen={onOpen ?? (() => {})} />;
case "appearance":
return <AppearanceSection />;
case "theme":
return <ThemeSection />;
case "ai":
return (
<div className="space-y-4 sm:space-y-5">
<AiSection />
<MemorySection />
</div>
);
case "quicklinks":
return <QuicklinksSection />;
case "mcp":
return <McpSection />;
case "a2a":
return <A2ASection />;
case "devices":
return (
<div className="space-y-4 sm:space-y-5">
{/* Which machine am I talking to, then who may talk to it. One section
because both answer the same question — the Server section used to be
separate and duplicated the sign-in/session vocabulary. */}
<DevicesHostCard />
<SettingsSection icon={<Lock />} title="Auto-Lock">
<AutoLockRow />
</SettingsSection>
{/* bare: DevicesPanel brings its own cards — don't nest a card-in-card */}
<SettingsSection
icon={<ShieldCheck />}
title="Approved devices"
bare
footnote="Each browser is a device gated by password + approval. Approve a pending device to grant it access; revoke to cut it off."
>
<DevicesPanel />
</SettingsSection>
</div>
);
case "cleanup":
return <CleanupSection />;
case "backup":
return <BackupSection />;
case "updates":
return <UpdateSection />;
case "about":
return <AboutSection onOpen={onOpen} />;
}
}
// One shared section body. Desktop renderers show a compact heading; mobile
// renderers normally suppress it because the shell-owned top bar carries the
// detail title. `showHeading` remains available for embedded/desktop contexts.
export function SectionDetail({
id,
showHeading = true,
onOpen,
}: {
id: SectionId;
showHeading?: boolean;
onOpen?: (id: SectionId) => void;
}) {
const { id: shellId } = useActiveShell();
const meta = settingsSection(id);
return (
<ScrollArea className="h-full">
<div
data-slot="settings-pane"
className={cn("mx-auto min-w-0 max-w-3xl space-y-4 overflow-x-hidden p-3 pb-[max(1rem,var(--sai-bottom,0px))] sm:space-y-5 sm:p-5", shellId === "windows" && "sm:px-7 sm:pt-7")}
>
{showHeading && meta && (
<header className="space-y-0.5">
<h2
className={cn(
"leading-tight",
shellId === "macos"
? "text-xl font-semibold tracking-tight"
: shellId === "windows" ? "text-[28px] font-semibold tracking-tight" : "text-sm font-semibold",
)}
>
{meta.label}
</h2>
<p className="text-xs text-muted-foreground">{meta.blurb}</p>
</header>
)}
<SettingsSectionBody id={id} onOpen={onOpen} />
</div>
</ScrollArea>
);
}